mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Adjust NNUE usage based on number of pawns in position
The idea of this patch is that positions are usually more complex and hard to evaluate even if there are more pawns. This patch adjusts NNUE threshold usage depending on number of pawns in position, if pawn count is <3 we use the classical evaluation more often, for pawn count = 3 patch the is non-functional, with pawn count > 3 NNUE evaluation is used more often. passed STC https://tests.stockfishchess.org/tests/view/5f2f02d09081672066536b1f LLR: 2.96 (-2.94,2.94) {-0.50,1.50} Total: 36520 W: 5011 L: 4823 D: 26686 Ptnml(0-2): 299, 3482, 10548, 3594, 337 passed LTC https://tests.stockfishchess.org/tests/view/5f2f4c329081672066536b5c LLR: 2.98 (-2.94,2.94) {0.25,1.75} Total: 39272 W: 2630 L: 2433 D: 34209 Ptnml(0-2): 53, 2066, 15218, 2229, 70 closes https://github.com/official-stockfish/Stockfish/pull/2960 bench 4084753
This commit is contained in:
parent
cd1bb27dd4
commit
2bfde55429
1 changed files with 2 additions and 2 deletions
|
@ -114,7 +114,7 @@ namespace {
|
|||
constexpr Value LazyThreshold1 = Value(1400);
|
||||
constexpr Value LazyThreshold2 = Value(1300);
|
||||
constexpr Value SpaceThreshold = Value(12222);
|
||||
constexpr Value NNUEThreshold = Value(520);
|
||||
constexpr Value NNUEThreshold = Value(460);
|
||||
|
||||
// KingAttackWeights[PieceType] contains king attack weights by piece type
|
||||
constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 81, 52, 44, 10 };
|
||||
|
@ -945,7 +945,7 @@ Value Eval::evaluate(const Position& pos) {
|
|||
{
|
||||
Value v = eg_value(pos.psq_score());
|
||||
// Take NNUE eval only on balanced positions
|
||||
if (abs(v) < NNUEThreshold)
|
||||
if (abs(v) < NNUEThreshold + 20 * pos.count<PAWN>())
|
||||
return NNUE::evaluate(pos) + Tempo;
|
||||
}
|
||||
return Evaluation<NO_TRACE>(pos).value();
|
||||
|
|
Loading…
Add table
Reference in a new issue