♞ chess960-nn v0.3
checking…
github ↗
portfolio project · 2026

An AlphaZero-style engine for Chess960, built from scratch on a single GPU.

A neural network chess engine for Fischer Random — one of the 960 randomized starting positions — trained from scratch via supervised pretraining on Lichess master games plus AlphaZero-style RL self-play. Plays at ~1600 Elo measured over 100 calibrated games against Stockfish. This site is the live demo: play it, watch it face Stockfish, or browse training metrics.

view source ↗
~1600
final elo
measured vs stockfish, 100 games, 5 skill levels
6.7 M
parameters
10-block resnet, 192 filters, policy + value heads
6.4 M
pretrain positions
lichess master games, 5 epochs supervised
1 × 3060 Ti
hardware
8 GB vram, single workstation, ~5 h compute

how it works

Three things, working in a loop.

The engine has three pieces. A neural network looks at a position and outputs (a) a move probability for every legal move and (b) an estimate of who is winning. Monte Carlo Tree Search uses those guesses to simulate many possible futures and refine the move choice. A self-play training loop generates new games and uses them to improve the network.

The architecture is a standard residual conv-net with 10 blocks of 192 filters — roughly 6.7M parameters. Two output heads: a policy head (one probability per possible move) and a value head (a single number in [-1, +1]).

After supervised pretraining on Lichess master games, the RL loop ran 5 iterations of: generate self-play games → train on the new data → play a 10-game match against the current champion → promote only if score ≥ 0.55. The gated promotion is the safety net — it caught a regression at iteration 1 that the self-play stats alone would have hidden.

Board encoding
FEN → 8×8 plane stack (one plane per piece type, castling, side to move)
↓
Neural network
10 × residual conv blocks, 192 filters → policy head + value head
↓
MCTS (PUCT)
100 sims/move during training, 800 in AlphaZero proper. Picks the most-visited move at the root.
↓
Self-play
Engine plays itself; (position, MCTS visits, game result) → training data
↓
Train + gate
Update weights, play 10-game match vs champion, promote only if score ≥ 0.55

results

Final eval vs Stockfish — 100 games across 5 calibrated skill levels.

stockfish skillsf elogamesscorenn elo est.
01320200.900 (17W / 1L / 2D)1702
31600200.450 (8W / 10L / 2D)1565
51787200.300 (3W / 11L / 6D)1640
71974200.150 (1W / 15L / 4D)1673
102255200.025 (0W / 19L / 1D)1619

Cross-over point is around Stockfish skill 3 (~1600 Elo). The engine reliably beats below-club-level Stockfish, holds its own around 1500-1700, and loses cleanly above that. An earlier 4-game-per-level eval suggested ~1876 Elo — that estimate was discarded once the 100-game eval showed the smaller sample was within ±400 Elo of noise.

try it

Three views.

stack

Built with.

Python 3.11PyTorch (CUDA 12) python-chessStockfish 16 (AVX2) FastAPI + Uvicornuv NumPyChart.js vanilla JS + CSS

honest assessment

The engineering is the deliverable.

The original goal was 2000+ Elo to beat strong club players. The engine lands ~400 Elo short. Diagnosis: the architecture is sound; the limit is compute budget. Pretraining was the source of strength — the RL loop never had enough self-play data per iteration (30 games vs AlphaZero's thousands) or MCTS budget (100 sims vs 800) to push past the pretrained baseline.

The two pieces I'm proudest of are the gating mechanism (which caught a real regression that self-play stats alone would have hidden) and the decision to redo evaluation when an early "+200 Elo" claim looked too good — the 100-game eval confirmed the smaller samples were noise. Honest measurement is harder than honest training.

Full writeup in SUMMARY.md. Plain-language walkthrough in EXPLAINER.md.