How Does Chess AI Work?

Posted by:

Chess tests the limits of human thinking, and now artificial intelligence is shaping how the game is played. Since their invention, chess computers have used their abilities in memory, calculation, and evaluation to master the game. Chess AI and neural networks enable these engines to learn and play chess in entirely different ways. This guide breaks down how it works and what it means for the future of chess.

A generated chess set with the pieces in play on the board.
Modern chess engines generate millions of chess positions a second. Credit: Callum Mullin/Unsplash

Computers, Engines, and Chess AI

Chess computers are machines designed to play and analyze chess games. Their software, which can often run on an ordinary laptop, is called a chess engine. Today, engines are built into every aspect of computerized and online chess. They allow us to study games by showing different lines in a position, evaluating which side is better, suggesting the best moves, and integrating databases of openings and past games. We can also play against them. The strongest engines are now effectively unbeatable, even against the best human chess players in the world.

Traditionally, chess has challenged the capabilities of the human mind. Machines matching and then exceeding human players has raised interesting questions about human intelligence and the game itself. The first chess-playing computers appeared in the 1950s. In the 80s and 90s, they developed into massive supercomputers capable of matching the best human players. This came to a head in 1997 in the Deep Blue vs. Garry Kasparov match, in which the world’s best grandmaster faced off against a chess-playing supercomputer and ultimately lost.

A chess position from the match between Garry Kasparov and Deep Blue in 1997.
A position from the match between Kasparov and Deep Blue in 1997. The supercomputer, with white, has the advantage.

When we think of AI today, we think of large language models, chatbots, and easy programming. Its role in chess engines is somewhat different. The following explains the basics of how chess engines work and use machine learning to beat top human players. 

The Camaratta Collection - The Botvinnik Flohr Series Chess Pieces - 4.0" King (opens in a new window)

The Camaratta Collection - The Botvinnik Flohr Series Chess Pieces - 4.0" King

$309.00
Leap Digital Classic Chess Clock (opens in a new window)

Leap Digital Classic Chess Clock

$79.95
US Chess Premium Chess Box (opens in a new window)

US Chess Premium Chess Box

$159.95

How Does Artificial Intelligence Work in Chess?

Chess engines calculate possible moves, evaluate which ones lead to the best outcomes, and draw on databases of previous positions. Precisely how they do this has changed dramatically over the years. One major shift is the development from brute-force calculation to AIs that taught themselves to play chess. 

Traditional Engines vs Neural Networks 

Early chess engines, like Deep Blue, are pure calculating machines. They do not think or evaluate on their own. Instead, they generate vast networks of possible future positions from the current board position. They pick a move and line based on evaluative criteria provided by humans. This changed drastically with the 2017 Neural Network Revolution, which created modern chess AI. 

A neural network is a type of machine learning that models the human brain. It uses artificial versions of neurons and synapses, allowing data to be processed in complex ways. They excel at pattern recognition, problem solving, prediction, visualization, and more. These skills are especially useful for playing chess. Over the last decade, researchers have used these neural networks to train engines through “self-play” and develop more effective, flexible evaluation functions. 

A digitally generated image representing neurons.
A digital representation of neurons. Credit: Bhautik Patel/Unsplash

Famously, this was first done through AlphaZero reinforcement learning, developed by DeepMind. AlphaZero learned to play chess by competing against itself through millions of iterations. It performed extremely well, but even more interestingly, its games looked radically different from those of traditional engines. This self-taught chess program played more like a human. It played with style, more willing to sacrifice pieces for an uncertain positional gain. 

Leela Chess Zero and Stockfish 

These neural networks are incorporated into modern chess engines in quite different ways. Two of the top engines today are Leela Chess Zero (Lc0) and Stockfish. 

Leela was directly inspired by AlphaZero’s reinforcement learning approach. Neural networks are fundamentally how it searches through moves and evaluates positions on its own. Essentially, it follows principles it developed itself. On the other hand, Stockfish maintains a classic alpha-beta search engine. It evaluates 100 million positions per second. Instead of changing the engine's fundamental design, it incorporated neural network evaluation (NNUE) to decide which moves are best. It uses a small, efficient neural network to judge positions instead of relying purely on human-written evaluation rules. This best-of-both-worlds approach seems to be working, as Stockfish is currently the best engine in the world. 

The Modern Series Chess Pieces - 3.75" King (opens in a new window)

The Modern Series Chess Pieces - 3.75" King

$159.00
DGT Pegasus Chess Board (e-Board) - Wireless Bluetooth with USB Charger (opens in a new window)

DGT Pegasus Chess Board (e-Board) - Wireless Bluetooth with USB Charger

$349.00
Bobby Fischer Teaches Chess (opens in a new window)

Bobby Fischer Teaches Chess

$9.95

How do Chess Engines Actually Pick a Move?

Chess AI can sift through and evaluate millions of positions, but how does it make the final decision?

The system can vary somewhat, but generally it involves:

  • Listing all available legal moves
  • Searching through lines (sequences of future positions)
  • Evaluating which line is best through the provided criteria or NNUE
  • Making a final choice based on which sequence leads to the most favorable position

This is the fundamental test of a chess engine. How deeply can it calculate? And how accurately can it evaluate which position is best? Compared to human players, this depth is now extraordinary. Chess engines make moves that, to human observers, can be completely mystifying because they can calculate so far ahead and evaluate with such precision. 

AI Chess Training and Analysis 

The strength, variance, and multifunctionality of chess engines make them incredibly useful for players. The obvious use is, of course, to compete against them. Engines now power human-like chess AI bots with different playing styles and strengths, allowing players to prepare for different types of opponents.

A chess playing robot competes against a human player.
One-on-one competition is just one use of chess engines and computers. Credit: Amos K/Unsplash

However, artificial intelligence in chess training goes far beyond playing against the computer. In fact, its main role is analysis, practice, and database incorporation. Strong chess players have to:

  • Study opening variations in depth
  • Train tactics, vision, and positional thinking
  • Master specific endgame scenarios
  • Statistically analyze the success of certain variations

AI-integrated chess engines make this easier. Through online analysis boards or downloadable programs like Chessbase, players can easily explore massive numbers of variations in a given position. They can also test the depth of their calculation against a machine that can find the best move in any position. Tools like the evaluation bar and centipawn loss measurements, which analyze which side is better to the 100th of a pawn’s value, assist in honing in-game assessment. Endgame tablebases (Syzygy) show exactly how a game will end with precise play when 7 or fewer pieces remain on the board. While human players cannot memorize this massive amount of data, it provides deep insight into endgame calculations. 

The *NEW* Austrian Coffeehouse Series Chess Pieces - 4.0" King (opens in a new window)

The *NEW* Austrian Coffeehouse Series Chess Pieces - 4.0" King

$339.00
DGT 3000 Digital Chess Clock (opens in a new window)

DGT 3000 Digital Chess Clock

$89.95
The Camaratta Signature Championship Chess Table - Dark Brown (opens in a new window)

The Camaratta Signature Championship Chess Table - Dark Brown

$1,195.00

AI provides a myriad of chess training functions. They allow everyone from amateurs to grandmasters to train against challenging opponents and analyze their games accurately, which was never possible before.

Future of AI in Chess 

Chess AI and extremely advanced engines have their downsides. One inevitable consequence of chess computers' supremacy is how easily unscrupulous players can cheat. Finding ways to access engine-provided moves during games is a major concern for tournament hosts. One way to combat this is to use anti-cheating detection algorithms that flag suspicious games and prompt further investigation. Beyond cheating, AI in grandmaster preparation will likely make competitive play more challenging. The best players need not only extraordinary natural skills but also to train, prepare, and analyze with the depth of chess computers. 

Many in the chess world see chess engines and AI as an existential threat to the game. Some question the point of humans competing in a sport computers can dominate. For others, Chess AI deepens the game, allowing for more competitive, higher-level play. Whatever the arguments, more people are playing chess than ever before, both online and in-person. 

It is also not the first time people have worried about the end of chess. As early as the 1920s, José Raúl Capablanca created a chess variant out of fear that grandmaster play would end in “draw death.” In the 90s, Bobby Fischer championed Fischer Random (Freestyle Chess) to escape the reliance on opening theory. Nevertheless, classical chess has prevailed and is still by far the most common form of the game. If I had to guess, I’d say human chess will stick around regardless of how well machines can play it. 


Frequently Asked Questions

Traditional chess engines try to exhaustively search possible lines and use human-coded evaluation to find the best move. Stockfish NNUE and similar engines use neural networks trained on millions of positions to evaluate the board through learned pattern recognition. The result is an engine that both calculates deeply and understands positions more sophisticatedly.