File size: 3,348 Bytes
cf2fa9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f208d38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cf2fa9f
f208d38
 
 
 
 
 
cf2fa9f
 
 
 
 
 
 
 
f208d38
 
 
 
 
7be4c0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f208d38
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
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

```bash
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.