Skip to content

Training loop: supported ONNX exporter, per-match openings, checks before a run starts - #6

Merged
DevomB merged 3 commits into
mainfrom
training-run-hardening
Nov 11, 2026
Merged

DevomB merged 3 commits into
mainfrom
training-run-hardening

Conversation

@DevomB

@DevomB DevomB commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes found while preparing a long training run on a new machine (Fedora, no GNU Go installed, PyTorch 2.15). None of them changes the training recipe: same network, same self-play settings, same losses.

What was wrong

Problem Effect Fix
ONNX export used the deprecated TorchScript exporter, and requirements.txt had no upper bound on PyTorch A PyTorch upgrade that removes it stops the loop at its first export Export with the torch.export-based exporter (opset 18); require PyTorch 2.9+
The arena seed was len(tag) gen-0005-vs-gen-0004, gen-0005-vs-gnugo-l1 and so on all have 20 characters, so every evaluation of a run replayed the same 20 openings Seed from a CRC of the match name: different per match, stable on resume
An anchor that cannot play (GNU Go not installed) was only discovered at the first anchor match The loop died after a full generation of self-play and training Check every anchor before anything is created, and say what to install
--set on an existing run was ignored silently A run could go on for hours with settings other than the ones on the command line Refuse values that would change the run; repeating the run's own settings still resumes it
init returned as soon as the first checkpoint existed A run stopped between saving that checkpoint and exporting it could never start Check the checkpoint and its export separately
gofer arena -json and gofer selfplay -stats wrote their result in place The loop treats these files as proof the work finished; a partial one would stop a resume Write through a rename

Also: scripts/setup.sh installs GNU Go with dnf on Fedora, the docs say what the ± beside an Elo rating means (the error against the opponents actually played, not against generation 0), and the training guide no longer says KataGo has no gating (it does: 100 wins in 200 games, Wu 2020, appendix E).

Exporter check

  • Same contract: inputs spatial/global, outputs policy/value, dynamic batch.
  • Both exporters' graphs agree with PyTorch to 1.3e-6 on batches of 1 to 256 (6×64 network).
  • Search speed with each graph, gofer bench, 10 s runs on an 8-core laptop: 14.5k and 13.6k playouts/s with the old exporter's graph, 13.7k and 13.7k with the new one.
  • Export now verifies batches of 1 and 5 against PyTorch (it was 5 only), so a graph with a fixed batch dimension fails at export.

Test plan

  • make lint, go test ./... with GNU Go on PATH, go test -race -short ./..., pure-Go and WebAssembly builds
  • pytest training: 26 passed (5 new) on PyTorch 2.15.0, and on PyTorch 2.9.0 in a separate environment
  • The loop without GNU Go: refuses to start, names the anchors and the install command, and leaves no run directory behind
  • Two generations at the default settings (600 games each, GNU Go level 1 and 6 anchors) on the laptop: finished in 14 min 14 s, peak memory 1.1 GB. Generation 1 beat generation 0 40–0 and generation 2 beat generation 1 40–0; all six matches used different seeds
  • Five small generations with a low champion_min_elo, to exercise champions with the real engine: first champion at generation 1, an undecided match that promoted nothing, and two promotions on SPRT H1 (48–12 and 43–17); no release repository given, so nothing was published
  • Resume: the same command on a finished run does nothing; a changed --set is refused; a run interrupted three times (during self-play and training) resumed and finished

🤖 Generated with Claude Code

DevomB and others added 3 commits November 11, 2026 09:43
The TorchScript exporter (dynamo=False) is deprecated and warns that it will
be removed, and requirements.txt put no upper bound on PyTorch, so a later
upgrade would have stopped the loop at its first export. The export now uses
the supported exporter at opset 18 and requires PyTorch 2.9 or newer.

The graph keeps its contract (inputs spatial/global, outputs policy/value,
any batch size). It is now verified against PyTorch at batch sizes 1 and 5
rather than 5 alone, so a graph whose batch dimension came out fixed is
caught at export time.

Measured on an 8-core laptop with the 6x64 network: the two exporters'
graphs agree with PyTorch to 1.3e-6 and search at the same speed
(13.6k-14.5k playouts/s with the old one, 13.7k with the new one).
Tests pass on PyTorch 2.9.0 and 2.15.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Evaluation:
- The arena seed was len(tag). Match names such as gen-0005-vs-gen-0004 and
  gen-0005-vs-gnugo-l1 all have 20 characters, so every evaluation of a run
  replayed the same 20 random openings. The seed is now a CRC of the name:
  different for every match, the same when a run is resumed.

Starting and resuming:
- The loop checks that every anchor can play before it creates anything.
  Without GNU Go it used to fail at the first anchor match, after a full
  generation of self-play and training.
- --set on an existing run was ignored silently. A value that would change
  the run's settings is now refused; repeating the run's own settings still
  resumes it.
- A run stopped between saving the first checkpoint and exporting it could
  not start again: init returned as soon as the checkpoint existed.
- gofer writes arena and self-play result files through a rename, since the
  loop takes their existence as proof that the work finished.
- scripts/setup.sh installs GNU Go with dnf on Fedora.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- docs/training.md and the changelog cover the anchor check, per-match
  openings, --set on existing runs and the new exporter.
- The Elo standard error treats the other ratings as exact. Say so where it
  is computed and where it is shown, rather than let it read as the error
  against generation 0.
- KataGo does gate candidates (100 wins in 200 games, Wu 2020, appendix E);
  the training guide said it does not.
- internal/nn/features.go pointed at a path that does not exist.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
gofer Building Building Preview Nov 11, 2026 5:44pm UTC

@DevomB
DevomB merged commit 19bc104 into main Nov 11, 2026
9 checks passed
@DevomB
DevomB deleted the training-run-hardening branch November 11, 2026 17:59

This branch was successfully deployed

1 active deployment
Preview — f60f7032 Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant