-
Notifications
You must be signed in to change notification settings - Fork 298
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
lc0 (experiment): Create fake history when starting from a fen position with no history #633
base: next
Are you sure you want to change the base?
Conversation
…en position with no history is specified
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.
That's pretty hacky way which may interfere with things like position repetition detection.
Instead, I'd suggest to add a flag to EncodePositionForNN() (something like bool fill_missing_history) and do that there.
That would also do that for initial position, but if it's behind flag, that's fine.
Or actually if we don't want to fill history before startpos, we can stop if "current ply" is less than 0. Fen have current move as part of a format. |
The problem with using the turn counter from the FEN is that very often FEN positions dont have these values set.... for example these puzzles on this page (scroll down a bit) does not have the halfmove clock and fullmove counters set... so people would usually just input 0 1 in those cases.. which works fine for leela (since the turn count plane is not filled anyway) I guess could set a flag automatically when the 'position fen' command is issued... (and fill the history planes even if default starting position is used..?) Of course.. if the fen actually specifies a halfmove and move counter different than 0 1, then that can be used... |
…e history to add Added code to ignore fake history when checking for repeated positions
Code should now be working "properly" in the hacky way (with repetition checks) ... will start to move around code into EncodePositionForNN() |
…ow the previous move Reverse the pawn move for fake history
Code has been moved to EncodePositionForNN() |
Oops.. the en passant commit is no good.. it permanently reverts the position in the first position from the FEN.. will fix later today |
Weird.. tried to respond to the thread on google forums (https://groups.google.com/forum/#!topic/lczero/PNHkPgV3bCM) but my posts instantly get deleted (twice) Marked my PR as experimental (not to be merged into main branch for now) Started to look into adding a command like option for enabling.. but because there are several ways to do this, its complicated to add an option that covers all... Would be better to agree on one way to do it than making command line options that support multiple ways... The PR I made currently uses a modified version of choice 2 in the forum posts (originally it was closer to choice 3, but not quite)
could add options to always fill 7 history (also possibly option to always do this, or only for fen) |
Is this PR sort of superseded by LeelaChessZero/lc0#305? Or is there things from here to combine with the other? |
Ah never mind, I forgot this repo was obsolete now. It came up during a google search and I didn't realize which repo I was in. :) |
Added copies of the current board position in history planes when a fen position with no history is specified (except the new board starting position)
This appears to greatly help evaluations compared to when history planes are empty.. eg with net315 it finds the Rxf3+ move with 1 node..
Default lc0 with net 315 is P: 0.12% vs P: 58.03% with fake history
position fen 8/p7/3N2R1/P7/5K1k/1r3B2/1Pr4p/8 b - - 0 1
go nodes 1
Creating backend [cudnn]...
info string c2c3 (1445) N: 0 (+ 0) (V: 0.00%) (P: 0.06%) (Q: 0.14733) (U: 0.00070) (Q+U: 0.14803)
info string a7a6 (204 ) N: 0 (+ 0) (V: 0.00%) (P: 0.05%) (Q: 0.14733) (U: 0.00058) (Q+U: 0.14791)
info string h4h3 (1134) N: 0 (+ 0) (V: 0.00%) (P: 2.18%) (Q: 0.14733) (U: 0.02611) (Q+U: 0.17344)
info string b3b2 (1187) N: 0 (+ 0) (V: 0.00%) (P: 0.18%) (Q: 0.14733) (U: 0.00210) (Q+U: 0.14943)
info string b3b4 (1176) N: 0 (+ 0) (V: 0.00%) (P: 10.12%) (Q: 0.14733) (U: 0.12148) (Q+U: 0.26881)
info string b3b5 (1172) N: 0 (+ 0) (V: 0.00%) (P: 0.03%) (Q: 0.14733) (U: 0.00038) (Q+U: 0.14771)
info string b3b6 (1169) N: 0 (+ 0) (V: 0.00%) (P: 0.02%) (Q: 0.14733) (U: 0.00027) (Q+U: 0.14760)
info string b3b7 (1167) N: 0 (+ 0) (V: 0.00%) (P: 0.03%) (Q: 0.14733) (U: 0.00032) (Q+U: 0.14765)
info string b3b8 (1165) N: 0 (+ 0) (V: 0.00%) (P: 0.05%) (Q: 0.14733) (U: 0.00063) (Q+U: 0.14796)
info string b3c3 (1180) N: 0 (+ 0) (V: 0.00%) (P: 0.02%) (Q: 0.14733) (U: 0.00026) (Q+U: 0.14759)
info string b3d3 (1181) N: 0 (+ 0) (V: 0.00%) (P: 0.06%) (Q: 0.14733) (U: 0.00070) (Q+U: 0.14803)
info string b3e3 (1182) N: 0 (+ 0) (V: 0.00%) (P: 0.04%) (Q: 0.14733) (U: 0.00048) (Q+U: 0.14781)
info string b3f3 (1183) N: 0 (+ 0) (V: 0.00%) (P: 58.03%) (Q: 0.14733) (U: 0.69633) (Q+U: 0.84366)
info string b3a3 (1179) N: 0 (+ 0) (V: 0.00%) (P: 0.04%) (Q: 0.14733) (U: 0.00046) (Q+U: 0.14779)
info string c2c1 (1457) N: 0 (+ 0) (V: 0.00%) (P: 0.71%) (Q: 0.14733) (U: 0.00854) (Q+U: 0.15587)
info string h2h1n (1597) N: 0 (+ 0) (V: 0.00%) (P: 0.16%) (Q: 0.14733) (U: 0.00197) (Q+U: 0.14930)
info string c2c4 (1440) N: 0 (+ 0) (V: 0.00%) (P: 0.19%) (Q: 0.14733) (U: 0.00233) (Q+U: 0.14967)
info string c2c5 (1436) N: 0 (+ 0) (V: 0.00%) (P: 0.19%) (Q: 0.14733) (U: 0.00222) (Q+U: 0.14955)
info string c2c6 (1434) N: 0 (+ 0) (V: 0.00%) (P: 0.05%) (Q: 0.14733) (U: 0.00059) (Q+U: 0.14792)
info string c2c7 (1432) N: 0 (+ 0) (V: 0.00%) (P: 0.07%) (Q: 0.14733) (U: 0.00084) (Q+U: 0.14817)
info string c2c8 (1431) N: 0 (+ 0) (V: 0.00%) (P: 0.04%) (Q: 0.14733) (U: 0.00046) (Q+U: 0.14779)
info string c2d2 (1450) N: 0 (+ 0) (V: 0.00%) (P: 0.23%) (Q: 0.14733) (U: 0.00277) (Q+U: 0.15010)
info string c2e2 (1451) N: 0 (+ 0) (V: 0.00%) (P: 0.11%) (Q: 0.14733) (U: 0.00135) (Q+U: 0.14868)
info string c2f2 (1452) N: 0 (+ 0) (V: 0.00%) (P: 26.52%) (Q: 0.14733) (U: 0.31829) (Q+U: 0.46562)
info string c2g2 (1453) N: 0 (+ 0) (V: 0.00%) (P: 0.07%) (Q: 0.14733) (U: 0.00081) (Q+U: 0.14814)
info string c2b2 (1449) N: 0 (+ 0) (V: 0.00%) (P: 0.22%) (Q: 0.14733) (U: 0.00259) (Q+U: 0.14992)
info string h2h1q (1855) N: 0 (+ 0) (V: 0.00%) (P: 0.27%) (Q: 0.14733) (U: 0.00324) (Q+U: 0.15057)
info string h2h1r (1856) N: 0 (+ 0) (V: 0.00%) (P: 0.16%) (Q: 0.14733) (U: 0.00192) (Q+U: 0.14926)
info string h2h1b (1857) N: 0 (+ 0) (V: 0.00%) (P: 0.11%) (Q: 0.14733) (U: 0.00129) (Q+U: 0.14863)
bestmove b3f3