https://pixabay.com/photos/macro-cogwheel-gear-engine-vintage-1452987/
LeelaChessZero vs Stockfish: Who could be your best chess coach?
There is not WorstFishLC0 and Stockfish are famous chess engines. They both compete in races in tournaments like TCEC and CCC. And I will be telling you which one is better at analysis, gameplay, and working mechanisms
I. Who analyzes better?
My point is clear. LC0 isn't stronger than Stockfish. I would advise you to just use Stockfish. LC0 usually makes your GPU overheat. To be honest, LC0 nearly fried my RTX 2080. I used LC0 and Stockfish for analyzing. They are quite different. But I am not an expert in chess engines. So I just provide a superficial introduction. This is my personal experience, not a rigorous test
Let us look at the positions and the pictures:
In these positions, LC0 says 23. Rd2 and 25. Ng5 are mistakes. 
However, it is not the case. In this position after 23. Qd7?, White gets an advantage. Stockfish's evaluation is about +1 pawn
Someone thinks LC0 can play even better than Stockfish in closed positions and strategic positions. Right, LC0 plays like a human, a superGM. And Stockfish just plays like a computing machine. Stockfish can play some counterintuitive moves
II. How do they work?
2.1 How does LC0 work?
The codebase of LC0 mainly consists of two logical components: the search algorithm and the neural network backend. Its idea is to use neural networks to replace traditional manually programmed evaluation functions, and it adopts MCTS to replace the classic Alpha-Beta search. Its neural network takes the board position as input and outputs three key heads of information:Policy head:
A probability distribution over all legal movesValue head:
Evaluation of the winning expectation of the position (LC0 shows: WDL)Move count head:
An estimation of the remaining moves in the game
LC0 uses the PUCT (Predictor Upper Confidence bounds applied to Trees). This is a variant of MCTS (Monte Carlo tree search),
The core process of PUCT is as follows:
1. Selection: Starting from the root node, traverse down the path of the most promising child nodes according to the PUCT formula
2. Evaluation: Upon reaching a leaf node, invoke the neural network to evaluate the game state and obtain the policy and value
3. Backpropagation: Propagate the evaluation results back along the path and update the visit count and average value of each node
LC0 relies heavily on GPUs for neural network inference. Why does LC0 love to work on GPUs? LC0 uses large-scale matrix algorithms. After analyzing multiple game positions, it packages them into a batch and sends the batch to the neural network for evaluation. This fits well with the parallel computing environment of GPU, for much the same reason that LLMs typically work on GPUs
2.2 How does Stockfish work?
The core search algorithm of Stockfish is Alpha-Beta Pruning. Alpha-Beta Pruning maintains two values, alpha (lower bound) and beta (upper bound), to prune branches that cannot affect the final decision, drastically reducing the size of the search tree. Stockfish also employs a variety of advanced search techniques:Move Ordering
It is used to optimize pruning efficiencyNull Move Pruning
It is used to filter out non-threatening variationsQuiescence Search
It is used to check for overlooked tactics
In 2020, Stockfish introduced NNUE (Efficiently Updatable Neural Network) neural network evaluation. The network architecture is specially designed for efficient inference on CPU. It leverages the locality of chess moves; only partial computations of the network need incremental updating after each move
III. Who plays better?
I made LC0 play a game against Stockfish using En Croissant:
38...Qb5
"Oh... Mr. Stock, just play 39. Qxb5 and trade with me," said LC0. If Stockfish had just traded with LC0, the game would have been a draw. Stockfish thought: "My 2 rooks are on open files, and 1 rook is on the 7th rank. If I take her queen, there is nothing left on the chessboard. So I played scared and I played 39. Qf3."
39. Qf3
Stockfish sacrificed a knight! W-H-A-T a sight! LC0 saw a knight and she could take it. So she just took the knight without hesitating. This gave White an advantage of about +4 pawns
41. Kh2
Great! A quiet move! Then LC0 had to take White's d4 pawn. "This sounds absolutely crazy. I still haven't understood what it's after," said LC0
49. Re7+ Qxe7 50. Qxe7
White won
IV. How to download and set them?
Downloads:
Click me to download LC0
Click me to download Stockfish
Click me to download En Croissant
Setting:
Take the RTX 2080 and the Intel(R) Core(TM) i7-10700F as an example. Its specifications are as follows (copy and paste the JSON code):
For LC0:{"settings": [{"name": "Threads","value": 1},{"name": "MultiPV","value": 1},{"name": "MinibatchSize","value": 256},{"name": "MoveOverheadMs","value": 0}]}
For Stockfish:{"settings": [{"name": "Threads","value": 8},{"name": "Hash","value": 1024},{"name": "MultiPV","value": 2},{"name": "Move Overhead","value": 0}]}
V. References
https://lczero.org/dev/overview/
https://draft.lczero.org/play/faq/
https://lczero.org/dev/wiki/technical-explanation-of-leela-chess-zero/
https://stockfishchess.org/blog/2020/introducing-nnue-evaluation/
https://official-stockfish.github.io/docs/stockfish-wiki/Download-and-usage/
https://lichess.org/@/Everdell/blog/how-do-chess-engines-really-work/JsMnuk3l
