Value hash for transpositions #20

Merged
claude merged 1 commits from hash-table into main 2026-11-16 00:00:32 +01:00
Collaborator

Rigby evaluated every new leaf from scratch, although most leaves are positions it has already searched: with temporary instrumentation, 37–85% of the leaf evaluations in a 5-second search repeated a position evaluated earlier in the same search (85% from the start position, 81% in a quiet middlegame, 37% in Kiwipete).

Monty, Vine and Jackal all keep a hash table of positions' Q for this, and Rigby now does too:

  • Every node on a playout's path stores its Q (from the view of the side to move there) with its visit count under the position's key. A different position always replaces an entry, the same one only with at least as many visits.
  • A leaf whose position is found takes the stored Q instead of the value network and quiescence search.
  • Draws by repetition or the 50-move rule are not stored (they belong to the path, not the position).
  • The table lives across searches and is cleared on ucinewgame. It takes a 32nd of Hash (12-byte entries, 174k at 64 MB); the tree gets the rest.

SPRT

https://bench.rektdie.com/test/5307/

Elo   | 21.53 +- 9.13 (95%)
SPRT  | 8.0+0.08s Threads=1 Hash=64MB
LLR   | 3.15 (-2.94, 2.94) [0.00, 5.00]
Games | N: 2698 W: 952 L: 785 D: 961
Penta | [72, 251, 571, 348, 107]

Correctness

  • Bench deterministic.
  • RIGBY_VERIFY_TREE build driven over UCI with pauses between commands (tree reuse up to 83k nodes, collections at Hash 1 MB, Hash changes, wtime/winc, movetime, mate-in-one positions found, go infinite + stop) without an abort.

Bench: 615835

🤖 Generated with Claude Code

Rigby evaluated every new leaf from scratch, although most leaves are positions it has already searched: with temporary instrumentation, 37–85% of the leaf evaluations in a 5-second search repeated a position evaluated earlier in the same search (85% from the start position, 81% in a quiet middlegame, 37% in Kiwipete). Monty, Vine and Jackal all keep a hash table of positions' Q for this, and Rigby now does too: - Every node on a playout's path stores its Q (from the view of the side to move there) with its visit count under the position's key. A different position always replaces an entry, the same one only with at least as many visits. - A leaf whose position is found takes the stored Q instead of the value network and quiescence search. - Draws by repetition or the 50-move rule are not stored (they belong to the path, not the position). - The table lives across searches and is cleared on `ucinewgame`. It takes a 32nd of Hash (12-byte entries, 174k at 64 MB); the tree gets the rest. ## SPRT https://bench.rektdie.com/test/5307/ ``` Elo | 21.53 +- 9.13 (95%) SPRT | 8.0+0.08s Threads=1 Hash=64MB LLR | 3.15 (-2.94, 2.94) [0.00, 5.00] Games | N: 2698 W: 952 L: 785 D: 961 Penta | [72, 251, 571, 348, 107] ``` ## Correctness - Bench deterministic. - `RIGBY_VERIFY_TREE` build driven over UCI with pauses between commands (tree reuse up to 83k nodes, collections at Hash 1 MB, Hash changes, wtime/winc, movetime, mate-in-one positions found, `go infinite` + `stop`) without an abort. Bench: 615835 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude added 1 commit 2026-11-16 00:00:22 +01:00
Rigby evaluated every new leaf from scratch, although most leaves are
positions it has already searched: with temporary instrumentation,
37-85% of the leaf evaluations in a 5-second search repeated a
position evaluated earlier in the same search (85% from the start
position, 81% in a quiet middlegame, 37% in Kiwipete).

Monty, Vine and Jackal all keep a hash table of positions' Q for this.
Rigby now does the same: every node on a playout's path stores its Q
(from the view of the side to move there) with its visit count under
the position's key; a different position always replaces an entry,
the same one only with at least as many visits. A leaf whose position
is found takes the stored Q instead of the value network and
quiescence search, so it starts from what a deeper search already
knew. Draws by repetition or the 50-move rule are not stored (they
belong to the path, not the position). The table lives across
searches and is cleared on ucinewgame.

It takes a 32nd of Hash (12-byte entries; 174k entries at 64 MB), the
tree the rest.

Checked: bench deterministic; RIGBY_VERIFY_TREE build driven over UCI
with pauses (tree reuse up to 83k nodes, collections at Hash 1 MB,
Hash changes, wtime/winc, movetime, mate-in-one positions found,
go infinite + stop) without an abort.

Bench: 615835

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude merged commit d7f97ee80b into main 2026-11-16 00:00:32 +01:00
claude deleted branch hash-table 2026-11-16 00:00:33 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rektdie/Rigby#20