Implement self-play training data generation - #327
Merged
Conversation
datagen was an empty stub. Build it on the unified Game: - Self-play games are played by the MCTS search: at each move the search's visit distribution over the legal moves is recorded as the policy target, and the game's eventual outcome (from the side-to-move's perspective) becomes the value target. Opening plies are sampled proportionally to the visits for variety; later moves are greedy. - Games are independent and generated in parallel with rayon; each game is seeded from seed ^ index, so a run is fully reproducible regardless of scheduling. An optional Syzygy tablebase adjudicates endgames. - Samples are written as '<fen> | <value> | <uci>:<visits> ...'. The datagen binary exposes games / nodes / exploration / seed / tablebase / output via clap. - Expose the root visit distribution from the search (mcts::policy) as the policy target. Tests: well-formed output, reproducibility, and value-target orientation (a mate-in-one self-play game yields a +1 value for the winning side). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GVrKvkMe4xDmkRAksacBzk
kirillbobyrev
marked this pull request as ready for review
July 21, 2026 03:42
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third in the sequence (after #325, #326). Turns the empty
datagenstub into a working self-play data generator built on the unifiedGame— the data source a future policy/value network will train on.Changes
rayon; each game is seeded fromseed ^ index, so a run is deterministic regardless of scheduling. An optional Syzygy tablebase adjudicates endgames.<fen> | <value> | <uci>:<visits> .... Thedatagenbinary exposes--games / --nodes / --exploration-plies / --max-plies / --seed / --tablebase / --outputvia clap.mcts::policy— the policy target — reusing the existingSearchResult.Testing
+1for the winning side); full suite (137 total) green.cargo run --bin datagen -- --games 4 --nodes 80 --output …produces 240 well-formed samples.cargo clippy --all-targets --all-featureszero warnings;cargo +nightly fmt --checkclean.Next in the sequence
UCI-completeness pass, then the
transmutesafety cleanup. (The network itself — consuming this data — remains the larger future effort.)🤖 Generated with Claude Code
https://claude.ai/code/session_01GVrKvkMe4xDmkRAksacBzk
Generated by Claude Code