Releases: kelseyde/calvin-chess-engine
5.1.0
Calvin 5.1.0 brings significant improvements in both search and evaluation.
Calvin has a bigger and better neural network, with a hidden layer size of 1024 and 4 king buckets, horizontally mirrored.
In search, the biggest improvement was fixing Calvin's bugged SEE algorithm, which enabled many search and move ordering techniques.
Tests against the previous release suggest a strength increase of 124 elo LTC / 106 elo STC:
Elo | 124.80 +- 7.10 (95%)
Conf | 40.0+0.40s Threads=1 Hash=64MB
Games | N: 4000 W: 1801 L: 423 D: 1776
Penta | [6, 139, 620, 941, 294]
Elo | 105.98 +- 7.84 (95%)
Conf | 8.0+0.08s Threads=1 Hash=8MB
Games | N: 4008 W: 1855 L: 669 D: 1484
Penta | [46, 157, 702, 763, 336]
This puts Calvin's estimated rating somewhere between 3400-3500.
βοΈ Evaluation
- New net, (768x4->1024)x2->1, horizontally mirrored, screlu, 2.7 billion positions (#270)
- Finny tables for faster accumulator refreshes (#270)
π Search
- Improved SEE algorithm (#236)
- PVS SEE quiet pruning (#193)
- PVS SEE noisy pruning (#237)
- Cut-node IIR (#268)
- Use cut-node in TT cutoff condition (#269)
- Use TT hit in NMP condition (#271)
- Stop excluding killers + promos from history bonuses (#252)
- Remove history ageing (#260)
- Don't correct static eval if ttMove != null (#267)
- Tweak aspiration windows (#272)
- Stop doing futility pruning in check (#273)
- Always overwrite TT entry if we have an exact score (#230)
- Don't drop into Q-search when in check (#274)
- Increase LMP depth (#275)
- History bonus if when bestScore > beta + margin (#278)
- Do check extension inside the move loop (#279)
π’ Move ordering
- Use SEE for good/bad noisy move ordering (#238)
- Use negative pawn threshold for SEE move ordering (#239)
- Use capthist score in SEE threshold (#249)
π Bugfix
- Stop excluding killers + promos from history bonuses (#252)
- Include positions before root in repetition detection (#259)
How to run
To run the jar file, you will need to enable the Vector API package which Calvin uses for SIMD, via this command:
java --add-modules jdk.incubator.vector -jar path/to/calvin-chess-engine-5.1.0.jar
For CCRL testers who use ChessGUI, please also download the calvin-wrapper.jar file and place it in the same folder as the calvin jar. When loading Calvin in ChessGUI, pass this file instead of the engine jar. This wrapper allows you to run Calvin without passing in the required JVM args (which ChessGUI does not support).
--
And finally, many thanks to the kind people who have tested Calvin, and to those who have offered their advice and expertise in the chess programming Discord channels!
5.0.2
This is another bugfix release to address some crashes and other issues that arose during testing of 5.0.0 and 5.0.1.
The main bugfix prevents Calvin crashing during very long games, where the number of ply exceeds Calvin's maximum ply of 256. Other fixes are to disable pretty print for tournament runners/GUIs (it is now disabled as soon as receiving a 'uci' command), and finally to always return a random legal move as last resort when encountering a crash.
It also includes some unrelated strength-gaining changes that I merged in the past weeks.
- π Don't increment ply when applying UCI moves (#225)
- π Disable pretty print for tournament runners (#226)
- π Apply futility reductions to 'bad noisies' (#224)
- π Overwrite TT entries where depth >= ttDepth - 4 (#229)
Tests suggest the bugfixes and search patches amount to a gain of 25 elo (LTC):
Score of Calvin DEV vs Calvin: 774 - 485 - 2741 [0.536] 4000
... Calvin DEV playing White: 660 - 47 - 1293 [0.653] 2000
... Calvin DEV playing Black: 114 - 438 - 1448 [0.419] 2000
... White vs Black: 1098 - 161 - 2741 [0.617] 4000
Elo difference: 25.1 +/- 6.0, LOS: 100.0 %, DrawRatio: 68.5 %
Thank you to testers for pointing out these crashes + bugs!
How to run
Calvin is available for download as a Java jar file, or as a standalone Windows executable.
To run the jar file, you will need to enable the Vector API package which Calvin uses for SIMD, via this command:
java --add-modules jdk.incubator.vector -jar path/to/calvin-chess-engine-5.0.1.jar
5.0.1
This is a bugfix release to address some crashes caused by hitting the max search ply limit (256).
As well as a patch for this bug, this release includes a couple of elo-gaining changes that I stumbled across in the last couple of days.
LTC test vs v5.0.0 indicates a strength gain of around 13 elo:
Score of Calvin DEV vs Calvin: 819 - 669 - 2512 [0.519] 4000
Elo difference: 13.0 +/- 6.6, LOS: 100.0 %, DrawRatio: 62.8 %
- π Write to TT in Q-search (#220)
- π Stop extending late moves with a good history score (#219)
- π Reset ply counter to zero after applying UCI moves (#221)
- π In case of engine crash, play random legal move (#222)
How to run
Calvin is available for download as a Java jar file, or as a standalone Windows executable.
To run the jar file, you will need to enable the Vector API package which Calvin uses for SIMD, via this command:
java --add-modules jdk.incubator.vector -jar path/to/calvin-chess-engine-5.0.1.jar
5.0.0
The first major release of Calvin since NNUE brings with it support for FRC (Fischer Random Chess) and DFRC (Double Fischer Random Chess)!
In addition, a new neural network and multiple enhancements to Calvin's search algorithm bring a significant strength increase of around 115 elo (LTC):
Score of Calvin DEV vs Calvin: 1839 - 563 - 1598 [0.659] 4000
Elo difference: 114.8 +/- 8.5, LOS: 100.0 %, DrawRatio: 40.0 %
These results, combined with tests against other engines of similar strength, suggest an estimated rating of around 3400.
βοΈ FRC/DFRC (#217)
FRC, also known as Chess960, follows the same rules as standard chess, except the positions of the pieces on the players' home ranks are randomised, following certain rules:
- The king must still be between the rooks,
- The bishops must still be on squares of opposite colour,
- White and black's pieces must be mirrored.
This leads to 960 possible starting positions, including the standard chess starting position. DFRC drops the last rule, meaning white and black can start with asymmetrical pieces.
FRC is interesting from a standpoint of a human player, since gaining an advantage through opening memorisation is effectively impossible - the player must instead rely entirely on their own creativity and skill over the board. And it's an interesting challenge for a chess programmer, since it requires that the board representation and move generation logic is much more abstract, with dynamic starting positions of the pieces and more fluid castling logic.
FRC/DFRC can be enabled via the UCI_Chess960 option.
βοΈ Evaluation
- New net, 768 hidden layer, screlu, 1.2 billion positions #178
π Search
- Pawn correction history (#74)
- Non-pawn correction history (#163)
- RFP quiet reductions (#209, #213)
- FP quiet reductions (#211, #214)
- TT non-cutoff extension (#172)
- Capthist late move reductions (#180)
- Don't TT cut in PV qsearch nodes (#184)
- NMP eval-based reductions (#190)
- Store staticEval early in TT (#208)
- Don't check TT entry depth in qsearch (#216)
- SPSA tune (#158)
π’ Move ordering
- Increase history bonus if staticEval > alpha (#148)
β‘ Performance
- Compress TT entry (#161)
π¬ Communication
How to run
Calvin is available for download as a Java jar file, or as a standalone Windows executable.
To run the jar file, you will need to enable the Vector API package which Calvin uses for SIMD, via this command:
java --add-modules jdk.incubator.vector -jar path/to/calvin-chess-engine-5.0.0.jar
4.3.0
Calvin 4.3.0 brings significant improvements to Calvin's evaluation function, as well as a grab bag of small gains in search and move ordering.
For evaluation Calvin uses a new neural net, with an increased hidden size of 512, trained on 950 million positions. Calvin also now uses a new activation function, switching from crelu to screlu - which brought a very significant strength jump.
In search, Calvin uses some new pruning techniques, including history pruning, history-based late move reductions, capture late move reductions, and razoring.
Test results from self-play suggest a new elo rating about 100 higher than the previous release:
STC (8+0.08):
Score of Calvin DEV vs Calvin: 655 - 234 - 611 [0.640] 1500
Elo difference: 100.2 +/- 13.7, LOS: 100.0 %, DrawRatio: 40.7 %
LTC (30+0.3):
Score of Calvin DEV vs Calvin: 214 - 57 - 229 [0.657] 500
Elo difference: 112.9 +/- 22.5, LOS: 100.0 %, DrawRatio: 45.8 %
These results, combined with tests against other engines of similar strength, suggest an estimated rating of around 3250 - 3300.
βοΈ Evaluation
- Switch to screlu activation function (#122)
- Increase hidden layer size -> 512 (#138)
- Significant NNUE code refactor (#137)
π Search
- History pruning (#127)
- History reductions (#139)
- Capture late move reductions (#142)
- TT eval correction (#146)
- Razoring (#131)
- SPSA tunes (#144, #145)
π’ Move ordering
- Only update quiet history on fail high (#113)
- Only update capture history on fail high (#114)
- 2-ply continuation history (#104)
β‘ Performance
How to run
Please download one of the jar files from this release. There are two release jars: calvin-chess-engine and calvin-chess-engine-no-simd. The no-simd release is specifically for CCRL testers: since ChessGUI does not support passing Java opts to a jar file, the Vector API which Calvin uses for NNUE must be disabled.
For the standard calvin-chess-engine release, Calvin can be started by running the command:
java --add-modules jdk.incubator.vector -jar path/to/calvin-chess-engine-4.3.0.jar
For the CCRL calvin-chess-engine-no-simd release, the Java opt can be ommited:
java -jar path/to/calvin-chess-engine-no-simd-4.3.0.jar
4.2.0
Calvin 4.2.0 brings a strength increase of around 80 elo, with improvements in a few areas, in particular evaluation and move ordering.
It features a new neural net, with an increased hidden layer size of 384 trained on 470 million positions - as well as eval scaling based on the remaining material on the board. For move ordering, 1-ply conthist has been added, along with a complete re-write of the MovePicker
and HistoryTable
code.
The primary reason for this release though is to fix a bug that was discovered during CCRL matches, where Calvin would hang when sent a negative time by the match runner. This is apparently a common issue, and so I'm joining a long list of devs who have scrambled to fix it π
LTC: Elo difference: 80.6 +/- 23.9
STC: Elo difference: 82.1 +/- 23.4
Estimated strength: 3200
βοΈ Evaluation
- New net: 384 HL size, 470m fens (#108)
- Material eval scaling (#72)
- Optimise NNUE inference / accumulator updates (#73)
π’ Move ordering
- 1-ply conthist (#97)
- Apply malus to all quiets that don't raise alpha (#83)
- Clear ply + 1 killers every node (#80)
π Search
- Use improving heuristic in RFP (#79)
- Add fail-high aspiration depth reduction (#82)
- Use fail-soft in quiescence (#89)
- Tweak LMR (#93)
- Quiescence search futility pruning (#95)
β Time management
- Node TM (#106)
π Bugfix
How to run
Please download one of the jar files from this release. There are two release jars: calvin-chess-engine and calvin-chess-engine-no-simd. The no-simd release is specifically for CCRL testers: since ChessGUI does not support passing Java opts to a jar file, the Vector API which Calvin uses for NNUE must be disabled.
For the standard calvin-chess-engine release, Calvin can be started by running the command:
java --add-modules jdk.incubator.vector -jar path/to/calvin-chess-engine-4.2.0.jar
For the CCRL calvin-chess-engine-no-simd release, the Java opt can be ommited:
java -jar path/to/calvin-chess-engine-no-simd-4.2.0.jar
4.1.0
Calvin 4.1.0
Calvin 4.1.0 brings major improvements to time management and move ordering, many minor enhancements to search, and a very embarrassing bugfix.
Results from self-play suggest a strength jump of around 110-140 elo and an estimated CCRL strength of at least 3100.
STC: Elo difference: 116.8 +/- 20.7
LTC: Elo difference: 140.9 +/- 28.2
π Very embarrassing bugfix
On the one hand I am ashamed. On the other hand, this was the easiest free elo ever.
- Stop searching first PV node with a null window (#69)
β³ Time management
Implemented soft/hard time limits. The soft limit is checked at the start of each ID loop to determine whether a new iteration should be started. This saves a lot of unnecessary time from unfinished searches. The soft limit is also scaled using two heuristics: best move stability and eval stability.
π’ Move ordering
Added a history malus, meaning a penalty, for all quiets that did not fail high. And history bonuses are adjusted by a 'gravity' formula that scales up bonuses when the fail high was unexpected, and scales them down when it was expected.
π Search
Just a bunch of random, tiny tweaks to search, resulting from trying stuff out and getting lucky.
- Don't do IIR in check, and only when TT move is null (#49)
- Move LMP before search extensions (#50)
- Allow RFP at depth 5 (#51)
- Don't expand aspiration window on the side that didn't fail (#52)
- Futility prune before makeMove, allow FP for checks (#53)
- Use best move from partial search (#55)
- Don't TT cut in PV nodes (#57)
- Increase NMP reduction (#63)
- Allow full LMR reduction when in check (#67)
β‘ Minor optimisations
βοΈ Refactoring / Quality of life
- Significantly refactor and improve UCI code (#60)
- Significantly refactor history/killer/move ordering code (#66)
- Add bench (#60)
How to run
Please download one of the jar files from this release. There are two release jars: calvin-chess-engine and calvin-chess-engine-no-simd. The no-simd release is specifically for CCRL testers: since ChessGUI does not support passing Java opts to a jar file, the Vector API which Calvin uses for NNUE must be disabled.
For the standard calvin-chess-engine release, Calvin can be started by running the command:
java --add-modules jdk.incubator.vector -jar path/to/calvin-chess-engine-4.1.0.jar
For the CCRL calvin-chess-engine-no-simd release, the Java opt can be ommited:
java -jar path/to/calvin-chess-engine-no-simd-4.1.0.jar
4.0.2
4.0.1
4.0.0
Calvin 4.0.0 (NNUE)
- βοΈ NNUE (#45)
NNUE finally comes to Calvin!
And brings with it ~400 elo (at least in self-play).
Calvin's hand-crafted evaluation function has been fully removed and replaced with an Efficiently Updated Neural Network (NNUE).
Architecture is (768->256)x2->1. The net was trained on 250 million positions taken from the Leela Chess Zero dataset, that I re-scored using Calvin's own search and HCE. For training I used the excellent bullet NNUE trainer. (I started off by writing my own trainer, but I couldn't get it anywhere near the speed of bullet).
Other minor features include:
- β‘ Minor move generation optimisations (#21)
- β‘ Add age to TT replacement scheme (#23)
- β‘ Add static eval to TT hash entry (#27)
- βοΈ Add training data scorer to re-score Leela data for NNUE training (#44)
- π Extend search 1 ply when entering a pawn endgame (#22)
- π Fix bug where killer ply > max ply (#43)
Score of Calvin DEV vs Calvin: 436 - 19 - 45 [0.917] 500
Elo difference: 417.3 +/- 47.1, LOS: 100.0 %, DrawRatio: 9.0 %
How to run
To run Calvin locally, you will need Java (minimum Java 21) installed on your machine. The binary calvin.jar can be downloaded from the Releases section. Start up Calvin by executing the command:
java --add-modules jdk.incubator.vector -jar calvin.jar
Please note the '--add-modules jdk.incubator.vector' - Calvin uses the incubator Vector API for SIMD operations during NNUE inference, and this module needs to enabled explicitly.