lichess.org
Donate

Leela Chess Zero's spectacular Qxf5!!

AnalysisChess engineChessPuzzleSoftware Development
It is all in the network!

In the following position, Leela Chess Zero played the spectacular move 47... Qxf5!! against Stockfish.

https://lichess.org/study/dRhvz8IO/1HBTD4DR

White is an exchange up against a pawn. After the move, 47. Nf5 White is attacking Rg7 and the pawn on h6, which can not be defended. Stockfish evaluates the position as clearly winning for White, but Leela Chess Zero believed she could create a fortress with the queen sacrifice and obtain a draw.
After a lot of shuffling, Stockfish sacrifices its rook and e5 to try to break through, and after 87.f7, we reach the following position:

https://lichess.org/study/dRhvz8IO/TqLk4jZ4

The entry squares for the white queen are all covered by the knight on f8 and the king on b7. Blacks can continue to play Bg7, Be5, Kc7, and Kd8, and there is no way for White to break through. On move 132, a draw was agreed. You can replay the game at the end of the article.

I was fascinated by this spectacular queen sacrifice. How did Leela Chess Zero 'see' this is a fortress? I thought you must calculate deeply to 'see' the fortress, but Stockfish is a stronger calculator and did not 'see' it. Did Leela Chess Zero conclude this is a fortress because the endgame evaluation did not change with increasing analysis depth? (This can indicate a fortress because the evaluation value typically increases with depth.)

I decided to try to replicate the analysis on my Razer 16 laptop with an NVIDIA RTX 4070 GPU with 12 GB of memory. It is not the strongest computer, but it is still adequate for most cases. With the standard installation of Lc0-v0.31.2 with network 791556, Leela Chess Zero was not selecting the move 47... Qxf5 after an hour of analysis! Giving Leela Chess Zero the first moves of the variation did not make a difference; Leela Chess Zero continued to evaluate the position as winning for White. Was I not able to replicate the move because of my hardware? Perhaps the match was played on an array of H100s, and my laptop was too slow.

As a final check, I downloaded the strongest network available for Leela Chess Zero: BT4-spsa-1740. The network is 4GB, so 1/3 of my total GPU memory.
I was shocked to find that with the network BT4-spsa-1740, Leela Chess Zero chooses the move 47... Qxf5 instantly! It is the first move that shows up, without any calculation time.

Leela Chess Zero evaluates positions based on a deep neural network. This neural network takes the board position as input and generates a position evaluation and a vector of move probabilities. Once trained, the network is combined with a specific version of Monte-Carlo Tree Search named PUCT (Predictor + Upper Confidence bounds applied to Trees).

Leela Chess Zero, with the standard network, did not find 47... Qxf5, irrespective of the time you give the engine for her Monte-Carlo Tree Search.
Leela Chess Zero, with the strongest network, immediately selects 47... Qxf5 before she has been given any time for Monte-Carlo Tree Search.

My conclusion:
The assessment by Leela Chess Zero that the move 47... Qxf5 leads to a fortress is embedded in the network and not based on calculation!

The game:

https://lichess.org/study/dRhvz8IO/Iy2cI9z3

My video:
https://youtu.be/rcLgoPh_JY4?si=X4IDb-ZY821_fR8b