lichess.org
Donate

7-piece Syzygy tablebases are complete

Use the world's first free 7-piece tablebase on Lichess!

Congratulations to Bojun Guo (aka noobpwnftw) and Ronald de Man (aka syzygy) for completing the first free 7-piece tablebase and generously sharing it with the world! Lichess now provides online access on the analysis board and in studies, practice against tablebases, a public API and a mirror for downloading the full tablebase files.

How to use tablebases on Lichess?

In endgame positions the opening explorer is replaced by a tablebase explorer. During analysis, click the book icon on the right side of the board to open it. It will show objective evaluations for every move in the position, giving you the best lines.

Tablebases are also used in applicable lessons and when practising against the computer.

Can you finish this endgame as precisely as the World Champion?

What is DTZ?

DTZ means distance to zeroing of the counter for the 50-move drawing rule. Syzygy tablebases do not aim for the fastest way to mate, but rather for the fastest way to make a winning capture or pawn move or give mate. This can be a bit unintuitive, but it allows perfect play (with regard to outcome) even under the 50-move rule.

What did it take to generate the tables?

Bojun Guo (also one of the top contributors of computing power for Stockfish testing) started generating the first tables in May, expertly managing two machines, one of them with 384 threads (8x Intel Xeon Platinum 8168) and more than 1 TB of RAM (later distributed differently).

Effectively using a huge number of threads is difficult. You can read up on the technical discussion here and here. Half-way into the process, Ronald de Man (the original author of the Syzygy tablebase generator) managed to significantly speed up generation of pawnless tables by making it NUMA-aware. He also fixed any other issues that occured while generating 7-piece tables.

The project was completed today, after exactly 5 months.

What is the longest 7-piece endgame?

In this position (already discovered 2012 by the Lomonosov team) Black can hold on for 1034 half-moves until White manages to make a winning capture.

https://lichess.org/study/NsJ0EYNk/vbO6wJNr

This requires a small extension to the Syzygy table format: With 6-piece endgames 8 bits were sufficient for the largest entry in the DTZ map. Now wider DTZ values are required.

Surprisingly this extension is even required for endgames with pawns. Here it takes 656 half-moves to arrange a winning pawn advance.

https://lichess.org/study/NsJ0EYNk/y8kkYRmP

There is also a list of longest endgames with basic stats for each material configuration.

How large is the tablebase?

The number of unique legal 7-piece positions is 423,836,835,667,331. Syzygy tablebases store all their information in 18.4 TB, so at around 0.35 bits per position. This is much more compact than the proprietary 100 TB Lomonosov tablebases.

How to use Syzygy tablebases offline with Stockfish?

The tablebase comes in seperate tables, 2 files per material configuration.

WDL tables (*.rtbw) store the outcome of positions, e.g. if a position is winning. An engine will use this very frequently to decide which endgames to aim for. WDL tables should be stored on the fastest disk (preferably SSD) you have.

DTZ tables (*.rtbz) tell the engine how to finish the endgame once it is on the board. They are optional, but required to reliably convert complicated endings.

First check how much disk space you have or you want to use.

PiecesEndgamesWDLDTZTotal
3-5145378.1 MiB560.9 MiB939.0 MiB
636567.8 GiB81.4 GiB149.2 GiB
710018.5 TiB8.3 TiB16.7 TiB

Then download the tables from one of the mirrors.

Finally set the SyzygyPath option in Stockfish. You can separate multiple paths with ; on Windows or : on Unix-based systems. Currently the development version of Stockfish is required for 7-piece tablebase support.

How to use Syzygy tablebases programmatically?

As a developer you may be interested in probing tablebases via a public HTTP API (feel free to suggest improvements), in C with the original probing code or a library (currently 6 piece only), in C++ by adjusting Stockfish, in Python or in Rust.

Why generate tables for 6v1 endgames?

While the outcome of such positions is rather obvious the exact distribution of the DTZ values may still be of theoretical interest. These tables were also a good warm up: Relatively fast to generate, no need for wide DTZ values, and making up only 1% of the entire set (trivial endgames compress very well). Finally, since Lomonosov skipped these endgames, and while we are splitting hairs, this makes Syzygy the first truly complete 7-piece tablebase.

Lichess is a charity and entirely free/libre open source software.
All operating costs, development, and content are funded solely by user donations.