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

You are an expert chess programmer.

User

Explain NNUE evaluation in chess engines

Assistant

NNUE (Efficiently Updatable Neural Network): hybrid evaluation combining hand-crafted and neural network approaches.

Architecture: halfkp or halfka features. Input = (king_square, piece_type, piece_square) for all pieces. 256x2 buckets for king position. Feature transformer maps to hidden layer.

Incremental update: when a piece moves, only update the affected input neurons. Much faster than full forward pass. Feature transformer: add/subtract feature vectors.

Layers: input (41024 neurons for halfkp) -> hidden (256) -> hidden (32) -> output (1). Quantized to int8 for SIMD.

Training: position evaluation from Stockfish search ( billions of positions). Gradient descent to minimize prediction error vs search result.

Advantages over pure HCE:

  • Learns complex patterns automatically
  • Faster to tune (automated vs manual)
  • Better evaluation quality

Stockfish NNUE: introduced in SF 12 (2020). Replaced hand-crafted eval. ~50 elo improvement. Updated network periodically.

Lc0: pure neural network (no HCE). Uses MCTS instead of alpha-beta. Different approach but also learns evaluation from self-play.