feat: separate, higher cpuct at the root

The root is where the move is chosen, so it pays to keep more of its
moves in play than deeper in the tree. Monty uses root_cpuct 0.4119
against cpuct 0.2826, a ratio of 1.458; with Rigby's cpuct of 1.6 that
gives a root cpuct of 2.33. The visit scaling applies on top as before.
Exposed as the UCI option RootCPuct (x100) next to CPuct for later
tuning.

Note on the previous commit: Monty's current cpuct_visits_scale is
37.63 (x128 = 4817), not 64; Rigby keeps 8192.

Bench is deterministic. setoption RootCPuct works.

Bench: 529903

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rektdieandclaude committed 2026-11-15 16:20:25 +01:00
1 parent d39b8a3a4a
commit b89ab39bdd
4 files changed
+9 -1

No files matched your search

+3 -1
View File
@@ -371,7 +371,9 @@ u32 Searcher::select_child(u32 idx) const {
// Exploration grows with the visits (Monty's scaling): a node searched a
// lot keeps giving its other children a chance.
const float n = float(std::max<u32>(node.visits, 1));
const float cpuct = params.cpuct * (1.0f + std::log((n + params.cpuct_visit_scale) / params.cpuct_visit_scale));
// The root, where the move is chosen, explores more.
const float base_cpuct = idx == Tree::root() ? params.root_cpuct : params.cpuct;
const float cpuct = base_cpuct * (1.0f + std::log((n + params.cpuct_visit_scale) / params.cpuct_visit_scale));
const float explore = cpuct * std::sqrt(n);
u32 best = node.first_child;