chess / README.md
xLeverd's picture
Update code and baseline
7be4c0c verified
|
Raw History Blame Contribute Delete
3.35 kB
metadata
license: cc0-1.0
task_categories:
  - other
language:
  - en
tags:
  - chess
  - stockfish
  - distillation
  - policy
  - value
size_categories:
  - 100K<n<1M
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*.parquet
      - split: validation
        path: val/val-*.parquet

xLeverd/chess — Stockfish distillation dataset

Synthetic chess positions for supervised policy/value distillation.

What is inside

  • Positions: short self-play games at weak Stockfish skill levels (3–7), i.e. around the SF5 target band. Random opening plies, then engine moves.
  • Labels: full-strength Stockfish 19, fixed depth 12, one principal variation, UCI_ShowWDL=true.
  • No human games in v1. Everything is generated and labeled on CPU.

Fields

Column Type Meaning
fen string Full FEN after python-chess normalization
move_uci string Best move from Stockfish, UCI
move_san string Same move in SAN
cp int16 Centipawn score from side-to-move POV (clamped ±30000)
mate int8 Mate distance from side-to-move POV (nullable)
wdl int8 2 = win, 1 = draw, 0 = loss, side-to-move POV
pv string First 6 moves of the principal variation, UCI
depth int16 Depth reported by Stockfish
nodes int64 Nodes searched for the label
source string sf_selfplay

Generation

python distill.py --target 100000 --workers 8 --depth 12 --out data
python distill.py --target 5000 --workers 6 --depth 12 --seed 987654 --out val
python upload_hf.py

Teacher: Stockfish 19, Skill Level 20, Hash 16, Threads 1, depth 12. Position generator: Stockfish Skill Level 3..7, depth 1–3, 6–36 plies.

Current version (v1)

  • 100,000 train rows, 5,000 validation rows.
  • 99,554 unique train FENs; 0 illegal moves / 0 SAN mismatches in validation.
  • Generated at ~156 positions/s on 8 CPU workers.
  • Median position length: 14 plies; WDL split: 65% draw, 21% win, 14% loss from side-to-move POV.

Intended use

Policy/value distillation for a small chess model, then optional MCTS. The labels are Stockfish outputs; they are not human annotations.

Baseline (v1, 100k train rows)

  • Model: ResNet 128×10, 3.0M params, 20 planes, 4096 policy logits.
  • 10 epochs on RTX 2060: best validation top-1 36.1%, top-5 71.6%, value MAE 0.223, WDL accuracy 0.693.
  • Play vs Stockfish Skill 5 with one-ply value search: 0W 0D 4L.
  • Diagnosis: overfits after ~4 epochs on 100k; one-ply value search does not see immediate recaptures. Next: 500k+ positions, 8-symmetry augmentation, 2-ply/MCTS.

Files

  • distill.py — CPU Stockfish distillation generator.
  • prepare.py — FEN → 20 planes / 4096 policy / value targets.
  • model.py, train.py — ResNet policy/value baseline.
  • play.py — model vs Stockfish arena.
  • kaggle_distill.ipynb — CPU Kaggle notebook for dataset generation.

Limitations

  • Positions are synthetic and biased toward weak-engine self-play.
  • Depth 12 is strong but not perfect; tactical noise exists.
  • No endgame tablebase labels in v1.
  • mate may be entirely null in a shard; cast at training time if needed.

License

CC0-1.0 for the generated dataset. Stockfish itself is GPLv3; only its output labels are stored here.