diff --git a/src/mcts.cpp b/src/mcts.cpp index 0530707..2383b67 100644 --- a/src/mcts.cpp +++ b/src/mcts.cpp @@ -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 explore = params.cpuct * std::sqrt(float(std::max(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(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; float best_score = -1e30f; diff --git a/src/mcts.h b/src/mcts.h index c766761..7c8d6b4 100644 --- a/src/mcts.h +++ b/src/mcts.h @@ -97,6 +97,9 @@ struct SearchLimits { struct SearchParams { 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 policy_temperature = 1.00f; i64 move_overhead = 20;