Files
chess-engine/python
KeshavAnandCode 0230c633eb feat: implement EXACT Stockfish NNUE FullThreats encoding
- FullThreats formula: from_piece_idx * 157 + to_piece_idx
- Max index: 59,889 (within 60,720 limit)
- 24 HalfKAv2_hm + 79 FullThreats = 103 features
- All verification tests pass
- Matches Stockfish NNUE encoding structure
2026-04-14 18:54:48 -05:00
..

Chess NNUE Distillation

Train a single linear layer on Stockfish's NNUE features.

Quick Start

cd python
source .venv/bin/activate
pip install torch --index-url https://download.pytorch.org/whl/cu121
pip install numpy python-chess tqdm matplotlib h5py joblib pytest
python train_full.py

Architecture

  • Input: 61,072 features (352 HalfKAv2_hm + 60,720 FullThreats)
  • Output: 1 scalar (centipawns)
  • Optimizer: Adam (lr=1e-3, wd=1e-4)