Your network blocks the Lichess assets!

lichess.org
Donate

Evaluation bug? Mate in 5 disappears

Hi, in this game

https://lichess.org/NvlTDRr9/white#70
after Black's 35 ... gxh5+ the Stockfish evaluation is #-5 (Black mates in 5).

My understanding is that when Sockfish "announces" a mate, there is no move the side being mated can make to get out of it. The side doing the mating can make a mistake and lose the forced sequence, but the side being mated can't just move to find a way out. Therefore, if the evaluation after Black's gxh5+ is #-5 then whatever White does the next evaluation will be at best #-4.

And yet, 36. Kxh5 changes the evaluation to -10.6 (still not looking good for White if there wasn't time trouble, but no longer a known forced mate).

The only explanation I can think of is Stockfish was not allowed to search to the same depth on move 36 as it did on move 35. But what would cause it to look to such a shallow level that it can't see a mate in 4?

When I turned on local evaluation it immediately changed 36 to #-11, then #-10 and so on as it searched. Turning it back off caused it to go back to -10.6 though.

I wonder if Lichess code needs a bit more logic along the lines of "if there's a mate, it can't possibly go away on the turn of the side being mated"?

Hi, in this game https://lichess.org/NvlTDRr9/white#70 after Black's 35 ... gxh5+ the Stockfish evaluation is #-5 (Black mates in 5). My understanding is that when Sockfish "announces" a mate, there is no move the side being mated can make to get out of it. The side doing the mating can make a mistake and lose the forced sequence, but the side being mated can't just move to find a way out. Therefore, if the evaluation after Black's gxh5+ is #-5 then whatever White does the next evaluation will be at best #-4. And yet, 36. Kxh5 changes the evaluation to -10.6 (still not looking good for White if there wasn't time trouble, but no longer a known forced mate). The only explanation I can think of is Stockfish was not allowed to search to the same depth on move 36 as it did on move 35. But what would cause it to look to such a shallow level that it can't see a mate in 4? When I turned on local evaluation it immediately changed 36 to #-11, then #-10 and so on as it searched. Turning it back off caused it to go back to -10.6 though. I wonder if Lichess code needs a bit more logic along the lines of "if there's a mate, it can't possibly go away on the turn of the side being mated"?

You must have clicked VERY quickly on something and cut its evaluation very short. I see mate in 5 both before and after Kxh5, as it correctly is. Somehow, you must have managed to see the stockfish evaluation after Kxh4 before it reached depth 10 (2 ply per move x 5 moves), so that it had not seen the mate yet. To get it to got of that short, you must have clicked through very quickly, or Stockfish was running somewhere on limited computer resources and thus going slower than usual.

You must have clicked VERY quickly on something and cut its evaluation very short. I see mate in 5 both before and after Kxh5, as it correctly is. Somehow, you must have managed to see the stockfish evaluation after Kxh4 before it reached depth 10 (2 ply per move x 5 moves), so that it had not seen the mate yet. To get it to got of that short, you must have clicked through very quickly, or Stockfish was running somewhere on limited computer resources and thus going slower than usual.

well I don't remember clicking anywhere, but we can't rule out phantom taps from a wobbly screen protector.

Still, are clicks from me supposed to be able to interfere with Lichess's server analysis? If I open the analysis board with local analysis turned off (i.e. just the server analysis) I still see the mate in 5 disappearing, even in a new incognito tab. Even if the problem was caused by a stray click, are clicks supposed to be able to mess up permanently the server-side FishNet computer analysis database like that?

well I don't remember clicking anywhere, but we can't rule out phantom taps from a wobbly screen protector. Still, are clicks from me supposed to be able to interfere with Lichess's server analysis? If I open the analysis board with local analysis turned off (i.e. just the server analysis) I still see the mate in 5 disappearing, even in a new incognito tab. Even if the problem was caused by a stray click, are clicks supposed to be able to mess up permanently the server-side FishNet computer analysis database like that?

Kind-of....

I assume you were looking at this game looking at server side analysis after the game was over. When we do that, we click through moves. On each current move, the engine runs, and once we click to go to the next move, it starts calculating again. The evaluation of the previous move on the list remains whatever it was when you clicked to the new position.

Once this analysis exist and is stored, if you look at it again, the evaluations remain the same.

If I open the above game using the analysis board, as you licked it, I see the mate both before and after the king move. If instead, I go to your profile, and find and open the game (with my local engine turned off), then I get shown the existing analysis created the first time someone (likely you or your opponent) asked for a computer analysis. It indeed shows me "only" -10.6 after the k move. If I turn on my engine and click on the king move, it instantly goes to mate, because it takes less than a second for Stockfish to get to a deep enough ply to fing the truth.

Kind-of.... I assume you were looking at this game looking at server side analysis after the game was over. When we do that, we click through moves. On each current move, the engine runs, and once we click to go to the next move, it starts calculating again. The evaluation of the previous move on the list remains whatever it was when you clicked to the new position. Once this analysis exist and is stored, if you look at it again, the evaluations remain the same. If I open the above game using the analysis board, as you licked it, I see the mate both before and after the king move. If instead, I go to your profile, and find and open the game (with my local engine turned off), then I get shown the existing analysis created the first time someone (likely you or your opponent) asked for a computer analysis. It indeed shows me "only" -10.6 after the k move. If I turn on my engine and click on the king move, it instantly goes to mate, because it takes less than a second for Stockfish to get to a deep enough ply to fing the truth.
<Comment deleted by user>
<Comment deleted by user>

OK I confirmed from the fishnet code that the amount of analysis does not depend on any user action like clicking, but I did find this:

Work::Analysis { nodes, depth, .. } => {
let mut go = vec![ "go".to_owned(), "nodes".to_owned(), nodes.get(eval_flavor).to_string(), ];
if let Some(depth) = depth {
go.extend_from_slice(&["depth".to_owned(), depth.to_string()]);
}

They're setting a maximum number of nodes to analyse, which in doc/protocol.md is suggested to be between 2 and 4 million (the actual number is set on the side of the Lichess server which I've not checked).

A node limit will not be an exhaustive search to a specific depth, since Stockfish uses various heuristics to explore some lines before others. Still, it seems strange that it's possible for Stockfish to see a mate in 5 from one position that it wouldn't see from one ply later with the same node budget.

But there's also a line that says "for position in chunk.positions". Lichess is sending, not just one position to the current FishNet node, but a whole series of them. If Stockfish is evaluating multiple positions within the same game, it can build up transposition tables and other shortcuts and therefore explore positions later in the same chunk to a deeper depth.

So now I'm thinking, Black's move 35 was evaluated at the end of one of the chunks, where StockFish had enough transposition tables to see the mate in 5 within its node budget, but White's move 36 was evaluated at the start of the next chunk (sent to a different machine) and that one didn't have enough tables to see the mate.

Prediction: a search in the computer analysis database will reveal more examples of Black's forced mates seeming to disappear on White's move 21, 26, 31, 36, 41, 46 etc in games evaluated since this chunk logic was introduced.

OK I confirmed from the fishnet code that the amount of analysis does not depend on any user action like clicking, but I did find this: Work::Analysis { nodes, depth, .. } => { let mut go = vec![ "go".to_owned(), "nodes".to_owned(), nodes.get(eval_flavor).to_string(), ]; if let Some(depth) = depth { go.extend_from_slice(&["depth".to_owned(), depth.to_string()]); } They're setting a maximum number of nodes to analyse, which in doc/protocol.md is suggested to be between 2 and 4 million (the actual number is set on the side of the Lichess server which I've not checked). A node limit will not be an exhaustive search to a specific depth, since Stockfish uses various heuristics to explore some lines before others. Still, it seems strange that it's possible for Stockfish to see a mate in 5 from one position that it wouldn't see from one ply later with the same node budget. But there's *also* a line that says "for position in chunk.positions". Lichess is sending, not just *one* position to the current FishNet node, but a whole series of them. If Stockfish is evaluating multiple positions within the same game, it can build up transposition tables and other shortcuts and therefore explore positions later in the same chunk to a deeper depth. So now I'm thinking, Black's move 35 was evaluated at the *end* of one of the chunks, where StockFish had enough transposition tables to see the mate in 5 within its node budget, but White's move 36 was evaluated at the start of the *next* chunk (sent to a different machine) and *that* one didn't have enough tables to see the mate. Prediction: a search in the computer analysis database will reveal more examples of Black's forced mates seeming to disappear on White's move 21, 26, 31, 36, 41, 46 etc in games evaluated since this chunk logic was introduced.