Files
chess-engine/python
KeshavAnandCode 60c3b5aecd feat: implement EXACT Stockfish NNUE feature encoding
- Exact HalfKAv2_hm formula from Stockfish source
- Exact FullThreats formula with lookup tables
- Precomputed tables matching Stockfish structure
- 71 features on starting position
- All tests passing
2026-04-14 19:01:26 -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)