exp190 phase-balanced deep MultiPV soft targets (SF18)
Browse files- ARCHITECTURE.md +41 -0
- PROGRESS.md +124 -0
- README.md +65 -0
- data/positions_000001.jsonl +0 -0
- data/positions_000002.jsonl +0 -0
- data/positions_000003.jsonl +0 -0
- data/positions_000004.jsonl +0 -0
- data/positions_000005.jsonl +0 -0
- data/positions_000006.jsonl +0 -0
- data/positions_000007.jsonl +0 -0
- data/positions_000008.jsonl +0 -0
- data/positions_000009.jsonl +0 -0
- data/positions_000010.jsonl +0 -0
- data/positions_000011.jsonl +0 -0
- data/positions_000012.jsonl +0 -0
- data/positions_000013.jsonl +0 -0
- data/positions_000014.jsonl +0 -0
- data/positions_000015.jsonl +0 -0
ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# exp190 — saturating soft data without starving training
|
| 2 |
+
|
| 3 |
+
## Problem
|
| 4 |
+
exp186 soft cache was ~56% opening / 22% mid / 22% end. Openings label
|
| 5 |
+
faster (shallower trees) so naive HF streaming floods the dataset. Training
|
| 6 |
+
then overfits early-game priors and underperforms in middlegame/endgame —
|
| 7 |
+
exactly where Elo is decided without MCTS.
|
| 8 |
+
|
| 9 |
+
## Data architecture
|
| 10 |
+
| Lever | Design |
|
| 11 |
+
|---|---|
|
| 12 |
+
| Phase quotas | 22% opening / 48% middlegame / 30% endgame (hard gate at writer) |
|
| 13 |
+
| Depth-by-phase | op 10–14, mid 12–16, eg 14–18 (full-strength SF18, no Elo limit) |
|
| 14 |
+
| Multi-source FENs | HF stream + book playouts + endgame templates + random walks |
|
| 15 |
+
| Deficit-first feed | Producer oversamples the lagging phase every cycle |
|
| 16 |
+
| Syzygy | Wired into each worker when `syzygy/*.rtbw` present |
|
| 17 |
+
| soft_cache tags | `phase` + `label_depth` tensors for stratified training |
|
| 18 |
+
|
| 19 |
+
## Training efficiency (how to consume this)
|
| 20 |
+
1. **Stratified batches** — sample 1/3 from each phase bucket every step so
|
| 21 |
+
gradients never bog on openings.
|
| 22 |
+
2. **Depth weights** — `w = label_depth / mean_depth` (or clip 0.5–1.5) so
|
| 23 |
+
deeper MultiPV pulls harder than shallow noise.
|
| 24 |
+
3. **Critical upweight** — boost high `cp_gap_top1_top2` / low entropy rows
|
| 25 |
+
(forcing moves teach more than quiet equals).
|
| 26 |
+
4. **Merge, don't replace** — mix exp190 deep cache with exp186 2M shallow
|
| 27 |
+
at ~30/70 so you keep volume + add quality.
|
| 28 |
+
5. **Round-robin curriculum** — alternate soft-deep / soft-shallow / hard-HF
|
| 29 |
+
micro-batches inside the same step (already partially done via soft_frac).
|
| 30 |
+
|
| 31 |
+
## Model-side advantages (no MCTS)
|
| 32 |
+
- Phase-balanced policy → fewer “opening genius / endgame idiot” failures
|
| 33 |
+
- Deeper soft targets → better next-move calibration under legal-mask argmax
|
| 34 |
+
- Endgame + Syzygy teacher → converts tablebase-perfect moves into policy mass
|
| 35 |
+
- Compact vocab + spatial head already amortizes move representation
|
| 36 |
+
|
| 37 |
+
## Ops
|
| 38 |
+
- SF binary: `stockfish/stockfish-latest` → SF18 `x86-64-vnni512` (Xeon 6342)
|
| 39 |
+
- 64 workers × 96MB hash ≈ 6GB; ~441GB RAM free on this box
|
| 40 |
+
- Safe alongside GPU exp189 (CPU-only)
|
| 41 |
+
- Tail: `tail -f outputs/exp190_phase_deep/run.log`
|
PROGRESS.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Progress report — 2026-07-10 / 2026-07-11
|
| 2 |
+
|
| 3 |
+
Session goal: push the latest **200M compact-vocab** ChessTransformer toward high Elo
|
| 4 |
+
**without MCTS** (pure next-move / policy argmax), while growing better soft-target data.
|
| 5 |
+
|
| 6 |
+
## Summary
|
| 7 |
+
|
| 8 |
+
| Item | Result |
|
| 9 |
+
|------|--------|
|
| 10 |
+
| Base model | `avewright/chess-transformer-200m-compact-soft` |
|
| 11 |
+
| Finetune run | **exp189** — soft MultiPV + hard deep labels + h-flip |
|
| 12 |
+
| Deep data harvest | **exp190** — phase-balanced SF18 MultiPV (ongoing) |
|
| 13 |
+
| Checkpoint pushed | `latest` step **2851**, `best` by holdout metric at step **500** |
|
| 14 |
+
| Pure-policy Elo (vs SF18 limited) | **~1700** (bracket 1500–1800) |
|
| 15 |
+
| Training status | Stopped on request after plateau |
|
| 16 |
+
|
| 17 |
+
## What we shipped (code)
|
| 18 |
+
|
| 19 |
+
| Path | Role |
|
| 20 |
+
|------|------|
|
| 21 |
+
| `experiments/exp189_200m_maxelo_policy.py` | Max-Elo policy finetune; mixes shallow soft + deep soft + hard HF |
|
| 22 |
+
| `experiments/exp190_phase_deep_harvest.py` | Phase-quota MultiPV harvest (SF18, Syzygy, multi-source FENs) |
|
| 23 |
+
| `scripts/run_exp189_200m_maxelo.sh` | Initial exp189 launch |
|
| 24 |
+
| `scripts/run_exp189_deep_mix.sh` | Resume with `--deep-soft-cache` mix |
|
| 25 |
+
| `scripts/run_exp190_phase_deep.sh` | Harvest launcher (40 workers, SF18 vnni512) |
|
| 26 |
+
| `play_factory_gui.py` | Fix: Chess960 castling UCI (`e8a8`) → standard (`e8c8`) for chess.js |
|
| 27 |
+
|
| 28 |
+
## Training recipe (exp189)
|
| 29 |
+
|
| 30 |
+
Resumed from compact-soft, then continued with deep-mix:
|
| 31 |
+
|
| 32 |
+
- Soft frac **0.72**, soft α **0.40**, deep-mix frac **0.40** among soft steps
|
| 33 |
+
- Batch **448 × 2** accum, LR **4e-6** cosine, warmup 200
|
| 34 |
+
- H-flip aug **p=0.5** on soft batches
|
| 35 |
+
- Hard ballast: HF lichess-sf stream, `min_depth≥15`
|
| 36 |
+
- Eval: shallow holdout + deep holdout; `best.pt` tracks blended top-1
|
| 37 |
+
|
| 38 |
+
### Observed learning
|
| 39 |
+
|
| 40 |
+
Deep-mix run plateaued around:
|
| 41 |
+
|
| 42 |
+
- Shallow soft holdout top-1 ≈ **38%**
|
| 43 |
+
- Deep soft holdout top-1 ≈ **41%**
|
| 44 |
+
- Blended best metric **0.3966** recorded at step **500** of the deep-mix resume
|
| 45 |
+
- Shutdown save: `latest.pt` at step **2851**
|
| 46 |
+
|
| 47 |
+
Losses stayed flat (~soft 2.38, hard CE ~1.79) — model had largely extracted the
|
| 48 |
+
signal from the then-available mix (~2M shallow + ~96–175k deep).
|
| 49 |
+
|
| 50 |
+
## Soft targets — why they matter
|
| 51 |
+
|
| 52 |
+
Hard labels = one Stockfish best move. Soft MultiPV labels = a **distribution** over
|
| 53 |
+
plausible moves (score → softmax). That teaches:
|
| 54 |
+
|
| 55 |
+
1. Near-equal alternatives (not overconfident on one line)
|
| 56 |
+
2. Better calibration under legal-mask argmax (no search)
|
| 57 |
+
3. Deeper MultiPV (exp190) = sharper teacher in middlegame/endgame
|
| 58 |
+
|
| 59 |
+
exp186 already provided ~2M shallow soft rows (`avewright/exp186-sf-multipv-2m`).
|
| 60 |
+
exp190 adds **phase-balanced deeper** labels so training does not drown in openings.
|
| 61 |
+
|
| 62 |
+
## exp190 harvest design
|
| 63 |
+
|
| 64 |
+
Targets: **22% opening / 48% middlegame / 30% endgame**
|
| 65 |
+
|
| 66 |
+
| Lever | Design |
|
| 67 |
+
|-------|--------|
|
| 68 |
+
| Depth-by-phase | opening 10–14, mid 12–16, endgame 14–18 |
|
| 69 |
+
| Teacher | Stockfish **18** full strength (`stockfish/stockfish-latest` vnni512) |
|
| 70 |
+
| Sources | HF streams + book playouts + endgame templates + random walks |
|
| 71 |
+
| Quotas | Deficit-first producer + hard gate at writer |
|
| 72 |
+
| Tags | `phase`, `label_depth` in `soft_cache.pt` for stratified training |
|
| 73 |
+
| Syzygy | Workers probe tablebases when present |
|
| 74 |
+
|
| 75 |
+
At upload time harvest was ~**187k** written positions (target 1M, still running),
|
| 76 |
+
phase mix roughly on quota. See `outputs/exp190_phase_deep/ARCHITECTURE.md`.
|
| 77 |
+
|
| 78 |
+
## Elo evaluation
|
| 79 |
+
|
| 80 |
+
Script: `elo_eval_latest.py`
|
| 81 |
+
Checkpoint: `outputs/exp189_200m_maxelo_policy/latest.pt`
|
| 82 |
+
Opponent: SF18 `UCI_LimitStrength`, 50ms/move, 8 openings × both colors, Syzygy + book.
|
| 83 |
+
|
| 84 |
+
| SF Elo | Score | W–D–L |
|
| 85 |
+
|--------|-------|-------|
|
| 86 |
+
| 1500 | 0.625 | 7–6–3 |
|
| 87 |
+
| 1800 | 0.438 | 4–6–6 |
|
| 88 |
+
|
| 89 |
+
**Estimated Elo ≈ 1700** (noisy; ±~150 with this sample).
|
| 90 |
+
Weakness: **Black** side (more losses / short mates). No MCTS at inference.
|
| 91 |
+
|
| 92 |
+
## Hugging Face artifacts
|
| 93 |
+
|
| 94 |
+
| Repo | Type | Contents |
|
| 95 |
+
|------|------|----------|
|
| 96 |
+
| `avewright/chess-transformer-200m-maxelo` | model | `best_model.pt`, `latest_model.pt`, config, Elo + progress docs |
|
| 97 |
+
| `avewright/exp190-phase-deep-soft` | dataset | `soft_cache.pt`, jsonl shards, status, architecture notes |
|
| 98 |
+
|
| 99 |
+
Base still: `avewright/chess-transformer-200m-compact-soft`
|
| 100 |
+
Shallow soft still: `avewright/exp186-sf-multipv-2m`
|
| 101 |
+
|
| 102 |
+
## How to load for inference
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
export MOVE_VOCAB_VERSION=compact
|
| 106 |
+
python play_factory_gui.py --checkpoint path/to/latest_model.pt
|
| 107 |
+
# or
|
| 108 |
+
python elo_eval_latest.py path/to/latest_model.pt
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
Policy-only: legal-mask argmax on `policy_logits` (see `elo_eval_latest.get_model_move_generic`).
|
| 112 |
+
|
| 113 |
+
## Next levers (not done this session)
|
| 114 |
+
|
| 115 |
+
1. Grow exp190 to 1M+ and retrain with stratified phase sampling + depth weights
|
| 116 |
+
2. Longer Elo gauntlet (more games / level) and evaluate `best` vs `latest`
|
| 117 |
+
3. AlphaZero-style expert iteration (`exp183_selfplay.py` / `rl_selfplay/`) after supervised plateau
|
| 118 |
+
4. Fix Black-side weakness (phase-balanced Black STM oversampling, or STM-normalized training audit)
|
| 119 |
+
|
| 120 |
+
## Ops notes
|
| 121 |
+
|
| 122 |
+
- Training stopped cleanly: `Saved on shutdown at step 2851`
|
| 123 |
+
- Harvest left running on CPU (40 workers) so it does not starve a future GPU train
|
| 124 |
+
- `.env` / tokens are gitignored — never commit HF or GitHub secrets
|
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
pretty_name: exp190 Phase-Balanced Deep Soft Targets
|
| 4 |
+
tags:
|
| 5 |
+
- chess
|
| 6 |
+
- stockfish
|
| 7 |
+
- multipv
|
| 8 |
+
- soft-labels
|
| 9 |
+
- imitation-learning
|
| 10 |
+
size_categories:
|
| 11 |
+
- 100K<n<1M
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# exp190 — Phase-balanced deep MultiPV soft targets
|
| 15 |
+
|
| 16 |
+
Stockfish **18** MultiPV soft-policy labels with **phase quotas** so training
|
| 17 |
+
does not drown in openings. Built for policy-only (no-MCTS) ChessTransformer
|
| 18 |
+
finetunes such as [`avewright/chess-transformer-200m-maxelo`](https://huggingface.co/avewright/chess-transformer-200m-maxelo).
|
| 19 |
+
|
| 20 |
+
## Motivation
|
| 21 |
+
|
| 22 |
+
Naive HF streaming + shallow MultiPV skews toward openings. Elo without search is
|
| 23 |
+
decided in middlegame/endgame. This harvest enforces:
|
| 24 |
+
|
| 25 |
+
| Phase | Target share | Label depth |
|
| 26 |
+
|-------|--------------|-------------|
|
| 27 |
+
| Opening | 22% | 10–14 |
|
| 28 |
+
| Middlegame | 48% | 12–16 |
|
| 29 |
+
| Endgame | 30% | 14–18 |
|
| 30 |
+
|
| 31 |
+
## Contents
|
| 32 |
+
|
| 33 |
+
| Path | Description |
|
| 34 |
+
|------|-------------|
|
| 35 |
+
| `soft_cache.pt` | Torch cache ready for exp189-style training |
|
| 36 |
+
| `data/*.jsonl` | Raw labeled positions (FEN + MultiPV soft targets) |
|
| 37 |
+
| `status.json` | Harvest counters at upload time |
|
| 38 |
+
| `ARCHITECTURE.md` | Design notes for stratified training |
|
| 39 |
+
|
| 40 |
+
### `soft_cache.pt` tensors
|
| 41 |
+
|
| 42 |
+
`board_array`, `turn`, `castling`, `ep_square`, `move_idx`, `cp`, `mate`,
|
| 43 |
+
`soft_indices`, `soft_probs`, **`phase`**, **`label_depth`**.
|
| 44 |
+
|
| 45 |
+
Phase encoding: `0=opening`, `1=middlegame`, `2=endgame`.
|
| 46 |
+
|
| 47 |
+
## How it was generated
|
| 48 |
+
|
| 49 |
+
- Engine: Stockfish 18 (`x86-64-vnni512`), full strength, MultiPV 8
|
| 50 |
+
- FEN sources: HF position streams, book playouts, endgame templates, random walks
|
| 51 |
+
- Deficit-first producer + hard phase gate at writer
|
| 52 |
+
- Syzygy tablebases when available
|
| 53 |
+
- Code: `experiments/exp190_phase_deep_harvest.py` in [avewright/transform](https://github.com/avewright/transform)
|
| 54 |
+
|
| 55 |
+
## Recommended training use
|
| 56 |
+
|
| 57 |
+
1. Mix with shallow volume (`exp186-sf-multipv-2m`) at ~30–40% deep / 60–70% shallow
|
| 58 |
+
2. Stratify batches by `phase` (1/3 each) so gradients never bog on openings
|
| 59 |
+
3. Optional depth weight: `w = label_depth / mean_depth` (clip 0.5–1.5)
|
| 60 |
+
|
| 61 |
+
## Related
|
| 62 |
+
|
| 63 |
+
- Shallow soft: [`avewright/exp186-sf-multipv-2m`](https://huggingface.co/datasets/avewright/exp186-sf-multipv-2m)
|
| 64 |
+
- Model trained with this mix: [`avewright/chess-transformer-200m-maxelo`](https://huggingface.co/avewright/chess-transformer-200m-maxelo)
|
| 65 |
+
- Progress write-up: `docs/PROGRESS_2026-07-10.md` in the transform repo
|
data/positions_000001.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000002.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000003.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000004.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000005.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000006.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000007.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000008.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000009.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000010.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000011.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000012.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000013.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000014.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/positions_000015.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|