Commit Graph

5116 Commits

Author SHA1 Message Date
nodchip
9a0b20d3fc Changed to show if NNUE is used in the training data generator. 2020-08-08 18:24:09 +09:00
nodchip
b0d28ac3ab Fixed a bug that the training data generation crashes if eval_limit is high. 2020-08-08 18:23:11 +09:00
nodchip
70d88364fe Fixed a bug that the training data generation crashes. 2020-08-08 18:22:29 +09:00
nodchip
ed4d007e3c Fixed a bug that the training data generator crahses on memory allocation. 2020-08-08 18:21:38 +09:00
nodchip
2395833c07 Re-added commands for training data generator and trainer. 2020-08-08 16:52:18 +09:00
nodchip
fa649ba1e2 Removed a compile warning. 2020-08-08 16:17:55 +09:00
nodchip
2c9075e919 Fixed Makefile to fix build. 2020-08-08 16:05:05 +09:00
nodchip
55a6b2bdc4 Merge branch 'master' of github.com:official-stockfish/Stockfish into nnue-player-merge
# Conflicts:
#	README.md
#	Readme.md
#	src/Makefile
#	src/evaluate.cpp
#	src/evaluate.h
#	src/misc.cpp
#	src/nnue/architectures/halfkp_256x2-32-32.h
#	src/nnue/evaluate_nnue.cpp
#	src/nnue/evaluate_nnue.h
#	src/nnue/features/feature_set.h
#	src/nnue/features/features_common.h
#	src/nnue/features/half_kp.cpp
#	src/nnue/features/half_kp.h
#	src/nnue/features/index_list.h
#	src/nnue/layers/affine_transform.h
#	src/nnue/layers/clipped_relu.h
#	src/nnue/layers/input_slice.h
#	src/nnue/nnue_accumulator.h
#	src/nnue/nnue_architecture.h
#	src/nnue/nnue_common.h
#	src/nnue/nnue_feature_transformer.h
#	src/position.cpp
#	src/position.h
#	src/types.h
#	src/ucioption.cpp
#	stockfish.md
2020-08-08 15:55:42 +09:00
nodchip
1abae04ceb Fixed Makefile. 2020-08-07 23:00:11 +09:00
nodchip
bf7d02578e Fixed build errors. 2020-08-07 22:47:45 +09:00
nodchip
1c23465383 Moved the nnue folder. 2020-08-07 22:34:53 +09:00
Sergio Vieri
857e045ced Update default net to nn-9931db908a9b.nnue
Net created at 20200806-1802

passed STC:
https://tests.stockfishchess.org/tests/view/5f2d00b461e3b6af64881f21
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 6672 W: 1052 L: 898 D: 4722
Ptnml(0-2): 63, 600, 1868, 730, 75

passed LTC:
https://tests.stockfishchess.org/tests/view/5f2d052a61e3b6af64881f29
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 7576 W: 573 L: 463 D: 6540
Ptnml(0-2): 8, 392, 2889, 480, 19

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

Bench: 4390086
2020-08-07 13:07:28 +02:00
Stefan Geschwentner
615d98da24 Do move legality check before pruning.
This alllows to simplify the code because the move counter haven't to be
decremented later if a move isn't legal. As a side effect now illegal
pruned moves doesn't included anymore in move counter. So slightly less
pruning and reductions are done.

STC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 111016 W: 21106 L: 21077 D: 68833
Ptnml(0-2): 1830, 13083, 25736, 12946, 1913
https://tests.stockfishchess.org/tests/view/5f28816fa5abc164f05e4c26

LTC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 39264 W: 4909 L: 4843 D: 29512
Ptnml(0-2): 263, 3601, 11854, 3635, 279
https://tests.stockfishchess.org/tests/view/5f297902a5abc164f05e4c8e

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

Bench: 4390086
2020-08-07 09:05:20 +02:00
UnaiCorzo
7f336dd59b Remove QueenInfiltration
STC https://tests.stockfishchess.org/tests/view/5f2955b1a5abc164f05e4c85
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 29216 W: 5560 L: 5416 D: 18240
Ptnml(0-2): 466, 3329, 6902, 3417, 494

LTC https://tests.stockfishchess.org/tests/view/5f299154a5abc164f05e4ca1
LLR: 2.92 (-2.94,2.94) {-1.50,0.50}
Total: 54144 W: 6635 L: 6594 D: 40915
Ptnml(0-2): 372, 4859, 16536, 4966, 339

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

Bench: 4609008
2020-08-07 09:00:45 +02:00
FauziAkram
af935365e3 Tuned pawn values
Passed STC:
https://tests.stockfishchess.org/tests/view/5f2aa49fa5abc164f05e4d1b
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 40888 W: 7977 L: 7726 D: 25185
Ptnml(0-2): 665, 4806, 9333, 4893, 747

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f2b1059b3ebe5cbfee85ae7
LLR: 2.98 (-2.94,2.94) {0.25,1.75}
Total: 51264 W: 6445 L: 6134 D: 38685
Ptnml(0-2): 328, 4564, 15580, 4789, 371

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

bench: 4314943
2020-08-07 08:57:37 +02:00
Stefan Geschwentner
8b8412ef87 Add tempo also to NNUE eval.
STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 10608 W: 1507 L: 1358 D: 7743
Ptnml(0-2): 94, 945, 3074, 1100, 91
https://tests.stockfishchess.org/tests/view/5f2c5921b3ebe5cbfee85b8b

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 7536 W: 556 L: 448 D: 6532
Ptnml(0-2): 9, 383, 2881, 481, 14
https://tests.stockfishchess.org/tests/view/5f2c6f4461e3b6af64881e95

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

Bench: 4746616
2020-08-07 08:54:38 +02:00
MJZ1977
3dca13a958 NNUE evaluation threshold
The idea is to use NNUE only on quite balanced material positions. This bring a big speedup on research since NNUE eval is slower than classical eval for most of the hardwares and specially on unbalanced positions with LazyEval.

STC: https://tests.stockfishchess.org/tests/view/5f2c2680b3ebe5cbfee85b61
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 3168 W: 560 L: 400 D: 2208
Ptnml(0-2): 21, 294, 819, 404, 46

LTC: https://tests.stockfishchess.org/tests/view/5f2c2ca6b3ebe5cbfee85b69
LLR: 2.98 (-2.94,2.94) {0.25,1.75}
Total: 3200 W: 287 L: 183 D: 2730
Ptnml(0-2): 4, 149, 1191, 251, 5

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

Bench 4746616
2020-08-06 21:46:31 +02:00
nodchip
84f3e86790 Add NNUE evaluation
This patch ports the efficiently updatable neural network (NNUE) evaluation to Stockfish.

Both the NNUE and the classical evaluations are available, and can be used to
assign a value to a position that is later used in alpha-beta (PVS) search to find the
best move. The classical evaluation computes this value as a function of various chess
concepts, handcrafted by experts, tested and tuned using fishtest. The NNUE evaluation
computes this value with a neural network based on basic inputs. The network is optimized
and trained on the evalutions of millions of positions at moderate search depth.

The NNUE evaluation was first introduced in shogi, and ported to Stockfish afterward.
It can be evaluated efficiently on CPUs, and exploits the fact that only parts
of the neural network need to be updated after a typical chess move.
[The nodchip repository](https://github.com/nodchip/Stockfish) provides additional
tools to train and develop the NNUE networks.

This patch is the result of contributions of various authors, from various communities,
including: nodchip, ynasu87, yaneurao (initial port and NNUE authors), domschl, FireFather,
rqs, xXH4CKST3RXx, tttak, zz4032, joergoster, mstembera, nguyenpham, erbsenzaehler,
dorzechowski, and vondele.

This new evaluation needed various changes to fishtest and the corresponding infrastructure,
for which tomtor, ppigazzini, noobpwnftw, daylen, and vondele are gratefully acknowledged.

The first networks have been provided by gekkehenker and sergiovieri, with the latter
net (nn-97f742aaefcd.nnue) being the current default.

The evaluation function can be selected at run time with the `Use NNUE` (true/false) UCI option,
provided the `EvalFile` option points the the network file (depending on the GUI, with full path).

The performance of the NNUE evaluation relative to the classical evaluation depends somewhat on
the hardware, and is expected to improve quickly, but is currently on > 80 Elo on fishtest:

60000 @ 10+0.1 th 1
https://tests.stockfishchess.org/tests/view/5f28fe6ea5abc164f05e4c4c
ELO: 92.77 +-2.1 (95%) LOS: 100.0%
Total: 60000 W: 24193 L: 8543 D: 27264
Ptnml(0-2): 609, 3850, 9708, 10948, 4885

40000 @ 20+0.2 th 8
https://tests.stockfishchess.org/tests/view/5f290229a5abc164f05e4c58
ELO: 89.47 +-2.0 (95%) LOS: 100.0%
Total: 40000 W: 12756 L: 2677 D: 24567
Ptnml(0-2): 74, 1583, 8550, 7776, 2017

At the same time, the impact on the classical evaluation remains minimal, causing no significant
regression:

sprt @ 10+0.1 th 1
https://tests.stockfishchess.org/tests/view/5f2906a2a5abc164f05e4c5b
LLR: 2.94 (-2.94,2.94) {-6.00,-4.00}
Total: 34936 W: 6502 L: 6825 D: 21609
Ptnml(0-2): 571, 4082, 8434, 3861, 520

sprt @ 60+0.6 th 1
https://tests.stockfishchess.org/tests/view/5f2906cfa5abc164f05e4c5d
LLR: 2.93 (-2.94,2.94) {-6.00,-4.00}
Total: 10088 W: 1232 L: 1265 D: 7591
Ptnml(0-2): 49, 914, 3170, 843, 68

The needed networks can be found at https://tests.stockfishchess.org/nns
It is recommended to use the default one as indicated by the `EvalFile` UCI option.

Guidelines for testing new nets can be found at
https://github.com/glinscott/fishtest/wiki/Creating-my-first-test#nnue-net-tests

Integration has been discussed in various issues:
https://github.com/official-stockfish/Stockfish/issues/2823
https://github.com/official-stockfish/Stockfish/issues/2728

The integration branch will be closed after the merge:
https://github.com/official-stockfish/Stockfish/pull/2825
https://github.com/official-stockfish/Stockfish/tree/nnue-player-wip

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

This will be an exciting time for computer chess, looking forward to seeing the evolution of
this approach.

Bench: 4746616
SF_NNUE
2020-08-06 16:37:45 +02:00
Stefan Geschwentner
9587eeeb5e Tweak cutnode reduction
Less reduction for second move at non-check CUT node with depth <= 10.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 38680 W: 7490 L: 7245 D: 23945
Ptnml(0-2): 643, 4441, 8967, 4606, 683
https://tests.stockfishchess.org/tests/view/5f21e1782f7e63962b99f451

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 71976 W: 9003 L: 8636 D: 54337
Ptnml(0-2): 440, 6414, 21972, 6663, 499
https://tests.stockfishchess.org/tests/view/5f2245762f7e63962b99f4bd

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

Bench: 4746616
SF_classical
2020-07-31 10:12:54 +02:00
Stéphane Nicolet
33f3cfae00 Improve handling of queen imbalance
We double the bonus for potential threats by minors and rooks against
our queen, in case of "queen vs pieces imbalance". Hopefully this will
improve a little bit the evaluation for this well-known Stockfish weakness.

passed STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 72976 W: 14003 L: 13710 D: 45263
Ptnml(0-2): 1218, 8370, 17094, 8513, 1293
https://tests.stockfishchess.org/tests/view/5efa50eb020eec13834a977d

passed LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 22232 W: 2779 L: 2560 D: 16893
Ptnml(0-2): 129, 1885, 6896, 2050, 156
https://tests.stockfishchess.org/tests/view/5f1fdd2dc09435d870cb9f13

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

Bench: 4367349
2020-07-31 10:01:39 +02:00
UnaiCorzo
62d3106caa Remove late irreversible move extension
We simplify away the late irreversible move extension, which
does not seem to be necessary in the current master.

STC
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 38584 W: 7464 L: 7342 D: 23778
Ptnml(0-2): 581, 4328, 9365, 4424, 594
https://tests.stockfishchess.org/tests/view/5f1c9669c09435d870cb9de9

LTC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 27840 W: 3417 L: 3353 D: 21070
Ptnml(0-2): 120, 2315, 8994, 2363, 128
https://tests.stockfishchess.org/tests/view/5f1d2e22c09435d870cb9e21

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

bench: 4829420
2020-07-31 09:55:56 +02:00
protonspring
f0abde241d Remove conditional_more_than_two().
This is a functional simplification that removes the conditional_more_than_two()
function, which was quite strange and kooky. Note the very minor change to the bench
value.

See this thread for relevant comments on the passing branch:
protonspring/Stockfish@d89730d...ff35b50

STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 59760 W: 11411 L: 11311 D: 37038
Ptnml(0-2): 992, 6863, 14044, 7015, 966
https://tests.stockfishchess.org/tests/view/5f179988c09435d870cb9b9a

LTC
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 45208 W: 5553 L: 5497 D: 34158
Ptnml(0-2): 315, 4081, 13761, 4127, 320
https://tests.stockfishchess.org/tests/view/5f184847c09435d870cb9bee

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

Bench: 4578290
2020-07-31 09:47:24 +02:00
nodchip
c0e1235fef Added a description to Makefile. 2020-07-20 17:36:09 +09:00
No name
74049a450c Add NNUE targets to the output of 'make help' 2020-07-20 17:29:20 +09:00
nodchip
fbdb373b64 Changed to set the binary directory to the current working directory. 2020-07-20 17:17:50 +09:00
mstembera
77018c77cc Fix profile builds for AVX512. 2020-07-19 21:25:50 +09:00
No name
fd78fb05f6 Hide NNUE options if building without NNUE support
Also remove an unused option.
2020-07-19 20:17:01 +09:00
nodchip
afd7d0ea4d Fixed a bug that Makefile specifies -mpopcnt for armv8-a. 2020-07-19 18:34:35 +09:00
nodchip
36092b855a Removed the x86-64-ssse3-popcnt architecture. 2020-07-19 14:17:35 +09:00
nodchip
3bbe4802b1 Removed the sse41-popcnt architecture. 2020-07-19 14:02:49 +09:00
nodchip
c001a4e62d Revert "Removed x86-64-ssse3-popcnt and x86-64-sse41-popcnt."
This reverts commit 92c2167481.
2020-07-19 13:58:19 +09:00
No name
1536e31065 Load the parameter set on an `isready' as well
Unbreaks Scid vs. PC, which doesn't send `ucinewgame'.
2020-07-19 13:22:40 +09:00
nodchip
92c2167481 Removed x86-64-ssse3-popcnt and x86-64-sse41-popcnt. 2020-07-19 12:52:20 +09:00
nodchip
a4786db4c2 Added support for architectures which supports SSE3+POPCNT, SSSE3+POPCNT and SSE41+POPCNT. 2020-07-19 12:41:50 +09:00
nodchip
c24ad8d8b5 Supported sse3 build. 2020-07-19 12:26:37 +09:00
mstembera
961a4dad5c Add AVX512 support.
bench: 3909820
2020-07-19 12:07:28 +09:00
Vizvezdenec
d89730d5c8 Do not overwrite valuable TT data after probcut.
This patch allows an engine to write probcut data only in case
the probcut search depth is greater than transposition table depth.

passed STC
https://tests.stockfishchess.org/tests/view/5f0b52e959f6f035328949a6
LLR: 2.97 (-2.94,2.94) {-0.50,1.50}
Total: 52544 W: 10145 L: 9880 D: 32519
Ptnml(0-2): 853, 6097, 12121, 6334, 867

passed LTC
https://tests.stockfishchess.org/tests/view/5f0bd94c59f6f035328949f3
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 49576 W: 6164 L: 5863 D: 37549
Ptnml(0-2): 297, 4371, 15218, 4538, 364

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

bench 4578298
2020-07-17 20:28:44 +02:00
mstembera
c3092c54bc Multiple lazy stages.
An extension of the lazy eval idea: when the score is sufficiently large
we now skip more granular parts of the eval.

Inspired by an original patch by Moez Jellouli
https://tests.stockfishchess.org/tests/view/5f03b2a159f6f03532894529
Credit to him!

STC https://tests.stockfishchess.org/tests/view/5f0a862c59f6f03532894924
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 13504 W: 2684 L: 2472 D: 8348
Ptnml(0-2): 229, 1496, 3111, 1666, 250

LTC https://tests.stockfishchess.org/tests/view/5f0ac0e159f6f0353289495b
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 31312 W: 3926 L: 3677 D: 23709
Ptnml(0-2): 185, 2773, 9509, 2986, 203

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

bench: 4541608
2020-07-17 20:24:02 +02:00
nodchip
7a13d4ed60 Changed the default eval file path so that more GUIs can use Stockfish NNUE. 2020-07-17 15:40:01 +09:00
xXH4CKST3RXx
4d4c80d7fd Update README.md
Added logo, reinforcement learning instructions, and resources list.
2020-07-17 12:40:47 +09:00
nodchip
2b821682aa Update README.md 2020-07-17 11:55:30 +09:00
xXH4CKST3RXx
be754a2379 Update README.md 2020-07-16 13:21:14 +09:00
xXH4CKST3RXx
ec5ef2b6df Update README.md 2020-07-16 13:21:14 +09:00
xXH4CKST3RXx
df4da8dc41 Update README.md 2020-07-16 13:21:14 +09:00
xXH4CKST3RXx
6118151c66 Create README.md
Added and cleaned up Gekkehenker's training guide.
2020-07-16 13:21:14 +09:00
xXH4CKST3RXx
2fd1c48e60 Rename Readme.md to stockfish.md 2020-07-16 13:21:14 +09:00
No name
961047ed6e Experimental support for PGO builds of NNUE
Only 'nnue' target and only gcc/mingw.
(does not clean profile data generated by other compilers)
To use:
 make profile-nnue ARCH=arch
(see 'make help' for list of supported archs)
2020-07-16 08:53:03 +09:00
J. Oster
e29499ee4b Use the path and filename for restoring parameter files. 2020-07-15 19:29:29 +09:00
nodchip
7f4b72cdfd Merge branch 'master' of github.com:nodchip/Stockfish 2020-07-13 22:25:56 +09:00
nodchip
686a5a0df9 Fixed a bug that gensfen command does not accept the use_draw_in_training_data_generation option. 2020-07-13 22:25:23 +09:00