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
> uciid 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.
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.
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.
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.
Pooled over all time controls: +130 ± 8 Elo (3,800 games). The gain is largest at the shortest time controls and levels off: from 5 s + 0.1 s per game on it is +104 ± 11 Elo (1,600 games).
The two networks inside the same engine, 20,000 nodes per move: +138 ± 11 Elo for the 3.0 network (2,000 games).
The cost of a node is almost the same (1.07 million nodes per second in the depth-12 bench against 1.13 for 2.3), but the search tree is smaller: the bench needs 859,322 nodes instead of 1,051,844 and takes 14 % less time.
In my own round robin against 100 other engines (5 s + 0.1 s, one thread) 3.0 scored 76.0 of 200 games; fitted onto the CCRL Blitz scale that is about 3576 (95 % interval 3552 to 3597). An estimate under my own conditions, not a rating-list result.
Opponent
Time control
Elo
95 % interval
Won
Lost
Drawn
2.3
1+0.01
+192
± 23
379
77
144
2.3
2+0.02
+150
± 23
350
106
144
2.3
3+0.03
+146
± 17
563
166
271
2.3
5+0.1
+105
± 14
475
181
344
2.3
10+0.1
+102
± 22
181
67
152
2.3
20+0.5
+102
± 28
92
35
73
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.
Platform
File
Size
Windows 64-bitCPU with AVX2 and BMI2 (most PCs since 2015). Recommended.
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
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).
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.
Set Hash to the memory you can spare (the default is 256 MB) and Threads to the cores you want to use.
Options include:
Hash, Threads (1 to 8)
MultiPV, Ponder
OwnBook, Experience
Move Overhead
UCI_LimitStrength, UCI_Elo
UCI_Chess960
UCI_ShowWDL, UCI_AnalyseMode
EvalFile, EvalScale
SyzygyPath, SyzygyProbeDepth, Syzygy50MoveRule, SyzygyProbeLimit (new in 3.0)
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.
24,576inputs per side: 12 piece kinds, 64 squares, 32 positions of the own king (mirrored)
1,536numbers per side, kept up to date move by move instead of recomputed
768products per side from the two halves of those numbers; about 90 % are zero
16 → 32 → 1three small layers, one of 8 weight sets chosen by the number of pieces
centipawnsthe score the search uses
Training data. 238 million positions of the Lichess evaluation database (CC0), 2.36 billion positions along the best lines stored with its entries, and 6.6 million positions from Kestrel's own games, all labelled by Stockfish evaluations: about nine times as many as 2.x. The 2.x network overfitted the database positions alone; the positions along the lines removed that limit.
Speed. A network this size costs time, so the evaluation code skips the zero inputs, builds the per-side numbers only for positions that are really evaluated, keeps a refresh cache for king moves and loads the weights ahead of time. Together that made the engine 1.95 times faster than its first version with identical moves and scores.
The network. 39.1 million parameters, trained from scratch in two stages (54 and 8 hours) on the CPU of one laptop, with no GPU. On held-out positions its error is 17 % lower than the 2.3 network's on Lichess positions and 32 % lower on positions from Kestrel's own games.
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.