Changes

Jump to: navigation, search

Stockfish NNUE

2,199 bytes added, 20:12, 19 July 2021
no edit summary
<ref>[http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74531&start=1 Re: NNUE accessible explanation] by [[Jonathan Rosenthal]], [[CCC]], July 23, 2020</ref>.
==HalfKP==
The so called '''HalfKP''' structure consists of two halves covering input layer and first hidden layer, each half of the input layer associated to one of the two [[King|kings]], cross coupled with the side to move or not to move halves of the first hidden layer.
For each either black or white king placement, the 10 none king pieces on their particular squares are the boolean {0,1} inputs, along with a relict from Shogi piece drop (BONA_PIECE_ZERO),
The output of the output layer is divided by FV_SCALE = 16 to produce the NNUE evaluation. SF's evaluation then take some further steps such as adding a Tempo bonus (even though the NNUE evaluation inherently already takes into account the side to move in the "transform" step) and scaling the evaluation towards zero as rule50_count() approaches 50 moves.
 
==HalfKA==
In subsequent Stockfish versions the network architecture was further improved by [[Tomasz Sobczyk]] et al.. The '''HalfKA''' architecture uses 12x64x64 = 45056 inputs for each of the 12 piece types times 64 squares for each of the 64 own king squares, times two, for both the side to move and other side perspective, further using the [[Vertical Flipping|vertical flip]] instead of the HalfKP rotate.
'''HalfKv2''' of Stockfish '''14''' saves some space considering the king square redundancy using 11x64x64 = 45056 inputs per side, mapped to a 2x520 linear feature transformer, <ref>[https://github.aom/official-stockfish/Stockfish/commit/e8d64af1230fdac65bb0da246df3e7abe82e0838 New NNUE architecture and net · official-stockfish/Stockfish@e8d64af · GitHub]</ref> <ref>[https://github.com/official-stockfish/Stockfish/pull/3474 Update default net to nn-8a08400ed089.nnue by Sopel97 · Pull Request #3474 · official-stockfish/Stockfish · GitHub]</ref> <ref>[https://github.com/glinscott/nnue-pytorch/blob/master/docs/nnue.md#halfkav2-feature-set HalfKAv2 feature set | nnue-pytorch/nnue.md at master · glinscott/nnue-pytorch · GitHub]</ref>, further feeding 8x2 outputs of this feature transformer directly to the output for better learning of unbalanced material configurations <ref>[https://github.com/glinscott/nnue-pytorch/blob/master/docs/nnue.md#a-part-of-the-feature-transformer-directly-forwarded-to-the-output A part of the feature transformer directly forwarded to the output | nnue-pytorch/nnue.md at master · glinscott/nnue-pytorch · GitHub]</ref>. Another improvement was using eight 512x2->16->32->1 output sub-networks discriminated by (piece_count-1) div 4 in the 0 to 7 range
<ref>[https://github.com/glinscott/nnue-pytorch/blob/master/docs/nnue.md#multiple-psqt-outputs-and-multiple-subnetworks Multiple PSQT outputs and multiple subnetworks | nnue-pytorch/nnue.md at master · glinscott/nnue-pytorch · GitHub]</ref>.
 
 
[[FILE:HalfKAv2.png|none|border|text-bottom|1024px]]
HalfKAv2 architecture by [[Tomasz Sobczyk]] <ref>[https://user-images.githubusercontent.com/8037982/118656988-553a1700-b7eb-11eb-82ef-56a11cbebbf2.png HalfKAv2.png]</ref>
=Network=

Navigation menu