![]() | |
Original author(s) | Gian-Carlo Pascutto, Gary Linscott |
---|---|
Developer(s) | Gary Linscott, Alexander Lyashuk, Folkert Huizinga, others |
Initial release | 9 January 2018 |
Stable release | v0.31.1 / 11 August 2024 |
Repository | |
Written in | C++ |
Operating system | Windows, Mac, Linux, Ubuntu, Android |
Type | Chess engine |
License | GPL-3.0-or-later |
Website | lczero |
This article is part of the series on |
Chess programming |
---|
![]() |
Leela Chess Zero (abbreviated as LCZero, lc0) is a free, open-source chess engine and volunteer computing project based on Google's AlphaZero engine. It was spearheaded by Gary Linscott, a developer for the Stockfish chess engine, and adapted from the Leela Zero Go engine. [1]
Like Leela Zero and AlphaGo Zero, early iterations of Leela Chess Zero started with no intrinsic chess-specific knowledge other than the basic rules of the game. [1] It learned how to play chess through reinforcement learning from repeated self-play, using a distributed computing network coordinated at the Leela Chess Zero website. However, as of November 2024 most models used by the engine are trained through supervised learning on data generated by previous reinforcement learning runs. [2]
As of June 2024 [update] , Leela Chess Zero has played over 2.5 billion games against itself, playing around 1 million games every day, [3] and is capable of play at a level that is comparable with Stockfish, the leading conventional chess program. [4] [5]
The Leela Chess Zero project was first announced on TalkChess.com on January 9, 2018, as an open-source, self-learning chess engine attempting to recreate the success of AlphaZero. [1] [6] [7] 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 due to the size of the deep neural network it uses as its evaluation function.
In December 2018, the AlphaZero team published a paper in Science magazine revealing previously undisclosed details of the architecture and training parameters used for AlphaZero. [8] These changes were soon incorporated into Leela Chess Zero and increased both its strength and training efficiency. [9]
Work on Leela Chess Zero has informed the AobaZero project for shogi. [10]
The engine has been rewritten and carefully iterated upon since its inception, and since 2019 [11] has run on multiple backends, allowing it to run on both CPU and GPU. [12]
The engine can be configured to use different weights, [13] including even different architectures. This same mechanism of substitutable weights can also be used for alternative chess rules, such as for the Fischer Random Chess variant, which was done in 2019. [14]
Like AlphaZero, Leela Chess Zero employs neural networks which output both a policy vector, a distribution over subsequent moves used to guide search, and a position evaluation. These neural networks are designed to run on GPU, unlike traditional engines. It originally used residual neural networks, but in 2022 switched to using a transformer-based architecture designed by Daniel Monroe and Philip Chalmers. [2] These models represent a chessboard as a sequence of 64 tokens and apply a trunk consisting of a stack of Post-LN encoder layers, outputting a sequence of 64 encoded tokens which is used to generate a position evaluation and a distribution over subsequent moves. [2] [15] They use a custom domain-specific position encoding called smolgen to improve the self-attention layer. [15]
As of November 2024, the models used by the engine are significantly larger and more efficient than the residual network used by AlphaZero, reportedly achieving grandmaster-level strength at one position evaluation per move. [2] [16] These models are able to detect and exploit positional features like trapped pieces and fortresses to outmaneuver traditional engines, giving Leela a unique playstyle. [2] There is also evidence that they are able to perform look-ahead. [17]
Like AlphaZero, Leela Chess Zero learns through reinforcement learning, continually training on data generated through self-play. [1] [8] However, unlike AlphaZero, Leela Chess Zero decentralizes its data generation through distributed computing, with volunteers generating self-play data on local hardware which is fed to the reinforcement algorithm. [3] In order to contribute training games, volunteers must download the latest non-release candidate (non-rc) version of the engine and the client. The client connects to the Leela Chess Zero server and iteratively receives the latest neural network version and produces self-play games which are sent back to the server and use to train the network. [18]
In order to run the Leela Chess Zero engine, two components are needed: the engine binary used to perform search, and a network used to evaluate positions. [18] The client, which is used to contribute training data to the project, is not needed for this purpose. Older networks can also be downloaded and used by placing those networks in the folder with the Lc0 binary.
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 neural network as Leela, but has a unique search algorithm for exploring different lines of play, and Stein, a network which was trained using supervised learning on existing game data from games between other engines. While neither of these projects were admitted to TCEC separately due to their similarity to Leela, the combination of Allie's search algorithm with the Stein network, called AllieStein, was deemed unique enough to warrant its inclusion in the competition. (The TCEC rules require that a neural network-based engine has at least two unique components out of three 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.) [19]
In early 2021, the LcZero blog announced Ceres, a transliteration of the engine to C Sharp which introduced several algorithmic improvements. The engine has performed competitively in tournaments, achieving third place in the TCEC Swiss 7 and fourth place in the TCEC Cup 4. In 2024, the CeresTrain framework was announced to support training deep neural networks for chess in PyTorch.
In April 2018, Leela Chess Zero became the first engine using a deep neural network to enter the Top Chess Engine Championship (TCEC), during Season 12 in the lowest division, Division 4. [20] Out of 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. [21] However, it improved quickly. In July 2018, Leela placed seventh out of eight competitors at the 2018 World Computer Chess Championship. [22] In August 2018, it won division 4 of TCEC season 13 with a record of 14 wins, 12 draws, and 2 losses. [21] [23] In Division 3, Leela scored 16/28 points, finishing third behind Ethereal, which scored 22.5/28 points, and Arasan on tiebreak. [24] [21]
By September 2018, Leela had become competitive with the strongest engines in the world. In the 2018 Chess.com Computer Chess Championship (CCCC), [25] Leela placed fifth out of 24 entrants. The top eight engines advanced to round 2, where Leela placed fourth. [26] [27] Leela then won the 30-game match against Komodo to secure third place in the tournament. [28] [29] Leela participated in the "TCEC Cup", an 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. [21]
In October and November 2018, Leela participated in the Chess.com Computer Chess Championship Blitz Battle, finishing third behind Stockfish and Komodo. [30] [31]
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. Leela managed this and therefore met Stockfish in the superfinal. In a back and forth match, first Stockfish and then Leela took three game leads before Stockfish won by the narrow margin of 50.5–49.5. [21]
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. [21] [32] In April 2019, Leela won the Chess.com Computer Chess Championship 7: Blitz Bonanza, becoming the first neural-network project to take the title. [33]
In the season 15 of the Top Chess Engine Championship (May 2019), Leela defended its TCEC Cup title, this time defeating Stockfish with a score of 5.5–4.5 (+2 =7 −1) in the final after Stockfish blundered a seven-man tablebase draw. [34] Leela also won the Superfinal for the first time, scoring 53.5–46.5 (+14 −7 =79) versus Stockfish, including winning as both white and black in the same predetermined opening in games 61 and 62. [35] [36]
Season 16 of TCEC saw Leela finish in third place in premier division, missing qualification for the Superfinal to Stockfish and the new deep neural network engine AllieStein. Leela was the only engine not to suffer any losses in the Premier division, and defeated Stockfish in one of the six games they played. However, Leela only managed to score nine wins, while AllieStein and Stockfish both scored 14 wins. This inability to defeat weaker engines led to Leela finishing third, half a point behind AllieStein and a point behind Stockfish. [37] 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. [38]
In Season 17 of TCEC, held in January–April 2020, Leela regained the championship by defeating Stockfish 52.5–47.5, scoring a remarkable six wins in the final ten games, including winning as both white and black in the same predetermined opening in games 95 and 96. [39] It qualified for the superfinal again in Season 18, but this time was defeated by Stockfish 53.5–46.5. [40] In the TCEC Cup 6 final, Leela lost to AllieStein, finishing second. [41]
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 shallow neural network–based evaluation function used primarily for the leaf nodes of the search tree. Stockfish NNUE defeated Leela convincingly with a final score of 54.5–45.5 (+18 −9 =73). [42] [43] Since then, Leela has repeatedly qualified for the Superfinal, only to lose every time to Stockfish: +14 −8 =78 in Season 20, +19 −7 =74 in Season 21, +27 −10 =63 in Season 23, +20 −16 =64 in Season 24, +27 -23 =50 in Season 25, +31 -17 =52 in Season 26, and +35 -18 =47 in Season 27.
Since the introduction of NNUE to Stockfish, Leela has scored victories at the TCEC Swiss 6 and 7 and the TCEC Cup 11, and is usually a close second behind Stockfish in major tournaments.
Season | Division 4 | Division 3 | Division 2 | Division 1 | Division P | Infrafinal | Superfinal |
---|---|---|---|---|---|---|---|
12 (2018) | 8th | – | – | – | – | – | – |
13 (2018) | 1st | 3rd | – | – | – | – | – |
14 (2018) | – | 1st | 1st | 1st | 2nd | – | 2nd |
15 (2019) | – | – | – | – | 2nd | – | 1st |
16 (2019) | – | – | – | – | 3rd | – | – |
17 (2020) | – | – | – | – | 1st | – | 1st |
18 (2020) | – | – | – | – | 2nd | – | 2nd |
19 (2020) | – | – | – | – | 2nd | – | 2nd |
20 (2020) | – | – | – | – | 1st | – | 2nd |
21 (2021) | – | – | – | – | 2nd | – | 2nd |
22 (2022) | – | – | – | – | 3rd | 3rd | – |
23 (2022) | – | – | – | – | 2nd | – | 2nd |
24 (2023) | – | – | – | – | 2nd | – | 2nd |
25 (2023) | – | – | – | – | 2nd | – | 2nd |
26 (2024) | – | – | – | – | 2nd | – | 2nd |
Event | Result | Opponent | Score |
---|---|---|---|
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 |
Cup 9 (2021) | 2nd | Stockfish | 1.5–2.5 |
Cup 10 (2022) | 2nd | Stockfish | 4–6 |
Cup 11 (2023) | 1st | Stockfish | 8.5–7.5 |
Cup 12 (2023) | 2nd | Stockfish | 13.5–14.5 |
Cup 13 (2024) | 2nd | Stockfish | 12.5–9.5 |
Cup 14 (2024) | 2nd | Stockfish | 18.5-17.5 |
Event | Year | Time Controls | Result | Ref |
---|---|---|---|---|
CCC 1: Rapid Rumble | 2018 | 15+5 | 3rd | [45] |
CCC 2: Blitz Battle | 2018 | 5+2 | 3rd | [46] |
CCC 3: Rapid Redux | 2019 | 30+5 | 2nd | [47] |
CCC 4: Bullet Brawl | 2019 | 1+2 | 2nd | [48] |
CCC 5: Escalation | 2019 | 10+5 | 2nd | [49] |
CCC 6: Winter Classic | 2019 | 10+10 | 2nd | [50] |
CCC 7: Blitz Bonanza | 2019 | 5+2 | 1st | [33] |
CCC 8: Deep Dive | 2019 | 15+5 | 2nd | [5] |
CCC 9: The Gauntlet | 2019 | 5+2, 10+5 | 3rd | [51] |
CCC 10: Double Digits | 2019 | 10+3 | 3rd | [52] |
CCC 11 | 2019 | 30+5 | 1st | [53] |
CCC 12: Bullet Madness! | 2020 | 1+1 | 1st | [54] |
CCC 13: Shapes | 2020 | 3+2, 5+5, 10+5, 15+5 | 1st | [55] [56] |
CCC 14 | 2020 | 15+5 | 1st | [57] |
CCC Blitz 2021 | 2021 | 5+5 | 2nd | [58] |
CCC Chess 960 Blitz | 2021 | 5+5 | 3rd | [59] |
CCC 16: Rapid | 2021 | 15+3 | 2nd | [60] |
CCC 16: Bullet | 2021 | 2+1 | 3rd | [61] |
CCC 16: Blitz | 2022 | 5+5 | 3rd | [62] |
CCC 17: Rapid | 2022 | 15+3 | 3rd | [63] |
CCC 17: Bullet | 2022 | 2+1 | 3rd | [64] |
CCC 17: Blitz | 2022 | 5+5 | 2nd | [65] |
CCC 18: Rapid | 2022 | 15+3 | 2nd | [66] |
CCC 19: Blitz | 2022 | 5+5 | 3rd | [67] |
CCC 19: Rapid | 2022 | 15+3 | 2nd | [68] |
CCC 19: Bullet | 2023 | 1+1 | 3rd | [69] |
CCC 20: Blitz | 2023 | 3+2 | 2nd | [70] |
CCC 20: Rapid | 2023 | 10+3 | 2nd | [71] |
CCC 20: Bullet | 2023 | 1+1 | 4th | [72] |
CCC 21: Blitz | 2023 | 3+2 | 3rd | [73] |
CCC 21: Rapid | 2023 | 10+3 | 2nd | [74] |
CCC 21: Bullet | 2023 | 1+1 | 5th | [75] |
CCC 22: Blitz | 2024 | 3+2 | 3rd | [76] |
CCC 22: Rapid | 2024 | 10+3 | 2nd | [77] |
CCC 22: Bullet | 2024 | 1+1 | 4th | [78] |
CCC 23: Blitz | 2024 | 3+2 | 3rd | [79] |