rektdieandclaude 8ceee77166 perf: incremental NNUE accumulator in quiescence
Every quiescence node built the network's hidden layer from the whole
board: about 30 pieces x 2 perspectives x 128 weights, a third of a
middlegame playout. The accumulator (both perspectives) is now built
once at the root of the quiescence search and passed down; each child
gets a copy updated with the two to four features the move changes
(normal move, capture, en passant, promotion, castling). i16 sums wrap
the same way in any order, so the values, and the search, are exactly
the same as before.

Playouts per second at 100k playouts, main -> this (two runs each):

  startpos           688k -> 705k   +2%
  QGD middlegame     453k -> 495k   +9%
  Kiwipete           128k -> 161k   +26%
  Sicilian middle    385k -> 440k   +14%
  rook endgame       881k -> 905k   +3%
  bench              3.87M -> 4.39M +14%

Checked: on 3,240,535 moves from random games (276,756 captures, 3,676
castles, 433 en passant, 30,900 promotions) the updated accumulator is
byte for byte equal to a fresh one, and a whole game played on updates
alone does not drift. The bench is identical to main.

Bench: 546966

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:03:40 +01:00

Rigby

Rigby is a UCI chess engine built on Monte Carlo Tree Search (PUCT). The goal is a neural-network-guided MCTS engine, later a Monte Carlo Graph Search (MCGS), with a value and policy network trained with bullet on data generated by Leela Chess Zero, and CUDA inference.

Every change is validated with SPRT on OpenBench.

Current state (0.1-dev)

  • Bitboard board with fancy magic attacks, fully legal move generation, copy-make. 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.
  • 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.
  • When the arena is full, the least visited parts of the tree are cut back to leaves (keeping their visits and Q) and the rest is packed, so search never stops expanding.
  • Single-threaded.

Building

Needs clang++ (C++20) and make. On Windows clang must have a MinGW runtime, 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 and after every collection (legal moves, visit counts) and aborts on the first inconsistency. It is slow, for debugging only.

UCI

Standard commands: uci, isready, ucinewgame, position, go (wtime btime winc binc movestogo movetime nodes depth infinite), stop, quit, setoption.

Extra commands:

Command Meaning
d Print the board, FEN and hash key
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

go depth N limits the mean playout depth. nodes in info lines are playouts.

Started from a terminal, Rigby shows its search for a human instead: a framed dashboard, redrawn in place ten times a second, with the score and an evaluation bar, depth, playouts, speed, a time bar, tree fill, the principal variation in SAN and the most visited root moves with their share of the visits, score and prior. It adapts to the terminal's size. The first uci command switches to plain UCI output for good; GUIs and match runners send it first and read stdout through a pipe, so they never see it. NO_COLOR turns it off, RIGBY_PRETTY=1 forces it into a pipe (e.g. less -R). It needs a terminal with 24-bit colour and UTF-8 (Windows Terminal, any modern Linux/macOS terminal).

Options

Option Default Meaning
Hash 64 Tree memory in MB. A node takes 20 bytes.
Threads 1 Only 1 for now.
MoveOverhead 20 Milliseconds kept back per move.
CPuct 160 Exploration constant x100.
FPUReduction 30 First-play urgency reduction x100.
PolicyTemp 100 Policy softmax temperature x100.

Bench

Rigby bench runs 5000 playouts on each of 16 positions. The reported node count is the number of positions visited in the tree over all playouts, so it changes whenever search behaviour changes, while the playout count stays fixed.

S
Description
No description provided
Readme
6 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 64.1%
Rust 30%
PowerShell 2.9%
Cuda 2.2%
Makefile 0.8%