Software:Leela Chess Zero
|Original author(s)||Gian-Carlo Pascutto, Gary Linscott|
|Developer(s)||Gary Linscott, Alexander Lyashuk, Folkert Huizinga, others|
|Initial release||9 January 2018|
v0.27 / 21 February 2021
|Operating system||Windows, Mac, Linux, Ubuntu, Android|
Leela chess Zero (abbreviated as LcZero, Lc0) is a free, open-source, and neural network–based chess engine and distributed computing project. Development has been spearheaded by programmer Gary Linscott, who is also a developer for the Stockfish chess engine. Leela chess Zero was adapted from the Leela Zero Go engine, which in turn was based on Google's AlphaGo Zero project, also to verify the methods in the AlphaZero paper as applied to the game of chess.
Like Leela Zero and AlphaGo Zero, Leela chess Zero starts with no intrinsic chess-specific knowledge other than the basic rules of the game. Leela chess Zero then learns how to play chess by reinforcement learning from repeated self-play, using a distributed computing network coordinated at the Leela Chess Zero website.
As of 2020[update], Leela chess Zero had played over 300 million games against itself, and is capable of play at a level that is comparable with Stockfish, the leading conventional chess program.
The Leela chess Zero project was first announced on TalkChess.com on January 9, 2018. This revealed Leela Chess Zero as the open-source, self-learning chess engine it would come to be known as, with a goal of creating a strong chess engine. Within the first few months of training, Leela Chess Zero had already reached the Grandmaster level, surpassing the strength of early releases of Rybka, Stockfish, and Komodo, despite evaluating orders of magnitude fewer positions while using MCTS.
In December 2018, the AlphaZero team published a new paper in Science magazine revealing previously undisclosed details of the architecture and training parameters used for AlphaZero. These changes were soon incorporated into Leela Chess Zero and increased both its strength and training efficiency.
The work on Leela chess Zero has informed the similar AobaZero project for shogi.
The engine has been rewritten and carefully iterated upon since its inception, and now runs on multiple backends, allowing it to effectively utilize different types of hardware, both CPU and GPU.
The engine supports the Fischer Random Chess variant, and a network is being trained to test the viability of such a network as of May 2020.
Program and use
The method used by its designers to make Leela Chess Zero self-learn and play chess at above human level is reinforcement learning. This is a machine-learning algorithm, mirrored from AlphaZero used by the Leela chess Zero training binary to maximize reward through self-play. As an open-source distributed computing project, volunteer users run Leela Chess Zero to play hundreds of millions of games which are fed to the reinforcement algorithm. In order to contribute to the advancement of the Leela Chess Zero engine, the latest non-release candidate (non-rc) version of the Engine as well as the Client must be downloaded. The Client is needed to connect to the current server of Leela Chess Zero, where all of the information from the self-play chess games are stored, to obtain the latest network, generate self-play games, and upload the training data back to the server.
In order to play against the Leela Chess Zero engine on a machine, 2 components are needed: the engine binary, and a network (The engine binary is distinct from the client, in that the client is used as a training platform for the engine). The network contains Leela Chess Zero's evaluation function that is needed to evaluate positions. Older networks can also be downloaded and used by placing those networks in the folder with the lc0 binary.
Self-play Elo is used to gauge relative network strength to look for anomalies and general changes in network strength, and can be used as a diagnostic tool when there are significant changes. Through test match games that are played with minimal temperature-based variation, lc0 engine clients test the most recent version against other recent versions of the same network's run, which is then sent the training server to create an overall Elo assessment.
Standard Elo formulae are used to calculate relative Elo strength between the two players. More recent Self-Play Elo calculations use match game results against multiple network versions to calculate a more accurate Elo value.
There are several unintended consequences of the Self-Play approach to gauging strength and are as follows:
- Differing scales of initial Elo inflation in training runs due to periods of lower/higher self-improvement and adversarial play.
- Strength measured this way is not objective and is relative to previous networks, allowing for a false illusion of gained strength since networks are trained to beat and anticipate the actions of their past selves.
- Overfitting against previous network versions of Lc0 continuously adds small amounts of Self-Play Elo to the cumulative measured Elo. Overfitting in this manner is generally seen more clearly when training smaller networks.
- There is no direct 1-to-1 correlation between self-play elo and the strength against Alpha-Beta engines, and no known correlation to strength against humans.
- Behavioral changes in networks between runs affect inflation.
An example of Self-Play elo inflation is the Test 71.4 run (named as 714xxx nets), a Fischer Random Chess run, which nearly has 4000 cumulative self-play elo 76 nets after the start of its run. Self-Play Elo estimates of this run can be roughly compared with other runs to gauge the impracticality of pure cumulative self-play elo. A pure self-play elo comparison with one of the Test 60 networks 3000 nets into the run reveals that 63000 can consistently beat 714070 in head-to-head matches at most, if not all "fair" time controls. Yet, 63000 nets from the Test 60 run have a self-play elo around 2900, while the Self-Play Elo of early Test 71.4 is already near 4000. This contradiction of self-play Elo strength is enough to credit the claim that self-play Elo is not an objective measure of strength, nor is it one which allows one to easily compare network strength to Human strength.
Self-play rating for the engine could be used as a rough approximation of conventional Human Elo ratings, however no universal conversion formula exists for many reasons. These include but are not limited to the scale of initial inflation of self-play Elo and the late-term self-play Elo inflation between trained runs, differing time controls, differing systems of Elo measurement between chess tournament platforms, allocated resources to the engine, network size and structure, a network's training data set, and the multiple factors of which strength is given by the binary of the engine.
Setting up the engine to play a single node with ``--minibatch-size=1`` and ``go nodes 1`` for each played move creates deterministic play, and Self-Play elo on such settings will always yield the same result between 2 of the same networks on the same start position--always win, always loss, or always draw. Self-play elo is not reliable for determining strength in these deterministic circumstances.
In season 15 of the Top Chess Engine Championship, the engine AllieStein competed alongside Leela. AllieStein is a combination of two different spinoffs from Leela: Allie, which uses the same evaluation network as Leela, but has a unique search algorithm for exploring different lines of play, and Stein, an evaluation network which has been trained using supervised learning based on existing game data featuring other engines (as opposed to the unsupervised learning which Leela uses). While neither of these projects would be admitted to TCEC separately due to their similarity to Leela, the combination of Allie's search algorithm with the Stein network, called AllieStein, is unique enough to warrant it competing alongside mainstream Lc0 (The TCEC rules require that a neural network-based engine has at least 2 unique components out of 3 essential features: The code that evaluates a network, the network itself, and the search algorithm. While AllieStein uses the same code to evaluate its network as Lc0, since the other two components are fresh, AllieStein is considered a distinct engine).
In April 2018, Leela chess Zero became the first neural network engine to enter the Top Chess Engine Championship (TCEC), during season 12 in the lowest division, division 4. Leela did not perform well: in 28 games, it won one, drew two, and lost the remainder; its sole victory came from a position in which its opponent, Scorpio 2.82, crashed in three moves. However, it improved quickly. In July 2018, Leela placed seventh out of eight competitors at the 2018 World Computer Chess Championship. In August 2018, it won division 4 of TCEC season 13 with a record of 14 wins, 12 draws, and 2 losses. In Division 3, Leela scored 16/28 points, finishing third behind Ethereal, which scored 22.5/28 points, and Arasan on tiebreak.
By September 2018, Leela had become competitive with the strongest engines in the world. In the 2018 Chess.com Computer Chess Championship (CCCC), Leela placed fifth out of 24 entrants. The top eight engines advanced to round 2, where Leela placed fourth. Leela then won the 30-game match against Komodo to secure third place in the tournament. Concurrently, Leela participated in the TCEC cup, a new event in which engines from different TCEC divisions can play matches against one another. Leela defeated higher-division engines Laser, Ethereal and Fire before finally being eliminated by Stockfish in the semi-finals.
In December 2018, Leela participated in season 14 of the Top Chess Engine Championship. Leela dominated divisions 3, 2, and 1, easily finishing first in all of them. In the premier division, Stockfish dominated while Houdini, Komodo and Leela competed for second place. It came down to a final-round game where Leela needed to hold Stockfish to a draw with black to finish second ahead of Komodo. It successfully managed this and therefore contested the superfinal against Stockfish. It narrowly lost the superfinal against Stockfish with a 49.5-50.5 final score.
In February 2019, Leela scored its first major tournament win when it defeated Houdini in the final of the second TCEC cup. Leela did not lose a game the entire tournament. In April 2019, Leela won the Chess.com Computer Chess Championship 7: Blitz Bonanza, becoming the first neural-network project to take the title.
In May 2019, Leela defended its TCEC cup title, this time defeating Stockfish in the final 5.5-4.5 (+2 =7 -1) after Stockfish blundered a 7-man tablebase draw. Leela also won the Superfinal of season 15 of the Top Chess Engine Championship 53.5-46.5 (+14 -7 =79) versus Stockfish.
Season 16 of TCEC saw Leela finish in 3rd place in premier division, missing qualification for the superfinal to Stockfish and new neural network engine AllieStein. Leela did not suffer any losses in the Premier division, the only engine to do so, and defeated Stockfish in one of the six games they played. However, Leela only managed to score 9 wins, while AllieStein and Stockfish both scored 14 wins. This inability to defeat weaker engines led to Leela finishing 3rd, half a point behind AllieStein and a point behind Stockfish. In the fourth TCEC cup, Leela was seeded first as the defending champion, which placed it on the opposite half of the brackets as AllieStein and Stockfish. Leela was able to qualify for the finals, where it faced Stockfish. After seven draws, Stockfish won the eighth game to win the match.
In Season 17 of TCEC, held in January-April 2020, Leela regained the championship by defeating Stockfish 52.5-47.5. It qualified for the superfinal again in Season 18, but this time was defeated by Stockfish 53.5-46.5. In the TCEC Cup 6 final, Leela lost to AllieStein, finishing 2nd.
Season 19 of TCEC saw Leela qualify for the superfinal again. This time it played against a new Stockfish version with support for NNUE, a neural network–based evaluation function used primarily for the leaf nodes of the search tree. It defeated Leela with a final score of 54.5-45.5 (+18 -9 =73).
|Season||Division 4||Division 3||Division 2||Division 1||Division P||Superfinal|
|Cup 1 (2018)||3rd||-||-|
|Cup 2 (2019)||1st||Houdini||4.5-3.5|
|Cup 3 (2019)||1st||Stockfish||5.5-4.5|
|Cup 4 (2019)||2nd||Stockfish||3.5-4.5|
|Cup 5 (2020)||2nd||Stockfish||1.5-2.5|
|Cup 6 (2020)||2nd||AllieStein||1.5-2.5|
|Cup 7 (2020)||2nd||Stockfish||1.5-2.5|
|Cup 8 (2021)||2nd||Stockfish||3.5-4.5|
|CCC 1: Rapid Rumble||2018||15+5||3rd|||
|CCC 2: Blitz Battle||2018||5+2||3rd|||
|CCC 3: Rapid Redux||2019||30+5||2nd|||
|CCC 4: Bullet Brawl||2019||1+2||2nd|||
|CCC 5: Escalation||2019||10+5||2nd|||
|CCC 6: Winter Classic||2019||10+10||2nd|||
|CCC 7: Blitz Bonanza||2019||5+2||1st|||
|CCC 8: Deep Dive||2019||15+5||2nd|||
|CCC 9: The Gauntlet||2019||5+2, 10+5||3rd|||
|CCC 10: Double Digits||2019||10+3||3rd|||
|CCC 12: Bullet Madness!||2020||1+1||1st|||
|CCC 13: Shapes||2020||3+2, 5+5, 10+5, 15+5||1st|||
- Leela vs Stockfish, CCCC bonus games, 1-0 Leela beats the world champion Stockfish engine despite a 1-pawn handicap.
- Stockfish vs Leela Chess Zero - TCEC S15 Superfinal - Game 61 Leela completely outplayed Stockfish with black pieces in Trompovsky attack, Leela's eval went from 0.1 to -1.2 in one move, and Stockfish's eval didn't go negative until 15 moves later.
- "Leela Chess Zero: Full Elo Graph". 7 March 2019. https://lczero.org/?full_elo=1. Retrieved 7 March 2019.
- "leela-zero". GitHub. https://github.com/gcp/leela-zero. Retrieved 27 April 2018.
- "LCZero". https://training.lczero.org/.
- "Lc0 Wins Computer Chess Championship, Makes History" (in en-US). https://www.chess.com/news/view/lc0-wins-computer-chess-championship-makes-history.
- Pete (pete). "Stockfish Strikes Back, Tops Lc0 In Computer Chess Championship" (in en-US). https://www.chess.com/news/view/computer-chess-championship-9-stockfish-lc0.
- "Announcing lczero". http://www.talkchess.com/forum3/viewtopic.php?t=66280. Retrieved 11 June 2018.
- "Announcing lczero - TalkChess.com". http://www.talkchess.com/forum3/viewtopic.php?t=66280.
- Silver, David; Hubert, Thomas; Schrittwieser, Julian et al. (6 December 2018). "A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play". Science 362 (6419): 1140–1144. doi:10.1126/science.aar6404. PMID 30523106. Bibcode: 2018Sci...362.1140S. http://discovery.ucl.ac.uk/10069050/1/alphazero_preprint.pdf.
- "AlphaZero paper, and Lc0 v0.19.1". 7 December 2018. https://blog.lczero.org/2018/12/alphazero-paper-and-lc0-v0191.html. Retrieved 14 February 2019.
- Kobayashi, Yuki (2019-09-15), GitHub - kobanium/aobazero: Aoba Zero., https://github.com/kobanium/aobazero, retrieved 2019-09-25
- "leela-chess-zero". GitHub. https://github.com/LeelaChessZero/lc0. Retrieved 11 May 2020.
- The rewritten engine, originally for tensorflow. Now all other backends have been ported here.: LeelaChessZero/lc0, LCZero, 2019-03-20, https://github.com/LeelaChessZero/lc0, retrieved 2019-03-21
- "Allie+Stein, the new neural network based engine entering TCEC S15". http://www.chessdom.com/alliestein-the-new-neural-network-entering-tcec-s15/.
- "Breaking: Leela Chess Zero enters TCEC Season 12". Chessdom. 18 April 2018. http://www.chessdom.com/breaking-leela-chess-zero-enters-tcec-season-12/.
- See the season 12 archives at http://tcec.chessdom.com/archive.php
- "World Computer Chess Championship 2018". ICGA. http://icga.org/pairing/wccc2018/. Retrieved 19 July 2018.
- See the season 13 archives at http://tcec.chessdom.com/archive.php
- "Leela Chess Zero wins the gold medal in TCEC Div 4 | Chessdom" (in en-US). http://www.chessdom.com/leela-chess-zero-wins-the-gold-medal-in-tcec-div-4/.
- "Ethereal chess engine wins the gold at TCEC Div 3 | Chessdom" (in en-US). http://www.chessdom.com/ethereal-chess-engine-wins-the-gold-at-tcec-div-3/.
- "Chess.com Computer Chess Championship". https://www.chess.com/computer-chess-championship.
- "CCCC stage 2 ended. Leela 4th with a good performance! Stockfish undefeated!". 26 September 2018. http://blog.lczero.org/2018/09/cccc-stage-2-ended-leela-4th-with-good.html. Retrieved 26 September 2018.
- Cilento, Pete (26 September 2018). "Stockfish, Houdini Battle For Computer Chess Championship; Komodo vs Lc0 For 3rd". https://www.chess.com/news/view/stockfish-houdini-to-battle-for-computer-chess-championship-komodo-vs-lc0-for-3rd. Retrieved 9 October 2018.
- "Leela wins the match series against Komodo and wins a Pawn odds game against Stockfish!". 3 October 2018. http://blog.lczero.org/2018/10/leela-wins-match-series-against-komodo.html. Retrieved 9 October 2018.
- Cilento, Pete (4 October 2018). "Stockfish Wins Computer Chess Championship Rapid; Lc0 Finishes 3rd". https://www.chess.com/news/view/stockfish-wins-computer-chess-championship-rapid-lc0-finishes-3rd-3887. Retrieved 9 October 2018.
- See the TCEC Cup 1 archives at http://tcec.chessdom.com/archive.php
- Cilento, Pete (11 October 2018). "Computer Chess Championship Returns For Blitz Battle". https://www.chess.com/news/view/computer-chess-championship-returns-for-blitz-battle. Retrieved 22 November 2018.
- Cilento, Pete (19 November 2018). "Stockfish Wins Computer Chess Championship Blitz". https://www.chess.com/news/view/stockfish-wins-computer-chess-championship-blitz. Retrieved 22 November 2018.
- See the season 14 archives at http://tcec.chessdom.com/archive.php
- See the TCEC Cup 2 archives at http://legacy-tcec.chessdom.com/archive.php
- "Leela won the TCEC CUP!". 4 February 2019. http://blog.lczero.org/2019/02/leela-won-tcec-cup.html. Retrieved 12 February 2019.
- Cilento, Pete (17 April 2019). "Lc0 Wins Computer Chess Championship, Makes History". https://www.chess.com/news/view/lc0-wins-computer-chess-championship-makes-history. Retrieved 18 April 2019.
- See the game score at https://www.tcec-chess.com/archive.html?season=cup3&round=fl&game=9
- "Lc0 won TCEC 15". 28 May 2019. https://blog.lczero.org/2019/05/lc0-won-tcec-15.html. Retrieved 28 May 2019.
- Högy, Kevin (2 June 2019). "A new age in computer chess? Lc0 beats Stockfish!". https://chess24.com/en/read/news/a-new-age-in-computer-chess-leela-beats-stockfish. Retrieved 25 June 2019.
- "Season 16, Div P archive". https://www.tcec-chess.com/archive.html?season=16&div=p&game=1. Retrieved 30 September 2019.
- "TCEC Cup 4 archive". https://www.tcec-chess.com/archive.html?season=cup4&round=fl&game=1. Retrieved 18 November 2019.
- "TCEC final report". https://lczero.org/blog/2020/04/tcec-s17-super-final-report/.
- "TCEC Season 18 archive". https://tcec-chess.com/#div=sf&game=1&season=18. Retrieved 3 July 2020.
- "TCEC Cup 6 Final". https://tcec-chess.com/#game=7&round=fl&season=cup6. Retrieved 23 July 2020.
- "Season 19, Div SF archive". https://www.tcec-chess.com/archive.html?season=19&div=sf&game=100. Retrieved 19 October 2020.
- "Stockfish 12". https://blog.stockfishchess.org/post/628172810852925440/stockfish-12. Retrieved 19 October 2020.
- Cilento, Pete. "Stockfish Wins Computer Chess Championship Rapid; Lc0 Finishes 3rd" (in en-US). https://www.chess.com/news/view/stockfish-wins-computer-chess-championship-rapid-lc0-finishes-3rd-3887.
- Cilento, Pete. "Stockfish Wins Computer Chess Championship Blitz" (in en-US). https://www.chess.com/news/view/stockfish-wins-computer-chess-championship-blitz.
- Cilento, Pete. "Stockfish Wins Rapid Computer Championship Over Lc0; Bullet Chess Next" (in en-US). https://www.chess.com/news/view/stockfish-wins-rapid-computer-championship-over-lc0-bullet-chess-next.
- Cilento, Pete. "Stockfish Wins Computer Chess Championship Bullet; 'Escalation' Next" (in en-US). https://www.chess.com/news/view/stockfish-wins-computer-chess-championship-bullet-escalation-next.
- Cilento, Pete. "Computer Chess Championship Plays Blitz After Stockfish Defends Title" (in en-US). https://www.chess.com/news/view/computer-chess-championship-playing-blitz-after-stockfish-defends-title.
- Cilento, Pete (7 August 2019). "Stockfish Wins Computer Chess Championship As Neural Networks Play Catch-Up" (in en-US). https://www.chess.com/news/view/computer-chess-championship-9-stockfish-10-lc0.
- "Computer Chess Championship". https://www.chess.com/computer-chess-championship#event=ccc10-semifinals. Retrieved 19 September 2019.
- "Computer Chess Championship". https://www.chess.com/computer-chess-championship#event=ccc11-finals. Retrieved 23 December 2019.
- "Computer Chess Championship". https://www.chess.com/computer-chess-championship#event=ccc1217-lc0-vs-leelenstein-finals. Retrieved 23 January 2020.
- "Computer Chess Championship". https://www.chess.com/computer-chess-championship#event=ccc13-finals. Retrieved 14 April 2020.
- Doggers, Peter (18 April 2020). "Leela Chess Zero Beats Stockfish 106-94 In 13th Chess.com Computer Chess Championship". Chess.com. https://www.chess.com/news/view/13th-computer-chess-championship-leela-chess-zero-stockfish. Retrieved 24 April 2020.
- "CCC14 Results". https://docs.google.com/spreadsheets/d/15OO7oyXyliBWa1aWRKWCIBblOP8KN6awsOMdS7yOQs0/edit#gid=390633471. Retrieved 19 August 2020.
- Official website
- Leela Chess Zero on GitHub
- Neural network training client
- Neural nets
- Chessprogramming wiki on Leela Chess Zero