chessmodel-data / README.md
jinshuoli's picture
Add dataset card (provenance, stats, format, load instructions)
73eb01c verified
|
Raw
History Blame Contribute Delete
4.96 kB
metadata
license: cc0-1.0
language: en
pretty_name: ChessModel-XPU formal teacher dataset
tags:
  - chess
  - alphazero
  - stockfish
  - knowledge-distillation
  - game
  - reinforcement-learning
size_categories:
  - 1M<n<10M

ChessModel-XPU formal teacher dataset

Stockfish-18-labeled chess positions used to train the jinshuoli/chessmodel checkpoint, part of the ChessModel-XPU project.

It is a custom-format dataset of bit-packed board tensors plus sparse Stockfish-derived policy / WDL targets. It is not loadable with datasets.load_dataset(...); use the project's TeacherDataset loader (see below). Game-level train/validation split — adjacent positions from the same game are never spread across splits.

Source and provenance

Source games Lichess Elite database, December 2023 (lichess_elite_2023-12), licensed CC0 1.0
Source SHA-256 a6a5a8253cf357d31b7b5c1895a63dfbf64cc93b4504398f748cb69a31c0eff0
Teacher Stockfish 18 — MultiPV 8, 10000 nodes/position, WDL enabled, temperature 0.15
Split Deterministic game-level 90 / 10 split, seed 7, minimum 16 plies per game
Prep script scripts/prepare_formal_pgn.py

Preparation removed parse failures, non-standard start positions, games without a decisive/draw result, short games (< 16 plies), and duplicate move sequences, then made the deterministic game-level split.

Contents

The dataset mirrors the repository layout, so downloading it into a clone of the project makes the workflow commands resolve unchanged:

Path Description
data/formal_1m_train/shard-00000…00244.npz 245 training shards
data/formal_50k_validation/shard-*.npz 13 validation shards
datasets/formal_train.pgn Source training PGN (game-level split)
datasets/formal_validation.pgn Source validation PGN (game-level split)
datasets/formal_pgn_metadata.json Provenance metadata (source hash, counts, split params)

Total ≈ 370 MB.

Statistics

From datasets/formal_pgn_metadata.json:

Parsed games 315,135
Accepted games 312,603
Train / validation games 281,003 / 31,600
Train / validation positions 2,971,862 / 334,836
Validation percent 10
Seed 7

Shard format

Each .npz shard is a project-defined record containing:

  • Bit-packed board planes (112 × 8 × 8, canonically oriented to the side to move: up to 8 history frames, castling rights, en-passant, side to move, halfmove and fullmove clocks).
  • Sparse policy target over the AlphaZero 8×8×73 = 4672 move encoding.
  • Win/Draw/Loss target derived from Stockfish WDL.
  • A shard format version, per-shard SHA-256 integrity check, Stockfish/node metadata, and the FEN (for legal-move masking and audit).

TeacherDataset loads each shard's bit-packed boards and sparse targets once and unpacks lazily, so the full million-position dataset stays out of resident memory.

How to load

Clone the repo and download the dataset into it, then use the project loader:

git clone https://github.com/JinShuo-Li/ChessModel.git
cd ChessModel
hf download jinshuoli/chessmodel-data --repo-type dataset --local-dir .
from torch.utils.data import DataLoader
from chess_ai.data.dataset import TeacherDataset

train = TeacherDataset("data/formal_1m_train")          # 245 shards
val   = TeacherDataset("data/formal_50k_validation")     # 13 shards
loader = DataLoader(train, batch_size=512, shuffle=True)

Verify integrity with the project's verifier:

python scripts/verify_teacher_dataset.py --dataset data/formal_1m_train
python scripts/verify_teacher_dataset.py --dataset data/formal_50k_validation

Intended use and limitations

  • Intended: training / evaluating compact neural chess models via Stockfish distillation, and reproducing the project's training pipeline.
  • Custom format: not consumable by the HF dataset viewer or datasets.load_dataset(); requires the project's loader.
  • Labels are Stockfish outputs: policy/WDL targets reflect Stockfish 18 search at the configured node budget, not human game outcomes (game results are used only for splitting/filtering).

License and attribution

  • Source game data: © Lichess, CC0 1.0 (public domain).
  • The loading code and preparation scripts are MIT-licensed in the source repository.
  • Stockfish is used solely as a teacher/labeling tool and is not distributed here.

Related