Skip to content

Commit

Permalink
finished 2.0 testing
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgobbi committed Mar 2, 2023
1 parent 1702a92 commit fb02ea6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "carp"
version = "1.3.0"
version = "2.0.0"
edition = "2021"
authors = ["Andrea Sgobbi"]

Expand Down
11 changes: 2 additions & 9 deletions readme.MD
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,16 @@ enabled, even in complex blitz midgames.

## NNUE

Carp uses a 768->256->1 perspective net trained with MarlinFlow.
Carp uses a 768->(256x2)->1 perspective net trained with MarlinFlow.
It fully relies on its own self-play data for training the network, and a datagen script (for windows, as its
my more capable machine) for fen generation. All utilities for training the network are found in the Scripts
directory.

Carp is temporarily making use of Viridithas's first net to debug inference, kindly handed to me by Viri's
author. Once data generation and net training is completed it will move to its own first net (most likely
much weaker). For this reason, NNUE is currently toggleable, though hundreds of elo stronger compared to
the HCE.
directory. As of Carp 2.0, NNUE has compltely replaced the old HCE.

## Implemented optimizations

* Fully legal move generation with Fixed Shift Black Magic Bitboards
* Fail-Hard Negamax + Quiescence
* Iterative Deepening with Aspiration Windows
* NNUE: (768->256)x2->1
* HCE: PeSTO + various optimizations (doubled/passed/isolated pawns, mobility, king safety)
* Move Ordering:
- MVV-LVA with Static Exchange Evaluation
- Killers
Expand Down
1 change: 0 additions & 1 deletion scripts/carp0000.json

This file was deleted.

24 changes: 12 additions & 12 deletions src/nnue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,18 @@ mod tests {
assert_eq!(s1.current_acc, s2.current_acc);
}

// #[test]
// fn test_nnue_index() {
// let idx1 = nnue_index(Piece::WP, Square::A8);
// let idx2 = nnue_index(Piece::WP, Square::H1);
// let idx3 = nnue_index(Piece::BP, Square::A1);
// let idx4 = nnue_index(Piece::WK, Square::E1);

// assert_eq!(idx1, (21504, 147456));
// assert_eq!(idx2, (2688, 171648));
// assert_eq!(idx3, (147456, 21504));
// assert_eq!(idx4, (124416, 293376));
// }
#[test]
fn test_nnue_index() {
let idx1 = nnue_index(Piece::WP, Square::A8);
let idx2 = nnue_index(Piece::WP, Square::H1);
let idx3 = nnue_index(Piece::BP, Square::A1);
let idx4 = nnue_index(Piece::WK, Square::E1);

assert_eq!(idx1, (14336, 98304));
assert_eq!(idx2, (1792, 114432));
assert_eq!(idx3, (98304, 14336));
assert_eq!(idx4, (82944, 195584));
}

#[test]
fn test_manual_update() {
Expand Down
15 changes: 10 additions & 5 deletions src/nnue/nnue_history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
│ Network │ Params │ SPRT │ Notes │
├──────────┼────────────────────────┼─────────────────────────────────────┼──────────────────────────────────────────────┤
│ carp0000 │ 100M d8 self-play fens │ 518.2 +/- 208.1, LOS: 100.0 % │ First unique network! Completely curshes HCE │
│ │ 768->256->1 arch │ │ SPRT took ~80 games just because it wouldn't │
│ lr=1e-2 wdl=0.1 │ │ lose │
│ │ 256 hidden nodes │ │ SPRT took ~80 games just because it wouldn't │
(CURR) │ lr=1e-2 wdl=0.1 │ │ lose │
│ │ 80 epoch, drop at 30 │ │ │
├──────────┼────────────────────────┼─────────────────────────────────────┼──────────────────────────────────────────────┤
│ carp0001 │ 100M d8 self-play fens │ │ Testing 384-node hidden layers │
│ │ 768->384->1 arch │ │
│ │ lr=1e-2 wdl=0.1 │ │
│ carp0001 │ 100M d8 self-play fens │ -9.2 (lost full output) │ Testing 384-node hidden layers │
│ │ 384 hidden nodes │ │ Data is probably not enough, maybe tweak
│ │ lr=1e-2 wdl=0.1 │ │ params
│ │ 80 epoch, drop at 30 │ │ │
├──────────┼────────────────────────┼─────────────────────────────────────┼──────────────────────────────────────────────┤
│ carp0002 │ │ │ │
│ │ │ │ │
│ │ │ │ │
│ │ │ │ │
└──────────┴────────────────────────┴─────────────────────────────────────┴──────────────────────────────────────────────┘

0 comments on commit fb02ea6

Please sign in to comment.