SEE pruning of losing captures in quiescence #7

Merged
claude merged 1 commits from qs-see into main 2026-11-15 14:50:07 +01:00
Collaborator

The quiescence search behind the value network now skips captures whose static exchange on the target square loses material (SEE < 0) when not in check. The SEE is the usual threshold swap: least valuable attacker first, x-rays opened as pieces leave, a king recaptures only an undefended square, pins ignored; castling, en passant and promotions count as even.

  • Motivation: profiling showed 80-85% of a middlegame playout in the quiescence search, with 15-41 quiescence nodes per leaf, because every capture was searched, including ones that just lose the piece.
  • Effect at 60k playouts (qsearch nodes per leaf, time per playout):
Position qsearch nodes / leaf Time / playout
startpos 3.7 → 2.2 −20%
QGD middlegame 14.7 → 4.2 −54%
Kiwipete 41.4 → 25.5 −25%
Sicilian middlegame 21.0 → 3.4 −68%
rook endgame 2.6 → 2.3 −2%

SPRT

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

Elo   | 115.97 +- 32.64 (95%)
SPRT  | 8.0+0.08s Threads=1 Hash=64MB
LLR   | 2.98 (-2.94, 2.94) [0.00, 10.00]
Games | N: 292 W: 146 L: 52 D: 94
Penta | [4, 11, 52, 45, 34]

Correctness

  • The SEE matches an independent python-chess reference exactly on 9957 captures from 3000 random positions (4884 with recaptures).
  • The bench is deterministic. Move generation is untouched.

Bench: 546966

🤖 Generated with Claude Code

The quiescence search behind the value network now skips captures whose static exchange on the target square loses material (SEE < 0) when not in check. The SEE is the usual threshold swap: least valuable attacker first, x-rays opened as pieces leave, a king recaptures only an undefended square, pins ignored; castling, en passant and promotions count as even. - **Motivation:** profiling showed 80-85% of a middlegame playout in the quiescence search, with 15-41 quiescence nodes per leaf, because every capture was searched, including ones that just lose the piece. - **Effect** at 60k playouts (qsearch nodes per leaf, time per playout): | Position | qsearch nodes / leaf | Time / playout | | --- | --- | --- | | startpos | 3.7 → 2.2 | −20% | | QGD middlegame | 14.7 → 4.2 | −54% | | Kiwipete | 41.4 → 25.5 | −25% | | Sicilian middlegame | 21.0 → 3.4 | −68% | | rook endgame | 2.6 → 2.3 | −2% | ## SPRT https://bench.rektdie.com/test/5288/ ``` Elo | 115.97 +- 32.64 (95%) SPRT | 8.0+0.08s Threads=1 Hash=64MB LLR | 2.98 (-2.94, 2.94) [0.00, 10.00] Games | N: 292 W: 146 L: 52 D: 94 Penta | [4, 11, 52, 45, 34] ``` ## Correctness - The SEE matches an independent python-chess reference exactly on 9957 captures from 3000 random positions (4884 with recaptures). - The bench is deterministic. Move generation is untouched. Bench: 546966 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude added 1 commit 2026-11-15 14:49:59 +01:00
Profiling showed that 80-85% of a middlegame playout is the quiescence
search behind the value network: 15-41 quiescence nodes per leaf, since
every capture was searched, including ones that just lose the piece.

The quiescence search now skips captures whose static exchange on the
target square loses material (SEE < 0) when not in check. The SEE is the
usual threshold swap (least valuable attacker first, x-rays opened as
pieces leave, a king recaptures only an undefended square, pins
ignored); castling, en passant and promotions count as even.

Effect at 60k playouts (instrumented build, qsearch nodes per leaf and
time per playout):

  startpos           3.7 -> 2.2     -20%
  QGD middlegame    14.7 -> 4.2     -54%
  Kiwipete          41.4 -> 25.5    -25%
  Sicilian middle   21.0 -> 3.4     -68%
  rook endgame       2.6 -> 2.3      -2%

Checked: the SEE matches an independent python-chess reference exactly
on 9957 captures from 3000 random positions (4884 with recaptures).
Bench is deterministic. Move generation is untouched.

Bench: 546966

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude merged commit c45450255a into main 2026-11-15 14:50:07 +01:00
claude deleted branch qs-see 2026-11-15 14:50:08 +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#7