nano-mistral-o1-sft
A full-parameter supervised fine-tune of Mistral-7B-v0.3 on step-by-step math solutions from PRM800K. Every step in each solution was rated non-negative by a human. This is the SFT substrate of the nano-mistral-o1 pipeline (SFT, then step-level DPO, then verifier-reward GRPO). All DPO arms and the Stage-B GRPO run start from this checkpoint, and they are scored against it in paired tests.
This is a research artifact, not a product model. Every number below comes from a local receipt (log, metrics file, or eval report). evidence.json maps each number to its source file and field.
1. TL;DR
| What | Zero-shot step-by-step math solver: Step k: paragraphs, then # Answer and a blank line before the final answer |
| Base | mistralai/Mistral-7B-v0.3 (base, not instruct), rev caa1feb0 |
| Method | Full-parameter SFT. Token-mean cross-entropy on completion tokens only (prompt masked). FSDP2, bf16, 8-bit AdamW |
| Data | 11,739 PRM800K solutions (6.12 M tokens, 4.92 M of them in the loss). 1 epoch. 0 rows overlap MATH-500 or GSM8K-test |
| Steps | 1,125 optimizer steps (2,250 micro-batches) |
| Compute | 4 GPUs (logged as NVIDIA A10G, 22.5 GB). 9.78 h wall-clock for the published lineage, about 39.1 GPU-hours |
| GSM8K-full | 0.2047 pass@1 (270/1,319), 95% CI [0.1838, 0.2273]. Base under the same protocol: 0.05 |
| MATH-500 | 0.084 pass@1 (42/500), 95% CI [0.0627, 0.1116] |
| Final train loss | 0.2605 on the last logged micro-batch. The mean of the last 10 logs is 0.286 (first log: 0.851) |
| Known defects | The LR schedule was logged but never applied (constant 1e-5). All 4 ranks trained identical batches. 16.7% of train rows are exact duplicates. Steps 1,001-1,125 started from fresh Adam moments. See §7 |
2. Model details and mechanism
| Field | Value |
|---|---|
| Architecture | MistralForCausalLM, decoder-only transformer, unchanged from base |
| Parameters | about 7.25 B (14,496,081,136-byte bf16 model.safetensors at 2 bytes/param) |
| Layers / hidden / FFN | 32 / 4,096 / 14,336 (SiLU-gated MLP) |
| Attention | 32 query heads, 8 KV heads (GQA), head_dim 128, RoPE θ = 1e6, no sliding window |
| Vocabulary | 32,768 (Mistral v0.3 tokenizer, unchanged) |
| Precision | bf16 only. fp16 is not supported |
| Context used in training | Rows up to 2,041 tokens. Eval generates at most 768 new tokens |
| Developed by | nano-mistral-o1 project (viai957) |
| Licence | Apache-2.0 (inherits base); training data MIT (see §3) |
Prompt format (nmo/data/schema.py::PROMPT_TEMPLATE). The model was trained and evaluated with exactly this wrapper. Other wrappers are out of distribution.
[INST] Solve the following math problem. Reason one step at a time, writing each step as its own paragraph separated by a blank line. When you reach the result, write "# Answer" followed by a blank line and the answer alone.
{problem} [/INST]
Target format: Step 1: ...\n\nStep 2: ...\n\n# Answer\n\n<answer></s>. Answers are extracted by splitting on the # Answer marker, then checked with a symbolic verifier (math_verify).
flowchart LR
subgraph DATA["Data build (scripts/build_data.py, build_version 2)"]
P["PRM800K phase1+2<br/>tasksource/PRM800K @547b195"] --> W["walk chosen_completion path<br/>(fallback: human_completion)"]
W --> F{"finish_reason == solution<br/>AND no step rated -1<br/>AND has '# Answer'"}
F -->|12,424 eligible| D["decontaminate vs 1,819<br/>MATH-500 + GSM8K-test hashes<br/>(0 hits)"]
D --> R["reject: 11 boundary, 14 too long,<br/>2 malformed -> 12,397 rows"]
R --> S["split: 11,739 train / 658 held<br/>(disjoint by problem_id)"]
end
subgraph TRAIN["SFT (scripts/sft.py, configs/sft.yaml)"]
S --> B["length-grouped micro-batches<br/>(3,072 padded-token budget, ~5.3 rows)"]
B --> M["Mistral-7B-v0.3, FSDP2 x4<br/>bf16 params, fp32 grad reduce,<br/>activation checkpointing"]
M --> L["fused chunked CE on completion<br/>tokens (prompt = -100)"]
L --> O["8-bit AdamW (bnb, shard-local)<br/>lr 1e-5, betas 0.9/0.95, wd 0"]
end
subgraph GATES["Stage gate chain"]
G1["golden regression"] --> G2["7B smoke"] --> G3["20-step probe"] --> G4["RSS preflight"] --> G5["train"] --> G6["eval"] --> G7["quality gate<br/>(adjudicated PASS)"]
end
O --> CK["micro_00002250<br/>= this repo"]
CK --> A["DPO arm A / arm B"]
CK --> GR["Stage-B GRPO"]
3. Training data
Sources and licences
| Source | Role | Revision | Licence |
|---|---|---|---|
tasksource/PRM800K (OpenAI PRM800K, Lightman et al. 2023) | All SFT text | 547b19506677a59037ee888838834b65e9b1ddd4 | MIT |
EleutherAI/hendrycks_math | Subject labels only (PRM800K has no subject field) | 21a5633873b6a120296cce3e2df9d5550074f4a3 | MIT |
HuggingFaceH4/MATH-500, openai/gsm8k | Decontamination set and evaluation only, never trained on | 6e4ed1a2…, 740312ad… | MATH-500: not declared on its HF card (derived from MATH, MIT); GSM8K: MIT |
Filtering (nmo/data/sft_corpus.py)
A PRM800K record becomes an SFT row only if all three conditions hold:
- The labeler finished with
finish_reason == "solution". - No step on the walked path is rated −1. The filter is on process correctness, not outcome.
- A
# Answerstep is present.
The walk follows chosen_completion and falls back to human_completion. bad_problem records are skipped.
| Stage | Count |
|---|---|
| Eligible after the walk and the three conditions | 12,424 |
| Rejected: step-boundary tokenisation | 11 |
Rejected: over max_len 2,048 tokens | 14 |
| Rejected: malformed | 2 |
| Removed by decontamination (normalised problem-text hash vs 1,819 eval problems) | 0 |
| Written | 12,397 |
| Train / held-out split | 11,739 / 658 (disjoint by problem_id: 7,745 vs 407 problems, 0 shared) |
Rows with no subject join (UNKNOWN_SUBJECT) | 1,107 (965 train + 142 held) |
Outcome property (measured, not filtered). For 11,285 rows with a gold answer, the symbolic verifier finds:
- 9,014 (0.799) agree with gold.
- 44 agree after unwrapping.
- 2,227 (0.197) are flagged divergent.
A random eyeball audit (n = 25) found about 45% of the flagged rows are answers a human would accept (units, tuple vs pmatrix, rounding, and similar). The genuinely-wrong-outcome rate is therefore about 10-11%. No outcome filter was applied, by pre-registered decision (docs/RESULTS.md, pre-freeze amendment 2026-08-17).
Schema and example
Each row is stored as token ids (int32) plus extras: problem_id, subject, prompt_len, n_steps, gold_answer, boundary_positions, source. Train row 0, decoded verbatim (its extras: subject Prealgebra, prompt_len 65, n_steps 5, gold_answer 468):
<s>[INST] Solve the following math problem. Reason one step at a time, writing each step as its own paragraph separated by a blank line. When you reach the result, write "# Answer" followed by a blank line and the answer alone.
How many seconds are in 7.8 minutes? [/INST]
Step 1: 7.8 minutes is the same as 7 minutes and 0.8 minutes.
Step 2: Right, and since there are 60 seconds in a minute, then there are 60 * 7 = 420 seconds in 7 minutes.
Step 3: And since there are 60 seconds in a minute, then there are 60 * 0.8 = 48 seconds in 0.8 minutes.
Step 4: So, in total, there are 420 + 48 = 468 seconds in 7.8 minutes.
Step 5: Exactly.
# Answer
468</s>
Statistics (train split)
| Quantity | Mean | Median | p5 | p95 | Max |
|---|---|---|---|---|---|
| Total tokens / row | 521.0 | 462 | 233 | 964 | 2,041 |
| Prompt tokens / row | 102.1 | 97 | 70 | 156 | 445 |
| Completion (loss) tokens / row | 418.9 | 358 | 144 | 840 | 1,926 |
| Reasoning steps / row | 11.38 | 10 | 5 | 22 | 66 |
The split has 6,116,251 tokens in total, 4,917,906 of them completion tokens. 427 rows exceed 1,024 tokens. They were trained untruncated, because seq_len is only the batch token budget.
Figure 1. Token and step-count distributions of the 11,739-row train split. Source: data/shards/sft/train/sft-train-0000.{input_ids.idx.npy,extras.jsonl}. The sharp spikes are duplicated sequences (Figure 3).
Figure 2. Train rows by MATH subject, joined from EleutherAI/hendrycks_math. Source: extras.jsonl field subject.
Exact duplicates (found while writing this card). The train split has only 9,776 distinct token sequences. 1,963 rows (16.7%) repeat a sequence that is already present. 339 sequences occur more than once, and one sequence occurs 319 times (top-5 multiplicities: 319, 239, 136, 105, 99). This comes from PRM800K itself: phase-2 re-annotates the same sampled solutions many times. The build deduplicated preference pairs (arm B) but not SFT rows. The near-zero-loss micro-batches in Figure 4 (minimum 1.4e-4) are batches made of these memorised copies. No train sequence appears in the held-out split.
Figure 3. Train rows grouped by how many identical copies of their token sequence exist (log scale). Source: SHA-1 of each row's input_ids in sft-train-0000.input_ids.bin. Computed by _build_figures.py.
4. Training procedure
Objective
Supervised next-token cross-entropy, restricted to completion tokens. A micro-batch $\mathcal{B}$ has rows $x^{(i)}$ with prompt length $p_i$ and length $T_i$. The mask is $m_t^{(i)} = \mathbb{1}[p_i \le t < T_i]$, implemented as labels -100 on the prompt and on padding:
$$ \mathcal{L}{\text{SFT}}(\theta) ;=; -,\frac{1}{\sum{i\in\mathcal{B}}\sum_t m^{(i)}{t}};\sum{i\in\mathcal{B}}\sum_{t} m^{(i)}{t},\log p\theta!\left(x^{(i)}{t},\middle|,x^{(i)}{<t}\right) $$
- The loss is a token-mean within each micro-batch, divided by
grad_accum= 2 and summed over the two micro-batches of an optimizer step. - Gradients are averaged across the 4 FSDP ranks (fp32 reduce).
- The LM head runs inside a fused, chunked cross-entropy kernel (
nmo.kernels.fused_ce), so the[B·T, 32768]logit tensor is never materialised. - There is no gradient clipping and no auxiliary loss.
The update is 8-bit AdamW (bitsandbytes AdamW8bit, shard-local over the 291 FSDP2 shards):
$$ \theta \leftarrow \theta - \eta\left(\frac{\hat m}{\sqrt{\hat v}+\epsilon} + \lambda\theta\right),\quad \beta=(0.9,0.95),\ \epsilon=10^{-8},\ \lambda=0,\ \eta = 10^{-5}\ \text{(constant, see note)} $$
Note on η. The config asks for 3% linear warmup and then cosine decay to 0 over 1,125 steps, and the trainer logged that schedule. But nmo/train/trainer.py never wrote the scheduled LR into optimizer.param_groups. This was verified at the training commits 6c5d51c and 1ddb1a4 (no param_groups write), and the bug was fixed later only in the successor align trainer (test_scheduled_lr_is_actually_applied_to_the_optimizer). The applied LR was therefore a constant 1e-5 for all 1,125 steps, with no warmup and no decay.
Hyperparameters
| Hyperparameter | Value |
|---|---|
| Fine-tuning type | Full parameters (no LoRA) |
| Precision | bf16 params, fp32 gradient reduce-scatter |
| Parallelism | FSDP2, 32 per-block units + root, 4 ranks |
| Activation checkpointing | All 32 blocks (use_reentrant=False) |
| Attention kernel | PyTorch SDPA (flash) |
| Optimizer | 8-bit AdamW (bitsandbytes), β = (0.9, 0.95), ε = 1e-8, weight decay 0 |
| Learning rate | 1e-5 configured; schedule logged but not applied (see above) |
| Micro-batch | Length-grouped, ≤ 3,072 padded tokens (seq_len 1024 × micro_batch_size 3), max 64 rows. Measured 5.33 rows on average (1-15), 2,191.5 loss tokens |
| Gradient accumulation | 2 |
| Effective unique rows / optimizer step | About 10.7. The DPO-era audit found the sampler was not rank-sharded, so all 4 ranks trained the identical micro-batch (confirmed: identical batch ids on all 4 ranks in history.jsonl) |
| Epochs / optimizer steps | 1 / 1,125 (2,250 micro-batches) |
| Gradient clipping | None |
| Seed | 0 |
| Dataloader workers | 2 per rank |
| Checkpoint cadence | Every 400 micro-steps, keep 2 |
Compute and run history
| Segment | Wall-clock (IST) | Duration |
|---|---|---|
| Steps 0 → 1,000 (original launch, 2026-08-17) | 19:33:41 → 04:14:52 | 8.69 h (31.3 s / optimizer step) |
| Steps 1,001 → 1,125, original | → 05:19:41. Then the post-epoch eval crashed, and no end-of-training save existed, so these weights were lost | n/a |
| Resume attempt 1 from step 1,000 | Superseded. Loss logged in history.jsonl | n/a |
| Resume attempt 2 from step 1,000 → 1,125 (published weights) | 07:16:02 → 08:21:43, 2026-08-18 | 1.09 h (31.5 s / step) |
| Published lineage total | 9.78 h × 4 GPUs ≈ 39.1 GPU-h |
- Hardware. 4 GPUs, reported by the run's own preflight as
NVIDIA A10G, 22.5GB total. Software: torch 2.11.0+cu128, transformers (local venv), bitsandbytes. - Memory. The 7B smoke measured a full-step peak of 9,561 MiB per GPU. Projected host RSS was 22 GB.
- Fresh optimizer moments at the resume. The step-1,000 checkpoint stored only rank 0's optimizer moments, so both resumes ran with fresh Adam moments on all ranks. Weights, data offset and scheduler position were exact.
5. Training curves
Figure 4. Training loss per logged micro-batch (every 10 micro-steps = 5 optimizer steps; 225 points) with an EMA. The dashed and dotted lines are the two tail attempts that are not part of the published weights. Source: checkpoints/sft/history.jsonl (= receipts/history.jsonl in this repo, sha256-identical), field loss. Each micro-step has 4 identical per-rank lines, and steps ≥ 1,005 have 3 attempts × 4 lines. The published lineage is the last attempt.
Figure 5. Pre-step gradient norm (log scale). Source: history.jsonl, field grad_norm. The four ranks report slightly different values, so the band shows the min-max. The norm starts at 73.8 (step 5), has a median of 3.51 after step 100, and ends at 2.66.
Figure 6. The learning rate the scheduler logged (history.jsonl field lr: peak 1.0e-5 at the end of 3% warmup, cosine decay to 0) against the value the optimizer actually used (constant 1e-5 from configs/sft.yaml; code audit in §4). The blue curve did not drive training.
Figure 7. Completion tokens in the loss and rows per micro-batch. Source: history.jsonl, fields tokens_in_loss and len(batch).
Figure 8. Relative weight change ‖W_sft − W_base‖ / ‖W_base‖ per layer and projection, accumulated in fp64. Source: outputs/trace/tier1_weight_diffs.json (2026-08-20, 291/291 tensors matched).
The family means of relative change are:
- Attention: q 0.050, k 0.040, v 0.117, o 0.067.
- MLP: gate 0.055, up 0.062, down 0.076.
lm_head0.158; embeddings 0.019.
The largest changes are concentrated in the early-layer value projections (layer-0 v_proj 0.884) and the layer-1 down_proj (0.423). Reward, KL and pass@k curves do not exist for this stage, which has no RL.
6. Evaluation
Protocol (configs/eval.yaml, nmo/eval/harness.py):
- Zero-shot with the training prompt template.
- Greedy decoding (temperature 0, top-p 1), 1 sample, ≤ 768 new tokens, seed 17, batch 16.
- The answer is extracted after
# Answerand scored by the hardenedmath_verify-based verifier. - Accuracy counts all problems: no-answer and truncated outputs score 0.
- 95% CIs are Wilson intervals.
- Eval stack hash:
7c8abafe62d60141.
The checkpoint-200 golden regression reproduced the predecessor's numbers (0.090 / 0.262 vs the anchor's 0.090 / 0.258), which certifies this harness.
| Model | Benchmark | n | pass@1 | 95% CI | Format compliance | Truncated @768 | Median tokens |
|---|---|---|---|---|---|---|---|
| Mistral-7B-v0.3 base (same protocol) | GSM8K (subset not recorded) | not recorded | 0.05 | not recorded | not recorded | 0.715 | not recorded |
| This model | GSM8K-full | 1,319 | 0.2047 (270) | [0.1838, 0.2273] | 0.9356 | 0.0644 | 225 |
| This model | MATH-500 | 500 | 0.084 (42) | [0.0627, 0.1116] | 0.670 | 0.334 | 404 |
| This model | Pooled (both) | 1,819 | 0.1715 | [0.1549, 0.1895] | 0.8626 | 0.1385 | n/a |
| This model | GSM8K[:500] anchor subset | 500 | 0.232 (116) | [0.197, 0.271] | n/a | n/a | n/a |
| This model | GSM8K remaining 819 | 819 | 0.188 (154) | not computed | n/a | n/a | n/a |
| This model at step 1,000 | GSM8K[:500] anchor subset | 500 | 0.238 (119) | [0.2028, 0.2772] | 0.866 | 0.134 | n/a |
Predecessor checkpoint-200 (0.35 epoch, same data recipe) | GSM8K[:500] | 500 | 0.262 | [0.2254, 0.3023] | 0.974 | 0.026 | n/a |
Predecessor checkpoint-200 | MATH-500 | 500 | 0.090 | [0.0679, 0.1183] | 0.854 | 0.152 | n/a |
- The base-model number (0.05, 71.5% truncation) comes from the phase-1 postmortem (
docs/audits/phase1_postmortem.md). No standalone eval receipt or CI exists for it, and the source records neither the sample size nor which GSM8K subset was used. - The 80%-power minimum detectable effects (independent samples) are 0.047 for GSM8K-full and 0.077 for MATH-500.
- maj@k, pass@k for k > 1, and the SFT held-out loss were not measured.
Figure 9. pass@1 with 95% Wilson CIs. Sources: outputs/eval/sft-final.json, outputs/eval/sft-step1000-golden500.json, outputs/eval/checkpoint-200-golden.json. The anchor-subset value is recomputed from sft-final.json per_problem restricted to the golden report's 500 GSM8K problem ids.
Figure 10. Accuracy next to format compliance and truncation rate. On MATH-500, a third of generations hit the 768-token cap without an answer. Source: the per_set blocks of the same reports.
Quality gate (paired, like-for-like). On the 500 anchor problems, this model is compared with the predecessor checkpoint-200. There are 73 problems only the predecessor solved and 58 only this model solved. Exact McNemar gives p = 0.221, which is not significant. The as-built gate compared a full-1,319 score with a 500-problem anchor and failed. That was a construction defect: the anchor subset is 4.4 pp easier than the rest. The adjudicated gate passed (receipts stage_gates.json and sft_quality_gate.json in receipts/).
Hill climbing. Not applicable. This is a single pre-registered run with no iterative search. Its children, evaluated on the same harness and paired against this checkpoint, are shown below.
| Child of this checkpoint | GSM8K-full pass@1 | Paired vs this SFT (exact McNemar) |
|---|---|---|
| DPO arm B primary (sigmoid β 0.1); post-hoc diagnostic | 0.2108 [0.1896, 0.2336] | 110 vs 102 discordant, p = 0.631 (null) |
| DPO arm B recorded result (dpop + NLL rerun) | 0.0091 [0.0052, 0.0158] | 10 vs 268, p = 2.8e-66. Attributed to an instrument-chain defect, not to DPO itself (docs/audits/phase1_postmortem.md) |
| Stage-B GRPO canary at step 0 (n = 100 fixed GSM8K problems) | 0.22 | n/a |
Figure 11. GSM8K-full accuracy of this checkpoint and its DPO children. Sources: outputs/eval/sft-final.json, arm-b-primary-posthoc.json, arm-b-final.json; paired tables in posthoc_primary_vs_sft.json and primary_contrast.json.
7. Results discussion and lessons
- The SFT works as a cold start. It took GSM8K from 0.05 (base, same zero-shot protocol; subset not recorded) to 0.2047, and it taught the output format (93.6% format compliance on GSM8K). The absolute level is low by design. The published ~35-40% for this base is 8-shot, a different information condition. The pipeline leaves accuracy gains to the RL stage.
- It is not significantly different from the predecessor checkpoint-200 on like-for-like problems (p = 0.22). The step-1,000 and final checkpoints differ by 3 problems on the anchor subset, so the fresh-moment tail had no measurable effect.
- MATH-500 is truncation-bound. 33.4% of generations hit the 768-token cap answerless, and median output is 404 tokens. A larger generation budget would likely raise the score. That effect has not been measured.
- Defects that shape how to read the run (all discovered after training; none were fixed for this checkpoint):
- Constant LR. The logged warmup-cosine schedule was never applied, so training ran at η = 1e-5 throughout, including the last steps where the log shows LR ≈ 0.
- Unsharded sampler. All 4 ranks computed gradients on the same micro-batch. The effective batch was about 10.7 rows per step instead of the recorded ~42, and three quarters of the compute was redundant. Data coverage was still exactly one epoch.
- Duplicated corpus rows. 16.7% of train rows are exact copies, with up to 319 copies of one solution. This over-weights a few problems, and memorised copies explain the near-zero-loss micro-batches.
- Tail resume with fresh Adam moments for steps 1,001-1,125.
- Horizon arithmetic. The pre-registration's "24 rows/step" was superseded by the token-budget sampler (1,125 steps instead of 517). This was recorded before the first step.
- Lesson carried forward: a run can log a perfect schedule and still not apply it. The sampler sharding, horizon hard-stop and end-of-training save were fixed in nano-mistral-o1 for all later runs (RESULTS.md 2026-08-18 and 2026-08-20 entries). The LR-application bug was fixed only in the successor trainer
align, which now has a test pinning that the scheduled LR reaches the optimizer.
8. Intended use, limitations, risks
Intended use:
- A research baseline and the substrate for preference and RL experiments on step-level math reasoning.
- Interpretability comparisons between base and SFT.
- Reproducing the nano-mistral-o1 results.
Not intended for production tutoring, grading, or any setting where a wrong answer causes harm. Expect about 80% of GSM8K and about 92% of MATH-500 answers to be wrong.
Limitations:
- English-only, competition- and grade-school math only. Not instruction-tuned for general chat or safety.
- Long problems often hit the generation cap.
- The training text contains some answers the verifier flags as wrong (about 10-11% of gold-bearing rows), along with the duplicates and optimisation defects listed in §7.
- No safety or refusal tuning was done beyond what the base model has.
Risks: confident, well-formatted but incorrect derivations.
9. Reproducibility
The code is the local nano-mistral-o1 repository (not public on the Hub). SHAs refer to that repo.
| Item | Value |
|---|---|
| Original launch | 2026-08-17 19:24:19 IST. The commits e927764 (receipt serialisation fix), e82e7f9, 6c5d51c (semantics-free format pass) and 1c8987c all carry timestamp 19:24:33, 14 s after launch. The last commit before launch is 2cbbd23 |
| Tail resume (published weights) | Commit 1ddb1a4 (2026-08-18 07:07 IST) |
| Config | configs/sft.yaml (run_name: sft-stage-11) |
| Data | build_version 2. Shard hashes sft-train 101d1404f0794d73e1156d8efdfbae0d, sft-held 0af5496c31c4e62f6cb6df870ef44ede. Tokenizer hash 69c68b365b9e8f42 |
| Weights | model.safetensors sha256 a79e229cf91a2d75e2d7bad1f8d96e6b5eb78541cf9eca1182939fa0ec21cd72 (repo commit 4a5cb20f) |
| Receipts in this repo | receipts/history.jsonl (full training log), receipts/stage_gates.json (gate ledger with eval JSON), receipts/sft_quality_gate.json |
| Card evidence | evidence.json (every number → file/field). _build_figures.py regenerates all figures from the logs |
# 1. data build (see the scripts/build_data.py docstring for flags)
uv run python scripts/build_data.py
# 2. SFT with the in-trainer gate chain (4 GPUs)
torchrun --nproc_per_node=4 scripts/sft.py configs/sft.yaml --optimizer.lr=1e-5
# 3. standalone eval on 1 GPU (fresh process; --quality-gate also writes the SFT gate receipt)
CUDA_VISIBLE_DEVICES=0 python scripts/eval_checkpoint.py \
--checkpoint checkpoints/sft/checkpoints/micro_00002250 --name sft-final \
--gsm8k-n 1319 --math500-n 500 --quality-gate
To reproduce this checkpoint exactly, you would also need the three defects in §7. A run on the fixed trainer will follow the cosine schedule and is not LR-comparable.
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("viai957/nano-mistral-o1-sft")
model = AutoModelForCausalLM.from_pretrained("viai957/nano-mistral-o1-sft", torch_dtype="bfloat16", device_map="auto")
prompt = ("[INST] Solve the following math problem. Reason one step at a time, writing each step as its own "
"paragraph separated by a blank line. When you reach the result, write \"# Answer\" followed by a "
"blank line and the answer alone.\n\nHow many seconds are in 7.8 minutes? [/INST]")
ids = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**ids, max_new_tokens=768, do_sample=False)
print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
To restore the original repo layout:
hf download viai957/nano-mistral-o1-sft --local-dir checkpoints/sft/checkpoints/micro_00002250 --exclude "receipts/*" "README.md" "figures/*" "evidence.json"
10. Related repositories, licence, citation
nano-mistral-o1 family
viai957/nano-mistral-o1-sft: this model (SFT substrate)viai957/nano-mistral-o1-dpo-arm-a: DPO on argilla math preference pairsviai957/nano-mistral-o1-dpo-arm-a-halfepoch-salvage: arm A from the unsharded-sampler runviai957/nano-mistral-o1-dpo-arm-b: step-level DPO on PRM800K pairs (primary sigmoid run)viai957/nano-mistral-o1-dpo-arm-b-response: the dpop + NLL rerun (recorded arm-B result)viai957/nano-mistral-o1-grpo-stageb-step48: Stage-B GRPO, optimizer step 48viai957/mistral-7b-v0.3-prm800k-prm-ppo-math: predecessor project (source of the checkpoint-200 golden anchor)viai957/align: successor trainer, with the LR-application fix
Licence and attribution. Weights are released under Apache-2.0, following mistralai/Mistral-7B-v0.3. Training text is from PRM800K (OpenAI, MIT), and subject labels come from MATH (Hendrycks et al., MIT).
@misc{nanomistralo1_2026,
title = {nano-mistral-o1: a gate-certified SFT to DPO math-reasoning pipeline for Mistral-7B-v0.3},
author = {{nano-mistral-o1 contributors}},
year = {2026},
howpublished = {\url{https://huggingface.co/viai957/nano-mistral-o1-sft}}
}
@article{lightman2023lets,
title = {Let's Verify Step by Step},
author = {Lightman, Hunter and Kosaraju, Vineet and Burda, Yura and Edwards, Harri and Baker, Bowen and Lee, Teddy and Leike, Jan and Schulman, John and Sutskever, Ilya and Cobbe, Karl},
journal = {arXiv preprint arXiv:2305.20050},
year = {2023}
}
@article{jiang2023mistral,
title = {Mistral 7B},
author = {Jiang, Albert Q. and others},
journal = {arXiv preprint arXiv:2310.06825},
year = {2023}
}