Use root utility offset to randomize move selection#2386
Open
Menkib64 wants to merge 5 commits intoLeelaChessZero:masterfrom
Open
Use root utility offset to randomize move selection#2386Menkib64 wants to merge 5 commits intoLeelaChessZero:masterfrom
Menkib64 wants to merge 5 commits intoLeelaChessZero:masterfrom
Conversation
Temperature implementation as post selection has bad interaction with smart prunning. Alternative idea is to implement randomization as utility offset for root moves. Offset allows search to refute temperature preferred moves.
There was a problem hiding this comment.
Pull request overview
This PR changes how move-selection randomness (“temperature”) is applied by introducing a root utility offset noise term, so the search can still refute initially-preferred noisy moves during exploration (improving interaction with smart pruning).
Changes:
- Extend
Randomto be usable as a standard C++ random engine (URBG) for<random>distributions. - Add per-root-move utility offsets sampled from a normal distribution and incorporate them into root UCT selection + verbose stats (classic + dag_classic).
- Add new UCI/options parameters for controlling the root utility offset noise (including endgame behavior), and refactor temperature decay logic into a shared helper in each search implementation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/utils/random.h |
Makes Random usable as a URBG (operator(), min/max) so it can drive <random> distributions. |
src/search/dag_classic/search.h |
Adds root_utility_offsets_ storage to the DAG classic search. |
src/search/dag_classic/search.cc |
Samples root utility offsets and applies them to root selection + verbose stats; reuses TemperatureDecay. |
src/search/classic/search.h |
Adds root_utility_offsets_ storage to the classic search. |
src/search/classic/search.cc |
Samples root utility offsets and applies them to root selection + verbose stats; reuses TemperatureDecay. |
src/search/classic/params.h |
Adds getters for new temperature utility offset parameters. |
src/search/classic/params.cc |
Registers the new options and their help text/defaults. |
src/search/classic/node.h |
Adds helper to compute a child edge index for verbose stats offset display. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Temperature cutoff uses win percentage. Using the same units requires less wondering how to scale the variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Temperature implementation as post selection has bad interaction with smart prunning. Alternative idea is to implement randomization as utility offset for root moves. Offset allows search to refute temperature preferred moves.
I'm planning to backport this to odds bots if it looks resonable.