-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Purposely repeating moves #4029
Comments
Although this was game was completely winning, if this also occurs in games in the balance of drawn and winning then a solution might bring elo as that wasted time would help stockfish convert. |
its not an issues , I Test this Position via stockfish 15 and result was correct
|
@movepicker I specified the version that I was using for a reason, don't just ignore it and use something else... The results can change with the version and depth |
Another example, black again can't do anything and Stockfish again only wants to check the king and go back to g3 for no reason instead of directly playing Bf8 Stockfish cc7bcd5
|
I Test this Position also and result was
my stockfish version is https://stockfishchess.org/files/stockfish_15_win_x64_avx2.zip |
Again... stop using an older/different version and expect the same result at the same depth...
Happy now? sigh |
yes yes , that is Like Zugzwang Issues ,maybe exist a bug in Nnue Evaluation , Thanks Dav for Report This Issues |
No, this happens in Stockfish Classical too
|
I Test this Position via komodo 12 and result was
Thanks Dav for found This Issues in Stockfish engine |
I think that this is the commit that causes the issue. |
This doesn't seem to be a new issue created by a recent commit as it can be reproduced with very old versions of Stockfish like (as I already mentioned) Stockfish Classical but I tried with even older versions like Stockfish 9 and same things happen |
A Discord user claims that weird shuffling can be found even in simple cases of KRvK, and that Stockfish 14 does not have a shuffling problem, while SFs 12, 13 and 15 all have a shuffling problem (even while 14 doesn't) |
The shuffling in KRvK is probably because the NNUE nets don't score positions in KRvK in a way that makes the path to mate obvious, it is just a winning position. The classical eval has terms that pushes the king to the edge. |
More generally, SF doesn't repeat moves 'on purpose' so there are no terms that obviously favor repetition. Nevertheless, this behavior could of course emerge from whatever combination of search heuristics. |
By "on purpose" I don't really mean "favor" as in "preferring" I mean more like "knowing and not caring". |
Let w1-b1-w2-b2-w3-b3-w4-... be the pv with SF playing move w1 and lets assume a repetition of the current position after move b3. You suggest that we should cut the first 6 plies of the pv and directly play w4, right? |
The repetitions to which I refer:
I think that limiting a filter to apply only in these situations could avoid trusting low depth moves
Please ignore the reactions, they are from a spammer that is now banned |
My argument "we may find a better w2' after w1-b1 are played" is still valid in your case.
Evaluating 2-fold repetition as a draw even in root (if expected score is > 0) should do what you want. No idea if this was already tested at some time. |
No idea if it was ever tested to be honest |
there was old work on 2-fold vs 3-fold, multiple PRs IIRC see #1126 as a starter |
Hmm yeah I didn't consider MultiPV... but I guess this behaviour could've been disabled only when MultiPV was more than 1? Why not? That way you "hide" the trick when MultiPV is 1 and it would still work for real games |
I don't see how purposely repeating moves is considered an issue. Stockfish has determined a winning route, but has also determined that it can reach that same winning route via transposition by repeating moves, and if the opponent doesn't play the sharpest line which likely also repeats moves, the opponent would be even worse off than if Stockfish simply went directly for the winning route. Keep in mind the best PV will always try to optimize its evaluation, and it has determined that it has an opportunity to reach an even stronger evaluation. Isn't that the purpose of Stockfish? The only argument I can think of is that if you have a clearly winning position, you should prioritize moves that reset the 50move rule over moves that might raise your evaluation? |
Another factor I haven't seen discussed (but touched on by @RogerThiede) is that it isn't guaranteed that a repetition in the PV is a repetition in the game. SF may not be decided between whether to repeat or choose another line. If This gets messier when factoring in contempt (see Roger again), the time control, and ponder settings: probing for more eval time is a good thing in critical moments during competitive play. NNUE might even be optimizing for this in training. In cases where it does matter (mate-in-N, 48-50 DTZ) SF should correct itself already, so I agree that this is a non-issue. Footnotes |
bug, i agree for nothing but black king as it's checked on d7 how come it takes at least 4 sec to the inevitable forced move ? |
I came up with a dirty trick that might solve the problem. It would be easy to test for regression, but it is a functional change nonetheless. |
There is a general issue with tree search that winning a pawn in 5 moves has the same evaluation as winning a pawn in 1 move (all else being equal). So the engine has no reason to select one over the other and this may lead to shuffling. Some people like to dampen evaluations by depth (as is done for mates) to mitigate this problem. However this may potentially lead to hash table issues. |
I forgot to put the link: I might test it in a latter occasion. |
Here is a potentially relevant page: https://www.ics.uci.edu/~eppstein/180a/990202a.html Here is also a very bootleg solution I came up with: https://github.com/silversolver1/Stockfish/commit/56177af44a0a7787dea3ac01918d20a0920e5e22 value_to_tt() Value value_to_tt(Value v, int ply) {
assert(v != VALUE_NONE);
return v >= VALUE_TB_WIN_IN_MAX_PLY ? v + ply
: v <= VALUE_TB_LOSS_IN_MAX_PLY ? v - ply : v;
} value_from_tt()Value value_from_tt(Value v, int ply, int r50c) {
if (v == VALUE_NONE)
return VALUE_NONE;
if (v >= VALUE_TB_WIN_IN_MAX_PLY) // TB win or better
{
if (v >= VALUE_MATE_IN_MAX_PLY && VALUE_MATE - v > 99 - r50c)
return VALUE_MATE_IN_MAX_PLY - 1; // do not return a potentially false mate score
return v - ply;
}
if (v <= VALUE_TB_LOSS_IN_MAX_PLY) // TB loss or worse
{
if (v <= VALUE_MATED_IN_MAX_PLY && VALUE_MATE + v > 99 - r50c)
return VALUE_MATED_IN_MAX_PLY + 1; // do not return a potentially false mate score
return v + ply;
}
return v;
} This is obviously a very naive attempt at a solution but this is the reasoning: this is clearly already done for values in the range of (greater than) VALUE_TB_WIN_IN_MAX_PLY and (less than) VALUE_TB_LOSS_IN_MAX_PLY so why not then increase the range of values that this is done for, by decreasing the minimum values for which this ply adjustment occurs at? For example, by decreasing VALUE_TB_WIN_IN_MAX_PLY to, say, VALUE_KNOWN_WIN * 2, we could have the effect of weighting clearly won positions by ply, without waiting so long for the positions to actually enter tb territory |
I was looking at Navs stream (https://www.twitch.tv/videos/1488780810?t=18h26m47s) and I saw Stockfish doing some very very weird things.
It did 7 useless moves to just take a pawn that it could've taken in 1, wasting a lot of time in the process.
So I decided to check with homefish and see what it would do and the results were even more weird.
Stockfish wanted to purposely repeat moves for absolutely no reason.
Repeating the same position throughout the game is not an issue, but wanting to repeat moves when you have a clear advantage and when it's just making you waste time makes no sense.
Stockfish 22b7909
In this position black is basically forced to go back and forth with the king from d7 to e8 waiting for white to do something and this is what Stockfish wants to do:
Stockfish basically wants to go to g6 to check the king expecting it to go back to d7 and then go back to g4?!?! WHY? It literally makes no sense, just take the pawn (g4f3) now!
This "bug" makes Stockfish look dumb during analysis and during games
The text was updated successfully, but these errors were encountered: