Hekastockfish NNUE

majkelnowaq
Inactive User
Points: 50,00 
Posts: 6
Joined: 04/11/2019, 1:20
Status: Offline (Active 1 Year, 3 Months, 2 Days, 9 Hours, 37 Minutes ago)
Topics: 1
Reputation: 5
Been thanked: 4 times

Hekastockfish NNUE

Post by majkelnowaq »

Hekastockfish NNUE

Based on dev SF form 27/09/2020.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------
New Options:

* NnueContempt - contempt which works with neural nets like old contempt for classical eval. Both basic contempt and nnue contempt have range -2000 to 2000.

------------------------------------------
* FluidMultiPV makes Sf able to consider more moves (if they aren't much less valuable than first pv move). Fluid means that it depends on position, SF is using multipv value depending on next options and not all the time;

* FmpvDifference - how much other moves differs in score from first pv. Default 10 means there isn't big difference, but if user choose 1000 (max value) it makes Sf to use multipv always because there will be almost all the time moves in this range. Value 0 would means it ll turn on multipv only for equal in score moves. I hope these explanations are enough.

* FmpvMaxMultiPV - here we decide how many moves it should consider for fluid multipv. Range from 2 to 8, default 4. If user for example pick 2, Stockfish will use max multipv 2 even if in set FmpvDifference there would be more moves meeting the criteria.

------------------------------------------
* Precision decreases some pruning code for few first moves (movecount), engine should play more cautious, noticeable decrease in gaining depths.

Both above options (Fluid MultiPV and Precision) are by default turned off, might have use for longer games or analysis.

------------------------------------------

* TacticalNodes - every one point is equal to 100 000 nodes (so for example default 1 means 0,1kk nodes).
* TacticalLevel - used for decreasing tactic blindness resulting from material values. 7 means 70% of pieces values, after time specified by TacticalNodes, sf regains worth of material again.

One core testing with cleared hash (256mb - hash), infinite analysis mode;

simple positions:
4rk2/2P2p2/p4P2/2p5/8/2p4b/P7/2KR4 w - - 0 3 Tnodes-10, Tlevel-7, time - instantly (Rd8)
1b2k1q1/4ppPp/1pK5/3pP3/3P4/1P6/8/2Q5 w - - 0 1 Tnodes-10, Tlevel-7, time - instantly (Qh6)

harder one:
rk6/p1r3p1/P3B1Kp/1p2B3/8/8/8/8 w Tnodes-400, Tlevel-10, time - 27kk nodes (Bd7 - mate)

This option can be freely use in games, it doesn't weak engine but we have to remember that engine should has some time after TacticalNodes to perform normal search. In other words if we set Tnodes to 10 (1kk nodes), we should be sure that engine ll have at least 2kk nodes for its moves, just keep in mind - time for games and strength of hardware should be adequate to values of this option.

------------------------------------------
* FindMate - never use this option for playing engine vs engine games, it ll produce mostly crazy moves leading to quick lose. This option is only for analysis, sometimes it can find good tactical moves not necessarily leading to mate, but its main use is looking for possibility of checkmate in given position. It's able to solve following positions, most of them very quickly:

rk6/p1r3p1/P3B1Kp/1p2B3/8/8/8/8 w Bd7(M)
7r/K7/5k1n/p3p3/Pp1pPp1p/1PpP1PpP/2P3P1/N1RR1B2 b Ke7(M)
8/2p1p1p1/2P1P1Pp/P4K2/P7/p2p4/rppP3P/qkn4R w a6(M)
n1QBq1k1/5p1p/5KP1/p7/8/8/8/8 w Bc7(M)
b4bN1/4p1p1/1Q1p2K1/q1np4/3p1Rnk/6pr/4Rppr/3N4 w - - Nh6(M)

------------------------------------------

* Suicide - engine will play worst possible moves, I made some tests and with this option turned on it ll lose even to other engines using random moves, option just for fun.

* Random - engine will play mostly random moves, not total random (it picks from first 12 root moves) but honestly it can be considered as a random move generator. It's for fun like above option but due to more variety - for testing purposes too (like generating lines and positions for opening books).

------------------------------------------


* BookFile etc - code for opening books in .bin from Brainfish;

------------------------------------------

* From Pawn to Queen Exchange - options from old Thothfish so I just copy my past words:

"Another thing u notice in uci menu are options from "pawn exchange" to "queen exchange". The bigger values u set (range is from -1000 to 1000, 0 is default) the more stockfish will try to exchange picked piece. For example with 1000 in queen exchange it would try to exchange queens before 20 moves or sooner if possible, analogical with -1000 queen exchange it will sacrifice a lot only to save its queen and opponent's queen on chessboard as long as possible. I think to make it competitive - relative safe range to testing is from -100 to 100, rest is for fun or testing/making opening books.
Logical - the bigger values in all pieces brings more open positions with quick exchanges and negative values brings closed positions. It has a lot of potential because when i was making tests with different sets of values i saw first time many opening playing by stockfish which it would never play without it (exchange options) and whats equally important it could still draw and win games against "normal" stockfish."

------------------------------------------

Other evaluation options:

* PawnForward - positive values encourage engine to push its pawns to enemy half of board, and restrict his pawns from doing the same. Negative Values make sf to stay (pawns) in its half of board;
* AttackBase - positive values - brings its pieces to enemy ranks, negative - stay at home :)
* AttackCentre - positive values - brings its pieces to center of board, negative - not interested in center;
* PawnChains - positive values - engine likes chains of enemy pawns, closed, blocked positions, negative - hates chains;

* Hunt (from King to Knight). Positive values - engine ll try to encircle enemy pieces, hunting and trapping them, limit their mobility. For example HuntKing - engine would prefer lines where enemy's king has fewer moves to go and it's under attack, surrounded by our pieces; negative values - opposite.

Users can tune these evaluation options on their own, looking for additional elo or different style of play.


------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Quick local tests:
- no opening book, all games from start position;
- 256 mb hash size;
- multicore amd (almost 2kk n/s at start position);
- Arena gui;
- Gauntlet type with stockfish_20092708_x64_modern (default options) at first position;
- Engines - HekaStockfishNNUE_popcnt.exe with different configurations (one with default options and others with all default except these included in name of engine for example Heka_PF+10_AB+10_AC+40_PC-40 means - PawnForward(10), AttackBase(10), AttackCentre(40), PawnChains(-40); other example - Heka_AllHunt-40 means all options with hunt (HuntKing etc) have (-40) values, rest configuration names I hope everyone ll figure out, because it's simple. Every variation has own .exe file in tournament.
- Adjudication rules: draw by 4-men tablebases/120 moves/60 moves and both have value(0) for 3 following moves. Win/Lose if both have at least +2/-2 for 3 consecutive moves;
- Engines reset after each game;
- Time 1min + 1s/move;
- 16 games for every configuration against Sf, 160 total.

The goal of this tournament isn't proving that this or other option is stronger than default for HekaStockfishNNUE. Even if some configuration ll lose or win by few games, sample is too small to draw any conclusions (so do not be influenced by those random values/option, find your own configurations). Tournament was made to see how some different configurations can handle in short time controls.

Results:

Engine Score St
01: Stockfish_20092708_x64_modern 82,0/160 ················
02: Heka_AllHunt+40 9,0/16 =====1=1========
03: Heka_NnueContempt+18 8,5/16 =====1==========
03: Heka_TNod10_TLev7 8,5/16 ====1===========
05: Heka_PF+10_AB+10_AC+40_PC-40 8,0/16 ================
05: Heka_AllHunt-40 8,0/16 ================
07: Heka_FluidMP_on 7,5/16 ==0=============
07: Heka_Precision_on 7,5/16 ====0===========
07: Heka_DefaultOptions 7,5/16 ==========0=====
10: Heka_AllExchange+40 7,0/16 ======0=====0===
11: Heka_AllExchange-40 6,5/16 ======0=0====0==




------------------------------------------

Links for engine (3 versions - popcnt/bmi2/nopopcnt with embedded net) :
https://www86.zippyshare.com/v/U6jH7vi1/file.html
http://www.mediafire.com/file/6wserhfuuiwq1ov/file
https://drive.google.com/file/d/1xRuzRMbUheAujH8SadpxtdbHGHrud7ob/view?usp=sharing


Links for engine without embedded net, 3 versions - popcnt/bmi2/nopopcnt, default net included in folder:
https://www86.zippyshare.com/v/At233nBI/file.html
http://www.mediafire.com/file/3gw5lv3n9r0xdb4/file
https://drive.google.com/file/d/1cpNSOwfG6KvQyHtas_KK7rFKfVr3TQSy/view?usp=sharing


Links for source code:
https://www18.zippyshare.com/v/FGvNDIbT/file.html
http://www.mediafire.com/file/zwq6u82hft1mtry/src.zip/file
https://drive.google.com/file/d/1Q6jdh9Qmi8NbVx-HoTvtQju0sz3GWCRP/view


Link for games from tournament:
https://www105.zippyshare.com/v/9Lk65WUq/file.html
http://www.mediafire.com/file/hdtt6ygs19n2bzk/file



------------------------------------------

Summary

Strength of HekaStockfishNNUE - it depends. With default options it plays like dev SF form 27/09/2020. Maybe is a few elo weaker than Stockfish, because it has a lot of additional code in evaluation and search and it can slow down it a bit. On the other hand if user tune it properly and fit options to time control and hardware - it can be stronger by some elo and has more interesting style of gampeplay (I recommend to test and experiment with all options).

Many new options: working NNUE contempt, fun options like Suicide or Random, Book file support (.bin), options for solving positions like Tactical Nodes or FindMate, options for longer games like Precision or FluidMultipv, Evaluation options changing style of play.

------------------------------------------

PS: I noticed new dev version today with another net. Anyway I included source code, if anyone ll be interested - is free to making changes according to Sf dev and keep it up to date or make avx or android version. I did my part, created derivative with some new ideas, tested it and published. Enjoy

Return to “HekaStockfish”