nano-mistral-o1-dpo-arm-a-halfepoch-salvage
This is an incident record. It holds the weights of the first, aborted DPO "Arm A" run of the
nano-mistral-o1 project. A data-sharding bug meant all four GPUs trained on the same preference
pair at every micro-step. The weights were kept for forensics, not as a result. The recorded Arm A
result is viai957/nano-mistral-o1-dpo-arm-a.
Correction to earlier descriptions. The previous version of this card, and the project's
docs/RESULTS.mdentry of 2026-08-20, say these weights are the "step-146 / half-epoch" state because the learning rate was 0 after step 146. The run's ownhistory.jsonlcontradicts that: (a) the logged LR is never 0 (it is 4.29e-7 at step 147 and 6.39e-8 at step 425); (b) the trainer's scheduler horizon was 549 steps, not 146; (c) 616 preference pairs that were seen twice, both times after step 146, had their chosen-completion log-prob rise between visits by a mean of +2.65 nats (98.4% of them rose, none stayed the same). The checkpoint is the optimizer-step-425 state (micro-step 3,400), after about 1.55 epochs of the 2,193-pair training split. The repo name is kept for link stability. Details are in Section 7.
1. TL;DR product sheet
| Field | Value |
|---|---|
| What it is | Full-parameter DPO checkpoint of Mistral-7B-v0.3 (bf16, 7.25B params, one 14.5 GB safetensors file), saved from a run halted by hand after a sharding bug |
| Parent | viai957/nano-mistral-o1-sft (SFT checkpoint micro_00002250), which descends from mistralai/Mistral-7B-v0.3 |
| Method | DPO, sigmoid loss, β = 0.1, no NLL or DPOP term, frozen-SFT reference log-probs precomputed |
| Data | argilla/distilabel-math-preference-dpo: 2,418 raw → 2,310 after filtering → 2,193 train / 117 held-out pairs |
| What it actually trained on | 3,400 pair-visits, 8 unique pairs per optimizer step (32 intended), 425 optimizer steps, about 1.55 epochs |
| Learning rate actually applied | constant 5e-7 (the trainer logged a warmup-cosine schedule but never applied it; see Section 4) |
| Compute | 4 × 23 GB NVIDIA GPUs with FSDP2, AdamW 8-bit, Triton FA2 attention. The project put the post-step-146 portion alone at about 24 GPU-hours. Total wall-clock was not logged. |
| Benchmarks | Not measured. No GSM8K, MATH-500 or held-out preference evaluation was run on this checkpoint. |
| Training-set signal | Preference accuracy on first visits (pairs not yet trained on) was 0.546 [0.525, 0.567], n = 2,193. On re-visits it was 0.944 [0.929, 0.955], n = 1,207. That pattern is memorisation, not generalisation. |
| Status | Superseded. Kept only to document the incident. |
2. Model details and mechanism
- Architecture:
MistralForCausalLM. 32 layers, hidden size 4096, FFN 14336, 32 query heads and 8 KV heads (GQA), head_dim 128, RoPE θ = 1e6, vocab 32,768, no sliding window, untied embeddings. The config was written by transformers 5.15.0. Weights are bf16. Do not run in fp16. - Tokenizer: the Mistral-7B-v0.3 tokenizer (
[INST]/[/INST]template) as saved with the parent SFT. - Training framework: the in-repo
nmotrainer of nano-mistral-o1. It uses FSDP2 with 32 per-block units and does not use TRL or DeepSpeed.
How the bug worked
flowchart TD
B[mistralai/Mistral-7B-v0.3] -->|SFT, 1 epoch, PRM800K-derived corpus| S[nano-mistral-o1-sft<br/>micro_00002250]
S -->|frozen| REF[(Reference log-probs<br/>precomputed, 2,193 + 117 pairs)]
S -->|init| P[Policy]
D[argilla distilabel-math-preference-dpo<br/>2,193 train pairs] --> SMP[LengthGroupedSampler<br/>NOT rank-sharded]
SMP -->|same pair| R0[rank 0]
SMP -->|same pair| R1[rank 1]
SMP -->|same pair| R2[rank 2]
SMP -->|same pair| R3[rank 3]
R0 & R1 & R2 & R3 -->|identical grads, all-reduce mean| ACC[grad-accum 8<br/>= 8 unique pairs / step<br/>intended 32]
REF --> L[sigmoid DPO loss, beta = 0.1]
P --> L --> ACC --> OPT[AdamW8bit, lr 5e-7 constant<br/>scheduler value logged, not applied]
OPT --> P
OPT -->|save every 100 micro-steps| CK[micro_00003400<br/>optimizer step 425<br/>= this repo]
In the code used for this run (nmo/train/dpo_stage.py::make_preference_sampler at 6a55cea), every
rank got the bare LengthGroupedSampler. So all four ranks walked the same batch list in the same
order. The logs confirm this: in all 3,470 logged micro-steps, the four rank rows carry the same
batch pair-id.
3. Training data
| Item | Value |
|---|---|
| Source | argilla/distilabel-math-preference-dpo, revision 440a59870da94a4c252c8f0031e7412cd1dfe3f2 |
| Licence | Apache-2.0 container. The project's research corpus flagged a possible OpenAI-output licence restriction on the responses, and the owner accepted that risk in a dated decision (2026-08-22, docs/RESULTS.md). |
| Pair type | One preferred and one rejected full solution per math prompt (response-level, not step-level) |
| Raw → filtered | 2,418 → 2,310 (decontamination plus token-boundary certification), max_len 2048 |
| Decontamination | Checked against 1,819 eval hashes (MATH-500 500 + GSM8K test 1,319). 0 contaminated pairs. |
| Split | Held-out fraction 0.05, seed 0: 2,193 train / 117 held-out |
| Train shard | arm_a-train-0000, 2,193 rows, 872,580 tokens, content hash 9db20954e6cc29660b58691e3cf83003 |
| Length baseline | Chosen response is the longer one in 54.89% of pairs (mean 1,278 vs 1,232 characters). This baseline feeds the length-drift tripwire. |
| Reference log-probs | Precomputed from the frozen SFT model. The path-bias check fired (max abs Δ 1.317 against a 0.025 threshold, n = 100), so the cache was rebuilt with the same FSDP2-sharded forward pass used in training. |
4. Training procedure
Objective
The loss is standard sigmoid DPO (Rafailov et al., 2023). Sequence log-probs are summed over completion tokens:
$$ \mathcal{L}{\text{DPO}}(\theta) = -,\mathbb{E}{(x,y_w,y_l)}\left[\log\sigma\Big(\beta\big[(\log\pi_\theta(y_w|x)-\log\pi_{\text{ref}}(y_w|x)) - (\log\pi_\theta(y_l|x)-\log\pi_{\text{ref}}(y_l|x))\big]\Big)\right],\quad \beta = 0.1 $$
The NLL coefficient is 0 for the whole run. The DPOP term (λ = 50) was configured only as a tripwire
response and never activated. The logged quantities are
rewards/chosen $=\beta(\log\pi_\theta(y_w|x)-\log\pi_{\text{ref}}(y_w|x))$, the same for rejected,
rewards/margins = chosen minus rejected, and rewards/accuracies $=\mathbb{1}[\text{margin}>0]$.
What the optimizer actually computed. With micro-batch 1, gradient accumulation 8 and world size 4, each step should average $32$ distinct pairs. Because all ranks saw the same pair, each step was
$$ g_t = \frac{1}{8}\sum_{i=1}^{8}\nabla_\theta \ell(x_i, y_{w,i}, y_{l,i}) $$
and the all-reduce averaged four copies of the same gradient. In effect this is a batch-8 DPO run that cost four times the compute.
Learning rate: logged versus applied
- Logged: linear warmup over 16 steps to 5e-7, then cosine decay. The schedule inverted from the
logged LR has a horizon of 549 optimizer steps, which matches the trainer's horizon computation
$\lceil 2 \times 2193 / 8 \rceil$ for each rank's unsharded stream. The 146 in the launch banner
came from a different formula, $2\lceil 2310/32\rceil$, that assumed sharding. The two numbers
were never compared at launch; that check was added as a launch refusal in
c7d3ab4. - Applied: in the trainer code used for this run (
nmo/train/trainer.pyat6a55cea), the scheduler is stepped and logged but its value is never written tooptimizer.param_groups. The optimizer therefore ran at its construction LR, 5e-7, from step 1 with no warmup and no decay. The project found this on 2026-10-12, and it affects every nano-mistral-o1 run on this trainer. It is fixed only in the successoraligntrainer.
Hyperparameters
| Hyperparameter | Value | Source |
|---|---|---|
| Init / reference | SFT micro_00002250 (quality gate passed 2026-08-18) | checkpoints/sft/sft_quality_gate.json |
| Variant | DPO sigmoid, β = 0.1 | configs/dpo_argilla.yaml @ 23b6f3f |
| LR (applied) | 5e-7 constant | config + trainer code |
| LR (logged) | warmup 16 → cosine, horizon 549 | history.jsonl |
| Micro-batch × accum × world | 1 × 8 × 4 (intended global batch 32, effective 8 unique pairs) | config + history.jsonl |
| Epochs configured | 2 | config |
| Optimizer | bitsandbytes AdamW8bit (shard-local), betas (0.9, 0.95), wd 0, eps 1e-8 | scripts/dpo.py, nmo/config.py @ 6a55cea |
| Gradient clipping | none (no clipping existed in this trainer) | docs/audits/phase1_postmortem.md |
| Precision / attention | bf16 / in-repo Triton FA2 (parity-gated) | config, docs/RESULTS.md 2026-08-17 entry |
| Sharding | FSDP2, 32 per-block units, bf16 params, fp32 reduce | runs/precompute_arm_a_sharded.log |
| Save cadence | every 100 micro-steps, keep 2 | config |
| Armed tripwires | logps_chosen, length_drift (band ±0.10 around 0.5489). Tripwire alarms are written only to the end-of-run summary, which this hand-halted run never produced, so whether either tripwire fired is not recorded. The trainer at 6a55cea does not halt on an alarm. | config, nmo trainer @ 6a55cea |
| Steps run | 3,470 micro / 433 optimizer (halted by hand); checkpoint at 3,400 / 425 | history.jsonl |
| Tokens processed to checkpoint | 2,067,664 (sum of logged n_tokens) | history.jsonl |
Compute
The run used 4 × 23 GB NVIDIA GPUs on one host. Project documents from that time say A10G; a host
audit on 2026-10-25 found 4 × L4. docs/RESULTS.md puts the post-step-146 stretch (steps 147–433)
at about 24 GPU-hours. history.jsonl has no timestamps, so total wall-clock is not available.
5. Training curves
All curves are parsed from receipts/history.jsonl in this repo, which is the same file as local
runs/dpo_arm_a_halfepoch_salvage/history.jsonl. Only the last continuous launch segment is used
(file lines 413–14,292). The earlier lines come from a micro-batch-2 attempt that ran out of memory
and an attempt that died at micro-step 100. Where those overlap the final segment, they match row
for row. Every micro-step has four rank rows with the same pair, so one row per micro-step is
plotted. All metrics are training-set metrics. Plot script: _build/analyze.py.
Figure 1. Loss, reward margin, preference accuracy and per-token NLL of the chosen response per
micro-step (light) with a 100-step rolling mean (bold). Dashed line: optimizer step 146. Dotted
line: end of epoch 1 (micro-step 2,193, where the last new pair appears). Solid line: the saved
checkpoint. During epoch 1 every pair is new and accuracy stays near chance. It jumps to about 0.94
exactly when pairs start repeating. Source: history.jsonl fields loss, rewards/margins,
rewards/accuracies, nll/chosen.
Figure 2. Left: summed policy log-probs of chosen and rejected completions (100-step rolling mean;
the mean moves with the pair mix). Right: implicit rewards. The mean chosen reward is 0.227 over epoch 1 and 0.572 over epoch 2 up to the checkpoint; the
rejected reward is 0.213 and 0.282 over the same windows. The run did not collapse the chosen likelihood.
Source: history.jsonl fields logps/* and rewards/chosen|rejected.
Figure 3. Left: the logged LR (scheduler value) against the 5e-7 actually applied. The logged LR
is never 0. Right: pre-step gradient norm per optimizer step, taken as the median of the four
logged rank values. Median over steps 116.6, max of the plotted median 196.9 at step 86 (largest single-rank value
207.5), no clipping. Source:
history.jsonl fields lr and grad_norm.
Figure 4. Change in logps/chosen between a pair's first and second visit, for the 616 pairs
whose two visits both came after optimizer step 146. Mean +2.65 nats, median +2.40, 98.4%
positive, 0 unchanged. If the weights had been frozen after step 146 these would all be exactly 0.
Source: history.jsonl (batch, optimizer_step, logps/chosen).
Figure 5. This run against the recorded, correctly sharded Arm A rerun on the same data, plotted
against epochs consumed. Both curves are rolling means over about 200 pairs. Both runs jump in
margin when epoch 2 begins. With four times as many optimizer steps per epoch, the unsharded run
reaches a higher train margin. Sources: runs/dpo_arm_a_halfepoch_salvage/history.jsonl and the
final-launch segment of runs/dpo_arm_a/history.jsonl (lines 15,493–17,684).
6. Evaluation
| Evaluation | This checkpoint | Reference |
|---|---|---|
| GSM8K test (n = 1,319) pass@1 | not measured | parent SFT 0.2047 [0.1838, 0.2273] (outputs/eval/sft-final.json) |
| MATH-500 (n = 500) pass@1 | not measured | parent SFT 0.084 [0.0627, 0.1116] |
| Held-out preference accuracy (n = 117) | not measured | recorded Arm A rerun 0.556 [0.465, 0.642], 65/117 (runs/dpo_arm_a/arm_result.json) |
| Train-set preference accuracy on first visits, steps 1–146 (micro 1–1,168) | 0.544 [0.515, 0.572], 635/1,168 | — |
| Train-set preference accuracy on first visits, all of epoch 1 | 0.546 [0.525, 0.567], 1,197/2,193 | — |
| Train-set preference accuracy on re-visits, epoch 2 up to the checkpoint | 0.944 [0.929, 0.955], 1,139/1,207 | — |
Intervals are Wilson 95%. A first-visit accuracy is computed in the forward pass before that pair's own gradient is applied, so it works as a rough generalisation estimate on unseen pairs. It agrees with the rerun's held-out 0.556. There is no hill-climbing chart because this was a single run with no iterations.
7. Results discussion and lessons
- The sharding bug was silent. The loss curve looked plausible, and the configured global batch
was 32 (config
global_batch: 32; the config comment gives a 146-step horizon), the values the launch banner is computed from. Tripwire alarms are written only to the end-of-run summary, which this hand-halted run never produced, so whether a tripwire fired is not recorded. The bug was found by checking thebatchidentities across ranks inhistory.jsonl. The fixes, in commitc7d3ab4, are a rank-sharded sampler, a hard stop at the scheduler horizon, and a refusal to launch when the banner horizon and the trainer horizon disagree. - The first explanation of the incident was wrong as well. The 2026-08-20 entry said the run became a "weights-frozen zombie" after step 146. It used the banner's 146-step horizon and assumed the trainer's cosine schedule reached zero there. The trainer's own horizon was 549, the logged LR stayed positive, and in any case the scheduler LR was never applied (Section 4). Figure 4 shows directly that the weights kept changing. The roughly 24 GPU-hours after step 146 did train the model, at batch 8, through about one more epoch.
- Re-visiting pairs produces memorisation, not preference learning. On first visits, train accuracy stayed at about 0.55, close to the rerun's held-out 0.556 and barely above chance. Once pairs repeated, accuracy jumped to about 0.94 and the margin rose from about 0.01 to about 0.29. That shows the model fitting pairs it has already seen. Treat any train-set preference accuracy from epoch ≥ 2 as uninformative.
- Logged training metrics can be wrong. The logged LR was a schedule that was never applied.
The lesson the project drew: check what the optimizer actually used (
param_groups), not only what the scheduler reports. - For the overall phase-1 picture: response-level DPO on Arm A was null on held-out preference accuracy, as pre-registered. The project's later diagnostic found vanilla step-level DPO (Arm B primary) was also null on GSM8K (0.2108 against SFT 0.2047, p = 0.63). See the sibling cards.
8. Intended use, limitations, risks
- Intended use: forensic and interpretability work on what an under-sharded, batch-8 DPO run does to a 7B SFT model, for example weight-diff comparisons against the SFT parent and the recorded Arm A rerun. Not for deployment, and not as a math assistant.
- Limitations: no benchmark evaluation exists. Training ran at a constant LR with no warmup. It saw about 1.55 epochs at an effective batch of 8, against a pre-registration of 2 epochs at batch 32. The parent SFT scores only 0.2047 on GSM8K, so expect weak math ability.
- Risks: the preference data may carry OpenAI-output terms (see Section 3). The model has no safety tuning. Outputs can be wrong with full confidence. Running in fp16 is unsupported and may produce NaNs.
9. Reproducibility
| Item | Value |
|---|---|
Code (local repo nano-mistral-o1) | Last commit before launch: 6a55cea3cd550ede274af4583531f027ee6252f8. The exact launch commit is not recorded in the receipts. |
| Config | configs/dpo_argilla.yaml as of 23b6f3fafd4af83164bd30419bd480b1d0422be4 (unchanged since b933602) |
| Incident record | docs/RESULTS.md dated entry 2026-08-20, commit 23b6f3f |
| Fix | c7d3ab47265ab40748232c24aa158b5d25435e86 |
| HF upload commit | db2e54d08eea1d0eb652ff8cf514c1f328c457c0. Upload receipt runs/dpo_arm_a_halfepoch_salvage/checkpoints/micro_00003400.hf.json holds the sha256 of every file. model.safetensors sha256 is e1a1bd3dba5b2f632b6924d25773de354167ba16abff8a4e42be2d3ef04503d4. |
| Launch (as run, buggy) | torchrun --nproc_per_node=4 scripts/dpo.py configs/dpo_argilla.yaml at 6a55cea. Do not rerun this; it reproduces the bug. |
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "viai957/nano-mistral-o1-dpo-arm-a-halfepoch-salvage"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="bfloat16")
# restore into the original repo layout
hf download viai957/nano-mistral-o1-dpo-arm-a-halfepoch-salvage \
--revision db2e54d08eea1d0eb652ff8cf514c1f328c457c0 \
--local-dir runs/dpo_arm_a_halfepoch_salvage/checkpoints/micro_00003400 \
--exclude 'receipts/*' --exclude README.md
Each number in this card is mapped to its source file and field in evidence.json. That file
travels with the card build but is not uploaded with the weights.
10. Related repos, licence, citation
nano-mistral-o1 family
viai957/nano-mistral-o1-sft: SFT parent and DPO referenceviai957/nano-mistral-o1-dpo-arm-a: the recorded Arm A result (sharded rerun)viai957/nano-mistral-o1-dpo-arm-b: Arm B primary (step-level DPO)viai957/nano-mistral-o1-dpo-arm-b-response: Arm B tripwire-response rerunviai957/nano-mistral-o1-grpo-stageb-step48: stage-b GRPO
Licence and attribution. The weights are released under Apache-2.0, following the base model
mistralai/Mistral-7B-v0.3 (Apache-2.0). The preference data is
argilla/distilabel-math-preference-dpo (Apache-2.0 container; see the note in Section 3). DPO is
from Rafailov et al. (2023).
@misc{nanomistralo1_dpo_arm_a_salvage_2026,
title = {nano-mistral-o1 DPO Arm A half-epoch salvage: an unsharded-sampler incident record},
author = {viai957},
year = {2026},
howpublished = {\url{https://huggingface.co/viai957/nano-mistral-o1-dpo-arm-a-halfepoch-salvage}},
note = {Revision db2e54d08eea1d0eb652ff8cf514c1f328c457c0}
}
@inproceedings{rafailov2023dpo,
title = {Direct Preference Optimization: Your Language Model is Secretly a Reward Model},
author = {Rafailov, Rafael and Sharma, Archit and Mitchell, Eric and Ermon, Stefano and Manning, Christopher D. and Finn, Chelsea},
booktitle = {Advances in Neural Information Processing Systems},
year = {2023}
}