Development Report · 15 Jul 2026 · Backgammon-NN
A development write-up on the neural backgammon engine: strengthening the value network, making rollouts 2.5× faster, and benchmarking — for the first time — against an independent engine. A deeper network took it from clearly behind wildbg to ahead of it at equal thinking time.
The goal
The engine's rollout search was already solid, but its static value net (a single 198→128→5 MLP) was the limiter. The plan: find out whether the net could be pushed past its apparent ceiling, and then measure the result honestly against an outside engine rather than only against our own hand-crafted evaluator (HCE).
Investigation
Three approaches failed in instructive ways before the fourth broke through. Every result is a head-to-head against the incumbent 128-unit net (0-ply, race-aware), so the difference is pure evaluation quality.
| Approach | What happened | Verdict |
|---|---|---|
| Rollout distribution fine-tuning | Fit improved a lot (equity-MSE 0.117→0.030) but play got worse — supervised fitting disrupts the ranking TD learned. | 49% · weaker |
| Race-focused fine-tuning (50%) | Gammon rate didn't move (57→58%) and overall strength dropped from capacity spent on races. | 37% · weaker |
| Wider single-layer net (256), 48k games | 60× the training and more width — yet dead-even. Width alone adds no representational class. | 48% · tie |
| Deeper net 256→128 + squared-ReLU, 150k games | Depth adds functions no 1-layer net can express. Trained long, it clears the incumbent decisively. | 58.8% · win |
Key insightThe width-only tie proved a single hidden layer was already at its capacity for this input+signal. Depth — not width, not fine-tuning — was the missing lever. Squared-ReLU and a long run did the rest.
The breakthrough
Trained from scratch on ~150k self-play games (TD, λ=1), it beats the old net on every axis — and, notably, is the first change to lower the gammon rate, confirming that gammon-leaking was a contact-evaluation weakness, not a race-play bug.
| Metric | Old 128-net | Deep net | Δ |
|---|---|---|---|
| Head-to-head (0-ply) | 41.2% | 58.8% | +17.6 |
| Self-play gammon+bg rate | 70.7% | 60.2% | −10.5 |
| vs HCE (win / PPG) | 81.7% · +1.36 | 85.3% · +1.36 | +3.6 |
Performance
The Rust evaluator ran one position at a time (a [1,198] matrix-vector product — the worst case for SIMD). Now it optimises the tract model for a symbolic batch axis and every rollout ply scores all legal moves in a single [N,198] pass: proper SIMD tiling, one dispatch, one allocation.
| Path | ms / move | Notes |
|---|---|---|
| Old — batch-1 (GEMV) | 4282 | one tract call per position |
| New — batched (GEMM) | 1694 | all moves per ply in one call |
At a fixed think-time that's ~2.5× more rollouts per second — a direct strength gain, and the axis the engine competes on.
External benchmark
wildbg is an independent neural backgammon engine (~5.9 GnuBG-2-ply error rate). To compare fairly, a purpose-built harness runs both nets through the identical bgcore search — so only evaluation quality differs — bridged via the shared board orientation and GnuBG Position ID.
| Test (our win %) | 128-net | Deep net | What it isolates |
|---|---|---|---|
| 1-ply eval | 39.3% | 46.7% | raw evaluation quality |
| Rollout ×100 (equal trials) | ~48% | 62.5% | eval + identical search |
| Rollout 200 ms (equal wall-clock) | — | 61.2% | fairest: same think-time |
The verdictThe deep net closed the raw-eval gap to near parity (46.7%) and, once search is involved, beats wildbg at both equal trials and equal wall-clock (~61%). Our cheaper, now-batched eval fits more informed rollouts into the same budget.
| Ours (deep) | wildbg | |
|---|---|---|
| Networks | 1 (all phases) | 2 — contact + race |
| Inputs | 198 | 202 / ~186 |
| Hidden | 256 → 128 | 300→250→200 / 16 |
| Activation | squared-ReLU | Hardsigmoid / Tanh |
| Output head | 5 nested (sigmoid) | 6 exclusive + softmax |
Findings
Shipped
dist()td.onnx / td_latest.ptThe deep net is now the engine used by the GUI, console app, and rollout opponent. tract parity re-verified against it.
Next
256,256,128 and more games, now that depth is proven to pay.