Kestrel

UCI chess engine · MIT licence · Made by Claude

Kestrel

A chess engine in one C++17 file. Version 3.0 judges every position with a single 76 MB neural network, trained on far more positions than before, and reads Syzygy tablebases.

For Windows, Linux and macOS; the Linux builds and the Apple Silicon build are run and checked on GitHub Actions.

$ kestrel
> uci
id name Kestrel 3.0
id author Claude
uciok
> position startpos
> go depth 13
info depth 5  score cp 32  nodes 618     time 9    pv d2d4 d7d5 c2c4 g8f6 c4d5
info depth 8  score cp 30  nodes 9491    time 68   pv e2e4 e7e5 g1f3 b8c6 b1c3 g8f6
info depth 11 score cp 21  nodes 31894   time 203  pv g1f3 c7c5 e2e4 b8c6 b1c3 e7e6
info depth 13 score cp 20  nodes 82820   time 514  pv d2d4 d7d5 c2c4 e7e6 b1c3 g8f6
bestmove d2d4

Output of Kestrel 3.0 (Windows build), some fields left out.

88 MB
the Windows exe, network included
39 million
parameters in the network
2.6 billion
training positions (238 M from Lichess, 2.36 B along its best lines, 6.6 M from Kestrel's own games)
8
search threads at most

Three versions

All play standard chess and Chess960 and work in any UCI program, such as Cute Chess, Arena, En Croissant or Lucas Chess.

Latest

Kestrel 3.0

A much stronger network of the same size, trained on about nine times more positions: +130 ± 8 Elo ahead of 2.3 over six time controls (3,800 games). New: Syzygy tablebases, a faster search to the same depth, and a few fixes. Same options as 2.3, plus four for the tablebases.

Choose a file Release notes
Previous

Kestrel 2.3

One large network replaces the two small ones and the hand-written evaluation of 1.1: about 37 Elo ahead of 1.1 over all the time controls tested. 2.3 is 2.0 with two bugs fixed (an overflow in the endgame evaluation, and options declared with wrong defaults) and new default settings: Hash 256 MB, no opening book, no position learning. The search is the same as in 3.0; only the network is older and there are no tablebases.

Downloads for 2.3
Older

Kestrel 1.1

Two small networks blended with a hand-written evaluation. The exe is about 13 MB. It fixes the evaluation of two knights against a bare king and the thread-stack and file-path problems of 1.0 on Linux and macOS.

Downloads for 1.1

How strong is it?

Kestrel 3.0 against Kestrel 2.3, the packaged x86-64-v3 builds, one thread each, 3,800 games over six time controls (base + increment in seconds). A dot is the measured Elo of 3.0, the bar is the 95 % interval; right of zero means 3.0 is stronger.

Elo of Kestrel 3.0 against Kestrel 2.36 results with their 95 percent intervals; the numbers are in the table below.-400+40+80+120+160+200+240+280against Kestrel 2.31+0.01+192 ± 232+0.02+150 ± 233+0.03+146 ± 175+0.1+105 ± 1410+0.1+102 ± 2220+0.5+102 ± 28Elo of 3.0 (95 % interval); right of 0 = 3.0 is stronger
OpponentTime controlElo95 % intervalWonLostDrawn
2.31+0.01+192± 2337977144
2.32+0.02+150± 23350106144
2.33+0.03+146± 17563166271
2.35+0.1+105± 14475181344
2.310+0.1+102± 2218167152
2.320+0.5+102± 28923573

Download 3.0

Unzip and add kestrel.exe (or kestrel) to your chess program. The x86-64-v3 build is the only one with the AVX2 evaluation code; the other builds give the same moves and run about 37 % slower. The exe is large because the network is inside it.

PlatformFileSize
Windows 64-bitCPU with AVX2 and BMI2 (most PCs since 2015). Recommended.Kestrel-3.0-windows-x86-64-v3.zip53 MB
Windows 64-bitCPU with SSE4.2 and POPCNT. About 37 % slower.Kestrel-3.0-windows-x86-64-v2.zip53 MB
Windows 64-bitany CPU. About 37 % slower.Kestrel-3.0-windows-x86-64.zip53 MB
Linux x86-64AVX2 + BMI2Kestrel-3.0-linux-x86-64-v3.tar.gz run on GitHub Actions53 MB
Linux x86-64SSE4.2 + POPCNTKestrel-3.0-linux-x86-64-v2.tar.gz run on GitHub Actions53 MB
Linux x86-64any CPUKestrel-3.0-linux-x86-64.tar.gz run on GitHub Actions53 MB
Linux ARM64Kestrel-3.0-linux-arm64.tar.gz run on GitHub Actions53 MB
macOSIntel MacsKestrel-3.0-macos-x86-64.tar.gz compiled, not run53 MB
macOSApple SiliconKestrel-3.0-macos-arm64.tar.gz run on GitHub Actions53 MB
Network fileonly needed to build from source or to load with EvalFilekestrel_net_3_0.bin76 MB
ChecksumsSHA-256 of every fileSHA256.txt0 MB

The Windows x86-64-v3 build ran all the tests (two audits, a 30-check sanitizer verification, the tablebase test); the other two Windows builds give the same bench. The Linux and macOS files were compiled with Zig; the GitHub Actions workflow runs the published files on GitHub's machines. Version 2.3 files are on the 2.3 release page, version 1.1 files on the 1.1 release page.

Use it

  1. Download a file above and unzip it. Keep claude_book.txt next to the engine and switch OwnBook on if you want the opening book (it is off by default; the book file keeps its old name).
  2. In your chess program, add a new UCI engine and point it at kestrel.exe. In Cute Chess this is Tools, Settings, Engines, the plus button.
  3. Set Hash to the memory you can spare (the default is 256 MB) and Threads to the cores you want to use.

Options include:

Syzygy tablebases: set SyzygyPath to the folder with the .rtbw and .rtbz files. The files with 3, 4 and 5 men were tested (940 MB); larger sets use the same code. Without tablebase files nothing changes. Details: docs/SYZYGY.md.

How it works

The search is a conventional alpha-beta search with a transposition table. The evaluation is one network, in five stages; since 3.0 the search also looks positions up in Syzygy tablebases when it has them.

  1. 24,576inputs per side: 12 piece kinds, 64 squares, 32 positions of the own king (mirrored)
  2. 1,536numbers per side, kept up to date move by move instead of recomputed
  3. 768products per side from the two halves of those numbers; about 90 % are zero
  4. 16 → 32 → 1three small layers, one of 8 weight sets chosen by the number of pieces
  5. centipawnsthe score the search uses

Build it yourself

The source is one file, src/kestrel_3_0.cpp. The 76 MB network is not stored in git: download kestrel_net_3_0.bin from the release, save it as kestrel_net.bin in the folder where you run the compiler, and compile.

g++ -std=c++17 -O3 -march=x86-64-v3 -static -pthread -DNDEBUG -o kestrel.exe src/kestrel_3_0.cpp

Other CPUs and operating systems: docs/BUILDING.md.