Skip to content

Add fixed-depth minimax to value-head search - #2434

Open
natsu0529 wants to merge 1 commit into
LeelaChessZero:masterfrom
natsu0529:valuehead-fixed-depth
Open

Add fixed-depth minimax to value-head search#2434
natsu0529 wants to merge 1 commit into
LeelaChessZero:masterfrom
natsu0529:valuehead-fixed-depth

Conversation

@natsu0529

@natsu0529 natsu0529 commented Jul 31, 2026

Copy link
Copy Markdown

Summary

  • add configurable full-width fixed-depth minimax to valuehead
  • preserve depth 1 as the default and let go depth override ValueHeadDepth
  • reduce requests to the deepest complete tree that fits ValueHeadMaxNodes
  • score checkmates, draws, repetitions, and the fifty-move rule without unnecessary NN evaluation
  • run instamove searches asynchronously with stop/abort cancellation and serialized UCI output
  • add focused regression tests for minimax, terminal scoring, safeguards, black-to-move handling, and response races

Behavior and safeguards

ValueHeadDepth defaults to 1, so the existing default behavior is preserved. ValueHeadMaxNodes defaults to 10000. If a requested full-width tree exceeds that limit, the search uses the deepest complete depth that fits; if even depth 1 does not fit, it returns a legal fallback move without NN evaluation.

Instamove search now runs on a worker thread. Tree construction, evaluation queuing, and minimax resolution observe cancellation. info and bestmove output are serialized so no search info is emitted after the final move.

Testing

  • ninja -C builddir
  • meson test -C builddir --print-errorlogs — 9/9 test targets passed
  • InstamoveTest — 14/14 cases passed
  • clang-format dry run and git diff --check
  • UCI smoke test with ValueHeadMaxNodes=300000, go depth 4, and stop after 10 ms

The default depth remains unchanged, so this does not alter default value-head playing behavior

Related to #2176.

Add configurable full-width fixed-depth minimax while keeping depth 1 as the default. Reduce requested depth to the largest complete tree that fits the node limit, and handle terminal positions without neural evaluation.

Run instamove searches asynchronously, propagate cancellation through tree construction and evaluation, and serialize UCI info/bestmove responses. Add regression tests for minimax, terminal scoring, safeguards, and stop/abort races.
@natsu0529
natsu0529 marked this pull request as ready for review July 31, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant