-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update search.cc to implement more aggressive time prune threshold to CLOP tune #123
Conversation
Implement EARLY-C strategy from https://pdfs.semanticscholar.org/a2e6/299fd3c8ab17e3a1a783d518688b55bb2363.pdf. I came up with this independently and tried it in lczero as well https://github.com/glinscott/leela-chess/pull/556/files and found it helped CPU but not GPU for some reason...
src/mcts/search.cc
Outdated
@@ -41,6 +41,7 @@ const char* Search::kTempDecayMovesStr = "Moves with temperature decay"; | |||
const char* Search::kNoiseStr = "Add Dirichlet noise at root node"; | |||
const char* Search::kVerboseStatsStr = "Display verbose move stats"; | |||
const char* Search::kSmartPruningStr = "Enable smart pruning"; | |||
const char* Search::pEarlyExit = "Aggressive smart pruning threshold"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pEarlyExitStr
src/mcts/search.cc
Outdated
@@ -72,6 +73,8 @@ void Search::PopulateUciParams(OptionsParser* options) { | |||
options->Add<BoolOption>(kNoiseStr, "noise", 'n') = false; | |||
options->Add<BoolOption>(kVerboseStatsStr, "verbose-move-stats") = false; | |||
options->Add<BoolOption>(kSmartPruningStr, "smart-pruning") = true; | |||
options->Add<FloatOption>(p_early_exit, 0.1f, 10.0f, | |||
"p_early_exit") = 1.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dashes in flag name instead of underscores.
src/mcts/search.cc
Outdated
@@ -578,7 +581,7 @@ SearchWorker::NodeToProcess SearchWorker::PickNodeToExtend() { | |||
// To ensure we have at least one node to expand, always include | |||
// current best node. | |||
if (child != search_->best_move_node_ && | |||
search_->remaining_playouts_ < | |||
p_early_exit*search_->remaining_playouts_ < |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this variable defined?
Also it's one additional float multiplication per visit. Probably not noticeable at all, but would be interesting to check with --backend=random
src/mcts/search.cc
Outdated
@@ -72,6 +73,8 @@ void Search::PopulateUciParams(OptionsParser* options) { | |||
options->Add<BoolOption>(kNoiseStr, "noise", 'n') = false; | |||
options->Add<BoolOption>(kVerboseStatsStr, "verbose-move-stats") = false; | |||
options->Add<BoolOption>(kSmartPruningStr, "smart-pruning") = true; | |||
options->Add<FloatOption>(p_early_exit, 0.1f, 10.0f, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pEarlyExitStr
Fixed comments except I dont know how to initalize p_early_exit yet. I was hoping all the options stuff did that...
I think this is closer...
declare two parameters in .h file
I think this is how I get it
got yah!
src/mcts/search.cc
Outdated
@@ -72,6 +73,8 @@ void Search::PopulateUciParams(OptionsParser* options) { | |||
options->Add<BoolOption>(kNoiseStr, "noise", 'n') = false; | |||
options->Add<BoolOption>(kVerboseStatsStr, "verbose-move-stats") = false; | |||
options->Add<BoolOption>(kSmartPruningStr, "smart-pruning") = true; | |||
options->Add<FloatOption>(pEarlyExitStr, 0.1f, 10.0f, | |||
"p-early-exit") = 1.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "p" mean here?
src/mcts/search.cc
Outdated
@@ -41,6 +41,7 @@ const char* Search::kTempDecayMovesStr = "Moves with temperature decay"; | |||
const char* Search::kNoiseStr = "Add Dirichlet noise at root node"; | |||
const char* Search::kVerboseStatsStr = "Display verbose move stats"; | |||
const char* Search::kSmartPruningStr = "Enable smart pruning"; | |||
const char* Search::pEarlyExitStr = "Aggressive smart pruning threshold"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kEarlyExitStr
or kPEarlyExitStr
The names of the constant p_early_exit is taken from the paper. It's the probability or really percentage that you prune at. If you prune at 1.0 (or above) its 100% chance of success not missing anything given a max_time, whereas the paper actually find optimal was p = 0.4 where you prune at only 40% of the nodes required to change it's mind, and increase scale_mover from 2 to 2.5. |
I'm still trying different values but it seems like a 20 elo gain is possible given my two results
and 18s+.2 default scale p 0.815
|
0.72 kEarly and 2.5 scale time with latest at the time main net 520 and 5+2 TC
|
Average of mean and max from CLOP tune 7-28
Updated from CLOP tune 7-28
I put in the average for the max and mean from the clop tune this morning. There about 25 elo +- 21 elo gain. I'm not planning on CLOP tuning any more until after TCEC starts probably as I'm testing latest testnets to send now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Change is very minimal, I'm satisfied by jjosh's data that it's plus elo in both self play and against AB engines, and I believe crem's RFCs have been satisfied. Worst case scenario, we submit a further PR to rename it before next release (and we can do that now, rename things before releases! hooray!)
Another test using roy's PR testing .68 vs 1.0 pruning
|
Implement EARLY-C strategy from https://pdfs.semanticscholar.org/a2e6/299fd3c8ab17e3a1a783d518688b55bb2363.pdf. I came up with this independently and tried it in lczero as well https://github.com/glinscott/leela-chess/pull/556/files and found it helped CPU but not GPU for some reason...