HOME

TheInfoList



OR:

Leela Chess Zero (abbreviated as LCZero, lc0) is a free, open-source
chess engine In computer chess, a chess engine is a computer program that analyzes chess or List of chess variants, chess variant positions, and generates a move or list of moves that it regards as strongest. A chess software engine, engine is usually a Front ...
and
volunteer computing Volunteer computing is a type of distributed computing in which people donate their computers' unused resources to a research-oriented project, and sometimes in exchange for credit points. The fundamental idea behind it is that a modern desktop ...
project based on
Google Google LLC (, ) is an American multinational corporation and technology company focusing on online advertising, search engine technology, cloud computing, computer software, quantum computing, e-commerce, consumer electronics, and artificial ...
's
AlphaZero AlphaZero is a computer program developed by artificial intelligence research company DeepMind to master the games of chess, shogi and Go (game), go. This algorithm uses an approach similar to AlphaGo Zero. On December 5, 2017, the DeepMind ...
engine. It was spearheaded by Gary Linscott, a developer for the Stockfish chess engine, and adapted from the Leela Zero Go engine. 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. It learned how to play chess through
reinforcement learning Reinforcement learning (RL) is an interdisciplinary area of machine learning and optimal control concerned with how an intelligent agent should take actions in a dynamic environment in order to maximize a reward signal. Reinforcement learnin ...
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 In machine learning, supervised learning (SL) is a paradigm where a Statistical model, model is trained using input objects (e.g. a vector of predictor variables) and desired output values (also known as a ''supervisory signal''), which are often ...
on data generated by previous reinforcement learning runs. , Leela Chess Zero has played over 2.5 billion games against itself, playing around 1 million games every day, and is capable of play at a level that is comparable with
Stockfish Stockfish is unsalted fish, especially cod, dried by cold air and wind on wooden racks (which are called "hjell" in Norway) on the foreshore. The drying of food is the world's oldest known preservation method, and dried fish has a storage li ...
, the leading conventional chess program.


History

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 AlphaZero is a computer program developed by artificial intelligence research company DeepMind to master the games of chess, shogi and Go (game), go. This algorithm uses an approach similar to AlphaGo Zero. On December 5, 2017, the DeepMind ...
. Within the first few months of training, Leela Chess Zero had already reached the Grandmaster level, surpassing the strength of early releases of
Rybka Rybka is a computer chess engine designed by International Master Vasik Rajlich. Around 2011, Rybka was one of the top-rated engines on chess engine rating lists and won many computer chess tournaments. After Rybka won four consecutive Wor ...
, Stockfish, and Komodo, despite evaluating orders of magnitude fewer positions due to the size of the
deep neural network Deep learning is a subset of machine learning that focuses on utilizing multilayered neural network (machine learning), neural networks to perform tasks such as Statistical classification, classification, Regression analysis, regression, and re ...
it uses as its
evaluation function An evaluation function, also known as a heuristic evaluation function or static evaluation function, is a function used by game-playing computer programs to estimate the value or goodness of a position (usually at a leaf or terminal node) in a g ...
. In December 2018, the
AlphaZero AlphaZero is a computer program developed by artificial intelligence research company DeepMind to master the games of chess, shogi and Go (game), go. This algorithm uses an approach similar to AlphaGo Zero. On December 5, 2017, the DeepMind ...
team published a paper in ''
Science Science is a systematic discipline that builds and organises knowledge in the form of testable hypotheses and predictions about the universe. Modern science is typically divided into twoor threemajor branches: the natural sciences, which stu ...
'' 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. Work on Leela Chess Zero has informed the AobaZero project for
shogi , also known as Japanese chess, is a Strategy game, strategy board game for two players. It is one of the most popular board games in Japan and is in the same family of games as chess, Western chess, chaturanga, xiangqi, Indian chess, and janggi. ...
. The engine has been rewritten and carefully iterated upon since its inception, and since 2019 has run on multiple backends, allowing it to run on both CPU and GPU. The engine can be configured to use different weights, 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 Chess960, also known as Fischer Random Chess, is a chess variant that randomizes the starting position of the pieces on the back rank. It was introduced by former world chess champion Bobby Fischer in 1996 to reduce the emphasis on opening prep ...
variant, which was done in 2019.


Neural network

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 network A residual neural network (also referred to as a residual network or ResNet) is a deep learning architecture in which the layers learn residual functions with reference to the layer inputs. It was developed in 2015 for image recognition, and won ...
s, but in 2022 switched to using a
transformer In electrical engineering, a transformer is a passive component that transfers electrical energy from one electrical circuit to another circuit, or multiple Electrical network, circuits. A varying current in any coil of the transformer produces ...
-based architecture designed by Daniel Monroe and Philip Chalmers. 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. They use a custom domain-specific position encoding called smolgen to improve the self-attention layer. 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. These models are able to detect and exploit positional features like trapped pieces and fortresses to outmaneuver traditional engines, giving Leela a unique playstyle. There is also evidence that they are able to perform look-ahead.


Program and use

Like AlphaZero, Leela Chess Zero learns through
reinforcement learning Reinforcement learning (RL) is an interdisciplinary area of machine learning and optimal control concerned with how an intelligent agent should take actions in a dynamic environment in order to maximize a reward signal. Reinforcement learnin ...
, continually training on data generated through self-play. 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. 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. 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. 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.


Spinoffs

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 In machine learning, supervised learning (SL) is a paradigm where a Statistical model, model is trained using input objects (e.g. a vector of predictor variables) and desired output values (also known as a ''supervisory signal''), which are often ...
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. In early 2021, the LcZero blog announce
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, th
CeresTrain
framework was announced to support training deep neural networks for chess in
PyTorch PyTorch is a machine learning library based on the Torch library, used for applications such as computer vision and natural language processing, originally developed by Meta AI and now part of the Linux Foundation umbrella. It is one of the mo ...
.


Competition results

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. 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. However, it improved quickly. In July 2018, Leela placed seventh out of eight competitors at the 2018
World Computer Chess Championship World Computer Chess Championship (WCCC) was an event held periodically from 1974 to 2024 where computer chess engines compete against each other. The event is organized by the ''International Computer Games Association'' (ICGA, until 2002 ICCA). I ...
. 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. 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. In October and November 2018, Leela participated in the Chess.com Computer Chess Championship Blitz Battle, finishing third behind Stockfish and Komodo. 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 Erik Weisz (March 24, 1874 – October 31, 1926), known professionally as Harry Houdini ( ), was a Hungarian-American escapologist, illusionist, and stunt performer noted for his escape acts. Houdini first attracted notice in vaudeville in ...
, 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. 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 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. 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. 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. 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, 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. 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 second. 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 An evaluation function, also known as a heuristic evaluation function or static evaluation function, is a function used by game-playing computer programs to estimate the value or goodness of a position (usually at a leaf or terminal node) in a g ...
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). 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.


Results summary


Notable games


Leela vs Stockfish, CCCC bonus games, 1–0
Leela beats the world champion Stockfish engine despite a one-pawn handicap.

Leela completely outplays Stockfish with black pieces in the Trompovsky attack. Leela's eval went from 0.1 to −1.2 in one move, and Stockfish's eval did not go negative until 15 moves later.
Stockfish vs Leela, CCC 21 Rapid Semifinals — Game 163
Leela traps Stockfish's rook, allowing it to win as black.
Stockfish vs Leela, CCC 23 Rapid Finals – Game 189
Leela constructs a fortress as black, allowing it to make a draw out of a lost position. Stockfish was not able to detect the fortress, with its eval staying above +5 for over 100 moves.


Notes


References


External links

*
Leela Chess Zero
on
GitHub GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...

Neural network training clientEngineNeural netsChessprogramming wiki on Leela Chess Zero
{{Chess Chess engines Free and open-source software Volunteer computing projects 2018 software Applied machine learning Software using the GNU General Public License Free software programmed in C++