SN97 training set: 41,463 rows + runbook, analysis, local scorer
Browse filesFiles changed (8)
- .gitattributes+2
- ANALYSIS.mdAdded+189
- README.mdAdded+193
- TRAINING_RUNBOOK.mdAdded+284
- local_scorer.pklAdded+3
- questions.jsonAdded+3
- score_local.pyAdded+110
- sft_final_v2.jsonlAdded+3
57 unmodified lines58596057 unmodified lines# Video files - compressed*.mp4 filter=lfs diff=lfs merge=lfs -text*.webm filter=lfs diff=lfs merge=lfs -text57 unmodified lines585960616257 unmodified lines# Video files - compressed*.mp4 filter=lfs diff=lfs merge=lfs -text*.webm filter=lfs diff=lfs merge=lfs -textquestions.json filter=lfs diff=lfs merge=lfs -textsft_final_v2.jsonl filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189# Duels against King 124 — analysis
King 124 = `s3://albedo-private-models-enam/.../ac88399ae7258da203f90fc54d44ebbd6e4e35f35cf2da09de8b42ad5a3e64d1`
8 runs pulled: 6 challengers that lost to it, plus its own 2 coronation evals(0.6946 and 0.7104 vs wondercat — the two independent wins required to take the crown).595 paired samples vs king, 794 king-side samples total.
## Scoreboard
| challenger | score | king | margin | loop-zeroed | <0.34 | edit rate ||---|---|---|---|---|---|---|| PRIVATE-f0ef9a32 (uid 232) | 0.673 | 0.665 | +0.008 | 0/99 | 8.1% | 39.4% || miner-to02 (uid 236) | 0.656 | 0.676 | -0.021 | 0/99 | 15.2% | 44.4% || **vh96v1 (ours, uid 225)** | **0.609** | 0.712 | **-0.103** | 1/100 | 18.0% | 62.0% || 4e538ed68b (uid 97) | 0.592 | 0.663 | -0.071 | 0/99 | 16.2% | 63.6% || 2e632862e8 (uid 98) | 0.568 | 0.668 | -0.100 | 2/99 | 21.2% | 61.6% || king-wife (uid 224) | 0.558 | 0.664 | -0.106 | 3/99 | 22.2% | 57.6% || KING 124 | 0.682 | — | — | 0/794 | 11.8% | 40.2% |
## 1. The eval is a find-and-show test, not a fix-the-bug test
Weight distribution across judge questions, and where the 5.44-point pooled gap comes from:
| tag | share of weight | king pass | chal pass | gap contribution ||---|---|---|---|---|| reference:explore | 52.8% | 74.3% | 68.3% | 3.18 (58%) || reference:claims | 23.9% | 58.5% | 50.5% | 1.91 (35%) || reference:grounding | 12.2% | 58.4% | 51.2% | 0.88 (16%) || reference:verification | 5.0% | 50.5% | 49.7% | 0.04 || reference:action | 4.9% | 47.2% | **58.0%** | **-0.53** || behavior:anchored_edit | 1.1% | 50.8% | 54.6% | -0.04 |
89% of scoring weight is read/evidence behaviour. Action is 4.9% of weight andchallengers already **beat** the king on it by 10.8 points.
In 440 of 595 samples (74%) the SOTA reference itself made no edit at all.
## 2. Editing more is negatively correlated with score
Paired by sample, margin is negative in every quadrant:
| king edited | chal edited | n | king | chal | margin ||---|---|---|---|---|---|| yes | yes | 204 | 0.665 | 0.615 | -0.050 || yes | no | 29 | 0.615 | 0.581 | -0.034 || no | yes | 122 | 0.666 | 0.611 | -0.055 || no | no | 240 | 0.694 | 0.607 | **-0.087** |
The gap is *widest* on samples where neither side edits. Edit count vs score forchallengers: 1 edit 0.643, 2 edits 0.579, 5+ edits 0.570. Within the king,editing correlates -0.026.
## 3. Looping is no longer the main failure
vh96v1 loop-zeroed 1 sample in 100, worth ~0.007 of a 0.103 gap (7%).Only king-wife (3%) and 2e632862e8 (2%) still lose meaningful points here.This was the top priority in earlier analysis; it is now mostly solved.
## 4. The gap is a tail problem
| model | margin | from samples <0.34 | share of gap ||---|---|---|---|| vh96v1 | -0.103 | -0.071 (18 samples) | 70% || 4e538ed68b | -0.071 | -0.042 (16) | 59% || 2e632862e8 | -0.100 | -0.060 (21) | 60% || king-wife | -0.106 | -0.084 (22) | 79% |
vh96v1 scores zero on 6.0% of samples vs the king's 2.7%. On the 82 non-tailsamples we are roughly at parity. Cutting the tail from 18 to the king's ~12closes most of the deficit.
## 5. Mechanism: not reading less, reading the wrong place
Read-shape is nearly identical — challengers actually read *more*:
| | obs chars | grep | cat | sed -n | find/ls | recursive grep | distinct files ||---|---|---|---|---|---|---|---|| king | 41,072 | 3.8 | 4.2 | 2.9 | 3.0 | 1.1 | 5.1 || challengers | 44,539 | 3.8 | 4.9 | 2.8 | 2.9 | 0.8 | 4.9 |
Evidence-span coverage (does the transcript literally contain the span thequestion asks about): king 40.0%, challengers 38.1% — a 1.9-point differencethat cannot explain a 6-point score gap. Conditional pass rates: with the spanpresent both sides pass ~86%; with it absent, king 46.4% vs challengers 39.8%.
Judge explanations on the 1,251 questions the king passed and challengers failed:
- **~78% — never opened or displayed the target file/function.** Not "read too little", but explored a different part of the repo. "The candidate never opens coverage/sqldata.py"; "never greps or inspects parso/python/tree.py".- **11.4% — asserted a claim without showing supporting output.** Straight hallucination: the model states a conclusion no observation backs.- **4.5% — looped**, sample forced to 0.- **2.2%** — displayed partially / truncated.- A recurring sub-mode inside the first bucket: **a command errors and the model never recovers.** "every attempt to read utils/JsonNodes.java returned a stale 'No such file or directory'"; "runs the reproduction with plain `python reproduce_issue.py` and never establishes PYTHONPATH=src"; "failed with ModuleNotFoundError and never successfully showed...". This is the exposure-bias snowball, visible in the judge's own words.
## 6. Bonus: 793 SOTA reference trajectories extracted
`reference_trajectories.jsonl` (24.6 MB) — the glm-5.2 trajectories the judgequestions are anchored to. Mean self-score 0.956, 65% score a perfect 1.0,mean 29.4k chars. These are the exact behaviour the questions reward.
## 7. The two gates score DISJOINT turn windows
| | turns generated | turns judged | judged on ||---|---|---|---|| duel (vs king) | 12 or 16 | **1–16** | evidence display: explore/claims/grounding = 89% of weight || pre-eval (sanity) | 32 | **17–32** (`TAIL_CUTOFF = 16`) | did you keep doing real work, then edit and submit |
This resolves the apparent contradiction: vh96v1 loops on only 1/100 duelsamples, yet loops are its top pre-eval killer. The model holds together throughturn 16 and falls apart after — and only pre-eval looks there.
Tail judge fails if >=3 questions score 0 on >=2 samples(`TAIL_JUDGE_FAIL_ZEROS = 3`, `TAIL_JUDGE_MIN_FAILED_SAMPLES = 2`). The fourquestions, with how often miners failed each in the last 200 submissions:
1. 33x — Does each shown non-submission turn take a concrete action that plausibly advances the task?2. 33x — Are the shown turns free of near-identical repeated commands, aside from renewed submission attempts?3. 29x — Does the visible reasoning actually inform the commands taken, rather than being absent, generic boilerplate, or unrelated padding?4. 11x — Is every shown turn coherent task work rather than filler, noise, or broken text?
Duel loop thresholds (`shared/loop_check.py`): `DUP_CMD_THRESHOLD = 0.65`,`MAX_RUN_THRESHOLD = 6`.
### Pre-eval failures, last 200 submissions (all miners)
| count | fault ||---|---|| 46 | looping (same command 6x+ consecutively, or dup ratio >= 0.65) || 39 | no submission / no edits in 32 turns; no unprompted submission; repeated submissions without work || 33 | degenerate tail past turn 16 || 21 | upload window expired || 8 | response exceeded token limit on N consecutive turns |
### chelsea-blue's own 10 pre-eval failures
| count | fault ||---|---|| 5 | looping (6x, 7x, 15x consecutive; dup ratio 0.67) || 2 | no submission and no edits in 32 turns || 1 | micro-task submitted without touching the required file || 1 | duplicate weights vs our own earlier upload || 1 | hotkey already has a validated submission |
Two hotkeys reached "0 attempts left and is now banned from further submissions".The ban counter is per hotkey and pre-eval failures burn it.
## 8. The sample pool is public, not a guess
`docs/DATASETS.md` names all four corpora and they are public HF datasets:
| source | upstream ||---|---|| `mini-coder` | `ricdomolm/mini-coder-trajs-400k` || `mini-coder-rs` | `AlienKevin/SWE-smith-rs-*` (3 repos) || `open-swe-traces` | `nvidia/Open-SWE-Traces` || `swe-hero` | `nvidia/SWE-Hero-openhands-trajectories` |
`dataset_version = "mini-coder+open-swe+smith-rs+hero-v1"`. The combinedmanifest — per-source repo, shard list, per-shard `rows_meta` — is published at`https://albedo.tech/datasets/manifest.json` (160 MB, currently HTTP 200),hash-pinned to `e3cff61772b0096811d4c5d8bbc8dee8dacbd9a069bc4557608adf1c1c2ddf40`.
Observed source mix in these 8 runs: mini-coder 435, open-swe-traces 298,swe-hero 34, mini-coder-rs 33.
We cannot know *which* 100 samples a duel draws, but the pool is fullyenumerable. No pattern-guessing is needed.
## Implications for the training set
1. Stop overweighting edit turns. Action is 4.9% of weight and we already win it.2. Optimise for *evidence display*: keep turns whose observation contains the span a question would ask about; that is 89% of the weight.3. Train show-before-claim: every assertion in an assistant turn must be preceded by a command whose output contains it. 11.4% of lost questions are unbacked claims.4. Train recovery from failed commands — wrong path, ModuleNotFoundError, missing PYTHONPATH. This is where the 18-sample tail lives.5. Loop-masking is maintenance now, not the priority.6. Judge-free local metric: evidence-span coverage against `reference_trajectories.jsonl`. Runs without an OpenRouter key.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193# duel_corpus — credit-assigned SFT data from SN97 duel artifacts
Built from the 200 eval runs the dashboard still exposes. The core idea: thejudge answers questions about a whole trajectory, but 81% of its explanationsname the `CANDIDATE OUTPUT N` block that satisfied each question. That citationis the only per-turn reward signal SN97 emits, and it is free — other miners'GPU time already paid for it.
## Pipeline
| step | script | output ||---|---|---|| 0 | `harvest_all.py` | `raw/` — 400 artifacts, 5.93 GB, 19,811 scored samples || 1 | `build_turn_corpus.py` | `turns.jsonl` (506,201 turns), `samples.jsonl` (39,622 sides) || 2 | `select_targets.py` | `sft_duel_credit_v1.jsonl` — 4,751 rows || 4 | `validate.py` | `sft_duel_credit_v1.clean.jsonl` — **4,664 rows, 22,762 train turns** |
Re-runnable end to end; the harvest resumes if interrupted.
## Output format
Drop-in for `sft/data.py`: a full `messages` list where assistant turns thatshould receive gradient carry `train: true`. Everything else stays as context,which is the point — the model must see the states it will generate from,including the failed ones.
Each row also carries `train_meta` (per-turn earned weight, tags, `is_recovery`,`cmd_kind`) so composition can be reweighted at training time without a rebuild.
## What the corpus says
Turn credit is not uniform. Mean credit earned by a turn, by command:
| command | share of turns | mean credit | % earning ||---|---|---|---|| `cat -n` | 9.8% | 1.350 | 44.3% || `sed -n` | 14.1% | 1.165 | 40.6% || `cat` | 14.6% | 0.866 | 37.0% || edit | 1.9% | 0.716 | 41.3% || `grep -r` | 4.2% | 0.487 | 30.0% || `pytest`/`python` | 11.2% | 0.247 | 21.8% || `find`/`ls` | 10.4% | 0.186 | 18.1% || submit | 0.4% | 0.153 | 9.5% |
Displaying file content earns 5-7x what `find`/`ls`/`pytest` earn, and those twolow-value kinds are 21.6% of all turns in the wild. That is the waste.
Credit is also strongly front-loaded — turn 1 earns 1.523, turn 15 earns 0.186.The first three turns are where a sample is won.
Exposure bias is measurable here: 19.2% of turns get a failed observation, and aturn following a failure earns credit only 18.8% of the time against a 30.3%baseline. A single bad command costs ~40% of the next turn's expected credit.
## Composition of the built dataset
24,472 selected train turns before validation, 22,762 after:
- command mix: `cat -n` 18.1%, `sed -n` 16.9%, `cat` 16.2% (51% display), `find`/`ls` down to 5.9%- earned tags: grounding 35.6%, explore 29.6%, claims 20.9% — 86% on the three tags carrying 89% of duel weight- 2,841 recovery turns (earned credit immediately after a failed observation), present in 41% of rows- source sides average 0.941 score, deduped to one side per `sample_id`- 4.2M trainable tokens; mean sequence 9,394 tokens, 0.4% over a 32,768 limit
## Gates applied
Run with the validator's own `loop_check` and `observation_format`:
- source side must be non-looped, score >= 0.85, `dup_cmd_ratio` <= 0.45, `max_cmd_run` <= 3 (validator kills at 0.65 / 6, so there is margin)- a repeated command never receives gradient- train turns must contain exactly one bash block, no unclosed `<think>`, no duplicate command among targets — violations are demoted to context, not dropped- 100% of train turns tokenize with `sft/data.py` and their label span decodes back to exactly the assistant content
## The escape set — `build_escape_set.py`
The Phase 2 filter above selects per *side*, and that quietly recreated theproblem it was supposed to fix: requiring score >= 0.85 and low repetition threwout every trajectory that demonstrates being stuck. It kept 8,021 of 39,622sides and captured only 16.8% of the available recovery material (2,805 of16,650 turns).
`build_escape_set.py` selects per *turn* instead. A turn qualifies when itearned judge credit and the state before it was bad — previous observationfailed, or previous commands were repeating. The degenerate prefix is keptverbatim with no gradient; only the escape trains. A side that scored 0.3overall still contributes its one good escape, because per-turn credit isverified per-question regardless of the side's total.
`sft_escape_v1.jsonl` — 13,979 rows, 7,655 unique samples:
- **73.7% come from sides Phase 2 rejected** — that is the material that matters- 98.3% follow a failed observation, 1.8% follow a repeat run- prior consecutive failures: mean 1.29, max 10- escapes are mostly reads: `cat` 19.2%, `grep` 18.5%, `cat -n` 14.1%, `sed -n` 13.5%- 100% tokenize clean, median 8,006 tokens, 1.8% over 32,768
## Combined output
`sft_final_v1.jsonl` — 18,643 rows, 36,741 gradient-bearing turns, 861 MB.4,664 credit rows (what winning looks like) + 13,979 escape rows (how to getout of trouble). Rows carry `mix` = `credit` | `escape` for reweighting.
## Judge-free local scorer
SN97 scores a trajectory by asking an LLM judge yes/no questions. The questionsare *in the artifacts* — what we lack is only the judge. So `build_local_scorer.py`featurizes each question against a trajectory and `fit_local_scorer.py` fits aclassifier to answer it. Train/test split is by eval run, so evaluation neversees a duel it was fit on.
| step | script | output ||---|---|---|| features | `build_local_scorer.py` | `scorer_features.jsonl` — 39,622 sides, 565k questions || fit | `fit_local_scorer.py` | `local_scorer.pkl` (gradient boosting) || use | `score_local.py --build-index` then `--trajectories mine.jsonl` | `local_scores.jsonl` |
Requires the venv at `/root/.venv-tok` (numpy, scikit-learn).
### Measured accuracy, held out
| what | number ||---|---|| per-question accuracy / AUC | 0.771 / 0.849 || per-side score correlation | pearson 0.727, **MAE 0.140** || paired same-sample: picks the better side | 70.0% || duel margin sign agreement | 73.3% || per-model ranking (57 models) | spearman 0.561 || loop detection | **exact** — runs the validator's own `loop_check` || catastrophic flag at <0.35 | precision 0.820, recall 0.384 |
### What this is and is not good for
**Trustworthy:** catching loops before you submit (exact, and it is what bannedtwo of your hotkeys); flagging which specific samples the model falls apart on(82% precision), which matters because 70% of the gap to the king lives insamples scoring under 0.34.
**Only with enough samples:** the per-sample error is 0.207, so a 100-sample rungives +/-0.041 at 95% — wider than the 0.025 margin that decides a duel. It takes**500+ paired samples to resolve 0.025**, 1000 to be comfortable. Generate on500–1000 samples, not 100.
**Not trustworthy:** any single sample's score (MAE 0.140), and ranking twomodels that are genuinely close.
End-to-end check on a held-out run: predicted 0.5804 against the judge's 0.5779.
## Window B — `../mini_coder/mine_window_b.py`
Duel artifacts stop at turn 16, so they contained only **243** escapes out of arepeat run and nothing at all past the cutoff where pre-eval's tail judge looks.`mini-coder` (`ricdomolm/mini-coder-trajs-400k`, 9.4 GB, 396,382 trajectories)covers exactly that region: mean 33 assistant turns, and 99.9% end in a submit.
Two products, suffix-masked the same way:
| product | rows | what it teaches ||---|---|---|| `escape` | 6,820 (**28x** the duel corpus; 41.3% past turn 16) | a command repeats, a *different* command breaks out — gradient on the escape only || `finish` | 177,559 mined, capped to 16,000 | concrete non-repeating tail work on verified tasks, plus the closing submit |
`finish` is capped at one row per instance because 177,559 rows come from only20,267 instances; uncapped it would swamp the duel material and pull the modeltoward mini-coder's style in the window that decides duels.
## Final mix — `build_final_mix.py` -> `sft_final_v2.jsonl`
**41,463 rows, 59,561 gradient-bearing turns, 1.69 GB.**
| mix | rows | share | train turns | window | purpose ||---|---|---|---|---|---|| `credit` | 4,664 | 11.2% | 22,762 | 1–16 | what earns judge credit || `escape_duel` | 13,979 | 33.7% | 13,979 | 1–16 | recovery from a failed command, on-policy || `escape_mini` | 6,820 | 16.4% | 6,820 | 5–32 | breaking out of a repeat run || `finish_mini` | 16,000 | 38.6% | 16,000 | 17–32 | surviving to a submit in 32 turns |
Every row carries `mix`, so ratios can be changed without a rebuild.
Tokenizer validation across all four mixes: **100% of sampled train turnsencode cleanly and their label spans decode back to exactly the assistantcontent.** Median sequence 7,798–9,110 tokens; only `escape_duel` has materialoverflow past 32,768 (2.0%).
### Coverage against the two gates
| failure | share of chelsea-blue's pre-eval failures | covered by ||---|---|---|| looping | 5/10 | `escape_mini` (6,820, 41% past cutoff) + `escape_duel` || no submission / no edits in 32 turns | 2/10 | `finish_mini` (16,000, 8,776 submit turns available) || duel score gap | — | `credit` + `escape_duel` |123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284# Training runbook — fresh VPS, start to submission
Everything here was verified on the build machine. Commands are copy-paste.Where a number came from measurement rather than judgement, the number is givenso you can decide for yourself.
---
## 0. What to copy to the VPS
| what | path | size | needed for ||---|---|---|---|| **the dataset** | `duel_corpus/sft_final_v2.jsonl` | 1.6 GB | training || base model | `model_source/222/` | 67 GB | training || tokenizer | `assets/tokenizers/Qwen3.6-35B-A3B/` | small | training || repo code | `sft/`, `src/` | small | training || local scorer | `duel_corpus/local_scorer.pkl` | small | eval before submit || question index | `duel_corpus/questions.json` | 142 MB | eval before submit || scorer entry point | `duel_corpus/score_local.py`, `build_local_scorer.py` | small | eval before submit |
You do **not** need `duel_corpus/raw/` (5.9 GB), `turns.jsonl`, `mini_coder/raw/`(8.8 GB), or the intermediate `sft_*.jsonl` files. They rebuild the dataset;they are not needed to train on it.
Minimum disk on the VPS: ~200 GB (67 model + 1.6 data + checkpoints).
```bash# from the build machinecd /root/albedotar czf albedo-train.tgz \ albedo/duel_corpus/sft_final_v2.jsonl \ albedo/duel_corpus/local_scorer.pkl \ albedo/duel_corpus/questions.json \ albedo/duel_corpus/score_local.py \ albedo/duel_corpus/build_local_scorer.py \ albedo/sft albedo/src albedo/assets/tokenizers# model_source/222 separately - it is 67 GB, use rsync so it can resumersync -avP albedo/model_source/222/ USER@VPS:/root/albedo/albedo/model_source/222/```
---
## 1. Setup
Needs 8 GPUs for the default config (`NGPU=8`, `per_device_batch_size=1`,`grad_accum=4`).
```bashcd /root/albedo/albedopython3 -m venv .venv.venv/bin/pip install --upgrade pip
# installs torch (pinned 2.11.0), transformers, pyarrow, safetensors AND puts the# src/ packages on the path. Without this, `import albedo_eval_service` fails and# every sft/ script dies on its first import..venv/bin/pip install -e .
.venv/bin/pip install -r sft/requirements.txt # accelerate, datasets.venv/bin/pip install numpy scikit-learn jinja2 # only for the local scorer```
Verify the install before going further — this is the import that breaks firston a fresh box:
```bash.venv/bin/python -c "import torch, transformers, albedo_eval_service; \print('torch', torch.__version__, '| cuda', torch.cuda.is_available(), \'| gpus', torch.cuda.device_count())"```
If you skip `pip install -e .` and rely on `PYTHONPATH=.` alone, use`PYTHONPATH=.:src` everywhere instead.
**The one path fix you must do.** `run_train.sh` hardcodes`MODEL="${ROOT}/model_source/king"`, but the king weights are in`model_source/222`:
```bashln -s /root/albedo/albedo/model_source/222 /root/albedo/albedo/model_source/kingls -l model_source/king/model.safetensors.index.json # must resolve```
---
## 2. Preflight — 3 minutes, do not skip
```bashcd /root/albedo/albedo
# a) the loader accepts every row (this is what would have crashed you)PYTHONPATH=. .venv/bin/python -c "from sft.data import load_jsonlr = load_jsonl('duel_corpus/sft_final_v2.jsonl')print(f'{len(r):,} rows loaded, all have messages:', all(x.messages for x in r))"# expect: 41,463 rows loaded, all have messages: True
# b) format alignment against the live chat template - the strictest check there is.# It asserts every train turn equals format_messages(prefix) + content + im_end,# and that the generation suffix is exactly "<|im_start|>assistant\n<think>\n".PYTHONPATH=. .venv/bin/python sft/train.py --verify-live-format \ --data-path duel_corpus/sft_final_v2.jsonl \ --tokenizer-path assets/tokenizers/Qwen3.6-35B-A3B# verified on the build machine: 1,200 rows sampled across all four mixes, 0 failures
# c) which parameters will actually get gradientPYTHONPATH=. .venv/bin/python sft/train.py --inspect-freeze --train-mode shared_router```
---
## 3. Build the token cache
Do this once, on CPU, before burning GPU hours. It is also the last place adata problem can surface cheaply.
```bashcd /root/albedo/albedoPYTHONPATH=. .venv/bin/python sft/train.py \ --preprocess-only \ --output-dir model_out/sft_v2_run1 \ --tokenizer-path assets/tokenizers/Qwen3.6-35B-A3B \ --data-path duel_corpus/sft_final_v2.jsonl \ --max-seq-length 32768```
Measured on a 1,500-row sample: **99.67% of rows expand, 0.33% dropped forexceeding 32,768 tokens, 0% skipped for anything else.** Expect roughly**61,900 examples and ~10M trainable tokens**. If the log shows materiallyfewer, stop and investigate rather than training.
---
## 4. Train
```bashcd /root/albedo/albedoDATA_PATH=duel_corpus/sft_final_v2.jsonl \OUTPUT_DIR=model_out/sft_v2_run1 \TRAIN_MODE=shared_router \NGPU=8 \MAX_SEQ_LENGTH=32768 \SAVE_STEPS=500 \ bash sft/run_train.sh```
Defaults inside the script: `learning_rate 1e-5`, `1` epoch,`per_device_train_batch_size 1`, `gradient_accumulation_steps 4`,`warmup_ratio 0.03`. At ~61,900 examples and effective batch 32, one epoch isroughly 1,900 optimizer steps.
`TRAIN_MODE` options are `shared_only`, `shared_router`, `full`. The scriptdefaults to `shared_router`. It resumes from the newest checkpointautomatically and writes `.training_complete` when done.
Then merge the trained weights back into a publishable model:
```bash# point --sft-checkpoint at the actual checkpoint dir, not the output dirls -d model_out/sft_v2_run1/checkpoint-* # pick the last one
PYTHONPATH=. .venv/bin/python sft/merge_sft_into_king.py \ --base-model model_source/king \ --sft-checkpoint model_out/sft_v2_run1/checkpoint-XXXX \ --output-dir model_out/sft_v2_merged \ --train-mode shared_router```
`--train-mode` here must match what you trained with.
---
## 5. Evaluate BEFORE submitting
This is the step that protects the hotkey. Two of yours are already banned.
Generate trajectories with the trained model on eval samples, then:
```bashcd /root/albedo/albedo/duel_corpuspython3 score_local.py --build-index # once, if questions.json was not copied../.venv/bin/python score_local.py --trajectories my_generations.jsonl```
Input JSONL needs `sample_id` and either `messages` or `turns`. `sample_id`must be one of the 19,019 in `questions.json` — those are samples that appearedin real eval runs.
### Generate on 500–1000 samples, not 100
Measured per-sample error is 0.207, so:
| samples | 95% CI on the mean | resolves the 0.025 win margin? ||---|---|---|| 100 | ±0.041 | **no — you are reading noise** || 200 | ±0.029 | no || 500 | ±0.018 | yes || 1000 | ±0.013 | comfortably |
### How much to trust each output
| output | trust ||---|---|| `looped: true` | **exact** — runs the validator's own `loop_check`. Anything flagged really would score 0. || `flag_catastrophic` | 82% precision at the 0.35 threshold || `mean predicted score` | pearson 0.727 vs the real judge, MAE 0.140 || any single sample's score | **do not trust** — MAE 0.140 |
**Hard gate: if any trajectory reports `looped: true`, do not submit.** That iswhat banned two hotkeys. It costs nothing to check and it is not a prediction.
Also useful, both in `sft/`:
```bashPYTHONPATH=. .venv/bin/python sft/local_multiturn_test.py --trajectories 10PYTHONPATH=. .venv/bin/python sft/local_prefix_test.py```
---
## 6. Validate the model files, then submit
```bashalbedo check-model --path model_out/sft_v2_merged```
Free, and catches the file-manifest and architecture failures before theyconsume a submission attempt. See `docs/MINING.md`.
---
## Tuning without rebuilding
Every row carries a `mix` label, so ratios change with a filter, not a rebuild:
| mix | rows | train turns | window | purpose ||---|---|---|---|---|| `credit` | 4,664 | 22,762 | 1–16 | raise the duel score || `escape_duel` | 13,979 | 13,979 | 1–16 | recover from failed commands (helps score **and** loops) || `escape_mini` | 6,820 | 6,820 | 5–32 | break out of repeat runs || `finish_mini` | 16,000 | 16,000 | 17–32 | reach a submit within 32 turns |
```bash# example: halve the mini-coder share if duel-window behaviour driftspython3 -c "import json, randomrandom.seed(0)keep = []for line in open('duel_corpus/sft_final_v2.jsonl'): r = json.loads(line) if r['mix'] != 'finish_mini' or random.random() < 0.5: keep.append(line)open('duel_corpus/sft_final_v2_light.jsonl','w').writelines(keep)print(len(keep), 'rows')"```
`finish_mini` is capped at 16,000 of 177,559 available deliberately: uncapped itwould be 80% of the dataset and pull the model toward mini-coder's style in thewindow that decides duels. If pre-eval still fails on no-submit, raise`FINISH_CAP` in `build_final_mix.py`; if duel behaviour drifts, lower it.
---
## Expectations
Set these honestly before spending money.
- The gap to king 124 was **−0.103**; a safe crown needs about **+0.05**.- Fixing the catastrophic tail is worth about **+0.071** — real, but roughly half the distance. This dataset targets the right 89% of scoring weight and is verifiably clean; whether it closes the rest is unknown until you train.- A duel's standard error is **0.026**, almost exactly the 0.025 win threshold, so even a genuinely better model loses sometimes. At a true margin of +0.025 you win two in a row 25% of the time; at +0.06, 83%.- Every failed submission burns hotkey ban-counter. Step 5 exists for that reason — spend the extra inference time.
## Where the numbers came from
- `duel_corpus/README.md` — how the dataset was built and every gate applied- `duels_king124/ANALYSIS.md` — the analysis of 8 duels against king 124 that set the targets: which tags carry the weight, why editing more hurts, the two disjoint scoring windows, and the pre-eval failure breakdown123version https://git-lfs.github.com/spec/v1oid sha256:e0abd661da12f66d91c9c56f2424812798bcac35fbf2f12d0f6ce6277200eedesize 1082634123version https://git-lfs.github.com/spec/v1oid sha256:dc7f7607bebcf8a398c38c28a331d84774909b0d788e75f3a3db9a024b549147size 142392662123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110"""Score locally generated trajectories without a judge or an API key.
python3 score_local.py --build-index # once /root/.venv-tok/bin/python score_local.py --trajectories mine.jsonl
Input is JSONL with `sample_id` and either `messages` (role/content) or `turns`.Questions are looked up from the harvested artifacts, so the sample must be onethat appeared in a real eval run - there are 19,811 of them in `questions.json`.
Read the accuracy notes in README before trusting a number: this resolves a2.5-point margin only at 500+ paired samples, and it is exact only for loops."""
from __future__ import annotations
import argparseimport jsonimport pickleimport statisticsimport sysfrom collections import defaultdictfrom pathlib import Path
ROOT = Path(__file__).resolve().parentsys.path.insert(0, str(ROOT))sys.path.insert(0, str(ROOT.parents[1] / "albedo" / "src"))
from build_local_scorer import featurize, side_context # noqa: E402
QUESTIONS = ROOT / "questions.json"SCORER = ROOT / "local_scorer.pkl"
def build_index() -> None: index = [r for r in json.loads((ROOT / "index.json").read_text()) if "SCORING_RESULTS" in (r.get("files") or {})] out: dict[str, list] = {} for rec in index: path = ROOT / "raw" / rec["files"]["SCORING_RESULTS"] for line in path.read_text(errors="replace").splitlines(): if not line.strip(): continue o = json.loads(line) if o.get("scored") and o["sample_id"] not in out: out[o["sample_id"]] = o.get("questions") or [] QUESTIONS.write_text(json.dumps(out)) print(f"indexed {len(out):,} samples -> {QUESTIONS.name} " f"({QUESTIONS.stat().st_size / 1e6:,.0f} MB)")
def main() -> int: ap = argparse.ArgumentParser() ap.add_argument("--build-index", action="store_true") ap.add_argument("--trajectories") ap.add_argument("--out", default="local_scores.jsonl") args = ap.parse_args()
if args.build_index: build_index() return 0 if not args.trajectories: ap.error("--trajectories required (or --build-index)")
import numpy as np
questions = json.loads(QUESTIONS.read_text()) bundle = pickle.load(SCORER.open("rb")) model = bundle["model"]
scores, missing, looped = [], 0, 0 with open(args.out, "w") as fh: for line in open(args.trajectories): if not line.strip(): continue rec = json.loads(line) qs = questions.get(rec.get("sample_id")) if not qs: missing += 1 continue turns = rec.get("messages") or rec.get("turns") or [] ctx = side_context(turns) X = np.asarray([featurize(q, ctx, len(qs)) for q in qs], dtype=np.float32) w = np.asarray([float(q.get("weight", 1) or 1) for q in qs], dtype=np.float32) p = model.predict_proba(X)[:, 1] score = 0.0 if ctx["looped"] else float((p * w).sum() / w.sum()) looped += int(ctx["looped"]) scores.append(score) fh.write(json.dumps({ "sample_id": rec["sample_id"], "predicted_score": round(score, 4), "looped": bool(ctx["looped"]), "n_turns": int(ctx["n_turns"]), "flag_catastrophic": score < 0.35, }) + "\n")
if not scores: print("no scorable trajectories - are the sample_ids from real eval runs?") return 1 n = len(scores) print(f"scored {n:,} trajectories (skipped {missing:,} with unknown sample_id)") print(f" mean predicted score : {statistics.mean(scores):.4f}") print(f" LOOPED (exact, pre-eval kills these): {looped:,} ({100 * looped / n:.1f}%)") print(f" flagged catastrophic (<0.35, ~82% precision): " f"{sum(1 for s in scores if s < 0.35):,}") print(f" 95% CI on the mean: +/-{1.96 * 0.207 / (n ** 0.5):.4f}" f"{' (resolves a 0.025 margin)' if 1.96 * 0.207 / (n ** 0.5) < 0.025 else ' (TOO NOISY - use 500+ samples)'}") print(f"\nwrote {args.out}") return 0
if __name__ == "__main__": sys.exit(main())123version https://git-lfs.github.com/spec/v1oid sha256:bf8f7fae5d192f4b7729abd3c68bf7f2e4924069f7939d3173328a3167229156size 1692460726.gitattributes+2
ANALYSIS.mdAdded+189
README.mdAdded+193
TRAINING_RUNBOOK.mdAdded+284
local_scorer.pklAdded+3
questions.jsonAdded+3
score_local.pyAdded+110
sft_final_v2.jsonlAdded+3