zero-evaluator / FORMAT.md
Pawitt's picture
Publish high-variance 1.5M chess position Parquet dataset
5f87c14 verified
|
Raw
History Blame Contribute Delete
3.65 kB

VPD1: Vex Position Dataset

VPD1 is an indexed SQLite container for independent chess positions. Its file extension is .vpd. It is designed for static teacher labeling, where a consumer needs one complete board immediately without replaying a game.

Position identity

Each row stores a legal six-field FEN. The fullmove number is normalized to 1; it does not affect board state or lc0 evaluation. The halfmove clock is preserved because it affects draw rules. En-passant state and castling rights are preserved.

The fen column is unique, so duplicate positions from different games are removed.

Tables

metadata(key, value) records provenance, format version, sampling seed, target size, quotas, progress, and completion information.

positions contains:

Column Meaning
id Integer row identifier
random_key Indexed deterministic 63-bit key for fast random sampling
fen Normalized six-field FEN
source_split Original train/test split if present
source_member PGN member inside the source archive
game_number Sequential source-game number
ply Ply at which the position was sampled
result Source game result; metadata, not a static WDL label
side_to_move 1 for White, 0 for Black
phase 0 opening, 1 middlegame, 2 endgame
piece_count Occupied squares
non_pawn_material Combined N/B/R/Q material in pawn units
material_balance White material minus Black material
legal_moves Legal move count
in_check Whether the side to move is in check
castling_mask KQkq availability as four bits
halfmove_clock Fifty-move-rule clock

Immediate access

By row identifier:

SELECT fen FROM positions WHERE id = 12345;

Near-constant-time random access uses the indexed random_key:

SELECT fen
FROM positions
WHERE random_key >= :random_63_bit_integer
ORDER BY random_key
LIMIT 1;

The supplied vpd.py sample command implements wraparound when the random key is above the largest stored key.

Parquet derivative

vpd_to_parquet.py converts the same rows into a columnar training dataset. The output uses Hive directories for source_split and phase; those two columns are therefore encoded in paths instead of duplicated inside each file. Each remaining VPD1 column retains its meaning, except phase is exposed as the strings opening, middlegame, and endgame.

Files use Zstandard compression and 65,536-row groups. _manifest.json contains the source database checksum plus per-file row counts, sizes, row groups, ID bounds, and checksums. This representation is optimized for batch and filtered scans; retain VPD1 SQLite for indexed single-position lookup.

Sampling policy

At most one position per game and phase is selected with reservoir sampling. The default 1.5-million-position build uses fixed phase quotas:

  • 15% opening
  • 60% middlegame
  • 25% endgame

This reduces correlation between adjacent plies and prevents ordinary middlegames from overwhelming openings and endgames.

Phase classification is deterministic:

  • opening: ply 20 or earlier with at least 50 combined non-pawn material;
  • endgame: at most 20 combined non-pawn material or at most 12 pieces;
  • middlegame: everything else.

Variance contract

A database is marked high_variance=true only if every declared threshold in the JSON report passes. The checks cover corpus size, phase entropy, minimum phase and result shares, side-to-move balance, legal-move spread, piece-count spread, material imbalance, castling-state coverage, and positions in check.