← kavinjain.in Source on GitHub ↗

Chess engine · C++17 · Neural network · Live on Lichess

A chess engine, from an empty file.

I built KavinEngine from scratch at 18: the rules of chess, a search that weighs millions of positions a second, and a neural network that judges each one, trained on cloud GPUs. Measured against eight independent engines, it plays at about 3495 on the CCRL Blitz scale and beats Ethereal and Halogen, two well-known open-source engines.

The board below replays its latest game on Lichess, straight from Lichess, at double speed: watch a captured piece shatter.

3495 ± 11CCRL Blitz scale · 1,536 games
59 %score vs Ethereal 12.75
2463Lichess blitz rating · live
219,192test games, all logged
01. Its latest game, replayed
…–:––
KavinEngine–:––

Loading its latest game from Lichess…

Speed

Lichess ratings

Blitz2463 Rapid2802 provisional

Record on Lichess

74 won15 drawn43 lost

Play it yourself

  1. Make a free Lichess account.
  2. Open @KavinEngine and press Challenge.
  3. Pick any time from 1+0 to 30+20, casual or rated.
  4. If it's mid-game, your challenge waits for the next one.

The server

A 2-core Intel i3 at home, 3 search threads, one game at a time. Opening book and endgame tablebases are added by the bot software, not the engine.

The 3495 is an estimate on CCRL's scale from my own games (60+0.6, one thread, GitHub's Linux machines), not an official CCRL listing. Lichess bot ratings sit on a different, lower scale: the strongest bots there are around 3050.

02. How it thinks
Learns547M positionsPositions from Leela Chess Zero's games, plus the engine's own self-play, teach a neural network on Kaggle GPUs.
JudgesA neural network768 inputs per king position feed 256 neurons per side. It updates move by move instead of starting over, so it's fast enough to run millions of times a second.
SearchesAlpha-betaLooks ahead move by move and skips lines that can't matter: pruning, reductions, a hash table of positions it has seen, and a quiet-position search at the end.
ProvesEvery change, testedA change only merges after thousands of games against the previous version show, statistically, that it's stronger.
03. How strong it is
OpponentTheir CCRL BlitzMy scoreMy performance
Stash 35334573.7 %3524
Stash 37341763.0 %3510
Ethereal 12.75342459.4 %3490
Halogen 11342561.2 %3504
Koivisto 7.0352945.8 %3500
Berserk 8.5357535.2 %3469
Altair 7.0.0357939.1 %3502
Alexandria 6.0.0363027.1 %3458

1,536 games at 60+0.6 against 8 engines from 7 families, each built from its official release and checked by name. Fitted by maximum likelihood with their ratings held fixed: 3495 ± 11 (3449 ± 11 the day before). Every game is in the repository.

04. What made it stronger
ChangeElo, measured
Neural-network evaluation instead of hand-written tables+557
Reverse futility pruning+111
Aspiration windows+71
Network retrained on Leela Chess Zero data+65
Self-play fine-tuning of the network+55
Singular extensions (look deeper when only one move works) · threat-aware move history+57
Futility pruning · exchange evaluation in search+72
King-position network inputs · iterative reductions · correction history+63
Endgame mating technique · smarter time use · exchange pruning+26
Multi-threaded search, 2 threads vs 1 (the Lichess bot)+69

Each change passed a sequential probability ratio test (grouped rows add their separately measured gains): games stop the moment the evidence is strong enough either way. Seven standard techniques that lost Elo here are logged too, in the test log.

05. The research

How big should the network be?

A bigger network judges positions more accurately but runs slower, and a chess engine is racing the clock. I measured both sides: accuracy follows a power law in network width,

loss(N) = 0.00335 + 0.0089 · N−0.278

and on this engine every 1 % of speed is worth about 1 Elo. Together they put the best width on a desktop near 400 neurons: a 512-wide net was more accurate yet lost 16 Elo to 256, because it searched 19 % fewer positions.

Teaching it with stronger teachers

The same positions, relabelled by Stockfish and by a Leela-trained engine, test whether a smarter teacher makes a stronger student. The first run overfit (it saw each position ~26 times), so the comparison is being redone.

Failures stay in the record: training on the "hardest" 25 % of positions picked up label noise and lost 14 Elo to a random 25 %.

The scaling study

06. Known limits
07. Who made it

Kavin Jain, 18, Udaipur, India. I set the goals, made the design and research decisions, and directed every experiment. The code was written with AI assistance (Claude); every claim on this page links to the games or logs behind it.

Built on open work: Leela Chess Zero training data (ODbL), the bullet trainer, fastchess for testing, and PeSTO tables for the first version. No Stockfish or Leela code or networks are inside the engine.