]> git.sesse.net Git - stockfish/log
stockfish
5 months agoSimplify ClippedReLU
cj5716 [Fri, 17 May 2024 10:05:12 +0000 (18:05 +0800)]
Simplify ClippedReLU

Removes some max calls

Some speedup stats, courtesy of @AndyGrant (albeit measured in an alternate implementation)
Dev  749240 nps
Base 748495 nps
Gain 0.100%
289936 games

STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 203040 W: 52213 L: 52179 D: 98648
Ptnml(0-2): 480, 20722, 59139, 20642, 537
https://tests.stockfishchess.org/tests/view/664805fe6dcff0d1d6b05f2c

closes #5261

No functional change

5 months agoRevert "Simplify Away Quadruple Extensions"
Viren6 [Sun, 19 May 2024 00:40:29 +0000 (01:40 +0100)]
Revert "Simplify Away Quadruple Extensions"

This reverts commit 4edd1a3

The unusual result of (combined) +12.0 +- 3.7 in the 2 VVLTC simplification SPRTs ran was the result of base having only 64MB of hash instead of 512MB (Asymmetric hash).
Vizvezdenec was the one to notice this.

closes https://github.com/official-stockfish/Stockfish/pull/5265

bench 1404295

Co-Authored-By: Michael Chaly <26898827+Vizvezdenec@users.noreply.github.com>
5 months agoVVLTC search tune
Muzhen Gaming [Sat, 18 May 2024 14:15:41 +0000 (22:15 +0800)]
VVLTC search tune

Tuned with 85k games at VVLTC.

VVLTC 1st sprt: https://tests.stockfishchess.org/tests/view/6648b836308cceea45533ad7
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 14880 W: 3890 L: 3652 D: 7338
Ptnml(0-2): 0, 1255, 4694, 1489, 2

VVLTC 2nd sprt: https://tests.stockfishchess.org/tests/view/6648c34f308cceea45533b4f
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 24984 W: 6502 L: 6235 D: 12247
Ptnml(0-2): 1, 2178, 7867, 2445, 1

closes https://github.com/official-stockfish/Stockfish/pull/5264

Bench: 1198142

5 months agoSimplify away adjustEval lambda
Linmiao Xu [Sat, 18 May 2024 01:38:38 +0000 (21:38 -0400)]
Simplify away adjustEval lambda

Now that only the shuffling constant differs between nets,
a lambda for adjusting eval is no longer needed.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/664806ca6dcff0d1d6b05f34
LLR: 2.99 (-2.94,2.94) <-1.75,0.25>
Total: 31552 W: 8175 L: 7959 D: 15418
Ptnml(0-2): 76, 3180, 9065, 3362, 93

closes https://github.com/official-stockfish/Stockfish/pull/5260

No functional change

5 months agoSimplify Away Quadruple Extensions
Shawn Xu [Sat, 18 May 2024 00:45:09 +0000 (17:45 -0700)]
Simplify Away Quadruple Extensions

serendipitous gainer

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 95472 W: 24176 L: 24031 D: 47265
Ptnml(0-2): 52, 10533, 26414, 10692, 45
https://tests.stockfishchess.org/tests/live_elo/6647fa596dcff0d1d6b05efa

Passed VVLTC 70+7 th 7:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 6772 W: 1793 L: 1583 D: 3396
Ptnml(0-2): 0, 502, 2172, 712, 0
https://tests.stockfishchess.org/tests/live_elo/6648277a6dcff0d1d6b05ffb

Passed VVLTC 70+7 th 7 (2x):
https://tests.stockfishchess.org/tests/view/66484c896dcff0d1d6b0619d
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 5424 W: 1469 L: 1254 D: 2701
Ptnml(0-2): 0, 394, 1710, 607, 1

closes https://github.com/official-stockfish/Stockfish/pull/5259

Bench: 1441794

5 months agoUse one nnue pawn count multiplier
Linmiao Xu [Fri, 17 May 2024 23:27:20 +0000 (19:27 -0400)]
Use one nnue pawn count multiplier

Switch to the value used by the main net.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/6647e8096dcff0d1d6b05e96
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 51040 W: 13249 L: 13044 D: 24747
Ptnml(0-2): 139, 6029, 13016, 6160, 176

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/6647f4a46dcff0d1d6b05eea
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 20460 W: 5195 L: 4972 D: 10293
Ptnml(0-2): 8, 2178, 5637, 2397, 10

https://github.com/official-stockfish/Stockfish/pull/5258

bench 1887462

5 months agoTweak NMP Formula
Shawn Xu [Thu, 16 May 2024 05:26:15 +0000 (22:26 -0700)]
Tweak NMP Formula

Passed STC:
LLR: 2.99 (-2.94,2.94) <0.00,2.00>
Total: 241728 W: 62440 L: 61811 D: 117477
Ptnml(0-2): 914, 28467, 61458, 29126, 899
https://tests.stockfishchess.org/tests/live_elo/6645992993ce6da3e93b5b99

Passed LTC:
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 167850 W: 42620 L: 42030 D: 83200
Ptnml(0-2): 82, 18412, 46354, 18988, 89
https://tests.stockfishchess.org/tests/live_elo/6647c5726dcff0d1d6b05dd3

closes https://github.com/official-stockfish/Stockfish/pull/5257

Bench: 1636018

5 months agoEarly Exit in Bitboards::sliding_attack()
FauziAkram [Fri, 17 May 2024 22:22:41 +0000 (01:22 +0300)]
Early Exit in Bitboards::sliding_attack()

he original code checks for occupancy within the loop condition. By moving this check inside the loop and adding an early exit condition, we can avoid unnecessary iterations if a blocking piece is encountered.

Passed stc:
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 127200 W: 33129 L: 32700 D: 61371
Ptnml(0-2): 424, 13243, 35826, 13694, 413
https://tests.stockfishchess.org/tests/view/664646006dcff0d1d6b05bca

closes https://github.com/official-stockfish/Stockfish/pull/5256

No functional change

5 months agoMove smallnet threshold logic into a function
Linmiao Xu [Thu, 16 May 2024 05:48:56 +0000 (01:48 -0400)]
Move smallnet threshold logic into a function

Now that the smallnet threshold is no longer a constant,
use a function to organize it with other eval code.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/66459fa093ce6da3e93b5ba2
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 217600 W: 56281 L: 56260 D: 105059
Ptnml(0-2): 756, 23787, 59729, 23736, 792

closes https://github.com/official-stockfish/Stockfish/pull/5255

No functional change

5 months agoUpdate default main net to nn-c721dfca8cd3.nnue
Linmiao Xu [Wed, 15 May 2024 23:26:48 +0000 (19:26 -0400)]
Update default main net to nn-c721dfca8cd3.nnue

Created by first retraining the spsa-tuned main net `nn-ae6a388e4a1a.nnue` with:
- using v6-dd data without bestmove captures removed
- addition of T80 mar2024 data
- increasing loss by 20% when Q is too high
- torch.compile changes for marginal training speed gains

And then SPSA tuning weights of epoch 899 following methods described in:
https://github.com/official-stockfish/Stockfish/pull/5149

This net was reached at 92k out of 120k steps in this 70+0.7 th 7 SPSA tuning run:
https://tests.stockfishchess.org/tests/view/66413b7df9f4e8fc783c9bbb
Thanks to @Viren6 for suggesting usage of:
- c value 4 for the weights
- c value 128 for the biases

Scripts for automating applying fishtest spsa params to exporting tuned .nnue are in:
https://github.com/linrock/nnue-tools/tree/master/spsa

Before spsa tuning, epoch 899 was nn-f85738aefa84.nnue
https://tests.stockfishchess.org/tests/view/663e5c893a2f9702074bc167

After initially training with max-epoch 800, training was resumed with max-epoch 1000.

```
experiment-name: 3072--S11--more-data-v6-dd-t80-mar2024--see-ge0-20p-more-loss-high-q-sk28-l8
nnue-pytorch-branch: linrock/nnue-pytorch/3072-r21-skip-more-wdl-see-ge0-20p-more-loss-high-q-torch-compile-more

start-from-engine-test-net: False
start-from-model: /data/config/apr2024-3072/nn-ae6a388e4a1a.nnue

early-fen-skipping: 28
training-dataset:
  /data/S11-mar2024/:
    - leela96.v2.min.binpack

    - test60-2021-11-12-novdec-12tb7p.v6-dd.min.binpack
    - test78-2022-01-to-05-jantomay-16tb7p.v6-dd.min.binpack

    - test80-2022-06-jun-16tb7p.v6-dd.min.binpack

    - test80-2022-08-aug-16tb7p.v6-dd.min.binpack
    - test80-2022-09-sep-16tb7p.v6-dd.min.binpack

    - test80-2023-01-jan-16tb7p.v6-sk20.min.binpack
    - test80-2023-02-feb-16tb7p.v6-sk20.min.binpack
    - test80-2023-03-mar-2tb7p.v6-sk16.min.binpack
    - test80-2023-04-apr-2tb7p.v6-sk16.min.binpack
    - test80-2023-05-may-2tb7p.v6.min.binpack

    # https://github.com/official-stockfish/Stockfish/pull/4782
    - test80-2023-06-jun-2tb7p.binpack
    - test80-2023-07-jul-2tb7p.binpack

    # https://github.com/official-stockfish/Stockfish/pull/4972
    - test80-2023-08-aug-2tb7p.v6.min.binpack
    - test80-2023-09-sep-2tb7p.binpack
    - test80-2023-10-oct-2tb7p.binpack

    # S9 new data: https://github.com/official-stockfish/Stockfish/pull/5056
    - test80-2023-11-nov-2tb7p.binpack
    - test80-2023-12-dec-2tb7p.binpack

    # S10 new data: https://github.com/official-stockfish/Stockfish/pull/5149
    - test80-2024-01-jan-2tb7p.binpack
    - test80-2024-02-feb-2tb7p.binpack

    # S11 new data
    - test80-2024-03-mar-2tb7p.binpack

  /data/filt-v6-dd/:
    - test77-dec2021-16tb7p-filter-v6-dd.binpack
    - test78-juntosep2022-16tb7p-filter-v6-dd.binpack
    - test79-apr2022-16tb7p-filter-v6-dd.binpack
    - test79-may2022-16tb7p-filter-v6-dd.binpack
    - test80-jul2022-16tb7p-filter-v6-dd.binpack
    - test80-oct2022-16tb7p-filter-v6-dd.binpack
    - test80-nov2022-16tb7p-filter-v6-dd.binpack

num-epochs: 1000

lr: 4.375e-4
gamma: 0.995
start-lambda: 0.8
end-lambda: 0.7
```

Training data can be found at:
https://robotmoon.com/nnue-training-data/

Local elo at 25k nodes per move:
nn-epoch899.nnue : 4.6 +/- 1.4

Passed STC:
https://tests.stockfishchess.org/tests/view/6645454893ce6da3e93b31ae
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 95232 W: 24598 L: 24194 D: 46440
Ptnml(0-2): 294, 11215, 24180, 11647, 280

Passed LTC:
https://tests.stockfishchess.org/tests/view/6645522d93ce6da3e93b31df
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 320544 W: 81432 L: 80524 D: 158588
Ptnml(0-2): 164, 35659, 87696, 36611, 142

closes https://github.com/official-stockfish/Stockfish/pull/5254

bench 1995552

5 months agoImprove comment
Rak Laptudirm [Wed, 15 May 2024 16:56:12 +0000 (22:26 +0530)]
Improve comment

closes https://github.com/official-stockfish/Stockfish/pull/5249

No functional change

5 months agoLower smallnet threshold linearly as pawn count decreases
Linmiao Xu [Wed, 15 May 2024 17:22:46 +0000 (13:22 -0400)]
Lower smallnet threshold linearly as pawn count decreases

Passed STC:
https://tests.stockfishchess.org/tests/view/6644f677324e96f42f89d894
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 377920 W: 97135 L: 96322 D: 184463
Ptnml(0-2): 1044, 44259, 97588, 44978, 1091

Passed LTC:
https://tests.stockfishchess.org/tests/view/664548af93ce6da3e93b31b3
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 169056 W: 42901 L: 42312 D: 83843
Ptnml(0-2): 58, 18538, 46753, 19115, 64

closes https://github.com/official-stockfish/Stockfish/pull/5252

Bench: 1991750

5 months agoRevert "Reduce more when improving and ttvalue is lower than alpha"
Muzhen Gaming [Wed, 15 May 2024 14:32:55 +0000 (22:32 +0800)]
Revert "Reduce more when improving and ttvalue is lower than alpha"

The patch regressed significantly at longer time controls.

Passed VLTC:
https://tests.stockfishchess.org/tests/view/6644c7a2bc537f5619453096
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 43336 W: 11177 L: 10884 D: 21275
Ptnml(0-2): 3, 4432, 12507, 4721, 5

Passed VVLTC:
https://tests.stockfishchess.org/tests/view/66450c974aa4fa9a83b6d0b0
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 32394 W: 8350 L: 8072 D: 15972
Ptnml(0-2): 2, 2798, 10317, 3080, 0

closes https://github.com/official-stockfish/Stockfish/pull/5251

Bench: 1594188

5 months agoUse same nnue divisor for both nets
Linmiao Xu [Tue, 14 May 2024 20:51:02 +0000 (16:51 -0400)]
Use same nnue divisor for both nets

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/6643ceeabc537f56194506f6
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 224800 W: 57910 L: 57896 D: 108994
Ptnml(0-2): 673, 26790, 57519, 26686, 732

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/6643ff15bc537f5619451719
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 347658 W: 87574 L: 87688 D: 172396
Ptnml(0-2): 207, 39004, 95488, 38956, 174

closes https://github.com/official-stockfish/Stockfish/pull/5250

Bench: 1804704

5 months agoSimplifying improving and worsening deduction formulas
FauziAkram [Wed, 15 May 2024 11:22:36 +0000 (14:22 +0300)]
Simplifying improving and worsening deduction formulas

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 77696 W: 20052 L: 19878 D: 37766
Ptnml(0-2): 222, 9124, 19994, 9274, 234
https://tests.stockfishchess.org/tests/view/66440032bc537f561945171e

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 234414 W: 58874 L: 58871 D: 116669
Ptnml(0-2): 96, 26147, 64742, 26102, 120
https://tests.stockfishchess.org/tests/view/6644094cbc537f5619451735

closes https://github.com/official-stockfish/Stockfish/pull/5248

Bench: 1336738

5 months agoUse same eval divisor for both nets
Linmiao Xu [Mon, 13 May 2024 22:06:38 +0000 (18:06 -0400)]
Use same eval divisor for both nets

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/66428f146577e9d2c8a29cf8
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 241024 W: 62173 L: 62177 D: 116674
Ptnml(0-2): 904, 28648, 61407, 28654, 899

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/6643ae6f1f32a966da74977b
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 193710 W: 48762 L: 48717 D: 96231
Ptnml(0-2): 70, 21599, 53481, 21626, 79

closes https://github.com/official-stockfish/Stockfish/pull/5246

Bench: 1700680

5 months agoReduce more when improving and ttvalue is lower than alpha
Stefan Geschwentner [Wed, 15 May 2024 02:10:58 +0000 (04:10 +0200)]
Reduce more when improving and ttvalue is lower than alpha

More reduction if position is improving but value from TT doesn't
exceeds alpha but the tt move is excluded.

This idea is based on following LMR condition tuning
https://tests.stockfishchess.org/tests/view/66423a1bf9f4e8fc783cba37
by using only three of the four largest terms P[3], P[18] and P[12].

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 27840 W: 7309 L: 7004 D: 13527
Ptnml(0-2): 85, 3219, 7018, 3502, 96
https://tests.stockfishchess.org/tests/view/6643dc1cbc537f56194508ba

Passed LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 191280 W: 48656 L: 48020 D: 94604
Ptnml(0-2): 78, 20979, 52903, 21589, 91
https://tests.stockfishchess.org/tests/view/6643e543bc537f5619451683

closes https://github.com/official-stockfish/Stockfish/pull/5245

Bench: 1430835

5 months agoCall adjustEval with correct parameters after rescore
mstembera [Mon, 13 May 2024 22:28:48 +0000 (15:28 -0700)]
Call adjustEval with correct parameters after rescore

Set smallNet to false after rescoring so we call adjustEval() w/ correct
parameters.

STC:
https://tests.stockfishchess.org/tests/view/664308687134c82f3f7a4003
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 146912 W: 37856 L: 37756 D: 71300
Ptnml(0-2): 566, 17562, 37122, 17618, 588

LTC:
https://tests.stockfishchess.org/tests/view/6643a0821f32a966da7485d6
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 390414 W: 98015 L: 98173 D: 194226
Ptnml(0-2): 162, 43555, 107929, 43401, 160

closes https://github.com/official-stockfish/Stockfish/pull/5244

Bench: 1819318

5 months agoAdd extra bonus to pawn history for a move that caused a fail low
Michael Chaly [Tue, 14 May 2024 17:10:01 +0000 (20:10 +0300)]
Add extra bonus to pawn history for a move that caused a fail low

Basically the same idea as it is for continuation/main history, but it
has some tweaks.
1) it has * 2 multiplier for bonus instead of full/half bonus - for
   whatever reason this seems to work better;
2) attempts with this type of big bonuses scaled somewhat poorly (or
   were unlucky at longer time controls), but after measuring the fact
   that average value of pawn history in LMR after adding this bonuses
   increased by substantial number (for multiplier 1,5 it increased by
   smth like 400~ from 8192 cap) attempts were made to make default pawn
   history negative to compensate it - and version with multiplier 2 and
   initial fill value -900 passed.

Passed STC:
https://tests.stockfishchess.org/tests/view/66424815f9f4e8fc783cba59
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 115008 W: 30001 L: 29564 D: 55443
Ptnml(0-2): 432, 13629, 28903, 14150, 390

Passed LTC:
https://tests.stockfishchess.org/tests/view/6642f5437134c82f3f7a3ffa
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 56448 W: 14432 L: 14067 D: 27949
Ptnml(0-2): 36, 6268, 15254, 6627, 39

Bench: 1857237

5 months agoAdd extra bonus for high-depth condition
FauziAkram [Mon, 13 May 2024 11:08:19 +0000 (14:08 +0300)]
Add extra bonus for high-depth condition

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 54208 W: 14058 L: 13717 D: 26433
Ptnml(0-2): 166, 6277, 13885, 6602, 174
https://tests.stockfishchess.org/tests/view/664136d8f9f4e8fc783c9b82

Passed LTC:
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 112548 W: 28492 L: 28018 D: 56038
Ptnml(0-2): 53, 12186, 31318, 12668, 49
https://tests.stockfishchess.org/tests/view/664143fef9f4e8fc783c9bf6

closes https://github.com/official-stockfish/Stockfish/pull/5242

Bench: 1725980

5 months agoUse 5% less time on first move
xoto10 [Mon, 13 May 2024 06:19:18 +0000 (07:19 +0100)]
Use 5% less time on first move

Stockfish appears to take too much time on the first move of a game and
then not enough on moves 2,3,4... Probably caused by most of the factors
that increase time usually applying on the first move.

Attempts to give more time to the subsequent moves have not worked so
far, but this change to simply reduce first move time by 5% worked.

STC 10+0.1 :
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 78496 W: 20516 L: 20135 D: 37845
Ptnml(0-2): 340, 8859, 20456, 9266, 327
https://tests.stockfishchess.org/tests/view/663d47bf507ebe1c0e9200ba

LTC 60+0.6 :
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 94872 W: 24179 L: 23751 D: 46942
Ptnml(0-2): 61, 9743, 27405, 10161, 66
https://tests.stockfishchess.org/tests/view/663e779cbb28828150dd9089

closes https://github.com/official-stockfish/Stockfish/pull/5235

Bench: 1876282

5 months agoOptimize update_accumulator_refresh_cache()
mstembera [Sun, 12 May 2024 11:45:01 +0000 (04:45 -0700)]
Optimize update_accumulator_refresh_cache()

STC https://tests.stockfishchess.org/tests/view/664105df26ac5f9b286d30e6
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 178528 W: 46235 L: 45750 D: 86543
Ptnml(0-2): 505, 17792, 52142, 18363, 462

Combo of two yellow speedups
https://tests.stockfishchess.org/tests/view/6640abf9d163897c63214f5c
LLR: -2.93 (-2.94,2.94) <0.00,2.00>
Total: 355744 W: 91714 L: 91470 D: 172560
Ptnml(0-2): 913, 36233, 103384, 36381, 961

https://tests.stockfishchess.org/tests/view/6628ce073fe04ce4cefc739c
LLR: -2.93 (-2.94,2.94) <0.00,2.00>
Total: 627040 W: 162001 L: 161339 D: 303700
Ptnml(0-2): 2268, 72379, 163532, 73105, 2236

closes https://github.com/official-stockfish/Stockfish/pull/5239

No functional change

5 months agoRe-evaluate some small net positions for more accurate evals
Linmiao Xu [Thu, 9 May 2024 18:03:35 +0000 (14:03 -0400)]
Re-evaluate some small net positions for more accurate evals

Use main net evals when small net evals hint that higher eval
accuracy may be worth the slower eval speeds. With Finny caches,
re-evals with the main net are less expensive than before.

Original idea by mstembera who I've added as co-author to this PR.

Based on reEval tests by mstembera:
https://tests.stockfishchess.org/tests/view/65e69187b6345c1b934866e5
https://tests.stockfishchess.org/tests/view/65e863aa0ec64f0526c3e991

A few variants of this patch also passed LTC:
https://tests.stockfishchess.org/tests/view/663d2108507ebe1c0e91f407
https://tests.stockfishchess.org/tests/view/663e388c3a2f9702074bc152

Passed STC:
https://tests.stockfishchess.org/tests/view/663dadbd1a61d6377f190e2c
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 92320 W: 23941 L: 23531 D: 44848
Ptnml(0-2): 430, 10993, 22931, 11349, 457

Passed LTC:
https://tests.stockfishchess.org/tests/view/663ef48b2948bf9aa698690c
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 98934 W: 24907 L: 24457 D: 49570
Ptnml(0-2): 48, 10952, 27027, 11382, 58

closes https://github.com/official-stockfish/Stockfish/pull/5238

bench 1876282

Co-Authored-By: mstembera <5421953+mstembera@users.noreply.github.com>
5 months agoSimplify npm constants when adjusting eval
Linmiao Xu [Thu, 9 May 2024 17:47:00 +0000 (13:47 -0400)]
Simplify npm constants when adjusting eval

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/663d0c4f507ebe1c0e91ec8d
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 162784 W: 41987 L: 41906 D: 78891
Ptnml(0-2): 520, 19338, 41591, 19427, 516

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/663d20fd507ebe1c0e91f405
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 457242 W: 115022 L: 115250 D: 226970
Ptnml(0-2): 271, 51566, 125179, 51330, 275

closes https://github.com/official-stockfish/Stockfish/pull/5237

Bench: 2238216

5 months agoAdjust standpat return value in qsearch
Michael Chaly [Thu, 9 May 2024 18:10:24 +0000 (21:10 +0300)]
Adjust standpat return value in qsearch

Instead of returning value itself return value between it and beta for non pv nodes - analogous to what we do after actual search there.

Passed STC:
https://tests.stockfishchess.org/tests/view/663cb1b4c0b75d7f7b98188e
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 131552 W: 34131 L: 33673 D: 63748
Ptnml(0-2): 420, 15446, 33600, 15876, 434

Passed LTC:
https://tests.stockfishchess.org/tests/view/663cda5dc0b75d7f7b981c6f
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 282798 W: 71658 L: 70833 D: 140307
Ptnml(0-2): 112, 31187, 77979, 32006, 115

closes https://github.com/official-stockfish/Stockfish/pull/5233

Bench: 1606672

5 months agoVVLTC search tune
Muzhen Gaming [Sun, 12 May 2024 09:49:30 +0000 (17:49 +0800)]
VVLTC search tune

Tuned at 111k games of VVLTC.

Passed VVLTC 1st sprt: https://tests.stockfishchess.org/tests/view/664090c6d163897c63214324
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 83046 W: 21071 L: 20747 D: 41228
Ptnml(0-2): 2, 7574, 26048, 7896, 3

Passed VVLTC 2nd sprt: https://tests.stockfishchess.org/tests/view/6640cb2abaa6260a5688dc17
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 68630 W: 17620 L: 17270 D: 33740
Ptnml(0-2): 4, 6242, 21471, 6596, 2

closes https://github.com/official-stockfish/Stockfish/pull/5240

Bench: 1752471

5 months agosimplify away quietCheckEvasions pruning
Shawn Xu [Thu, 9 May 2024 07:38:43 +0000 (00:38 -0700)]
simplify away quietCheckEvasions pruning

simplifies away the pruning of quiet evasion moves in quiescent search.

Passed STC:
LLR: 2.98 (-2.94,2.94) <-1.75,0.25>
Total: 343520 W: 88356 L: 88470 D: 166694
Ptnml(0-2): 1061, 40073, 89706, 39759, 1161
https://tests.stockfishchess.org/tests/view/663c7ddfc0b75d7f7b980f3b

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 168744 W: 42454 L: 42384 D: 83906
Ptnml(0-2): 75, 18678, 46782, 18776, 61
https://tests.stockfishchess.org/tests/view/663ce34fc0b75d7f7b981ed9

closes https://github.com/official-stockfish/Stockfish/pull/5231

bench 3681552

5 months agoFix usage of abs vs std::abs
xu-shawn [Thu, 9 May 2024 07:11:09 +0000 (00:11 -0700)]
Fix usage of abs vs std::abs

closes https://github.com/official-stockfish/Stockfish/pull/5229

no functional change

5 months agoSimplify Away Negative Extension
Shawn Xu [Wed, 8 May 2024 21:26:01 +0000 (14:26 -0700)]
Simplify Away Negative Extension

This patch simplifies away the negative extension applied when the value returned by the transposition table is assumed to fail low over the value of reduced search.

Passed STC:
LLR: 2.99 (-2.94,2.94) <-1.75,0.25>
Total: 248736 W: 64293 L: 64302 D: 120141
Ptnml(0-2): 925, 29833, 62831, 29884, 895
https://tests.stockfishchess.org/tests/view/663bee3bca93dad645f7f64a

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 254970 W: 64289 L: 64308 D: 126373
Ptnml(0-2): 110, 28428, 70422, 28421, 104
https://tests.stockfishchess.org/tests/view/663c11f0c0b75d7f7b97d4bb

closes https://github.com/official-stockfish/Stockfish/pull/5226

Bench: 2353057

5 months agoSimplify depth formula based on score improvement
FauziAkram [Wed, 8 May 2024 23:56:43 +0000 (02:56 +0300)]
Simplify depth formula based on score improvement

Simplify depth formula based on score improvement.
This idea was first tried by cj5716

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 347104 W: 89683 L: 89804 D: 167617
Ptnml(0-2): 1357, 38824, 93307, 38711, 1353
https://tests.stockfishchess.org/tests/view/66378edf9819650825aa75d0

Passed LTC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 63000 W: 15851 L: 15694 D: 31455
Ptnml(0-2): 22, 5396, 20499, 5569, 14
https://tests.stockfishchess.org/tests/view/663c04e5c0b75d7f7b97d461

closes https://github.com/official-stockfish/Stockfish/pull/5225

Bench: 2691699

Co-Authored-By: cj5716 <125858804+cj5716@users.noreply.github.com>
5 months agoRemove conthist 3 from moves loop pruning
Michael Chaly [Tue, 7 May 2024 06:27:04 +0000 (09:27 +0300)]
Remove conthist 3 from moves loop pruning

Followup to previous gainer that made it twice less impactful there - this patch removes it entirely as a simplification.

Passed STC:
https://tests.stockfishchess.org/tests/view/6637aa7e9819650825aa93e0
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 26208 W: 6930 L: 6694 D: 12584
Ptnml(0-2): 113, 2997, 6652, 3225, 117

Passed LTC:
https://tests.stockfishchess.org/tests/view/66383cba493aaaf4b7ea90c2
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 67866 W: 17294 L: 17118 D: 33454
Ptnml(0-2): 46, 7627, 18415, 7795, 50

closes https://github.com/official-stockfish/Stockfish/pull/5221

Bench: 2691699

5 months agoSimplify away conthist 3 from statscore
Michael Chaly [Mon, 6 May 2024 17:18:12 +0000 (20:18 +0300)]
Simplify away conthist 3 from statscore

Following previous elo gainer that gained by making conthist 3 less important in pruning this patch simplifies away this history from calculation of statscore.

Passed STC:
https://tests.stockfishchess.org/tests/view/6637aa7e9819650825aa93e0
LLR: 3.00 (-2.94,2.94) <-1.75,0.25>
Total: 35392 W: 9352 L: 9120 D: 16920
Ptnml(0-2): 141, 4145, 8888, 4385, 137

Passed LTC:
https://tests.stockfishchess.org/tests/view/66383cd8493aaaf4b7ea90c5
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 33948 W: 8714 L: 8503 D: 16731
Ptnml(0-2): 39, 3701, 9270, 3938, 26

closes https://github.com/official-stockfish/Stockfish/pull/5220

Bench: 2508571

5 months agosimplify moveCountPruning
FauziAkram [Sun, 5 May 2024 00:10:26 +0000 (03:10 +0300)]
simplify moveCountPruning

no (significant) speedup upon renewed testing

Passed stc:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 88992 W: 22779 L: 22633 D: 43580
Ptnml(0-2): 137, 8706, 26681, 8818, 154
https://tests.stockfishchess.org/tests/view/6636c4844b68b70d85800dae

closes https://github.com/official-stockfish/Stockfish/pull/5213

No functional change.

5 months agoFix nodestime
MinetaS [Tue, 7 May 2024 18:26:09 +0000 (03:26 +0900)]
Fix nodestime

1. The current time management system utilizes limits.inc and
limits.time, which can represent either milliseconds or node count,
depending on whether the nodestime option is active. There have been
several modifications which brought Elo gain for typical uses (i.e.
real-time matches), however some of these changes overlooked such
distinction. This patch adjusts constants and multiplication/division to
more accurately simulate real TC conditions when nodestime is used.

2. The advance_nodes_time function has a bug that can extend the time
limit when availableNodes reaches exact zero. This patch fixes the bug
by initializing the variable to -1 and make sure it does not go below
zero.

3. elapsed_time function is newly introduced to print PV in the UCI
output based on real time. This makes PV output more consistent with the
behavior of trivial use cases.

closes https://github.com/official-stockfish/Stockfish/pull/5186

No functional changes

5 months agoIIR on cutnodes if there is a ttMove but the ttBound is upper
rn5f107s2 [Wed, 8 May 2024 20:08:56 +0000 (22:08 +0200)]
IIR on cutnodes if there is a ttMove but the ttBound is upper

If there is an upper bound stored in the transposition table, but we still have a ttMove, the upperbound indicates that the last time the ttMove was tried, it failed low. This fail low indicates that the ttMove may not be good, so this patch introduces a depth reduction of one for cutnodes with such ttMoves.

Passed STC:
https://tests.stockfishchess.org/tests/view/663be4d1ca93dad645f7f45f
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 139424 W: 35900 L: 35433 D: 68091
Ptnml(0-2): 425, 16357, 35743, 16700, 487

Passed LTC:
https://tests.stockfishchess.org/tests/view/663bec95ca93dad645f7f5c8
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 129690 W: 32902 L: 32390 D: 64398
Ptnml(0-2): 63, 14304, 35610, 14794, 74

closes https://github.com/official-stockfish/Stockfish/pull/5227

bench 2257437

5 months agoRefactor quiet moves pruning in qsearch
Michael Chaly [Wed, 8 May 2024 18:59:03 +0000 (21:59 +0300)]
Refactor quiet moves pruning in qsearch

Make it formula more in line with what we use in search - current formula is more or less the one we used years ago for search but since then it was remade, this patch remakes qsearch formula to almost exactly the same as we use in search - with sum of conthist 0, 1 and pawn structure history.

Passed STC:
https://tests.stockfishchess.org/tests/view/6639c8421343f0cb16716206
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 84992 W: 22414 L: 22019 D: 40559
Ptnml(0-2): 358, 9992, 21440, 10309, 397

Passed LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 119136 W: 30407 L: 29916 D: 58813
Ptnml(0-2): 46, 13192, 32622, 13641, 67

closes https://github.com/official-stockfish/Stockfish/pull/5224

Bench: 2138659

5 months agoDepth dependent statscore based reductions
FauziAkram [Tue, 7 May 2024 12:03:58 +0000 (15:03 +0300)]
Depth dependent statscore based reductions

Test a modification of Fawzi's PR #5223, against that PR.

parameters locally tuned with nevergrad4sf.

passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 1047424 W: 271478 L: 269649 D: 506297
Ptnml(0-2): 3851, 124543, 265290, 125982, 4046
https://tests.stockfishchess.org/tests/view/663b0889ca93dad645f7c58c

passed LTC:
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 796236 W: 201712 L: 199825 D: 394699
Ptnml(0-2): 361, 88381, 218778, 90206, 392
https://tests.stockfishchess.org/tests/view/663be6adca93dad645f7f509

https://github.com/official-stockfish/Stockfish/pull/5228

Bench: 3346224

5 months agoTweak reduction formula based on depth
FauziAkram [Tue, 7 May 2024 12:03:58 +0000 (15:03 +0300)]
Tweak reduction formula based on depth

The idea came to me by checking for trends from the megafauzi tunes, since the values of the divisor for this specific formula were as follows:
stc: 15990
mtc: 16117
ltc: 14805
vltc: 12719
new vltc passed by Muzhen: 12076

This shows a clear trend related to time control, the higher it is, the lower the optimum value for the divisor seems to be.
So I tried a simple formula, using educated guesses based on some calculations, tests show it works pretty fine, and it can still be further tuned at VLTC in the future to scale even better.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 431360 W: 110791 L: 109898 D: 210671
Ptnml(0-2): 1182, 50846, 110698, 51805, 1149
https://tests.stockfishchess.org/tests/view/663770409819650825aa269f

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 114114 W: 29109 L: 28625 D: 56380
Ptnml(0-2): 105, 12628, 31101, 13124, 99
https://tests.stockfishchess.org/tests/view/66378c099819650825aa73f6

https://github.com/official-stockfish/Stockfish/pull/5223

bench: 2273551

5 months agoVVLTC search tune
Muzhen Gaming [Sat, 4 May 2024 23:36:48 +0000 (07:36 +0800)]
VVLTC search tune

This patch is the result of two tuning stages:
1. ~32k games at 60+0.6 th8:
   https://tests.stockfishchess.org/tests/view/662d9dea6115ff6764c7f817
2. ~193k games at 80+0.8 th6, based on PR #5211:
   https://tests.stockfishchess.org/tests/view/663587e273559a8aa857ca00.
   Based on extensive VVLTC tuning and testing both before and after
   #5211, it is observed that introduction of new extensions positively
   affected the search tune results.

Passed VVLTC 70+0.7 th7 1st sprt: https://tests.stockfishchess.org/tests/view/6636c6f04b68b70d85801409
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 18566 W: 4864 L: 4620 D: 9082
Ptnml(0-2): 0, 1608, 5827, 1844, 4

Passed VVLTC 70+0.7 th7 2nd sprt: https://tests.stockfishchess.org/tests/view/6636d4b84b68b70d85802ab7
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 43142 W: 11141 L: 10838 D: 21163
Ptnml(0-2): 4, 3915, 13427, 4224, 1

Passed VVLTC 70+0.7 3rd sprt: https://tests.stockfishchess.org/tests/view/66376b4f9819650825aa230b
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 40322 W: 10374 L: 10076 D: 19872
Ptnml(0-2): 1, 3660, 12544, 3952, 4

The first two sprts were run against passed #5211. The third sprt was
run against latest master.

closes https://github.com/official-stockfish/Stockfish/pull/5216

Bench: 2180675

5 months agoSimplify accumulator refreshes
cj5716 [Wed, 1 May 2024 07:54:17 +0000 (15:54 +0800)]
Simplify accumulator refreshes

Passed Non-Regression STC:
https://tests.stockfishchess.org/tests/view/6631f5d5d01fb9ac9bcdc7d0
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 57472 W: 14979 L: 14784 D: 27709
Ptnml(0-2): 185, 6486, 15192, 6695, 178

closes https://github.com/official-stockfish/Stockfish/pull/5207

No functional change

5 months agoAdjust history usage in moves loop pruning
Michael Chaly [Sun, 5 May 2024 02:20:05 +0000 (05:20 +0300)]
Adjust history usage in moves loop pruning

After experiments with conthist 5 addition failed really bad divions by 2 passed as a gainer.

Passed STC:
https://tests.stockfishchess.org/tests/view/6636d7114b68b70d858035ce
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 35936 W: 9287 L: 8976 D: 17673
Ptnml(0-2): 81, 4129, 9234, 4446, 78

Passed LTC:
https://tests.stockfishchess.org/tests/view/6636ddb64b68b70d858040a8
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 82428 W: 21035 L: 20622 D: 40771
Ptnml(0-2): 29, 8985, 22775, 9394, 31

closes https://github.com/official-stockfish/Stockfish/pull/5217

Bench: 2309253

5 months agoSome history fixes and tidy-up
cj5716 [Wed, 1 May 2024 10:31:38 +0000 (18:31 +0800)]
Some history fixes and tidy-up

This adds the functions `update_refutations` and `update_quiet_histories` to better distinguish the two. `update_quiet_stats` now just calls both of these functions.

The functional side of this patch is two-fold:
1. Stop refutations being updated when we carry out multicut
2. Update pawn history every time we update other quiet histories

Yellow STC:
LLR: -2.95 (-2.94,2.94) <0.00,2.00>
Total: 238976 W: 61506 L: 61415 D: 116055
Ptnml(0-2): 846, 28628, 60456, 28705, 853
https://tests.stockfishchess.org/tests/view/66321b5ed01fb9ac9bcdca83

However, it passed in <-1.75, 0.25> bounds:
$ python3 sprt.py --wins 61506 --losses 61415 --draws 116055 --elo0 -1.75 --elo1 0.25
ELO: 0.132 +- 0.998 [-0.865, 1.13]
LLR: 4.15 [-1.75, 0.25] (-2.94, 2.94)
H1 Accepted

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 399126 W: 100730 L: 100896 D: 197500
Ptnml(0-2): 116, 44328, 110843, 44158, 118
https://tests.stockfishchess.org/tests/view/66357b0473559a8aa857ba6f

closes #5215

Bench 2370967

5 months agoSimplify shuffling and optimism divisors to constants
FauziAkram [Sat, 4 May 2024 18:43:07 +0000 (21:43 +0300)]
Simplify shuffling and optimism divisors to constants

Shuffling divisor and Optimism divisors passed STC & LTC separately:
shuf STC: https://tests.stockfishchess.org/tests/view/66356316b4e9bdbc7228b995
shuf LTC: https://tests.stockfishchess.org/tests/view/6635815a73559a8aa857c1dc
opt STC: https://tests.stockfishchess.org/tests/view/66356326b4e9bdbc7228b9a0
opt LTC: https://tests.stockfishchess.org/tests/view/663615c673559a8aa8589f8a

And then passed LTC together:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 178278 W: 45039 L: 44979 D: 88260
Ptnml(0-2): 43, 19776, 49460, 19798, 62
https://tests.stockfishchess.org/tests/view/66363f19cdb7cf5da64e22a3

closes https://github.com/official-stockfish/Stockfish/pull/5212

Bench: 2198243

5 months agoIntroduce Quadruple Extensions
Viren6 [Sat, 4 May 2024 16:29:23 +0000 (17:29 +0100)]
Introduce Quadruple Extensions

This patch introduces quadruple extensions, with the new condition of not ttPv. It also generalises all margins, so that extensions can still occur if conditions are only partially fulfilled, but with a stricter margin.

Failed STC:
LLR: -2.94 (-2.94,2.94) <0.00,2.00>
Total: 16096 W: 3984 L: 4228 D: 7884
Ptnml(0-2): 72, 2067, 4002, 1847, 60
https://tests.stockfishchess.org/tests/view/66316422d01fb9ac9bcdbdcd

Passed VVLTC 1:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 96660 W: 24550 L: 24210 D: 47900
Ptnml(0-2): 5, 8776, 30426, 9120, 3
https://tests.stockfishchess.org/tests/view/66361f2c74fa3f41ef2ee091

Passed VVLTC 2:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 80546 W: 20495 L: 20120 D: 39931
Ptnml(0-2): 6, 7477, 24929, 7858, 3
https://tests.stockfishchess.org/tests/view/66350cf739ba8e443112b3fa

closes https://github.com/official-stockfish/Stockfish/pull/5211

bench 2233743

5 months agoAdd extra bonuses to some moves that forced a fail low
Michael Chaly [Sat, 4 May 2024 07:33:26 +0000 (10:33 +0300)]
Add extra bonuses to some moves that forced a fail low

The previous patch on this idea was giving bonuses to this moves if best value of search is far below current static evaluation.
This patch does similar thing but adds extra bonus when best value of search is far below static evaluation before previous move.

Passed STC:
https://tests.stockfishchess.org/tests/view/66355fc819566d64b481d6a4
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 454144 W: 116575 L: 115656 D: 221913
Ptnml(0-2): 1060, 53410, 117215, 54325, 1062

Passed LTC:
https://tests.stockfishchess.org/tests/view/6635c61a73559a8aa858012d
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 136578 W: 34858 L: 34335 D: 67385

closes https://github.com/official-stockfish/Stockfish/pull/5209

Bench: 1614825

5 months agoRemove PSQT-only mode
cj5716 [Sat, 4 May 2024 01:52:27 +0000 (09:52 +0800)]
Remove PSQT-only mode

Passed STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 94208 W: 24270 L: 24112 D: 45826
Ptnml(0-2): 286, 11186, 24009, 11330, 293
https://tests.stockfishchess.org/tests/view/6635ddd773559a8aa8582826

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 114960 W: 29107 L: 28982 D: 56871
Ptnml(0-2): 37, 12683, 31924, 12790, 46
https://tests.stockfishchess.org/tests/view/663604a973559a8aa85881ed

closes #5214

Bench 1653939

5 months agoClear Workers after changing the network
Disservin [Wed, 1 May 2024 13:10:23 +0000 (15:10 +0200)]
Clear Workers after changing the network

ensures internal state (e.g. accumulator cache) is consistent with network

closes https://github.com/official-stockfish/Stockfish/pull/5204

No functional change

6 months agoAccumulator cache bugfix and cleanup
mstembera [Tue, 30 Apr 2024 03:37:54 +0000 (20:37 -0700)]
Accumulator cache bugfix and cleanup

STC:
https://tests.stockfishchess.org/tests/view/663068913a05f1bf7a511dc2
LLR: 2.98 (-2.94,2.94) <-1.75,0.25>
Total: 70304 W: 18211 L: 18026 D: 34067
Ptnml(0-2): 232, 7966, 18582, 8129, 243

1) Fixes a bug introduced in
   https://github.com/official-stockfish/Stockfish/pull/5194. Only one
   psqtOnly flag was used for two perspectives which was causing
   wrong entries to be cleared and marked.
2) The finny caches should be cleared like histories and not at the
   start of every search.

closes https://github.com/official-stockfish/Stockfish/pull/5203

No functional change

6 months agoOptimise NNUE Accumulator updates
cj5716 [Sun, 28 Apr 2024 08:33:59 +0000 (16:33 +0800)]
Optimise NNUE Accumulator updates

Passed STC:
https://tests.stockfishchess.org/tests/view/662e3c6a5e9274400985a741
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 86176 W: 22284 L: 21905 D: 41987
Ptnml(0-2): 254, 9572, 23051, 9963, 248

closes https://github.com/official-stockfish/Stockfish/pull/5202

No functional change

6 months agoAvoid unnecessary creation of accumulator cache
Ciekce [Mon, 29 Apr 2024 00:45:56 +0000 (01:45 +0100)]
Avoid unnecessary creation of accumulator cache

Saves a (currently) 800 KB allocation and deallocation when running
`eval`, not particularly significant and zero impact on play but not
necessary either.

closes https://github.com/official-stockfish/Stockfish/pull/5201

No functional change

6 months agoUse capture history to better judge which sacrifices to explore
Dubslow [Sat, 20 Apr 2024 05:29:01 +0000 (00:29 -0500)]
Use capture history to better judge which sacrifices to explore

This idea has been bouncing around a while. @Vizvezdenec tried it a
couple years ago in Stockfish without results, but its recent arrival in
Ethereal inspired him and thence me to try it afresh in Stockfish.

(Also factor out the now-common code with futpruning for captures.)

STC:
https://tests.stockfishchess.org/tests/view/662355bc3fe04ce4cefc18ac
LLR: 2.92 (-2.94,2.94) <0.00,2.00>
Total: 45760 W: 11970 L: 11640 D: 22150
Ptnml(0-2): 124, 5371, 11625, 5571, 189

LTC:
https://tests.stockfishchess.org/tests/view/662dda396115ff6764c817c9
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 243828 W: 62042 L: 61287 D: 120499
Ptnml(0-2): 211, 27202, 66329, 27965, 207

closes https://github.com/official-stockfish/Stockfish/pull/5200

Bench: 1480008

6 months agoMore reduction at cut nodes which are not a former PV node
Stefan Geschwentner [Sun, 28 Apr 2024 14:53:47 +0000 (16:53 +0200)]
More reduction at cut nodes which are not a former PV node

But the tt move and first killer are excluded.

This idea is based on following LMR condition tuning
https://tests.stockfishchess.org/tests/view/66228bed3fe04ce4cefc0c71 by
using only the two largest terms P[0] and P[1].

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 173248 W: 45091 L: 44565 D: 83592
Ptnml(0-2): 693, 20534, 43673, 21002, 722
https://tests.stockfishchess.org/tests/view/6629603b3fe04ce4cefc7d37

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 722394 W: 183231 L: 181487 D: 357676
Ptnml(0-2): 462, 80650, 197252, 82348, 485
https://tests.stockfishchess.org/tests/view/662cbe45d46f72253dcff7bf

closes https://github.com/official-stockfish/Stockfish/pull/5199

Bench: 1619613

6 months agoSimplify non-pawn material divisor to a constant
Stefan Geschwentner [Sun, 28 Apr 2024 14:04:28 +0000 (16:04 +0200)]
Simplify non-pawn material divisor to a constant

Passed STC:
https://tests.stockfishchess.org/tests/view/662942603fe04ce4cefc7aba
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 272832 W: 70456 L: 70497 D: 131879
Ptnml(0-2): 1020, 32619, 69154, 32628, 995

Passed LTC:
https://tests.stockfishchess.org/tests/view/662dfe3b6115ff6764c829eb
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 100254 W: 25446 L: 25303 D: 49505
Ptnml(0-2): 121, 11292, 27166, 11419, 129

closes https://github.com/official-stockfish/Stockfish/pull/5198

Bench: 1544645

6 months agoPenalise the TT move in multicut
cj5716 [Sun, 28 Apr 2024 00:53:28 +0000 (08:53 +0800)]
Penalise the TT move in multicut

Passed STC:
LLR: 2.99 (-2.94,2.94) <0.00,2.00>
Total: 185504 W: 48079 L: 47533 D: 89892
Ptnml(0-2): 716, 21866, 46988, 22520, 662
https://tests.stockfishchess.org/tests/view/662d9e1d6115ff6764c7f83d

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 75612 W: 19351 L: 18948 D: 37313
Ptnml(0-2): 46, 8363, 20592, 8752, 53
https://tests.stockfishchess.org/tests/view/662dc9dc6115ff6764c80fea

closes https://github.com/official-stockfish/Stockfish/pull/5195

Bench: 1415435

6 months agoCombine remove and add in update_accumulator_refresh_cache()
mstembera [Sun, 28 Apr 2024 17:28:25 +0000 (10:28 -0700)]
Combine remove and add in update_accumulator_refresh_cache()

Combine remove and add in update_accumulator_refresh_cache().
Move remove before add to match other parts of the code.

STC:
https://tests.stockfishchess.org/tests/view/662d96dc6115ff6764c7f4ca
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 364032 W: 94421 L: 93624 D: 175987
Ptnml(0-2): 1261, 41983, 94811, 42620, 1341

closes https://github.com/official-stockfish/Stockfish/pull/5194

Bench: 1836777

6 months agoCache small net w/ psqtOnly support
mstembera [Fri, 26 Apr 2024 01:20:08 +0000 (18:20 -0700)]
Cache small net w/ psqtOnly support

Caching the small net in the same way as the big net allows them to
share the same code path and completely removes
update_accumulator_refresh().

STC:
https://tests.stockfishchess.org/tests/view/662bfb5ed46f72253dcfed85
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 151712 W: 39252 L: 39158 D: 73302
Ptnml(0-2): 565, 17474, 39683, 17570, 564

closes https://github.com/official-stockfish/Stockfish/pull/5194

Bench: 1836777

6 months agoOutput some basic info about the used networks
Joost VandeVondele [Sat, 27 Apr 2024 16:09:45 +0000 (18:09 +0200)]
Output some basic info about the used networks

Adds size in memory as well as layer sizes as in

info string NNUE evaluation using nn-ae6a388e4a1a.nnue (132MiB, (22528, 3072, 15, 32, 1))
info string NNUE evaluation using nn-baff1ede1f90.nnue (6MiB, (22528, 128, 15, 32, 1))

For example, the size in MiB is useful to keep the fishtest memory sizes up-to-date,
the L1-L3 sizes give a useful hint about the architecture used.

closes https://github.com/official-stockfish/Stockfish/pull/5193

No functional change

6 months agoFix missing initialization of AccumulatorCaches in Eval::trace
Disservin [Thu, 25 Apr 2024 17:20:57 +0000 (19:20 +0200)]
Fix missing initialization of AccumulatorCaches in Eval::trace

Add a constructor to `AccumulatorCaches` instead of just calling
`clear(networks)` to prevent similar issues from appearing in the
future.

fixes https://github.com/official-stockfish/Stockfish/issues/5190

closes https://github.com/official-stockfish/Stockfish/pull/5191

No functional change

6 months agoUse less time on recaptures
xoto10 [Sun, 28 Apr 2024 15:27:40 +0000 (16:27 +0100)]
Use less time on recaptures

Credit for the idea goes to peregrine on discord.

Passed STC 10+0.1:
https://tests.stockfishchess.org/tests/view/662652623fe04ce4cefc48cf
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 75712 W: 19793 L: 19423 D: 36496
Ptnml(0-2): 258, 8487, 20023, 8803, 285

Passed LTC 60+0.6:
https://tests.stockfishchess.org/tests/view/6627495e3fe04ce4cefc59b6
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 49788 W: 12743 L: 12404 D: 24641
Ptnml(0-2): 29, 5141, 14215, 5480, 29

The code was updated slightly and tested for non-regression against the
original code at STC:

LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 41952 W: 10912 L: 10698 D: 20342
Ptnml(0-2): 133, 4825, 10835, 5061, 122
https://tests.stockfishchess.org/tests/view/662d84f56115ff6764c7e438

closes https://github.com/official-stockfish/Stockfish/pull/5189

Bench: 1836777

6 months agoImplement accumulator refresh table
gab8192 [Sat, 20 Apr 2024 19:26:00 +0000 (21:26 +0200)]
Implement accumulator refresh table

For each thread persist an accumulator cache for the network, where each
cache contains multiple entries for each of the possible king squares.
When the accumulator needs to be refreshed, the cached entry is used to more
efficiently update the accumulator, instead of rebuilding it from scratch.
This idea, was first described by Luecx (author of Koivisto) and
is commonly referred to as "Finny Tables".

When the accumulator needs to be refreshed, instead of filling it with
biases and adding every piece from scratch, we...

1. Take the `AccumulatorRefreshEntry` associated with the new king bucket
2. Calculate the features to activate and deactivate (from differences
   between bitboards in the entry and bitboards of the actual position)
3. Apply the updates on the refresh entry
4. Copy the content of the refresh entry accumulator to the accumulator
   we were refreshing
5. Copy the bitboards from the position to the refresh entry, to match
   the newly updated accumulator

Results at STC:
https://tests.stockfishchess.org/tests/view/662301573fe04ce4cefc1386
(first version)
https://tests.stockfishchess.org/tests/view/6627fa063fe04ce4cefc6560
(final)

Non-Regression between first and final:
https://tests.stockfishchess.org/tests/view/662801e33fe04ce4cefc660a

STC SMP:
https://tests.stockfishchess.org/tests/view/662808133fe04ce4cefc667c

closes https://github.com/official-stockfish/Stockfish/pull/5183

No functional change

6 months agoTune Search Parameters
FauziAkram [Mon, 22 Apr 2024 11:34:22 +0000 (14:34 +0300)]
Tune Search Parameters

Parameters Tune, adding also another tunable parameter (npmDiv) to be
variable for different nets (bignet, smallnet, psqtOnly smallnet). P.s:
The changed values are only the parameters where there is agreement
among the different time controls, so in other words, the tunings are
telling us that changing these specific values to this specific
direction is good in all time controls, so there shouldn't be a high
risk of regressing at longer time controls.

Passed STC:
LLR: 2.97 (-2.94,2.94) <0.00,2.00>
Total: 39552 W: 10329 L: 9999 D: 19224
Ptnml(0-2): 156, 4592, 9989, 4844, 195
https://tests.stockfishchess.org/tests/view/661be9a0bd68065432a088c0

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 56394 W: 14439 L: 14078 D: 27877
Ptnml(0-2): 30, 6152, 15480, 6497, 38
https://tests.stockfishchess.org/tests/view/661c746296961e72eb565406

closes https://github.com/official-stockfish/Stockfish/pull/5187

Bench: 1836777

6 months agoRestore NPS output for Perft
Disservin [Mon, 22 Apr 2024 17:24:10 +0000 (19:24 +0200)]
Restore NPS output for Perft

Previously it was possible to also get the node counter after running a bench with perft, i.e.
`./stockfish bench 1 1 5 current perft`, caused by a small regression from the uci refactoring.

```
Nodes searched: 4865609

===========================
Total time (ms) : 18
Nodes searched  : 4865609
Nodes/second    : 270311611
````

closes https://github.com/official-stockfish/Stockfish/pull/5188

No functional change

6 months agoTweak TT aging and replacement strategies
cj5716 [Thu, 18 Apr 2024 10:50:09 +0000 (18:50 +0800)]
Tweak TT aging and replacement strategies

We change the definition of "age" from "age of this position" to "age of this TT entry".
In this way, despite being on the same position, when we save into TT, we always prefer the new entry as compared to the old one.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 152256 W: 39597 L: 39110 D: 73549
Ptnml(0-2): 556, 17562, 39398, 18063, 549
https://tests.stockfishchess.org/tests/view/6620faee3fe04ce4cefbf215

Passed LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 51564 W: 13242 L: 12895 D: 25427
Ptnml(0-2): 24, 5464, 14463, 5803, 28
https://tests.stockfishchess.org/tests/view/66231ab53fe04ce4cefc153e

closes #5184

Bench 1479416

6 months agoMove ALSR change to CI Workflow file
Disservin [Sat, 20 Apr 2024 18:37:39 +0000 (20:37 +0200)]
Move ALSR change to CI Workflow file

It makes more sense to not (potentially) change the developers alsr entropy setting to make the test run through. This should be an active choice even if the test then might fail locally for them.

closes https://github.com/official-stockfish/Stockfish/pull/5182

No functional change

6 months agoImprove CI
Joost VandeVondele [Sat, 20 Apr 2024 13:33:07 +0000 (15:33 +0200)]
Improve CI

the recent refactoring has shown some limitations of our testing, hence we add a couple of more tests including:
* expected mate score
* expected mated score
* expected in TB win score
* expected in TB loss score
* expected info line output
* expected info line output (wdl)

closes https://github.com/official-stockfish/Stockfish/pull/5181

No functional change

6 months agoupdate the WDL model
Robert Nurnberg @ elitebook [Tue, 16 Apr 2024 06:23:42 +0000 (08:23 +0200)]
update the WDL model

The patch only changes the displayed cp and wdl values.

closes https://github.com/official-stockfish/Stockfish/pull/5178

No functional change

6 months agofix clang compiler warning for avx512 build
Gahtan Nahdi [Mon, 15 Apr 2024 04:55:28 +0000 (11:55 +0700)]
fix clang compiler warning for avx512 build

Initialize variable in constexpr function to get rid of clang compiler warning for avx512 build.

closes https://github.com/official-stockfish/Stockfish/pull/5176

Non-functional change

6 months agoTrivial cleanup
Michael Chaly [Thu, 11 Apr 2024 21:00:59 +0000 (00:00 +0300)]
Trivial cleanup

Make naming and declaration of futilityValue in search consistent between different places.

closes https://github.com/official-stockfish/Stockfish/pull/5165

No functional change.

6 months agoRefactor elapsed time checks in search
Disservin [Wed, 10 Apr 2024 21:10:07 +0000 (23:10 +0200)]
Refactor elapsed time checks in search

Small improvement of the elapsed time usage in search, makes the code easier to read overall.
Also Search::Worker::iterative_deepening() now only checks the elapsed time once, instead of 3 times in a row.

Non Regression STC:
https://tests.stockfishchess.org/tests/view/6617005d5a4693796d965c3c
LLR: 2.97 (-2.94,2.94) <-1.75,0.25>
Total: 61024 W: 16002 L: 15806 D: 29216
Ptnml(0-2): 243, 6874, 16102, 7030, 263

closes https://github.com/official-stockfish/Stockfish/pull/5163

No functional change

6 months agoUpdate outdated comments
Disservin [Sun, 7 Apr 2024 12:26:23 +0000 (14:26 +0200)]
Update outdated comments

closes https://github.com/official-stockfish/Stockfish/pull/5158

No functional change

6 months agoFix wrong sign for 200 TB score
Disservin [Sat, 13 Apr 2024 19:54:10 +0000 (21:54 +0200)]
Fix wrong sign for 200 TB score

Fix another case of 9032c6cbe74ccf7e8963755501e7e6cc473ae471

*    TB values can have a distance of 0, mainly when we are in a tb position but haven't found mate.
*    Add a missing whitespace to UCIEngine::on_update_no_moves()

Closes https://github.com/official-stockfish/Stockfish/pull/5172

No functional change

6 months agoRemove duplicated Position object in UCIEngine
Disservin [Fri, 12 Apr 2024 17:11:10 +0000 (19:11 +0200)]
Remove duplicated Position object in UCIEngine

Also fixes searchmoves.

Drop the need of a Position object in uci.cpp.

A side note, it is still required for the static functions,
but these should be moved to a different namespace/class
later on, since sf kinda relies on them.

closes https://github.com/official-stockfish/Stockfish/pull/5169

No functional change

6 months agoFix some more UCI output
Shahin M. Shahin [Fri, 12 Apr 2024 10:32:31 +0000 (13:32 +0300)]
Fix some more UCI output

further fall-out of the refactoring, fixes:

* the position object in UCI is not never getting updated if position token is used
* duplicate string of " wdl "

See also:

https://discord.com/channels/435943710472011776/1032922913499783169/1228227522945351690
https://discord.com/channels/435943710472011776/813919248455827515/1228288106449338398

closes https://github.com/official-stockfish/Stockfish/pull/5168

No functional change

Co-Authored-By: disservin <45608332+disservin@users.noreply.github.com>
6 months agoFix wrong mate sign
Robert Nurnberg @ elitebook [Fri, 12 Apr 2024 06:39:39 +0000 (08:39 +0200)]
Fix wrong mate sign

introduced yesterday by the UCI refactoring 9032c6cbe

fixes #5166
closes https://github.com/official-stockfish/Stockfish/pull/5167

No functional change

6 months agoSimplify the depth-dependent part of the best value adjustment formula in main search
FauziAkram [Thu, 11 Apr 2024 11:00:46 +0000 (14:00 +0300)]
Simplify the depth-dependent part of the best value adjustment formula in main search

Passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 139648 W: 36171 L: 36061 D: 67416
Ptnml(0-2): 545, 16685, 35282, 16739, 573
https://tests.stockfishchess.org/tests/view/660d953b8ff4a059828d625d

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 222894 W: 56519 L: 56505 D: 109870
Ptnml(0-2): 112, 25145, 60971, 25055, 164
https://tests.stockfishchess.org/tests/view/660fd4afbfeb43334bf7d558

closes https://github.com/official-stockfish/Stockfish/pull/5164

bench: 1479416

6 months agoRemove an useless assignment
gab8192 [Wed, 3 Apr 2024 21:41:24 +0000 (23:41 +0200)]
Remove an useless assignment

The assignment (ss + 1)->excludedMove = Move::none() can be simplified away because when that line is reached, (ss + 1)->excludedMove is always already none. The only moment stack[x]->excludedMove is modified, is during singular search, but it is reset to none right after the singular search is finished.

closes https://github.com/official-stockfish/Stockfish/pull/5153

No functional change

6 months agoRemove COMPILER from Makefile
Disservin [Fri, 5 Apr 2024 09:34:11 +0000 (11:34 +0200)]
Remove COMPILER from Makefile

The same functionality is available by using COMPCXX and having another variable which does the same is just confusing.
There was only one mention on Stockfish Wiki about this which has been changed to COMPCXX.

closes https://github.com/official-stockfish/Stockfish/pull/5154

No functional change

6 months agoAvoid permuting inputs during transform()
mstembera [Mon, 8 Apr 2024 20:07:41 +0000 (13:07 -0700)]
Avoid permuting inputs during transform()

Avoid permuting inputs during transform() and instead do it once at load time.
Affects AVX2 and newer Intel architectures only.

https://tests.stockfishchess.org/tests/view/661306613eb00c8ccc0033c7
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 108480 W: 28319 L: 27898 D: 52263
Ptnml(0-2): 436, 12259, 28438, 12662, 445

speedups measured such as e.g.

```
Result of 100 runs
==================
base (./stockfish.master       ) =    1241128  +/- 3757
test (./stockfish.patch        ) =    1247713  +/- 3689
diff                             =      +6585  +/- 2583

speedup        = +0.0053
P(speedup > 0) =  1.0000
```

closes https://github.com/official-stockfish/Stockfish/pull/5160

No functional change

6 months agoVVLTC search tune
Muzhen Gaming [Sat, 6 Apr 2024 14:39:29 +0000 (22:39 +0800)]
VVLTC search tune

Parameters were tuned in 3 stages:

* Using an earlier L1-3072 net, and with triple extension margin manually set to 0: https://tests.stockfishchess.org/tests/view/65ffdf5d0ec64f0526c544f2 (~30k games)
* Continue tuning, but with the previous master net (L1-2560). https://tests.stockfishchess.org/tests/view/660663f00ec64f0526c59c41 (~27k games)
* Starting with the parameters from step 2, use the current L1-3072 net, and allow the triple extension margin to be tuned starting from 0: https://tests.stockfishchess.org/tests/view/660c16b8216a13d9498e7536 (40k games)

Passed VVLTC 1st sprt: https://tests.stockfishchess.org/tests/view/66115eacbfeb43334bf7eddd
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 27138 W: 7045 L: 6789 D: 13304
Ptnml(0-2): 1, 2421, 8471, 2673, 3

Passed VVLTC 2nd sprt: https://tests.stockfishchess.org/tests/view/661483623eb00c8ccc0049c1
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 26242 W: 6807 L: 6535 D: 12900
Ptnml(0-2): 0, 2353, 8143, 2625, 0

STC Elo estimate: https://tests.stockfishchess.org/tests/view/66175ca55a4693796d96608c
Elo: -10.53 ± 2.4 (95%) LOS: 0.0%
Total: 21584 W: 5294 L: 5948 D: 10342
Ptnml(0-2): 102, 2937, 5363, 2293, 97
nElo: -19.99 ± 4.7 (95%) PairsRatio: 0.79

closes https://github.com/official-stockfish/Stockfish/pull/5162

Bench: 1381387

6 months agoTransform search output to engine callbacks
Disservin [Sat, 23 Mar 2024 09:22:20 +0000 (10:22 +0100)]
Transform search output to engine callbacks

Part 2 of the Split UCI into UCIEngine and Engine refactor.
This creates function callbacks for search to use when an update should occur.
The benching in uci.cpp for example does this to extract the total nodes
searched.

No functional change

6 months agoSplit UCI into UCIEngine and Engine
Disservin [Sun, 17 Mar 2024 11:33:14 +0000 (12:33 +0100)]
Split UCI into UCIEngine and Engine

This is another refactor which aims to decouple uci from stockfish. A new engine
class manages all engine related logic and uci is a "small" wrapper around it.

In the future we should also try to remove the need for the Position object in
the uci and replace the options with an actual options struct instead of using a
map. Also convert the std::string's in the Info structs a string_view.

closes #5147

No functional change

6 months agoUpdate NNUE architecture to SFNNv9 and net nn-ae6a388e4a1a.nnue
Viren6 [Tue, 2 Apr 2024 03:38:54 +0000 (04:38 +0100)]
Update NNUE architecture to SFNNv9 and net nn-ae6a388e4a1a.nnue

Part 1: PyTorch Training, linrock

Trained with a 10-stage sequence from scratch, starting in May 2023:
https://github.com/linrock/nnue-tools/blob/master/exp-sequences/3072-10stage-SFNNv9.yml

While the training methods were similar to the L1-2560 training sequence,
the last two stages introduced min-v2 binpacks,
where bestmove capture and in-check position scores were not zeroed during minimization,
for compatibility with skipping SEE >= 0 positions and future research.

Training data can be found at:
https://robotmoon.com/nnue-training-data

This net was tested at epoch 679 of the 10th training stage:
https://tests.stockfishchess.org/tests/view/65f32e460ec64f0526c48dbc

Part 2: SPSA Training, Viren6

The net was then SPSA tuned.
This consisted of the output weights (32 * 8) and biases (8)
as well as the L3 biases (32 * 8) and L2 biases (16 * 8), totalling 648 params in total.

The SPSA tune can be found here:
https://tests.stockfishchess.org/tests/view/65fc33ba0ec64f0526c512e3

With the help of Disservin , the initial weights were extracted with:
https://github.com/Viren6/Stockfish/tree/new228

The net was saved with the tuned weights using:
https://github.com/Viren6/Stockfish/tree/new241

Earlier nets of the SPSA failed STC compared to the base 3072 net of part 1:
https://tests.stockfishchess.org/tests/view/65ff356e0ec64f0526c53c98
Therefore it is suspected that the SPSA at VVLTC has
added extra scaling on top of the scaling of increasing the L1 size.

Passed VVLTC 1:
https://tests.stockfishchess.org/tests/view/6604a9020ec64f0526c583da
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 53042 W: 13554 L: 13256 D: 26232
Ptnml(0-2): 12, 5147, 15903, 5449, 10

Passed VVLTC 2:
https://tests.stockfishchess.org/tests/view/660ad1b60ec64f0526c5dd23
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 17506 W: 4574 L: 4315 D: 8617
Ptnml(0-2): 1, 1567, 5362, 1818, 5

STC Elo estimate:
https://tests.stockfishchess.org/tests/view/660b834d01aaec5069f87cb0
Elo: -7.66 ± 3.8 (95%) LOS: 0.0%
Total: 9618 W: 2440 L: 2652 D: 4526
Ptnml(0-2): 80, 1281, 2261, 1145, 42
nElo: -13.94 ± 6.9 (95%) PairsRatio: 0.87

closes https://tests.stockfishchess.org/tests/view/660b834d01aaec5069f87cb0

bench 1823302

Co-Authored-By: Linmiao Xu <lin@robotmoon.com>
7 months agoAvoid a note related to an ABI change
Joost VandeVondele [Sat, 30 Mar 2024 09:54:36 +0000 (10:54 +0100)]
Avoid a note related to an ABI change

current master triggers a gcc note:
parameter passing for argument of type 'std::pair<double, double>' when C++17 is enabled changed to match C++14 in GCC 10.1

while this is inconsequential, and just informative  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111516 we can easily avoid it.

closes https://github.com/official-stockfish/Stockfish/pull/5145

No functional change

7 months agoImprove prerelease creation workflow
Disservin [Fri, 29 Mar 2024 09:49:53 +0000 (10:49 +0100)]
Improve prerelease creation workflow

In the last couple of months we sometimes saw duplicated prereleases uploaded to GitHub, possibly due to some racy behavior when concurrent jobs create a prerelease. This now creates an empty prerelease at the beginning of the CI and the binaries are later just attached to this one.

closes https://github.com/official-stockfish/Stockfish/pull/5144

No functional change

7 months agoFix usage of abs vs std::abs
Joost VandeVondele [Fri, 29 Mar 2024 09:25:41 +0000 (10:25 +0100)]
Fix usage of abs vs std::abs

close https://github.com/official-stockfish/Stockfish/pull/5143

No functional change

7 months agoSimplify NMP Condition
Shawn Xu [Wed, 27 Mar 2024 09:58:59 +0000 (02:58 -0700)]
Simplify NMP Condition

Remove eval >= ss->staticEval condition for Null Move Pruning.

Passed non-regression STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 44000 W: 11420 L: 11202 D: 21378
Ptnml(0-2): 174, 5243, 10978, 5401, 204
https://tests.stockfishchess.org/tests/live_elo/6603ee490ec64f0526c57984

Passed non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 82956 W: 20978 L: 20818 D: 41160
Ptnml(0-2): 54, 9353, 22499, 9523, 49
https://tests.stockfishchess.org/tests/live_elo/660464b50ec64f0526c5804d

closes https://github.com/official-stockfish/Stockfish/pull/5142

Bench 1759189

7 months agoAdjust best value after a pruned quiet move
Michael Chaly [Thu, 28 Mar 2024 21:17:37 +0000 (00:17 +0300)]
Adjust best value after a pruned quiet move

Logic somewhat similar to how we adjust best value after pruned captures
in qsearch, but in search this patch does it after pruned quiet moves
and also to not full scale of futility value but to smth in between
best value and futility value.

Passed STC:
https://tests.stockfishchess.org/tests/view/6601cf900ec64f0526c55c30
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 59936 W: 15722 L: 15369 D: 28845
Ptnml(0-2): 182, 7097, 15112, 7340, 237

Passed LTC:
https://tests.stockfishchess.org/tests/view/66029b2d0ec64f0526c566f1
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 118362 W: 29953 L: 29460 D: 58949
Ptnml(0-2): 68, 13159, 32249, 13622, 83

closes https://github.com/official-stockfish/Stockfish/pull/5141

bench 1772608

7 months agoVary time use with eval
xoto10 [Wed, 27 Mar 2024 08:20:49 +0000 (08:20 +0000)]
Vary time use with eval

Adjust time use depending on the current eval.

Passed STC :
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 101696 W: 26651 L: 26238 D: 48807
Ptnml(0-2): 400, 11602, 26459, 11959, 428
https://tests.stockfishchess.org/tests/live_elo/660187a50ec64f0526c557f6

Passed LTC :
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 60648 W: 15550 L: 15187 D: 29911
Ptnml(0-2): 40, 6356, 17171, 6715, 42
https://tests.stockfishchess.org/tests/live_elo/660298ed0ec64f0526c566d0

Values were found using two tunes with the final values taken from the ltc tune after 62k games :
stc - https://tests.stockfishchess.org/tests/view/65fb526b0ec64f0526c50694
ltc - https://tests.stockfishchess.org/tests/view/65fd36e60ec64f0526c5214b

Ideas for future work;

  * tune these values with the other TM adjustments
  * try narrower bands
  * calculate adjustment for exact eval by interpolation

closes https://github.com/official-stockfish/Stockfish/pull/5138

No functional change

7 months agoRemove material imbalance from nnue eval
Gahtan Nahdi [Fri, 22 Mar 2024 20:48:44 +0000 (03:48 +0700)]
Remove material imbalance from nnue eval

Passed non-reg STC:
https://tests.stockfishchess.org/tests/view/65fdf11f0ec64f0526c52b57
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 76480 W: 19893 L: 19712 D: 36875
Ptnml(0-2): 339, 9107, 19157, 9308, 329

Passed non-reg LTC:
https://tests.stockfishchess.org/tests/view/65fee22e0ec64f0526c53885
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 150948 W: 38078 L: 37988 D: 74882
Ptnml(0-2): 111, 16997, 41148, 17127, 91

closes https://github.com/official-stockfish/Stockfish/pull/5135

Bench: 2103324

7 months agoTweak the stats bonus and malus
FauziAkram [Sun, 24 Mar 2024 11:02:27 +0000 (14:02 +0300)]
Tweak the stats bonus and malus

For depth 1 we don't have a negative score anymore.

Passed STC:
https://tests.stockfishchess.org/tests/view/65fb055c0ec64f0526c5024f
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 117120 W: 30468 L: 30023 D: 56629
Ptnml(0-2): 526, 13759, 29539, 14216, 520

Passed LTC:
https://tests.stockfishchess.org/tests/view/65fdca4b0ec64f0526c5293f
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 54816 W: 13955 L: 13595 D: 27266
Ptnml(0-2): 30, 6046, 14897, 6404, 31

closes https://github.com/official-stockfish/Stockfish/pull/5134

Bench: 1876428

7 months agoAdd functionality to export small net
Disservin [Sat, 23 Mar 2024 09:34:32 +0000 (10:34 +0100)]
Add functionality to export small net

Usage
```
export_net <filenameBigNet> <filenameSmallNet>
```

closes https://github.com/official-stockfish/Stockfish/pull/5133

No functional change

7 months agoUpdate nnue_feature_transformer.h
mstembera [Thu, 21 Mar 2024 08:25:59 +0000 (01:25 -0700)]
Update nnue_feature_transformer.h

Unroll update_accumulator_refresh to process two
active indices simultaneously.

The compiler might not unroll effectively because
the number of active indices isn't known at
compile time.

STC https://tests.stockfishchess.org/tests/view/65faa8850ec64f0526c4fca9
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 130464 W: 33882 L: 33431 D: 63151
Ptnml(0-2): 539, 14591, 34501, 15082, 519

closes https://github.com/official-stockfish/Stockfish/pull/5125

No functional change

7 months agoVVLTC search tune
Muzhen Gaming [Sun, 17 Mar 2024 03:20:41 +0000 (11:20 +0800)]
VVLTC search tune

This set of parameters was derived from 3 tuning attempts:

    https://tests.stockfishchess.org/tests/view/65d19ab61d8e83c78bfd8436 (80+0.8 x8, ~40k games)
    Then tuned with one of linrock's early L1-3072 nets:
    https://tests.stockfishchess.org/tests/view/65def7b04b19edc854ebdec8 (VVLTC, ~36k games)
    Starting from the result of this tuning, the parameters were then tuned with the current master net:
    https://tests.stockfishchess.org/tests/view/65f11c420ec64f0526c46fc4 (VVLTC, ~45k games)

Additionally, at the start of the third tuning phase, 2 parameters were manually changed:

    Notably, the triple extension margin was decreased from 78 to 22. This idea was given by Vizvezdenec:
    https://tests.stockfishchess.org/tests/view/65f0a2360ec64f0526c46752.
    The PvNode extension margin was also adjusted from 50 to 40.

This tune also differs from previous tuning attempts by tuning the evaluation thresholds for smallnet and psqt-only.
The former was increased through the tuning, and this is hypothesized to scale better at VVLTC,
although there is not much evidence of it.

Passed VVLTC 1st sprt: https://tests.stockfishchess.org/tests/view/65f6761d0ec64f0526c4be88
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 44688 W: 11421 L: 11140 D: 22127
Ptnml(0-2): 1, 4170, 13722, 4449, 2

Passed VVLTC 2nd sprt: https://tests.stockfishchess.org/tests/view/65fa31a30ec64f0526c4f611
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 27450 W: 7057 L: 6778 D: 13615
Ptnml(0-2): 4, 2545, 8346, 2828, 2

STC Elo estimate: https://tests.stockfishchess.org/tests/view/65fd3e540ec64f0526c521ae
Elo: -7.84 ± 1.8 (95%) LOS: 0.0%
Total: 40000 W: 9899 L: 10802 D: 19299
Ptnml(0-2): 203, 5221, 10025, 4378, 173
nElo: -14.91 ± 3.4 (95%) PairsRatio: 0.84

closes https://github.com/official-stockfish/Stockfish/pull/5130

Bench: 1876107

7 months agoAdd cmath header to movepick.h
Disservin [Wed, 20 Mar 2024 15:36:10 +0000 (16:36 +0100)]
Add cmath header to movepick.h

No functional change

7 months agoRemove reduction increase on repetition
Gahtan Nahdi [Mon, 18 Mar 2024 19:45:09 +0000 (02:45 +0700)]
Remove reduction increase on repetition

Passed non-reg STC:
https://tests.stockfishchess.org/tests/view/65f89ae30ec64f0526c4e0ff
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 173568 W: 45005 L: 44936 D: 83627
Ptnml(0-2): 684, 19878, 45628, 19873, 721

Passed non-reg LTC:
https://tests.stockfishchess.org/tests/view/65fa0f370ec64f0526c4f42d
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 21138 W: 5432 L: 5216 D: 10490
Ptnml(0-2): 13, 2107, 6112, 2325, 12

closes https://github.com/official-stockfish/Stockfish/pull/5123

Bench: 2109005

7 months agoEvaluation adjustment for different eval types
Gahtan Nahdi [Fri, 15 Mar 2024 09:50:27 +0000 (16:50 +0700)]
Evaluation adjustment for different eval types

Gives different eval scaling parameters for the three different types
of evaluation (bignet, smallnet, psqtOnly).

Passed STC:
https://tests.stockfishchess.org/tests/view/65f4b0020ec64f0526c4a3bd
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 168064 W: 43507 L: 42987 D: 81570
Ptnml(0-2): 662, 19871, 42445, 20393, 661

Passed LTC:
https://tests.stockfishchess.org/tests/view/65f6be1a0ec64f0526c4c361
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 162564 W: 41188 L: 40604 D: 80772
Ptnml(0-2): 120, 18112, 44216, 18732, 102

closes https://github.com/official-stockfish/Stockfish/pull/5122

Bench: 2113576

7 months agoBase WDL model on material count and normalize evals dynamically
Robert Nurnberg [Sun, 17 Mar 2024 14:39:01 +0000 (15:39 +0100)]
Base WDL model on material count and normalize evals dynamically

This PR proposes to change the parameter dependence of Stockfish's
internal WDL model from full move counter to material count. In addition
it ensures that an evaluation of 100 centipawns always corresponds to a
50% win probability at fishtest LTC, whereas for master this holds only
at move number 32. See also
https://github.com/official-stockfish/Stockfish/pull/4920 and the
discussion therein.

The new model was fitted based on about 340M positions extracted from
5.6M fishtest LTC games from the last three weeks, involving SF versions
from e67cc979fd2c0e66dfc2b2f2daa0117458cfc462 (SF 16.1) to current
master.

The involved commands are for
[WDL_model](https://github.com/official-stockfish/WDL_model) are:
```
./updateWDL.sh --firstrev e67cc979fd2c0e66dfc2b2f2daa0117458cfc462
python scoreWDL.py updateWDL.json --plot save --pgnName update_material.png --momType "material" --momTarget 58 --materialMin 10 --modelFitting optimizeProbability
```

The anchor `58` for the material count value was chosen to be as close
as possible to the observed average material count of fishtest LTC games
at move 32 (`43`), while not changing the value of
`NormalizeToPawnValue` compared to the move-based WDL model by more than
1.

The patch only affects the displayed cp and wdl values.

closes https://github.com/official-stockfish/Stockfish/pull/5121

No functional change

7 months agoFix header name in Makefile
Disservin [Sun, 17 Mar 2024 11:34:02 +0000 (12:34 +0100)]
Fix header name in Makefile

No functional change

7 months agoConsistent use of anonymous namespace
Disservin [Sun, 17 Mar 2024 09:33:03 +0000 (10:33 +0100)]
Consistent use of anonymous namespace

Also change `bindThisThread` to match the current code style for function naming.

closes https://github.com/official-stockfish/Stockfish/pull/5118

No functional change

7 months agoClamp history bonus to stats range
Michael Chaly [Fri, 15 Mar 2024 15:55:40 +0000 (18:55 +0300)]
Clamp history bonus to stats range

Before, one always had to keep track of the bonus one assigns to a history to stop
the stats from overflowing. This is a quality of life improvement. Since this would often go unnoticed during benching.

Passed non-regression bounds:
https://tests.stockfishchess.org/tests/view/65ef2af40ec64f0526c44cbc
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 179232 W: 46513 L: 46450 D: 86269
Ptnml(0-2): 716, 20323, 47452, 20432, 693

closes https://github.com/official-stockfish/Stockfish/pull/5116

No functional change