From 478e7568f5eda9780d1409bb8dccc86221126281 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 9 Nov 2026 16:38:13 +1300 Subject: feat: Multi-threaded training; play matches every 10 generations Gradients and losses are computed on rayon's pool in fixed-size chunks summed in order, so the weights are the same on any number of threads. Self-play uses the same pool, and the output shows the training time. The matches against the earlier network and ClaudePlayer now run only every --match-every generations (default 10), against the generation that last played them, read back from its saved file. Co-Authored-By: Claude Opus 5.5 --- plans.org | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'plans.org') diff --git a/plans.org b/plans.org index b54040b..c2f36b2 100644 --- a/plans.org +++ b/plans.org @@ -81,6 +81,20 @@ Before the fix, tigers won ~97% of self-play games and the net only reached ~15- *** Next candidates - Pick exploratory moves among near-best ones (softmax over root scores) rather than uniformly - Sheep are still the weaker side: report the match score for each side separately +** DONE Multi-threaded training steps +=gradient= and =loss= run on rayon's pool in fixed chunks (32 samples per gradient task), summed +in order, so 1 thread and 16 give byte-identical weights. Self-play's =parallel()= uses the same pool. +=train 4 500= from random weights, 16 cores, hpet clocksource, training part of each generation (s): +| Gen | Samples | Before | After | +|-----+---------+--------+-------| +| 1 | 15112 | 0.09 | 0.03 | +| 2 | 29658 | 0.17 | 0.06 | +| 3 | 43748 | 0.27 | 0.09 | +| 4 | 57978 | 0.35 | 0.13 | +- About 2.7x, not 16x: a 256-sample batch is only 8 chunks, and the chunks' gradients are added + up serially. Training was only ~15% of a ~2 s generation, so the whole generation is ~10% faster. +*** Next candidates +- Bigger batches (or smaller chunks) for more parallel tasks per step; reuse the per-chunk gradient buffers ** DONE Balance tiger-win and sheep-win positions The unbalanced net (gen 100) had 7x the error on positions from sheep-win games (0.045) as on tiger-win ones (0.0065), so it leaned towards tiger wins, though not a constant prediction (that -- cgit v1.3.1