feat: value network trained on Lc0 data

The static evaluation behind the quiescence search is now a
(768 -> 128)x2 -> 1 SCReLU network instead of the hand-written
evaluation. It was trained with bullet on linrock's Lc0-derived test80
2024-02 binpack, 40 superbatches (10 min on an RTX 3070), final loss
0.0220. The quiescence search itself is unchanged.

The network is embedded with incbin (EVALFILE, default
networks/rigby-value-v1.bin). Q is tanh(cp / 800), the same scale the
network was trained on (sigmoid(cp / 400) = expected score).

Checked: bullet's float evaluation of fixed positions (trainer --check)
and the engine's quantised inference (evalfens) agree within 6 cp; an
integer re-implementation in Python matches the engine exactly. Perft
passes, bench is deterministic.

Bench: 545914

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rektdieandclaude committed 2026-11-15 04:12:52 +01:00
1 parent 530c4d67ed
commit 30b0c36cd5
14 files changed
+700 -68

No files matched your search

+9 -4
View File
@@ -13,9 +13,10 @@ Every change is validated with SPRT on OpenBench.
Verified with a perft suite (`Rigby perftsuite`).
- PUCT search: node arena with contiguous children, first-play urgency reduction,
two-fold repetition, 50-move and insufficient-material draws inside the tree.
- Placeholder evaluation until the network exists: a small hand-written
evaluation behind a capture-only quiescence search for the value, and move
heuristics (captures, promotions, checks, pawn threats) for the policy.
- Value: a `(768 -> 128)x2 -> 1` network trained with bullet on Lc0 data
(`networks/rigby-value-v1.bin`, embedded at build time; see `train/README.md`),
behind a capture-only quiescence search. Policy: move heuristics (captures,
promotions, checks, pawn threats) until a policy network exists.
- Tree reuse between moves: the subtree of the new position is packed to the
front of the node arena in place, so it costs no extra memory.
- Single-threaded.
@@ -28,8 +29,11 @@ the build targets `x86_64-w64-windows-gnu`, same as Eleanor.
```
make
make EXE=Rigby-dev
make EVALFILE=path/to/quantised.bin
```
`EVALFILE` defaults to `networks/rigby-value-v1.bin`.
Compiling with `-DRIGBY_VERIFY_TREE` checks the whole tree before and after every
reuse (legal moves, visit counts) and aborts on the first inconsistency. It is slow,
for debugging only.
@@ -45,7 +49,8 @@ Extra commands:
| Command | Meaning |
| --- | --- |
| `d` | Print the board, FEN and hash key |
| `eval` | Static and quiescence evaluation of the current position |
| `eval` | Static (network) and quiescence evaluation of the current position |
| `evalfens` | Network evaluation of fixed positions, to compare with the trainer's `--check` |
| `perft <depth>` | Perft with per-move breakdown |
| `perftsuite [maxdepth]` | Standard perft positions with expected counts |
| `bench [playouts]` | Fixed playout search over the bench positions |