tinycodinglm / chess /chess-0106.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 12)
3c88a0f verified
|
Raw History Blame Contribute Delete
1.4 kB
opencode trace
System You are an expert software engineer.

You are an expert software engineer.

User

Explain Stockfish's NNUE neural network evaluation

Assistant

Stockfish uses NNUE (Efficiently Updatable Neural Network) for position evaluation:

Architecture: 8 layer stacks selected by piece count. Forward pass:

  1. fc_0 (AffineTransformSparseInput) - exploits input sparsity
  2. ac_sqr_0 + ac_0 (SqrClippedReLU + ClippedReLU) - concatenated activations
  3. fc_1 (AffineTransform) - hidden layer
  4. ac_sqr_1 + ac_1 (SqrClippedReLU + ClippedReLU) - concatenated
  5. fc_2 (AffineTransform) - output

Feature sets:

  • HalfKAv2_hm: king-relative piece-square features
  • FullThreats: attack/threat relationships via lookup tables
  • PP_3Wide: pawn pair features within 3-file bands

Key innovation: AccumulatorStack tracks dirty pieces/threats/pawn pairs incrementally. Finny Tables cache entries for each of 64 king squares to avoid full recomputation when king moves.

Evaluation pipeline: NNUE output -> complexity calc -> optimism adjustment -> material scaling -> Rule50 damping -> tablebase clamping. Never evaluates positions in check (handled by qsearch).