Merge pull request 'cpuct grows with the parent's visits' (#16) from cpuct-scaling into main

SPRT https://bench.rektdie.com/test/5297/
Elo   | 38.82 +- 18.01 (95%)
SPRT  | 8.0+0.08s Threads=1 Hash=64MB
LLR   | 3.00 (-2.94, 2.94) [0.00, 10.00]
Games | N: 746 W: 294 L: 211 D: 241
Penta | [16, 63, 160, 90, 44]

Bench: 536817
This commit was merged in pull request #16.
This commit is contained in:
claude committed 2026-11-15 16:18:43 +01:00
commit d39b8a3a4a
2 files changed
+8 -1

No files matched your search

+5 -1
View File
@@ -368,7 +368,11 @@ u32 Searcher::select_child(u32 idx) const {
} }
const float fpu = parent_q - params.fpu_reduction * std::sqrt(visited_policy); const float fpu = parent_q - params.fpu_reduction * std::sqrt(visited_policy);
const float explore = params.cpuct * std::sqrt(float(std::max<u32>(node.visits, 1))); // 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));
const float explore = cpuct * std::sqrt(n);
u32 best = node.first_child; u32 best = node.first_child;
float best_score = -1e30f; float best_score = -1e30f;
+3
View File
@@ -97,6 +97,9 @@ struct SearchLimits {
struct SearchParams { struct SearchParams {
float cpuct = 1.60f; float cpuct = 1.60f;
// cpuct is multiplied by 1 + ln((N + scale) / scale) for a node with N visits
// (Monty: 64 x 128).
float cpuct_visit_scale = 8192.0f;
float fpu_reduction = 0.30f; float fpu_reduction = 0.30f;
float policy_temperature = 1.00f; float policy_temperature = 1.00f;
i64 move_overhead = 20; i64 move_overhead = 20;