]> git.sesse.net Git - stockfish/log
stockfish
14 months agoAdd new CPU archs in CI Tests workflow
ppigazzini [Mon, 31 Jul 2023 11:41:28 +0000 (13:41 +0200)]
Add new CPU archs in CI Tests workflow

Add CPU archs: armv8-dotprod, riscv64 and ppc64le.
The last two archs are built using QEMU multiarch docker container.

References:
https://docs.docker.com/build/building/multi-platform/
https://github.com/docker/setup-buildx-action
https://github.com/docker/setup-qemu-action
https://github.com/tonistiigi/binfmt
https://stackoverflow.com/questions/72444103/what-does-running-the-multiarch-qemu-user-static-does-before-building-a-containe

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

No functional change

14 months agoIdentify NEON_DOTPROD in compiler_info()
Niklas Fiekas [Sat, 29 Jul 2023 14:34:58 +0000 (14:34 +0000)]
Identify NEON_DOTPROD in compiler_info()

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

No functional change

15 months agoMalus during move ordering for putting pieces en prise
rn5f107s2 [Wed, 26 Jul 2023 12:31:16 +0000 (14:31 +0200)]
Malus during move ordering for putting pieces en prise

The original idea is the reverse of a previous patch [1] which added bonuses
in our move picker to moves escaping threats. In this patch, in addition to
bonuses for evading threats, we apply penalties to moves moving to threatened
squares.

Further tweaks of that basic idea resulted in this specific version which
further increases the penalty of moves moving to squares threatend depending
on the piece threatening it. So for example a queen moving to a square attacked
by a pawn would receive a larger penalty than a queen moving to square attacked
by a rook.

[1]: https://github.com/official-stockfish/Stockfish/commit/08e0f52b77edb929989c68c49e954b9bc5d7d67e

--------

Passed STC:
https://tests.stockfishchess.org/tests/live_elo/64c11269dc56e1650abb935d
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 95552 W: 24654 L: 24250 D: 46648
Ptnml(0-2): 322, 11098, 24562, 11442, 352

Passed LTC:
https://tests.stockfishchess.org/tests/live_elo/64c2004ddc56e1650abba8b3
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 190230 W: 48806 L: 48178 D: 93246
Ptnml(0-2): 90, 20439, 53453, 21019, 114

-------

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

Bench: 1350831

15 months agoImprove some comments
Stéphane Nicolet [Fri, 28 Jul 2023 21:38:37 +0000 (23:38 +0200)]
Improve some comments

- clarify the examples for the bench command
- typo  in search.cpp

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

No functional change

15 months agoRemove unused return type from propagate()
mstembera [Tue, 25 Jul 2023 02:02:49 +0000 (19:02 -0700)]
Remove unused return type from propagate()

Also make two get_weight_index() static methods constexpr, for
consistency with the other static get_hash_value() method right above.
Tested for speed by user Torom (thanks).

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

No functional change

15 months agoSimplify one multicut extension
FauziAkram [Tue, 25 Jul 2023 10:55:29 +0000 (13:55 +0300)]
Simplify one multicut extension

Simplify away the ttValue <= alpha extension in the multicut block.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 318336 W: 81307 L: 81398 D: 155631
Ptnml(0-2): 1088, 37291, 82469, 37264, 1056
https://tests.stockfishchess.org/tests/view/64b8589fdc56e1650abad61d

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 89388 W: 22925 L: 22775 D: 43688
Ptnml(0-2): 34, 9635, 25210, 9777, 38
https://tests.stockfishchess.org/tests/view/64bc41d0dc56e1650abb29cb

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

bench: 1604592

15 months agoRemove Zobrist::noPawns
Stephen Touset [Mon, 24 Jul 2023 22:06:14 +0000 (00:06 +0200)]
Remove Zobrist::noPawns

Zobrist::noPawns is no longer used.

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

no functional change

15 months agoSimplify TT cutoff
Stefan Geschwentner [Thu, 20 Jul 2023 20:12:15 +0000 (22:12 +0200)]
Simplify TT cutoff

Remove the exact bound condition from TT depth check.

STC:
https://tests.stockfishchess.org/tests/view/64b30b320cdec37b957359e9
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 332928 W: 84895 L: 85003 D: 163030
Ptnml(0-2): 1242, 39200, 85604, 39260, 1158

LTC:
https://tests.stockfishchess.org/tests/view/64b74e2adc56e1650abac0b6
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 92946 W: 23628 L: 23482 D: 45836
Ptnml(0-2): 38, 10033, 26192, 10165, 45

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

Bench: 1601764

15 months agoSimplify some qsearch conditions
windfishballad [Sun, 23 Jul 2023 00:35:40 +0000 (20:35 -0400)]
Simplify some qsearch conditions

Use the assert which ensures that beta == alpha+1 at PVNodes
to simplify a little bit the conditions further down in the code.

passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 56160 W: 14370 L: 14173 D: 27617
Ptnml(0-2): 210, 6192, 15076, 6395, 207
https://tests.stockfishchess.org/tests/view/64bc769cdc56e1650abb2e26

closes https://tests.stockfishchess.org/tests/view/64bc769cdc56e1650abb2e26

No functional change

15 months agoCheck clock more often
Joost VandeVondele [Sat, 22 Jul 2023 07:41:55 +0000 (09:41 +0200)]
Check clock more often

This patch changes the frequency with which the time is checked, changing
frequency from every 1024 counted nodes to every 512 counted nodes. The
master value was tuned for the old classical eval, the patch takes the
roughly 2x slowdown in nps with SFNNUEv7 into account. This could reduce
a bit the losses on time on fishtest, but they are probably unrelated.

passed STC:
https://tests.stockfishchess.org/tests/view/64bb8ae5dc56e1650abb1b11
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 76576 W: 19677 L: 19501 D: 37398
Ptnml(0-2): 274, 8592, 20396, 8736, 290

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

No functional change

15 months agoDo more futility pruning for cutNodes that are not in TT
Michael Chaly [Wed, 19 Jul 2023 08:58:02 +0000 (11:58 +0300)]
Do more futility pruning for cutNodes that are not in TT

This is somewhat similar to IIR for cutnodes but instead of reducing
depth for cutnodes that don't have tt move we reduce margin multiplier
in futility pruning for cutnodes that are not in TT.

Passed STC:
https://tests.stockfishchess.org/tests/view/64b244b90cdec37b95734c5b
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 75552 W: 19404 L: 19029 D: 37119
Ptnml(0-2): 233, 8806, 19378, 9071, 288

Passed LTC:
https://tests.stockfishchess.org/tests/view/64b3ae5a0cdec37b95736516
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 104988 W: 27152 L: 26697 D: 51139
Ptnml(0-2): 41, 11259, 29446, 11700, 48

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

bench 1727577

15 months agoRemove inline assembly
mstembera [Tue, 18 Jul 2023 18:50:34 +0000 (11:50 -0700)]
Remove inline assembly

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

No functional change

15 months agoUnused code cleanup
Cody Ho [Tue, 18 Jul 2023 20:03:26 +0000 (13:03 -0700)]
Unused code cleanup

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

No functional change

15 months agoAdd CodeQL workflow
Jorge [Mon, 3 Jul 2023 07:17:24 +0000 (09:17 +0200)]
Add CodeQL workflow

add CI tooling to detect security bugs.

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

No functional change

15 months agoRemoves a few Bitboards and functions
rn5f107s2 [Mon, 17 Jul 2023 19:41:03 +0000 (21:41 +0200)]
Removes a few Bitboards and functions

No longer used

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

No functional change

15 months agoremove evalType from bench
Robert Nurnberg @ elitebook [Mon, 17 Jul 2023 16:02:22 +0000 (18:02 +0200)]
remove evalType from bench

no longer used

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

No functional change

15 months agoSwitch to macos 13 for CI
Joost VandeVondele [Sun, 16 Jul 2023 16:14:38 +0000 (18:14 +0200)]
Switch to macos 13 for CI

allows for building x86-64-avx2 and x86-64-bmi2 binaries for mac

install coreutils
show hardware capabilities as seen by the compilers
move some tests from sse41 to avx2 as platforms support it

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

No functional change

15 months agoDeprecate the x86-64-modern arch
Joost VandeVondele [Sun, 16 Jul 2023 14:25:03 +0000 (16:25 +0200)]
Deprecate the x86-64-modern arch

Explicitly describe the architecture as deprecated,
it remains available as its current alias x86-64-sse41-popcnt

CPUs that support just this instruction set are now years old,
any few years old Intel or AMD CPU supports x86-64-avx2. However,
naming things 'modern' doesn't age well, so instead use explicit names.

Adjust CI accordingly. Wiki, fishtest, downloader done as well.

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

No functional change.

15 months agoRemove improvement variable
Michael Chaly [Sun, 16 Jul 2023 08:52:37 +0000 (11:52 +0300)]
Remove improvement variable

No longer used in a meaningful way.
Improve comments.

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

No functional change

15 months agoRemove pawnKey from StateInfo
maxim [Thu, 13 Jul 2023 16:09:02 +0000 (19:09 +0300)]
Remove pawnKey from StateInfo

Remove pawnKey since it is not used anymore.

Passed Non-regression STC:
https://tests.stockfishchess.org/tests/view/64b023110cdec37b9573265c
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 334848 W: 85440 L: 85545 D: 163863
Ptnml(0-2): 1134, 38101, 89075, 37964, 1150

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

No functional change

15 months agoConsolidate to centipawns conversion
Joost VandeVondele [Sat, 15 Jul 2023 11:34:16 +0000 (13:34 +0200)]
Consolidate to centipawns conversion

avoid doing this calculations in multiple places.

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

No functional change

15 months agoRemove some CI parts not yet working
Joost VandeVondele [Sat, 15 Jul 2023 09:59:27 +0000 (11:59 +0200)]
Remove some CI parts not yet working

downgrading compiler didn't work for windows build. Stick to gcc 13 for now.
Windows x86-32 not a 32bit binary, remove.

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

No functional change

15 months agoremove large input specialization
AndrovT [Sat, 15 Jul 2023 09:00:18 +0000 (11:00 +0200)]
remove large input specialization

Removes unused large input specialization for dense affine transform. It has been obsolete since #4612 was merged.

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

No functional change

15 months agoReintroduce nnue eval pawn count multipliers again
Linmiao Xu [Mon, 3 Jul 2023 02:26:52 +0000 (22:26 -0400)]
Reintroduce nnue eval pawn count multipliers again

With separate multipliers for nnue eval and optimism scaling.
This patch used 4 out of 7 params tuned with spsa at 30+0.3
using this tuning config:

Value LazyThreshold1 = Value(3622);
Value LazyThreshold2 = Value(1962);
int psqThresh = 2048;
int nnueNpmBase = 945;
int nnuePcMult = 0;
int optNpmBase = 150;
int optPcMult = 0;
TUNE(SetRange(3322, 3922), LazyThreshold1);
TUNE(SetRange(1662, 2262), LazyThreshold2);
TUNE(SetRange(1748, 2348), psqThresh);
TUNE(SetRange(745, 1145), nnueNpmBase);
TUNE(SetRange(-16, 16), nnuePcMult);
TUNE(SetRange(0, 300), optNpmBase);
TUNE(SetRange(-16, 16), optPcMult);

Passed STC:
https://tests.stockfishchess.org/tests/view/64a5a9b402cd07745c60ed07
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 173632 W: 44417 L: 43903 D: 85312
Ptnml(0-2): 547, 20025, 45068, 20719, 457

Passed LTC:
https://tests.stockfishchess.org/tests/view/64a972a302cd07745c6136af
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 277644 W: 70955 L: 70147 D: 136542
Ptnml(0-2): 193, 29902, 77787, 30784, 156

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

bench 1556301

15 months agoBuild and test more binaries in CI
Joost VandeVondele [Fri, 14 Jul 2023 15:43:56 +0000 (17:43 +0200)]
Build and test more binaries in CI

use a fixed compiler on Linux and Windows (right now gcc 11).
build avxvnni on Windows (Linux needs updated core utils)
build x86-32 on Linux (Windows needs other mingw)
fix a Makefile issue where a failed PGOBENCH would not stop the build
reuse the WINE_PATH for SDE as we do for QEMU
use WINE_PATH variable also for the signature
verify the bench for each of the binaries
do not build x86-64-avx2 on macos

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

No functional change

15 months agoUse more expressive names for bonus1 and bonus2
FauziAkram [Fri, 14 Jul 2023 21:51:14 +0000 (00:51 +0300)]
Use more expressive names for bonus1 and bonus2

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

No functional change

15 months agoGenerate binaries for more advanced architectures
Joost VandeVondele [Wed, 12 Jul 2023 17:34:07 +0000 (19:34 +0200)]
Generate binaries for more advanced architectures

use intel's Software Development Emulator (SDE) in the actions that build the binaries.
This allows for building on Windows and Linux binaries for
- x86-64-avx512
- x86-64-vnni256
- x86-64-vnni512

(x86-64-avxvnni needs more recent gcc in the actions)

also build x86-64-avx2 on macos.

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

No functional change

15 months agoMore simplifications and cleanup in affine_transform_sparse_input.h
mstembera [Wed, 12 Jul 2023 05:19:48 +0000 (22:19 -0700)]
More simplifications and cleanup in affine_transform_sparse_input.h

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

No functional change

15 months agoCleanup code after removal of classical evaluation
Sebastian Buchwald [Wed, 12 Jul 2023 17:46:33 +0000 (19:46 +0200)]
Cleanup code after removal of classical evaluation

This includes the following changes:
- Remove declaration of removed global variable
- Adapt string that mentions removed UCI option

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

No functional change

15 months agoRemove classical evaluation
Joost VandeVondele [Thu, 1 Jun 2023 06:09:07 +0000 (08:09 +0200)]
Remove classical evaluation

since the introduction of NNUE (first released with Stockfish 12), we
have maintained the classical evaluation as part of SF in frozen form.
The idea that this code could lead to further inputs to the NN or
search did not materialize. Now, after five releases, this PR removes
the classical evaluation from SF. Even though this evaluation is
probably the best of its class, it has become unimportant for the
engine's strength, and there is little need to maintain this
code (roughly 25% of SF) going forward, or to expend resources on
trying to improve its integration in the NNUE eval.

Indeed, it had still a very limited use in the current SF, namely
for the evaluation of positions that are nearly decided based on
material difference, where the speed of the classical evaluation
outweights its inaccuracies. This impact on strength is small,
roughly 2Elo, and probably decreasing in importance as the TC grows.

Potentially, removal of this code could lead to the development of
techniques to have faster, but less accurate NN evaluation,
for certain positions.

STC
https://tests.stockfishchess.org/tests/view/64a320173ee09aa549c52157
Elo: -2.35 ± 1.1 (95%) LOS: 0.0%
Total: 100000 W: 24916 L: 25592 D: 49492
Ptnml(0-2): 287, 12123, 25841, 11477, 272
nElo: -4.62 ± 2.2 (95%) PairsRatio: 0.95

LTC
https://tests.stockfishchess.org/tests/view/64a320293ee09aa549c5215b
 Elo: -1.74 ± 1.0 (95%) LOS: 0.0%
Total: 100000 W: 25010 L: 25512 D: 49478
Ptnml(0-2): 44, 11069, 28270, 10579, 38
nElo: -3.72 ± 2.2 (95%) PairsRatio: 0.96

VLTC SMP
https://tests.stockfishchess.org/tests/view/64a3207c3ee09aa549c52168
 Elo: -1.70 ± 0.9 (95%) LOS: 0.0%
Total: 100000 W: 25673 L: 26162 D: 48165
Ptnml(0-2): 8, 9455, 31569, 8954, 14
nElo: -3.95 ± 2.2 (95%) PairsRatio: 0.95

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

Bench: 1444646

15 months agoSimplify PvNode reduction
Muzhen Gaming [Fri, 7 Jul 2023 12:19:31 +0000 (20:19 +0800)]
Simplify PvNode reduction

Simplification STC: https://tests.stockfishchess.org/tests/view/64a415803ee09aa549c539c3
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 37856 W: 9719 L: 9504 D: 18633
Ptnml(0-2): 98, 4277, 9977, 4464, 112

Simplification LTC: https://tests.stockfishchess.org/tests/view/64a5ffe202cd07745c60f360
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 55878 W: 14323 L: 14138 D: 27417
Ptnml(0-2): 21, 5993, 15732, 6166, 27

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

Bench: 2604965

15 months agoFix CI output
Joost VandeVondele [Thu, 6 Jul 2023 21:29:11 +0000 (23:29 +0200)]
Fix CI output

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

No functional change

15 months agoUpdate default net to nn-c38c3d8d3920.nnue
Linmiao Xu [Mon, 26 Jun 2023 00:57:50 +0000 (20:57 -0400)]
Update default net to nn-c38c3d8d3920.nnue

This was a later epoch from the same experiment that led to the
previous master net. After training, it was prepared the same way:

1. greedy permuting L1 weights with https://github.com/official-stockfish/Stockfish/pull/4620
2. leb128 compression with https://github.com/glinscott/nnue-pytorch/pull/251
3. greedy 2- and 3- cycle permuting with https://github.com/official-stockfish/Stockfish/pull/4640

Local elo at 25k nodes per move (vs. L1-1536 nn-fdc1d0fe6455.nnue):
nn-epoch739.nnue : 20.2 +/- 1.7

Passed STC:
https://tests.stockfishchess.org/tests/view/64a050b33ee09aa549c4e4c8
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 195552 W: 49977 L: 49430 D: 96145
Ptnml(0-2): 556, 22775, 50607, 23242, 596

Passed LTC:
https://tests.stockfishchess.org/tests/view/64a127bd3ee09aa549c4f60c
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 235452 W: 60327 L: 59609 D: 115516
Ptnml(0-2): 119, 25173, 66426, 25887, 121

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

bench 2427629

15 months agoAdd armv8-dotprod to CI binaries
Joost VandeVondele [Wed, 5 Jul 2023 18:15:49 +0000 (20:15 +0200)]
Add armv8-dotprod to CI binaries

also generate binaries for more recent Android hardware.

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

No functional change

15 months agoSimplify away lookup_count.
mstembera [Mon, 3 Jul 2023 19:59:42 +0000 (12:59 -0700)]
Simplify away lookup_count.

https://tests.stockfishchess.org/tests/view/64a3c1a93ee09aa549c53167
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 32832 W: 8497 L: 8280 D: 16055
Ptnml(0-2): 80, 3544, 8967, 3729, 96

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

No functional change

15 months agoRevise extract bench from git log in CI
Joost VandeVondele [Thu, 6 Jul 2023 16:30:51 +0000 (18:30 +0200)]
Revise extract bench from git log in CI

order commits differently

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

No functional change

15 months agoRemove leftover braces for if conditional in CI
ppigazzini [Mon, 3 Jul 2023 17:41:13 +0000 (19:41 +0200)]
Remove leftover braces for if conditional in CI

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

No functional change

15 months agoExtract bench according to wiki instructions
ppigazzini [Fri, 16 Jun 2023 11:01:20 +0000 (13:01 +0200)]
Extract bench according to wiki instructions

- loop through the commits starting from the latest one
- read the bench value from the last match, if any, of the template
  in the commit body text

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

No functional change

15 months agosimplified gives check castling
rn5f107s2 [Fri, 16 Jun 2023 16:49:31 +0000 (18:49 +0200)]
simplified gives check castling

tested verifying perft and bench is unchanged
on a larger set of epds for both standard and FRC chess.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/live_elo/648587be65ffe077ca123d78
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 153632 W: 41015 L: 40928 D: 71689
Ptnml(0-2): 377, 16077, 43816, 16174, 372

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

No functional change

15 months agoImproving grammar and readability of comments
FauziAkram [Tue, 27 Jun 2023 12:13:59 +0000 (15:13 +0300)]
Improving grammar and readability of comments

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

No functional change

15 months agoSimplify score improvement reduction
Muzhen Gaming [Thu, 22 Jun 2023 11:19:21 +0000 (19:19 +0800)]
Simplify score improvement reduction

Reduce depth by 2 based on score improvement, only for depths 3 to 11.

Simplification STC: https://tests.stockfishchess.org/tests/view/64929a53dc7002ce609c7807
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 238912 W: 63466 L: 63468 D: 111978
Ptnml(0-2): 564, 26262, 65805, 26262, 563

Simplification LTC: https://tests.stockfishchess.org/tests/view/64942e47dc7002ce609c9e07
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 64452 W: 17485 L: 17320 D: 29647
Ptnml(0-2): 19, 6161, 19706, 6316, 24

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

Bench: 2740142

15 months agoSimplify away improvement term in null move search
Muzhen Gaming [Wed, 28 Jun 2023 10:36:11 +0000 (18:36 +0800)]
Simplify away improvement term in null move search

passed STC:
https://tests.stockfishchess.org/tests/view/649c0d2edc7002ce609d33b5
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 271104 W: 72181 L: 72217 D: 126706
Ptnml(0-2): 691, 30042, 74129, 29992, 698

passed LTC:
https://tests.stockfishchess.org/tests/view/649d0dd7dc7002ce609d4efa
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 183120 W: 49469 L: 49418 D: 84233
Ptnml(0-2): 84, 17636, 56063, 17699, 78

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

Bench: 2642851

15 months agoFix pruning to (in TB loss) in Null move pruning.
peregrineshahin [Tue, 27 Jun 2023 03:07:20 +0000 (06:07 +0300)]
Fix pruning to (in TB loss) in Null move pruning.

Current logic can apply Null move pruning
on a dead-lost position returning an unproven loss
(i.e. in TB loss score or mated in losing score) on nonPv nodes.

on a default bench, this can be observed by adding this debugging line:
```
if (nullValue >= beta)
{
    // Do not return unproven mate or TB scores
    nullValue = std::min(nullValue, VALUE_TB_WIN_IN_MAX_PLY-1);
    dbg_hit_on(nullValue <= VALUE_TB_LOSS_IN_MAX_PLY); // Hit #0: Total 73983 Hits 1 Hit Rate (%) 0.00135166
    if (thisThread->nmpMinPly || depth < 14)
        return nullValue;
```

This fixes this very rare issue (happens at ~0.00135166% of the time) by
eliminating the need to try Null Move Pruning with dead-lost positions
and leaving it to be determined by a normal searching flow.

The previous try to fix was not as safe enough because it was capping
the returned value to (out of TB range) thus reviving the dead-lost position
based on an artificial clamp (i.e. the in TB score/mate score can be lost on that nonPv node):
https://tests.stockfishchess.org/tests/view/649756d5dc7002ce609cd794

Final fix:
Passed STC:
https://tests.stockfishchess.org/tests/view/649a5446dc7002ce609d1049
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 577280 W: 153613 L: 153965 D: 269702
Ptnml(0-2): 1320, 60594, 165190, 60190, 1346

Passed LTC:
https://tests.stockfishchess.org/tests/view/649cd048dc7002ce609d4801
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 246432 W: 66769 L: 66778 D: 112885
Ptnml(0-2): 83, 22105, 78847, 22100, 81

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

Bench: 2425978

15 months agoSimplify lookup_count and clean up pieces().
mstembera [Mon, 3 Jul 2023 02:48:18 +0000 (19:48 -0700)]
Simplify lookup_count and clean up pieces().

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

No functional change

15 months agoAdd bmi2 to CI generated binaries
disservin [Mon, 3 Jul 2023 06:20:56 +0000 (08:20 +0200)]
Add bmi2 to CI generated binaries

verify bench for avx2 and bmi2 as well

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

No functional change

16 months agoMake posix and msys2 shells consistent in CI
ppigazzini [Sat, 1 Jul 2023 12:36:52 +0000 (14:36 +0200)]
Make posix and msys2 shells consistent in CI

In CI, it is typical for the process to halt immediately when an error
is encountered. However, with our `shell: bash {0}` configuration,
the process continues despite errors for posix shells.
This commit updates the behavior of posix and msys2 shells to ensure
consistency in terms of pipeline exit codes and stop conditions.
We adopt the most appropriate default behavior as recommended
by the GitHub documentation.

Update the code that searches for the bench value in the git log:
- to be compatible with the new shell settings
- to retry the value from the first line that contains
  only the template and spaces/tabs/newlines

see also

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
https://github.com/msys2/setup-msys2/blob/main/main.js

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

No functional change

16 months agoUpdate NNUE architecture to SFNNv7 with larger L1 size of 2048
Linmiao Xu [Sun, 25 Jun 2023 21:44:28 +0000 (17:44 -0400)]
Update NNUE architecture to SFNNv7 with larger L1 size of 2048

Creating this net involved:
- a 5-step training process from scratch
- greedy permuting L1 weights with https://github.com/official-stockfish/Stockfish/pull/4620
- leb128 compression with https://github.com/glinscott/nnue-pytorch/pull/251
- greedy 2- and 3- cycle permuting with https://github.com/official-stockfish/Stockfish/pull/4640

The 5 training steps were:

1. 400 epochs, lambda 1.0, lr 9.75e-4
   UHOx2-wIsRight-multinet-dfrc-n5000-largeGensfen-d9.binpack (178G)
     nodes5000pv2_UHO.binpack
     data_pv-2_diff-100_nodes-5000.binpack
     wrongIsRight_nodes5000pv2.binpack
     multinet_pv-2_diff-100_nodes-5000.binpack
     dfrc_n5000.binpack
     large_gensfen_multipvdiff_100_d9.binpack
   ep399 chosen as start model for step2

2. 800 epochs, end-lambda 0.75, skip 16
   LeelaFarseer-T78juntoaugT79marT80dec.binpack (141G)
     T60T70wIsRightFarseerT60T74T75T76.binpack
     test78-junjulaug2022-16tb7p.no-db.min.binpack
     test79-mar2022-16tb7p.no-db.min.binpack
     test80-dec2022-16tb7p.no-db.min.binpack
   ep559 chosen as start model for step3

3. 800 epochs, end-lambda 0.725, skip 20
   leela96-dfrc99-v2-T80dectofeb-sk20-mar-v6-T77decT78janfebT79apr.binpack (223G)
     leela96-filt-v2.min.binpack
     dfrc99-16tb7p-eval-filt-v2.min.binpack
     test80-dec2022-16tb7p-filter-v6-sk20.min-mar2023.binpack
     test80-jan2023-16tb7p-filter-v6-sk20.min-mar2023.binpack
     test80-feb2023-16tb7p-filter-v6-sk20.min-mar2023.binpack
     test80-mar2023-2tb7p-filter-v6.min.binpack
     test77-dec2021-16tb7p.no-db.min.binpack
     test78-janfeb2022-16tb7p.no-db.min.binpack
     test79-apr2022-16tb7p.no-db.min.binpack
   ep499 chosen as start model for step4

4. 800 epochs, end-lambda 0.7, skip 24
   0dd1cebea57 dataset https://github.com/official-stockfish/Stockfish/pull/4606
   ep599 chosen as start model for step5

5. 800 epochs, end-lambda 0.7, skip 28
   same dataset as step4
   ep619 became nn-1b951f8b449d.nnue

For the final step5 training:

python3 easy_train.py \
  --experiment-name L1-2048-S5-sameData-sk28-S4-0dd1cebea57-shuffled-S3-leela96-dfrc99-v2-T80dectofeb-sk20-mar-v6-T77decT78janfebT79apr-sk20-S2-LeelaFarseerT78T79T80-ep399-S1-UHOx2-wIsRight-multinet-dfrc-n5000-largeGensfen-d9 \
  --training-dataset /data/leela96-dfrc99-T60novdec-v2-T80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd-T80apr.binpack \
  --early-fen-skipping 28 \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes-L1-2048 \
  --engine-test-branch linrock/Stockfish/L1-2048 \
  --start-from-engine-test-net False \
  --start-from-model /data/experiments/experiment_L1-2048-S4-0dd1cebea57-shuffled-S3-leela96-dfrc99-v2-T80dectofeb-sk20-mar-v6-T77decT78janfebT79apr-sk20-S2-LeelaFarseerT78T79T80-ep399-S1-UHOx2-wIsRight-multinet-dfrc-n5000-largeGensfen-d9/training/run_0/nn-epoch599.nnue
  --max_epoch 800 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --tui False \
  --seed $RANDOM \
  --gpus 0

SF training data components for the step1 dataset:
https://drive.google.com/drive/folders/1yLCEmioC3Xx9KQr4T7uB6GnLm5icAYGU

Leela training data for steps 2-5 can be found at:
https://robotmoon.com/nnue-training-data/

Due to larger L1 size and slower inference, the speed penalty loses elo
at STC. Measurements from 100 bench runs at depth 13 with x86-64-modern
on Intel Core i5-1038NG7 2.00GHz:

sf_base =  1240730  +/-   3443 (95%)
sf_test =  1153341  +/-   2832 (95%)
diff    =   -87388  +/-   1616 (95%)
speedup = -7.04330% +/- 0.130% (95%)

Local elo at 25k nodes per move (vs. L1-1536 nn-fdc1d0fe6455.nnue):
nn-epoch619.nnue : 21.1 +/- 3.2

Failed STC:
https://tests.stockfishchess.org/tests/view/6498ee93dc7002ce609cf979
LLR: -2.95 (-2.94,2.94) <0.00,2.00>
Total: 11680 W: 3058 L: 3299 D: 5323
Ptnml(0-2): 44, 1422, 3149, 1181, 44

LTC:
https://tests.stockfishchess.org/tests/view/649b32f5dc7002ce609d20cf
Elo: 0.68 ± 1.5 (95%) LOS: 80.5%
Total: 40000 W: 10887 L: 10809 D: 18304
Ptnml(0-2): 36, 3938, 11958, 4048, 20
nElo: 1.50 ± 3.4 (95%) PairsRatio: 1.02

Passed VLTC 180+1.8:
https://tests.stockfishchess.org/tests/view/64992b43dc7002ce609cfd20
LLR: 3.06 (-2.94,2.94) <0.00,2.00>
Total: 38086 W: 10612 L: 10338 D: 17136
Ptnml(0-2): 9, 3316, 12115, 3598, 5

Passed VLTC SMP 60+0.6 th 8:
https://tests.stockfishchess.org/tests/view/649a21fedc7002ce609d0c7d
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 38936 W: 11091 L: 10820 D: 17025
Ptnml(0-2): 1, 2948, 13305, 3207, 7

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

Bench: 2505168

16 months agoNegative extension on cutNodes based on depth
cj5716 [Mon, 26 Jun 2023 11:40:22 +0000 (19:40 +0800)]
Negative extension on cutNodes based on depth

This patch was inspired by candirufish original attempt at negative extensions
here that failed yellow: https://tests.stockfishchess.org/tests/view/6486529065ffe077ca124f32

I tested some variations of the idea and tuned a depth condition for
a modified version of it here https://tests.stockfishchess.org/tests/view/648db80a91c58631ce31fe00
after noticing abnormal scaling (ie many passed STC but not LTC)
After some small tweaks I got the final version here

Passed STC:
LLR: 2.98 (-2.94,2.94) <0.00,2.00>
Total: 122208 W: 32776 L: 32350 D: 57082
Ptnml(0-2): 310, 13250, 33553, 13686, 305
https://tests.stockfishchess.org/tests/view/64997934dc7002ce609d01e3

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 145092 W: 39617 L: 39115 D: 66360
Ptnml(0-2): 54, 13691, 44552, 14197, 52
https://tests.stockfishchess.org/tests/view/649a1c5ddc7002ce609d0bff

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

Bench: 2637784

16 months agoDocument the LEB128 patch
Stéphane Nicolet [Tue, 27 Jun 2023 10:03:00 +0000 (12:03 +0200)]
Document the LEB128 patch

Add some comments and harmonize style for the LEB128 patch.

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

No functional change

16 months agoUpdate default net to nn-a3d1bfca1672.nnue
Daniel Monroe [Fri, 23 Jun 2023 22:36:27 +0000 (18:36 -0400)]
Update default net to nn-a3d1bfca1672.nnue

faster permutation of master net weights

Activation data taken from https://drive.google.com/drive/folders/1Ec9YuuRx4N03GPnVPoQOW70eucOKngQe?usp=sharing
Permutation found using https://github.com/Ergodice/nnue-pytorch/blob/836387a0e5e690431d404158c46648710f13904d/ftperm.py
See also https://github.com/glinscott/nnue-pytorch/pull/254

The algorithm greedily selects 2- and 3-cycles that can be permuted to increase the number of runs of zeroes. The percent of zero runs from the master net increased from 68.46 to 70.11 from 2-cycles and only increased to 70.32 when considering 3-cycles. Interestingly, allowing both halves of L1 to intermix when creating zero runs can give another 0.5% zero-run density increase with this method.

Measured speedup:

```
CPU: 16 x AMD Ryzen 9 3950X 16-Core Processor
Result of 50 runs

base (./stockfish.master ) = 1561556 +/- 5439
test (./stockfish.patch ) = 1575788 +/- 5427
diff = +14231 +/- 2636

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

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

No functional change

16 months agoRestore development
Joost VandeVondele [Sat, 1 Jul 2023 10:18:46 +0000 (12:18 +0200)]
Restore development

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

No functional change

16 months agoStockfish 16
Joost VandeVondele [Sat, 24 Jun 2023 06:58:17 +0000 (08:58 +0200)]
Stockfish 16

Official release version of Stockfish 16

Bench: 2593605

---

Stockfish 16

A new major release of Stockfish is now available at

https://stockfishchess.org/download/

*Quality of chess play*

Stockfish continues to demonstrate its ability to discover superior moves
with remarkable speed. In self-play against Stockfish 15, this new
release gains up to 50 Elo[1] and wins up to 12 times more game pairs[2]
than it loses. In major chess engine tournaments, Stockfish reliably tops
the rankings[3] winning the TCEC season 24 Superfinal, Swiss, Fischer
Random, and Double Random Chess tournaments and the CCC 19 Bullet,
20 Blitz, and 20 Rapid competitions. Leela Chess Zero[4] was the
challenger in most finals, putting top-engine chess now firmly in the
hands of teams embracing free and open-source software.

*Progress made*

This updated version of Stockfish introduces several enhancements,
including an upgraded neural net architecture (SFNNv6)[5], improved
implementation, and refined parameterization. The ongoing utilization
of Leela’s data combined with a novel inference approach exploiting
sparsity[6], and network compression[7] ensure a speedy evaluation and
modest binary sizes while allowing for more weights and higher accuracy.
The search has undergone more optimization, leading to improved
performance, particularly in longer analyses[8]. Additionally,
the Fishtest framework has been improved and is now able to run the
tests needed to validate new ideas with 10000s of CPU cores.

*Usability improvements*

Stockfish now comes with documentation, found in the wiki folder when
downloading it or on GitHub[9]. Additionally, Stockfish now includes
a clear and consistent forced tablebase win score, displaying a value
of 200 minus the number of plies required to reach a tablebase win[10].
Furthermore, the UCI_Elo option, to reduce its strength, has been
calibrated[11]. It is worth noting that the evaluation system remains
consistent with Stockfish 15.1[12], maintaining the choice that 100cp
means a 50% chance of winning the game against an equal opponent[13].
Finally, binaries of our latest development version are now provided
continuously as pre-releases on GitHub making it easier for
enthusiasts to download the latest and strongest version of
the program[14], we thank Roman Korba for having provided a similar
service for a long time.

*Thank you*

The success of the Stockfish project relies on the vibrant community
of passionate enthusiasts (we appreciate each and every one of you!)
who generously contribute their knowledge, time, and resources.
Together, this dedicated community works towards the common goal of
developing a powerful, freely accessible, and open-source chess engine.
We invite all chess enthusiasts to join the Fishtest testing framework
and contribute to the project[15].

The Stockfish team

[1] https://tests.stockfishchess.org/tests/view/649409f0dc7002ce609c99cc
[2] https://tests.stockfishchess.org/tests/view/649409d7dc7002ce609c99c6
[3] https://en.wikipedia.org/wiki/Stockfish_(chess)#Competition_results
[4] https://lczero.org/
[5] https://github.com/official-stockfish/Stockfish/commit/c1fff71
[6] https://github.com/official-stockfish/Stockfish/commit/38e6166
[7] https://github.com/official-stockfish/Stockfish/commit/a46087e
[8] https://github.com/official-stockfish/Stockfish/commit/472e726
[9] https://github.com/official-stockfish/Stockfish/wiki/
[10] https://github.com/official-stockfish/Stockfish/commit/def2966
[11] https://github.com/official-stockfish/Stockfish/commit/a08b8d4
[12] https://github.com/official-stockfish/Stockfish/commit/52e84e4
[13] https://github.com/official-stockfish/Stockfish/wiki/Stockfish-FAQ#interpretation-of-the-stockfish-evaluation
[14] https://github.com/official-stockfish/Stockfish/releases?q=prerelease%3Atrue
[15] https://stockfishchess.org/get-involved/

16 months agoUpdate default net to nn-5af11540bbfe.nnue
Linmiao Xu [Wed, 21 Jun 2023 04:43:46 +0000 (00:43 -0400)]
Update default net to nn-5af11540bbfe.nnue

Created by retraining the sparsified master net (nn-cd2ff4716c34.nnue) on
a 100% minified dataset including Leela transformers data from T80 may2023.

Weights permuted with the exact methods and code in:
https://github.com/official-stockfish/Stockfish/pull/4620

LEB128 compression done with the new serialize.py param in:
https://github.com/glinscott/nnue-pytorch/pull/251

Initially trained with max epoch 800. Around epoch 780, training was paused
and max epoch raised to 960.

python3 easy_train.py \
  --experiment-name L1-1536-sparse-master-retrain \
  --training-dataset /data/leela96-dfrc99-v2-T60novdecT77decT78jantosepT79aprmayT80juntonovjan-v6dd-T80febtomay2023.min.binpack \
  --early-fen-skipping 27 \
  --start-from-engine-test-net True \
  --max_epoch 960 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --tui False \
  --seed $RANDOM \
  --gpus 0

For preparing the training dataset (interleaved size 328G):

python3 interleave_binpacks.py \
  leela96-filt-v2.min.binpack \
  dfrc99-16tb7p-eval-filt-v2.min.binpack \
  filt-v6-dd-min/test60-novdec2021-12tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test77-dec2021-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test78-jantomay2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test78-juntosep2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test79-apr2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test79-may2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-jun2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-jul2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-aug2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-sep2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-oct2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-nov2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-jan2023-16tb7p-filter-v6-dd.min.binpack \
  test80-2023/test80-feb2023-16tb7p-no-db.min.binpack \
  test80-2023/test80-mar2023-2tb7p-no-db.min.binpack \
  test80-2023/test80-apr2023-2tb7p-no-db.min.binpack \
  test80-2023/test80-may2023-2tb7p-no-db.min.binpack \
  /data/leela96-dfrc99-v2-T60novdecT77decT78jantosepT79aprmayT80juntonovjan-v6dd-T80febtomay2023.min.binpack

Minified binpacks and Leela T80 training data from 2023 available at:
https://robotmoon.com/nnue-training-data/

Local elo at 25k nodes per move:
nn-epoch879.nnue : 3.9 +/- 5.7

Passed STC:
https://tests.stockfishchess.org/tests/view/64928c1bdc7002ce609c7690
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 72000 W: 19242 L: 18889 D: 33869
Ptnml(0-2): 182, 7787, 19716, 8126, 189

Passed LTC:
https://tests.stockfishchess.org/tests/view/64930a37dc7002ce609c82e3
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 54552 W: 14978 L: 14647 D: 24927
Ptnml(0-2): 23, 5123, 16650, 5460, 20

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

bench 2593605

16 months agoFix Potential in TB cutoffs for NMP.
peregrineshahin [Mon, 12 Jun 2023 09:57:41 +0000 (12:57 +0300)]
Fix Potential in TB cutoffs for NMP.

Removes the second dependency on beta and caps the return value to VALUE_TB_WIN_IN_MAX_PLY - 1

Earlier tests:

STC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 193632 W: 51372 L: 51326 D: 90934
Ptnml(0-2): 447, 20111, 55687, 20091, 480
https://tests.stockfishchess.org/tests/view/6486ee4465ffe077ca125bc1

LTC:
LLR: 2.97 (-2.94,2.94) <-1.75,0.25>
Total: 331758 W: 89538 L: 89624 D: 152596
Ptnml(0-2): 114, 30121, 105516, 29993, 135
https://tests.stockfishchess.org/tests/view/6489401af42a44347ed7be42

updated constant:
LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 100260 W: 27143 L: 27017 D: 46100
Ptnml(0-2): 34, 8842, 32248, 8976, 30
https://tests.stockfishchess.org/tests/view/6492fcafdc7002ce609c818c

closes: https://github.com/official-stockfish/Stockfish/pull/4632
fixes: https://github.com/official-stockfish/Stockfish/issues/4598

bench: 2370027

16 months agoUpdate winrate model with June data
Joost VandeVondele [Thu, 22 Jun 2023 07:59:03 +0000 (09:59 +0200)]
Update winrate model with June data

Retained 748191776 scored positions for analysis

const int NormalizeToPawnValue = 328;
Corresponding spread = 60;
Corresponding normalized spread = 0.18337766691628035;
Draw rate at 0.0 eval at move 32 = 0.9914715947898592;

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

No functional change

16 months agoUpdate top CPU contributors
Joost VandeVondele [Tue, 20 Jun 2023 07:46:02 +0000 (09:46 +0200)]
Update top CPU contributors

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

No functional change

16 months agoFix failing CI of pull requests
disservin [Tue, 20 Jun 2023 16:27:20 +0000 (18:27 +0200)]
Fix failing CI of pull requests

adds a guard to prevent pull requests from trying to delete the previous pre-release

closing https://github.com/official-stockfish/Stockfish/pull/4631

No functional change.

16 months agoFix indentation in qsearch.
Joerg Oster [Tue, 20 Jun 2023 08:40:31 +0000 (10:40 +0200)]
Fix indentation in qsearch.

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

No functional change.

16 months agocreate prereleases upon push to master
disservin [Tue, 13 Jun 2023 17:30:01 +0000 (19:30 +0200)]
create prereleases upon push to master

using github actions, create a prerelease for the latest commit to master.
As such a development version will be available on github, in addition to the latest release.

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

No functional change

16 months agoCompressed network parameters
maxim [Tue, 13 Jun 2023 20:09:05 +0000 (23:09 +0300)]
Compressed network parameters

Implemented LEB128 (de)compression for the feature transformer.
Reduces embedded network size from 70 MiB to 39 Mib.

The new nn-78bacfcee510.nnue corresponds to the master net compressed.

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

No functional change

16 months agoSmall cleanup
cj5716 [Thu, 15 Jun 2023 13:05:01 +0000 (21:05 +0800)]
Small cleanup

This non-functional change keeps formatting consistent.

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

Bench 2370027

16 months agoPermute master net weights to increase sparsity
AndrovT [Tue, 13 Jun 2023 01:00:04 +0000 (03:00 +0200)]
Permute master net weights to increase sparsity

Activation data collection using https://github.com/AndrovT/Stockfish/commit/ac468039ab544b03ad9a22c859a4217729c10a77 run as

bench 16 1 13 varied_1000.epd depth NNUE log.bin

on FENs from https://gist.github.com/AndrovT/7eae6918eb50764227e2bafe7938953c.

Permutation found using https://gist.github.com/AndrovT/359c831b7223c637e9156b01eb96949e.
Uses a greedy algorithm that goes sequentially through the output positions and
chooses a neuron for that position such that the number of nonzero quartets is the smallest.

Net weights permuted using https://gist.github.com/AndrovT/9e3fbaebb7082734dc84d27e02094cb3.

Benchmark:

Result of 100 runs of 'bench 16 1 13 default depth NNUE'
========================================================
base (...kfish-master) =     885869  +/- 7395
test (./stockfish    ) =     895885  +/- 7368
diff                   =     +10016  +/- 2984

speedup        = +0.0113
P(speedup > 0) =  1.0000

Passed STC:
https://tests.stockfishchess.org/tests/view/648866c4713491385c804728
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 126784 W: 34003 L: 33586 D: 59195
Ptnml(0-2): 283, 13001, 36437, 13358, 313

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

No functional change.

16 months agoConsistent bench extraction with fishtest.
peregrineshahin [Wed, 14 Jun 2023 12:57:36 +0000 (15:57 +0300)]
Consistent bench extraction with fishtest.

Consistent with recent fishtest commit https://github.com/glinscott/fishtest/commit/c0d174396f7fb1c0b3243aaa6cc73769079f3ff9

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

No functional change

16 months agoRemove setting of static to none if in check in qsearch
Viren6 [Tue, 13 Jun 2023 21:26:20 +0000 (22:26 +0100)]
Remove setting of static to none if in check in qsearch

Small simplification

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/6487924d713491385c8034ae
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 59616 W: 15885 L: 15703 D: 28028
Ptnml(0-2): 144, 6130, 17086, 6296, 152

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

No functional change.

16 months agoFix for MSVC compilation.
Andreas Matthies [Tue, 13 Jun 2023 04:24:04 +0000 (06:24 +0200)]
Fix for MSVC compilation.

MSVC needs two more explicit casts to compile new affine_transform_sparse_input.
See https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_castsi256_ps
and https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_castsi128_ps

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

No functional change

16 months agoClean-up code indentation in qsearch
Stéphane Nicolet [Mon, 12 Jun 2023 21:26:42 +0000 (23:26 +0200)]
Clean-up code indentation in qsearch

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

No functional change

16 months agoImprove comments
Michael Chaly [Mon, 12 Jun 2023 19:13:08 +0000 (22:13 +0300)]
Improve comments

Fix comments for IIR, also document non-linear scaling in extensions.
Also add explicitly the bench, to fix an issue after the last commit.

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

bench 2370027

16 months agoUse block sparse input for the first layer.
AndrovT [Sun, 11 Jun 2023 01:24:04 +0000 (03:24 +0200)]
Use block sparse input for the first layer.

Use block sparse input for the first fully connected layer on architectures with at least SSSE3.

Depending on the CPU architecture, this yields a speedup of up to 10%, e.g.

```
Result of 100 runs of 'bench 16 1 13 default depth NNUE'

base (...ockfish-base) =     959345  +/- 7477
test (...ckfish-patch) =    1054340  +/- 9640
diff                   =     +94995  +/- 3999

speedup        = +0.0990
P(speedup > 0) =  1.0000

CPU: 8 x AMD Ryzen 7 5700U with Radeon Graphics
Hyperthreading: on
```

Passed STC:
https://tests.stockfishchess.org/tests/view/6485aa0965ffe077ca12409c
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 8864 W: 2479 L: 2223 D: 4162
Ptnml(0-2): 13, 829, 2504, 1061, 25

This commit includes a net with reordered weights, to increase the likelihood of block sparse inputs,
but otherwise equivalent to the previous master net (nn-ea57bea57e32.nnue).

Activation data collected with https://github.com/AndrovT/Stockfish/tree/log-activations, running bench 16 1 13 varied_1000.epd depth NNUE on this data. Net parameters permuted with https://gist.github.com/AndrovT/9e3fbaebb7082734dc84d27e02094cb3.

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

No functional change

16 months agoAdd network export to CI
Joost VandeVondele [Mon, 12 Jun 2023 07:51:28 +0000 (09:51 +0200)]
Add network export to CI

verify the network written by export_net matches the original

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

No functional change

16 months agoUpdate default net to nn-ea57bea57e32.nnue
Linmiao Xu [Wed, 7 Jun 2023 18:57:17 +0000 (14:57 -0400)]
Update default net to nn-ea57bea57e32.nnue

Created by retraining an earlier epoch (ep659) of the experiment that led to the first SFNNv6 net:
- First retrained on the nn-0dd1cebea573 dataset
- Then retrained with skip 20 on a smaller dataset containing unfiltered Leela data
- And then retrained again with skip 27 on the nn-0dd1cebea573 dataset

The equivalent 7-step training sequence from scratch that led here was:

1. max-epoch 400, lambda 1.0, constant LR 9.75e-4, T79T77-filter-v6-dd.min.binpack
   ep379 chosen for retraining in step2

2. max-epoch 800, end-lambda 0.75, T60T70wIsRightFarseerT60T74T75T76.binpack
   ep679 chosen for retraining in step3

3. max-epoch 800, end-lambda 0.75, skip 28, nn-e1fb1ade4432 dataset
   ep799 chosen for retraining in step4

4. max-epoch 800, end-lambda 0.7, skip 28, nn-e1fb1ade4432 dataset
   ep759 became nn-8d69132723e2.nnue (first SFNNv6 net)
   ep659 chosen for retraining in step5

5. max-epoch 800, end-lambda 0.7, skip 28, nn-0dd1cebea573 dataset
   ep759 chosen for retraining in step6

6. max-epoch 800, end-lambda 0.7, skip 20, leela-dfrc-v2-T77decT78janfebT79aprT80apr.binpack
   ep639 chosen for retraining in step7

7. max-epoch 800, end-lambda 0.7, skip 27, nn-0dd1cebea573 dataset
   ep619 became nn-ea57bea57e32.nnue

For the last retraining (step7):

python3 easy_train.py
  --experiment-name L1-1536-Re6-masterShuffled-ep639-sk27-Re5-leela-dfrc-v2-T77toT80small-Re4-masterShuffled-ep659-Re3-sameAs-Re2-leela96-dfrc99-16t-v2-T60novdecT80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd-Re1-LeelaFarseer-new-T77T79 \
  --training-dataset /data/leela96-dfrc99-T60novdec-v2-T80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd-T80apr.binpack \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes-L1-1536 \
  --early-fen-skipping 27 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --max_epoch 800 \
  --start-from-engine-test-net False \
  --start-from-model /data/L1-1536-Re5-leela-dfrc-v2-T77toT80small-epoch639.nnue \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --tui False \
  --seed $RANDOM \
  --gpus "0,"

For preparing the step6 leela-dfrc-v2-T77decT78janfebT79aprT80apr.binpack dataset:

python3 interleave_binpacks.py \
  leela96-filt-v2.binpack \
  dfrc99-16tb7p-eval-filt-v2.binpack \
  test77-dec2021-16tb7p.no-db.min-mar2023.binpack \
  test78-janfeb2022-16tb7p.no-db.min-mar2023.binpack \
  test79-apr2022-16tb7p-filter-v6-dd.binpack \
  test80-apr2022-16tb7p.no-db.min-mar2023.binpack \
  /data/leela-dfrc-v2-T77decT78janfebT79aprT80apr.binpack

The unfiltered Leela data used for the step6 dataset can be found at:
https://robotmoon.com/nnue-training-data

Local elo at 25k nodes per move:
nn-epoch619.nnue : 2.3 +/- 1.9

Passed STC:
https://tests.stockfishchess.org/tests/view/6480d43c6e6ce8d9fc6d7cc8
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 40992 W: 11017 L: 10706 D: 19269
Ptnml(0-2): 113, 4400, 11170, 4689, 124

Passed LTC:
https://tests.stockfishchess.org/tests/view/648119ac6e6ce8d9fc6d8208
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 129174 W: 35059 L: 34579 D: 59536
Ptnml(0-2): 66, 12548, 38868, 13050, 55

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

bench: 2370027

16 months agoReintroduce SEE verification against discovered attacks
Guenther Demetz [Wed, 7 Jun 2023 07:01:05 +0000 (09:01 +0200)]
Reintroduce SEE verification against discovered attacks

Reintroduces https://github.com/official-stockfish/Stockfish/pull/4453
along with https://github.com/official-stockfish/Stockfish/pull/4469

Leaving out
https://github.com/official-stockfish/Stockfish/pull/4533
https://github.com/official-stockfish/Stockfish/pull/4572

Passed STC:
https://tests.stockfishchess.org/tests/view/647d8c37726f6b400e408a0a
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 143168 W: 38346 L: 37892 D: 66930
Ptnml(0-2): 352, 15672, 39164, 15962, 434

Passed LTC:
https://tests.stockfishchess.org/tests/view/647ee8c528c4431bcb58e432
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 71538 W: 19560 L: 19190 D: 32788
Ptnml(0-2): 49, 6905, 21499, 7259, 57

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

bench: 2595430

16 months agoSimplify multiplier for improvement
cj5716 [Sun, 4 Jun 2023 23:59:56 +0000 (07:59 +0800)]
Simplify multiplier for improvement

This simplifies a `* 99 / 1300` term into just `/ 13`.

Passed non-regression STC:
LLR: 2.92 (-2.94,2.94) <-1.75,0.25>
Total: 58816 W: 15727 L: 15540 D: 27549
Ptnml(0-2): 149, 6370, 16203, 6517, 169
https://tests.stockfishchess.org/tests/view/647d25e4726f6b400e408165

Passed non-regression LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 154386 W: 41749 L: 41669 D: 70968
Ptnml(0-2): 94, 14992, 46956, 15042, 109
https://tests.stockfishchess.org/tests/view/647d9b3c726f6b400e408b2a

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

Bench:  2511327

16 months agoRemove optimism multiplier in nnue eval calculation
Linmiao Xu [Mon, 5 Jun 2023 05:08:38 +0000 (01:08 -0400)]
Remove optimism multiplier in nnue eval calculation

The same formula had passed SPRT against an earlier version of master.

Passed non-regression STC vs. d99942f:
https://tests.stockfishchess.org/tests/view/6478e76654dd118e1d98f72e
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 118720 W: 31402 L: 31277 D: 56041
Ptnml(0-2): 301, 13148, 32344, 13259, 308

Passed non-regression LTC vs. d99942f:
https://tests.stockfishchess.org/tests/view/647a22c154dd118e1d991146
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 74286 W: 20019 L: 19863 D: 34404
Ptnml(0-2): 31, 7189, 22540, 7359, 24

The earlier patch had conflicted with a faster SPRT passer, so this
was tested again after rebasing on latest master.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/647d6e46726f6b400e408790
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 166176 W: 44309 L: 44234 D: 77633
Ptnml(0-2): 461, 18252, 45557, 18387, 431

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/647eb00ba268d1bc11255e7b
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 28170 W: 7713 L: 7513 D: 12944
Ptnml(0-2): 14, 2609, 8635, 2817, 10

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

bench 2503095

16 months agoUpdate default net to nn-0dd1cebea573.nnue
Linmiao Xu [Sun, 4 Jun 2023 05:56:11 +0000 (01:56 -0400)]
Update default net to nn-0dd1cebea573.nnue

Created by retraining an earlier epoch of the experiment leading to the first SFNNv6 net
on a more-randomized version of the nn-e1fb1ade4432.nnue dataset mixed with unfiltered
T80 apr2023 data. Trained using early-fen-skipping 28 and max-epoch 960.

The trainer settings and epochs used in the 5-step training sequence leading here were:
1. train from scratch for 400 epochs, lambda 1.0, constant LR 9.75e-4, T79T77-filter-v6-dd.min.binpack
2. retrain ep379, max-epoch 800, end-lambda 0.75, T60T70wIsRightFarseerT60T74T75T76.binpack
3. retrain ep679, max-epoch 800, end-lambda 0.75, skip 28, nn-e1fb1ade4432 dataset
4. retrain ep799, max-epoch 800, end-lambda 0.7, skip 28, nn-e1fb1ade4432 dataset
5. retrain ep439, max-epoch 960, end-lambda 0.7, skip 28, shuffled nn-e1fb1ade4432 + T80 apr2023

This net was epoch 559 of the final (step 5) retraining:

```bash
python3 easy_train.py \
  --experiment-name L1-1536-Re4-leela96-dfrc99-T60novdec-v2-T80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd-T80apr-shuffled-sk28 \
  --training-dataset /data/leela96-dfrc99-T60novdec-v2-T80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd-T80apr.binpack \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes-L1-1536 \
  --early-fen-skipping 28 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --max_epoch 960 \
  --start-from-engine-test-net False \
  --start-from-model /data/L1-1536-Re3-nn-epoch439.nnue \
  --engine-test-branch linrock/Stockfish/L1-1536 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --tui False \
  --seed $RANDOM \
  --gpus "0,"
```

During data preparation, most binpacks were unminimized by removing positions with
score 32002 (`VALUE_NONE`). This makes the tradeoff of increasing dataset filesize
on disk to increase the randomness of positions in interleaved datasets.
The code used for unminimizing is at:
https://github.com/linrock/Stockfish/tree/tools-unminify

For preparing the dataset used in this experiment:

```bash
python3 interleave_binpacks.py \
  leela96-filt-v2.binpack \
  dfrc99-16tb7p-eval-filt-v2.binpack \
  filt-v6-dd-min/test60-novdec2021-12tb7p-filter-v6-dd.min-mar2023.unmin.binpack \
  filt-v6-dd-min/test80-aug2022-16tb7p-filter-v6-dd.min-mar2023.unmin.binpack \
  filt-v6-dd-min/test80-sep2022-16tb7p-filter-v6-dd.min-mar2023.unmin.binpack \
  filt-v6-dd-min/test80-jun2022-16tb7p-filter-v6-dd.min-mar2023.unmin.binpack \
  filt-v6-dd/test80-jul2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test80-oct2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test80-nov2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd-min/test80-jan2023-3of3-16tb7p-filter-v6-dd.min-mar2023.unmin.binpack \
  filt-v6-dd-min/test80-feb2023-16tb7p-filter-v6-dd.min-mar2023.unmin.binpack \
  filt-v6-dd/test79-apr2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test79-may2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd-min/test78-jantomay2022-16tb7p-filter-v6-dd.min-mar2023.unmin.binpack \
  filt-v6-dd/test78-juntosep2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test77-dec2021-16tb7p-filter-v6-dd.binpack \
  test80-apr2023-2tb7p.binpack \
  /data/leela96-dfrc99-T60novdec-v2-T80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd-T80apr.binpack
```

T80 apr2023 data was converted using lc0-rescorer with ~2tb of tablebases and can be found at:
https://robotmoon.com/nnue-training-data/

Local elo at 25k nodes per move vs. nn-e1fb1ade4432.nnue (L1 size 1024):
nn-epoch559.nnue : 25.7 +/- 1.6

Passed STC:
https://tests.stockfishchess.org/tests/view/647cd3b87cf638f0f53f9cbb
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 59200 W: 16000 L: 15660 D: 27540
Ptnml(0-2): 159, 6488, 15996, 6768, 189

Passed LTC:
https://tests.stockfishchess.org/tests/view/647d58de726f6b400e4085d8
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 58800 W: 16002 L: 15657 D: 27141
Ptnml(0-2): 44, 5607, 17748, 5962, 39

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

bench 2141197

16 months agoAdd binaries to releases with github actions
disservin [Mon, 17 Apr 2023 20:16:22 +0000 (22:16 +0200)]
Add binaries to releases with github actions

when a release is made with a tag matching sf_* the binaries will also be uploaded to the release as assets.

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

No functional change.

16 months agoFix no previous moves on root.
peregrineshahin [Sun, 4 Jun 2023 21:59:31 +0000 (00:59 +0300)]
Fix no previous moves on root.

guards against no previous move existing if qSearch is called on the root node (i.e. when razoring).

Passed Non-regression STC:
https://tests.stockfishchess.org/tests/view/647d242d726f6b400e408143
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 53120 W: 14167 L: 13976 D: 24977
Ptnml(0-2): 109, 5597, 14981, 5740, 133

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

Bench: 2551691

16 months agoMove internal iterative reduction before probcut
Michael Chaly [Thu, 1 Jun 2023 12:24:13 +0000 (15:24 +0300)]
Move internal iterative reduction before probcut

This patch moves IIR before probcut which allows probcut
to be produced at lower depths. Comments in IIR are also slightly updated.

Passed STC:
https://tests.stockfishchess.org/tests/view/6472d604d29264e4cfa749fd
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 387616 W: 103295 L: 102498 D: 181823
Ptnml(0-2): 976, 42322, 106381, 43187, 942

Passed LTC:
https://tests.stockfishchess.org/tests/view/6475eb8c4a36543c4c9f42e8
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 202836 W: 54901 L: 54281 D: 93654
Ptnml(0-2): 85, 19609, 61422, 20205, 97

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

bench 2551691

16 months agoRemove static eval threshold for extensions when giving check
Linmiao Xu [Tue, 30 May 2023 22:24:54 +0000 (18:24 -0400)]
Remove static eval threshold for extensions when giving check

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/647685d54a36543c4c9f4f2a
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 114688 W: 30701 L: 30571 D: 53416
Ptnml(0-2): 336, 12708, 31136, 12818, 346

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/64774b02b81f005b572de770
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 107310 W: 28920 L: 28796 D: 49594
Ptnml(0-2): 33, 10427, 32621, 10531, 43

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

bench 2597974

16 months agoSimplify away SEE verification
Guenther Demetz [Wed, 31 May 2023 09:48:18 +0000 (11:48 +0200)]
Simplify away SEE verification

After 4 simplificatons over PR#4453 the idea does not yield significant
improvement anymore. Maybe also
https://tests.stockfishchess.org/tests/view/640c88092644b62c3394c1c5 was
a fluke.

Passed non-regression bounds:

STC:
https://tests.stockfishchess.org/tests/view/64705389c079b6583146d873
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 131936 W: 35040 L: 34930 D: 61966
Ptnml(0-2): 336, 14559, 36035, 14735, 303

LTC:
https://tests.stockfishchess.org/tests/view/6471a2ade549d9cf2fb213cd
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 407700 W: 109999 L: 110164 D: 187537
Ptnml(0-2): 279, 39913, 123689, 39632, 337

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

bench: 2675974

16 months agoSimplify blending nnue complexity with optimism
Linmiao Xu [Thu, 1 Jun 2023 13:50:19 +0000 (09:50 -0400)]
Simplify blending nnue complexity with optimism

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/6478a26d54dd118e1d98f21c
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 241248 W: 64058 L: 64063 D: 113127
Ptnml(0-2): 644, 26679, 65960, 26720, 621

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/647b464854dd118e1d9928b2
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 24336 W: 6658 L: 6451 D: 11227
Ptnml(0-2): 8, 2316, 7312, 2525, 7

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

bench 2425813

16 months agoSearch tuning at very long time control with new net
Muzhen Gaming [Fri, 2 Jun 2023 11:55:25 +0000 (19:55 +0800)]
Search tuning at very long time control with new net

The most significant change would be the singularBeta formula.
It was first tested by cj5716 (see https://tests.stockfishchess.org/tests/view/647317c9d29264e4cfa74ec7),
and I took much inspiration from that idea.

LTC (fixed games): https://tests.stockfishchess.org/tests/view/6479d8da54dd118e1d990b12
Elo: 0.61 ± 1.2 (95%) LOS: 83.4%
Total: 60000 W: 16278 L: 16172 D: 27550
Ptnml(0-2): 16, 5845, 18179, 5937, 23
nElo: 1.38 ± 2.8 (95%) PairsRatio: 1.02

VLTC 180+1.8: https://tests.stockfishchess.org/tests/view/6479da1454dd118e1d990b2b
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 33224 W: 9261 L: 8984 D: 14979
Ptnml(0-2): 5, 2809, 10710, 3080, 8

SMP VLTC 8-thread: https://tests.stockfishchess.org/tests/view/647b0fe354dd118e1d992425
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 61398 W: 17386 L: 17081 D: 26931
Ptnml(0-2): 7, 4571, 21232, 4888, 1

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

Bench: 2805878

17 months agoSmall simplification for probcut in check
Michael Chaly [Wed, 31 May 2023 06:22:26 +0000 (09:22 +0300)]
Small simplification for probcut in check

Remove depth condition from there as not longer needed.

Passed STC:
https://tests.stockfishchess.org/tests/view/647367cad29264e4cfa753e6
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 254336 W: 67830 L: 67847 D: 118659
Ptnml(0-2): 580, 28181, 69697, 28096, 614

Passed LTC:
https://tests.stockfishchess.org/tests/view/647576184a36543c4c9f3af7
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 80706 W: 22048 L: 21898 D: 36760
Ptnml(0-2): 28, 7721, 24712, 7857, 35

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

bench 2381945

17 months agoSimplify nnue eval complexity calculation
Linmiao Xu [Sun, 28 May 2023 18:45:24 +0000 (14:45 -0400)]
Simplify nnue eval complexity calculation

Remove a multiplier when blending nnue complexity with semi-classical complexity.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/6473a71dd29264e4cfa75839
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 124768 W: 33180 L: 33060 D: 58528
Ptnml(0-2): 314, 13797, 34030, 13941, 302

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/6474af3dd29264e4cfa768f4
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 108180 W: 29008 L: 28884 D: 50288
Ptnml(0-2): 29, 10420, 33075, 10530, 36

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

bench 2316827

17 months agoUpdate NNUE architecture to SFNNv6 with larger L1 size of 1536
Linmiao Xu [Fri, 12 May 2023 22:07:20 +0000 (18:07 -0400)]
Update NNUE architecture to SFNNv6 with larger L1 size of 1536

Created by training a new net from scratch with L1 size increased from 1024 to 1536.
Thanks to Vizvezdenec for the idea of exploring larger net sizes after recent
training data improvements.

A new net was first trained with lambda 1.0 and constant LR 8.75e-4. Then a strong net
from a later epoch in the training run was chosen for retraining with start-lambda 1.0
and initial LR 4.375e-4 decaying with gamma 0.995. Retraining was performed a total of
3 times, for this 4-step process:

1. 400 epochs, lambda 1.0 on filtered T77+T79 v6 deduplicated data
2. 800 epochs, end-lambda 0.75 on T60T70wIsRightFarseerT60T74T75T76.binpack
3. 800 epochs, end-lambda 0.75 and early-fen-skipping 28 on the master dataset
4. 800 epochs, end-lambda 0.7 and early-fen-skipping 28 on the master dataset

In the training sequence that reached the new nn-8d69132723e2.nnue net,
the epochs used for the 3x retraining runs were:

1. epoch 379 trained on T77T79-filter-v6-dd.min.binpack
2. epoch 679 trained on T60T70wIsRightFarseerT60T74T75T76.binpack
3. epoch 799 trained on the master dataset

For training from scratch:

python3 easy_train.py \
  --experiment-name new-L1-1536-T77T79-filter-v6dd \
  --training-dataset /data/T77T79-filter-v6-dd.min.binpack \
  --max_epoch 400 \
  --lambda 1.0 \
  --start-from-engine-test-net False \
  --engine-test-branch linrock/Stockfish/L1-1536 \
  --nnue-pytorch-branch linrock/Stockfish/misc-fixes-L1-1536 \
  --tui False \
  --gpus "0," \
  --seed $RANDOM

Retraining commands were similar to each other. For the 3rd retraining run:

python3 easy_train.py \
  --experiment-name L1-1536-T77T79-v6dd-Re1-LeelaFarseer-Re2-masterDataset-Re3-sameData \
  --training-dataset /data/leela96-dfrc99-v2-T60novdecT80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd.binpack \
  --early-fen-skipping 28 \
  --max_epoch 800 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --start-from-engine-test-net False \
  --start-from-model /data/L1-1536-T77T79-v6dd-Re1-LeelaFarseer-Re2-masterDataset-nn-epoch799.nnue \
  --engine-test-branch linrock/Stockfish/L1-1536 \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes-L1-1536 \
  --tui False \
  --gpus "0," \
  --seed $RANDOM

The T77+T79 data used is a subset of the master dataset available at:
https://robotmoon.com/nnue-training-data/

T60T70wIsRightFarseerT60T74T75T76.binpack is available at:
https://drive.google.com/drive/folders/1S9-ZiQa_3ApmjBtl2e8SyHxj4zG4V8gG

Local elo at 25k nodes per move vs. nn-e1fb1ade4432.nnue (L1 size 1024):
nn-epoch759.nnue : 26.9 +/- 1.6

Failed STC
https://tests.stockfishchess.org/tests/view/64742485d29264e4cfa75f97
LLR: -2.94 (-2.94,2.94) <0.00,2.00>
Total: 13728 W: 3588 L: 3829 D: 6311
Ptnml(0-2): 71, 1661, 3610, 1482, 40

Failing LTC
https://tests.stockfishchess.org/tests/view/64752d7c4a36543c4c9f3618
LLR: -1.91 (-2.94,2.94) <0.50,2.50>
Total: 35424 W: 9522 L: 9603 D: 16299
Ptnml(0-2): 24, 3579, 10585, 3502, 22

Passed VLTC 180+1.8
https://tests.stockfishchess.org/tests/view/64752df04a36543c4c9f3638
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 47616 W: 13174 L: 12863 D: 21579
Ptnml(0-2): 13, 4261, 14952, 4566, 16

Passed VLTC SMP 60+0.6 th 8
https://tests.stockfishchess.org/tests/view/647446ced29264e4cfa761e5
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 19942 W: 5694 L: 5451 D: 8797
Ptnml(0-2): 6, 1504, 6707, 1749, 5

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

bench 2222567

17 months agoRemoved quadratic term in optimism
windfishballad [Tue, 23 May 2023 00:13:44 +0000 (20:13 -0400)]
Removed quadratic term in optimism

Remove term which is quadratic in optimism in the eval.
Simplifies and should also remove the bias towards side to move making the eval better for analysis.

STC: https://tests.stockfishchess.org/tests/view/6470a9d8c29e0d4352b0bca5
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 154432 W: 41127 L: 41040 D: 72265
Ptnml(0-2): 380, 17094, 42190, 17163, 389

LTC: https://tests.stockfishchess.org/tests/view/6471e9b3e549d9cf2fb219ef
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 127926 W: 34474 L: 34369 D: 59083
Ptnml(0-2): 43, 12505, 38776, 12582, 57

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

Bench: 2541211

17 months agoUpdate CPU contributors list
Joost VandeVondele [Sat, 27 May 2023 16:01:08 +0000 (18:01 +0200)]
Update CPU contributors list

update CPU contributors list, the previous update was a couple of months ago,
and unfortunately, was not quite accurate for the number of games played.

This version is based clean calculation from the DB and
an updated script that tracks things (see https://github.com/glinscott/fishtest/pull/1702).

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

No functional change

17 months agoRemove ss->ttHit condition where ttValue != VALUE_NONE
cj5716 [Thu, 25 May 2023 06:34:52 +0000 (14:34 +0800)]
Remove ss->ttHit condition where ttValue != VALUE_NONE

Simplification is done at 3 separate places in the code.
Thanks to peregrineshahin for helping me find 2 of such places.
(See original PR #4584)

Passed non-regression test
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 120256 W: 32204 L: 32085 D: 55967
Ptnml(0-2): 292, 12473, 34483, 12584, 296
https://tests.stockfishchess.org/tests/view/646f045968661bfd984325e3

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

No functional change

17 months agoSimplify Futility pruning for captures
FauziAkram [Tue, 23 May 2023 17:36:47 +0000 (20:36 +0300)]
Simplify Futility pruning for captures

Passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 412928 W: 109433 L: 109620 D: 193875
Ptnml(0-2): 1071, 45929, 112650, 45744, 1070
https://tests.stockfishchess.org/tests/view/6468eac40db5177f2b76ef4d

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 190200 W: 51465 L: 51420 D: 87315
Ptnml(0-2): 58, 18585, 57788, 18592, 77
https://tests.stockfishchess.org/tests/view/646b66520db5177f2b772a84

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

bench: 2486604

17 months agoSimplify Prune moves with negative SEE
FauziAkram [Sun, 21 May 2023 13:22:28 +0000 (16:22 +0300)]
Simplify Prune moves with negative SEE

Passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 57760 W: 15472 L: 15286 D: 27002
Ptnml(0-2): 123, 6025, 16430, 6147, 155
https://tests.stockfishchess.org/tests/view/6468eb6b0db5177f2b76ef62

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 93966 W: 25274 L: 25141 D: 43551
Ptnml(0-2): 33, 8498, 29792, 8623, 37
https://tests.stockfishchess.org/tests/view/6469570b0db5177f2b76f81b

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

Bench: 2304063

17 months agoSimplify delta calculation in aspiration window
Muzhen Gaming [Sat, 20 May 2023 13:28:54 +0000 (21:28 +0800)]
Simplify delta calculation in aspiration window

Simplification STC: https://tests.stockfishchess.org/tests/view/6468cb200db5177f2b76ecbb
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 220416 W: 58503 L: 58487 D: 103426
Ptnml(0-2): 596, 24384, 60188, 24488, 552

Simplification LTC: https://tests.stockfishchess.org/tests/view/646a15840db5177f2b770704
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 177756 W: 47882 L: 47825 D: 82049
Ptnml(0-2): 55, 17430, 53858, 17473, 62

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

Bench: 2304063

17 months agoMore Depth Reduction
candirufish [Sun, 21 May 2023 22:14:55 +0000 (00:14 +0200)]
More Depth Reduction

Reduce more for depth > 3 and depth < 12

LTC: https://tests.stockfishchess.org/tests/view/646c5abbd1f14fd69a6f2fab
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 197280 W: 53405 L: 52797 D: 91078
Ptnml(0-2): 62, 19025, 59886, 19577, 90

STC: https://tests.stockfishchess.org/tests/view/646bee71d1f14fd69a6f259d
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 100832 W: 26861 L: 26466 D: 47505
Ptnml(0-2): 240, 10985, 27622, 11278, 291

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

bench: 2276617

17 months agoSmall simplification in low depth pruning
Michael Chaly [Sat, 13 May 2023 21:30:35 +0000 (00:30 +0300)]
Small simplification in low depth pruning

Uncap low depth pruning lmr depth.
It's anyway capped for most cases apart from futility pruning for captures - removes one std::min call.

Passed STC:
https://tests.stockfishchess.org/tests/view/645e8fa6d55cccb2e64225a1
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 184064 W: 49039 L: 48982 D: 86043
Ptnml(0-2): 462, 20353, 50349, 20402, 466

Passed LTC:
https://tests.stockfishchess.org/tests/view/645f4d48d55cccb2e6423335
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 83886 W: 22613 L: 22465 D: 38808
Ptnml(0-2): 31, 8090, 25546, 8252, 24

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

bench 3201883

17 months agoSimplify SEE verfication logic
pb00067 [Wed, 17 May 2023 07:22:02 +0000 (09:22 +0200)]
Simplify SEE verfication logic

Passed STC
https://tests.stockfishchess.org/tests/view/6461d51887f6567dd4df27d0
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 177056 W: 47181 L: 47118 D: 82757
Ptnml(0-2): 456, 19381, 48792, 19442, 457

Passed LTC
https://tests.stockfishchess.org/tests/view/64631a9287f6567dd4df4502
2.94 (-2.94,2.94) <-1.75,0.25>
Total: 104346 W: 28062 L: 27935 D: 48349
Ptnml(0-2): 25, 10190, 31631, 10287, 40

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

bench: 2903251

17 months agoSimplify optimism calculation
xoto10 [Fri, 19 May 2023 18:58:18 +0000 (19:58 +0100)]
Simplify optimism calculation

This change removes one of the constants in the calculation of optimism. It also changes the 2 constants used with the scale value so that they are independent, instead of applying a constant to the scale and then adjusting it again when it is applied to the optimism. This might make the tuning of these constants cleaner and more reliable in the future.

STC 10+0.1 (accidentally run as an Elo gainer:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 154080 W: 41119 L: 40651 D: 72310
Ptnml(0-2): 375, 16840, 42190, 17212, 423
https://tests.stockfishchess.org/tests/live_elo/64653eabf3b1a4e86c317f77

LTC 60+0.6:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 217434 W: 58382 L: 58363 D: 100689
Ptnml(0-2): 66, 21075, 66419, 21088, 69
https://tests.stockfishchess.org/tests/live_elo/6465d077f3b1a4e86c318d6c

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

bench: 3190961

17 months agoSmall simplification in history pruning.
Stefan Geschwentner [Fri, 19 May 2023 21:16:48 +0000 (23:16 +0200)]
Small simplification in history pruning.

Remove the constant term of the history threshold which lowers the chance that pruning occurs.
As compensation allow pruning at a slightly higher depth.

Passed STC:
https://tests.stockfishchess.org/tests/view/64634c9a87f6567dd4df4901
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 101536 W: 27156 L: 27012 D: 47368
Ptnml(0-2): 266, 11165, 27772, 11289, 276

Passed LTC:
https://tests.stockfishchess.org/tests/view/6463d68b17982fde89d2bc2b
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 32154 W: 8741 L: 8543 D: 14870
Ptnml(0-2): 8, 3093, 9687, 3271, 18

Passed LTC: retest on top of VLTC tuning PR 4571 because this changes the history depth factor (use this new factor here)
https://tests.stockfishchess.org/tests/view/6467300e165c4b29ec0afd3f
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 99270 W: 26840 L: 26707 D: 45723
Ptnml(0-2): 36, 9753, 29928, 9878, 40

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

Bench: 2984341

17 months agoSearch tuning at very long time control
Muzhen Gaming [Tue, 16 May 2023 13:30:53 +0000 (21:30 +0800)]
Search tuning at very long time control

Many search parameter changes, tuned
(https://tests.stockfishchess.org/tests/view/645e4c67d55cccb2e64220ff)
at ~300k games @ VLTC (120+1.2).

Failed STC:
https://tests.stockfishchess.org/tests/view/6465fcd77968ca827c1410c2
LLR: -2.95 (-2.94,2.94) <0.00,2.00>
Total: 33824 W: 8863 L: 9067 D: 15894
Ptnml(0-2): 89, 3833, 9266, 3641, 83

Neutral LTC:
https://tests.stockfishchess.org/tests/view/646385ce87f6567dd4df4e37
Elo: -0.48 +-1.2 (95%) LOS: 22.2%
Total: 60000 W: 16235 L: 16318 D: 27447
Ptnml(0-2): 27, 5831, 18366, 5750, 26
nElo: -1.08 +-2.8 (95%) PairsRatio: 0.99

Passed VLTC 180+1.8:
https://tests.stockfishchess.org/tests/view/646385f787f6567dd4df4e3e
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 126448 W: 34704 L: 34258 D: 57486
Ptnml(0-2): 9, 10970, 40825, 11406, 14

Passed VLTC SMP 60+0.6 8thread:
https://tests.stockfishchess.org/tests/view/646628de884ce93b65df2ac9
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 59456 W: 16791 L: 16487 D: 26178
Ptnml(0-2): 5, 4473, 20467, 4779, 4

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

Bench: 3347573

17 months agoUpdate WLD model
Joost VandeVondele [Fri, 19 May 2023 21:02:27 +0000 (23:02 +0200)]
Update WLD model

using data of May, recalibrate the WLD model.

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

No functional change

17 months agoRefine deeper post-lmr searches
Michael Chaly [Sun, 7 May 2023 20:33:04 +0000 (23:33 +0300)]
Refine deeper post-lmr searches

This patch improves logic conditions for performing deeper searches after passed LMR.

Instead of exceeding alpha by some margin now it requires to exceed the
current best value - which may be lower than alpha (but never bigger since we
update alpha with bestvalue if it exceeds alpha).

Passed STC:
https://tests.stockfishchess.org/tests/view/6455f78008858de8313775b6
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 209344 W: 55993 L: 55448 D: 97903
Ptnml(0-2): 507, 22798, 57526, 23325, 516

Passed LTC:
https://tests.stockfishchess.org/tests/view/64572d46eb75932ccfebff97
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 66288 W: 17867 L: 17514 D: 30907
Ptnml(0-2): 21, 6240, 20269, 6593, 21

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

bench 3808503

17 months agoSmall cleanup
Michael Chaly [Fri, 5 May 2023 20:32:56 +0000 (23:32 +0300)]
Small cleanup

In search remove one condition check and reorder conditions. Removes some code.

Passed non-regression test:
https://tests.stockfishchess.org/tests/view/64548fa06206ee34ebf853ad
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 282976 W: 75327 L: 75374 D: 132275
Ptnml(0-2): 604, 29673, 80995, 29598, 618

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

No functional change

17 months agoClean up after "Simplify away complexity in evaluation"
peregrineshahin [Wed, 3 May 2023 11:11:55 +0000 (14:11 +0300)]
Clean up after "Simplify away complexity in evaluation"

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

No functional change.