lichess-org / lila

♞ lichess.org: the forever free, adless and open source chess server ♞
https://lichess.org
GNU Affero General Public License v3.0
15.64k stars 2.28k forks source link

Analysis and initial evaluation #11779

Open dav1312 opened 2 years ago

dav1312 commented 2 years ago

As far as I know the initial evaluation is currently hardcoded to be 15cp. This is "fine" for most cases but in some situations this causes the analysis to behave unexpectedly. https://github.com/lichess-org/lila/blob/1c1cacbea3c0976e9385be7fefe0cbbbb1f54afa/modules/tree/src/main/Eval.scala#L73


In this game, b5 is correctly evaluated as a mistake since the evaluation went from -1.46 to 0.00

1. g4? { (0.15 → -1.46) Mistake. Nf3 was best. } 1... b5? { (-1.46 → 0.00) Mistake. d5 was best. }

Since the starting position evaluation changes in the UI depending on the first move evaluation, the evaluation that appears in the UI is wrong, it should be 0.1/0.2 but it is -1.5

However, in this game, which is basically the same, b5 was not considered a mistake

[FEN "rnbqkbnr/pppppppp/8/8/6P1/8/PPPPPP1P/RNBQKBNR b KQkq - 0 1"]

1... b5

In this case the opposite happens, the evaluation that appears in the UI should be -1.5 but it is 0.0


The starting position should always be evaluated just like any other position, I'm not entirely sure why does it need to be hardcoded at all. If it has to be hardcoded then it should only be used for standard chess from the starting position, otherwise this causes issues not only in standard chess "from position" but also in variants. For example, in Atomic or Three-Check white has a huge initial advantage, however white can blunder all of the advantage on move 1 and the analysis is not going to notice it.

Regular Three-Check opening, +2.6 advantage

Bad first move (from +2.6 to 0.0) but not considered a blunder

In the PGN of a game we can clearly see that it considers +0.15 to be the initial evaluation instead of +2.6

[Variant "Three-check"]

1. a4?? { (0.15 → -2.90) Blunder. e4 was best. }

The opposite can happen too! If the starting position has a big advantage for black, no matter what move white makes, it will be considered a blunder even if it isn't! In this case, the starting position has a advantage for black of around -2.3 but the analysis still thinks that it is +0.15

[FEN "nbbqrnkr/pppppppp/8/8/8/8/PPPPPPPP/RQNKBBRN w KQkq - 0 1"]

1. e3?? { (0.15 → -2.34) Blunder. f4 was best. }
ornicar commented 2 years ago

Yes the issue is that fishnet doesn't analyse the initial position.

dav1312 commented 6 days ago

This issue applies to all games played by the Leela odds bots https://lichess.org/3RUrP3xV#1

ornicar commented 6 days ago

It's annoying, and very hard to fix because analysis storage doesn't contain the initial position.