Skip to content

Commit

Permalink
Lower smallnet threshold with tuned eval params
Browse files Browse the repository at this point in the history
The smallnet threshold is now below the training data range
of the current smallnet (material diff > 1k, nn-baff1edelf90.nnue)
when no pawns are on the board.

Params found with spsa at 93k / 120k games at 60+06:
https://tests.stockfishchess.org/tests/view/664fa166a86388d5e27d7d6b

Tuned on top of: official-stockfish#5287

Passed STC:
https://tests.stockfishchess.org/tests/view/664fc8b7a86388d5e27d8dac
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 64672 W: 16731 L: 16371 D: 31570
Ptnml(0-2): 239, 7463, 16517, 7933, 184

Passed LTC:
https://tests.stockfishchess.org/tests/view/664fd5f9a86388d5e27d8dfe
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 210648 W: 53489 L: 52813 D: 104346
Ptnml(0-2): 102, 23129, 58164, 23849, 80

bench 1717838
  • Loading branch information
linrock committed May 24, 2024
1 parent 94ec125 commit 9c28a5e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int Eval::simple_eval(const Position& pos, Color c) {

bool Eval::use_smallnet(const Position& pos) {
int simpleEval = simple_eval(pos, pos.side_to_move());
return std::abs(simpleEval) > 1018 + 5 * pos.count<PAWN>();
return std::abs(simpleEval) > 992 + 6 * pos.count<PAWN>();
}

// Evaluate is the evaluator for the outer world. It returns a static evaluation
Expand Down Expand Up @@ -74,16 +74,15 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
}

// Blend optimism and eval with nnue complexity
optimism += optimism * nnueComplexity / 512;
nnue -= nnue * (nnueComplexity * 5 / 3) / 32082;
optimism += optimism * nnueComplexity / 470;
nnue -= nnue * (nnueComplexity * 5 / 3) / 32621;

int material = 200 * pos.count<PAWN>()
+ 350 * pos.count<KNIGHT>()
+ 400 * pos.count<BISHOP>()
+ 640 * pos.count<ROOK>()
+ 1200 * pos.count<QUEEN>();
int material = 200 * pos.count<PAWN>() + 350 * pos.count<KNIGHT>() + 400 * pos.count<BISHOP>()
+ 640 * pos.count<ROOK>() + 1200 * pos.count<QUEEN>();

v = (nnue * (34000 + material) + optimism * (4400 + material)) / 36860;
v = (nnue * (34000 + material + 135 * pos.count<PAWN>())
+ optimism * (4400 + material + 99 * pos.count<PAWN>()))
/ 35967;

// Damp down the evaluation linearly when shuffling
v = v * (204 - pos.rule50_count()) / 208;
Expand Down

0 comments on commit 9c28a5e

Please sign in to comment.