mofengenden's picture
Add files using upload-large-folder tool
588095e verified
|
Raw History Blame Contribute Delete
29.1 kB

Experiment log

Each entry gives: the survey item it tests (S#), what I expected, the setup, the GPU job names and GPU-hours used, what happened, and what I decided. GPU-hours are H100-equivalent.

CPU-side preparation (no GPU)

C1. Data download (18:50-19:30 UTC)

Raw data on local disk (/root/raw):

  • FineWeb-Edu sample-100BT: 40 files.
  • DCLM-baseline: 240 shards, spread over global shards.
  • ClimbMix (karpathy/climbmix-400b-shuffle): 400 shards.
  • Common Pile: stackv2_edu (30 of 95 files, every 3rd so all languages are covered), stackexchange (12), arxiv_papers (8), project_gutenberg (15), peS2o (10), pubmed (4).
  • Wikipedia: 20231101.en, all 41 files.
  • FineMath-4plus: 64 files.
  • FineWeb-2: 2 files each of de, fr, es, it, pt, ru, zh, ja.
  • FineWeb sample-10BT: 2 files, used for validation only ("generic web" proxy).

Throughput was about 130-350 MB/s aggregate from HF.

C2. Tokenizer

Byte-level BPE (HF tokenizers), vocab 65,536, so ids fit in uint16. Special tokens <|bos|>=0, <|eos|>=1, <|pad|>=2. No normalizer. Pre-tokenization uses a GPT-4-style regex with digits split in groups of 1-2 (nanochat's ablation found \p{N}{1,2} better than 1-3 at 32k vocab), followed by byte-level mapping. Training sample: 3.0B characters, domain-balanced. Shares: fwedu 14%, dclm 14%, climbmix 18%, code 17%, math 8%, arxiv 5%, books 5%, wiki 6%, stackexchange 5%, peS2o 2%, multilingual 6%. Each document is randomly cropped to 16k characters so that books do not dominate.

  • First attempt was restarted: the sampler took the first 8 files of each source, and for FineWeb-2 that meant only zh/de/fr/it. The fix spreads the sampled files across each source.
  • Result: 0 round-trip failures on edge cases (CRLF, tabs, emoji/ZWJ, CJK, control chars, literal special-token strings). Compression is 4.76 bytes/token on ClimbMix; the other domains are measured in C4.

C3. Pipeline validation on CPU (no GPU)

  • The training model (code/model.py, SDPA path, fp32) and the HF wrapper (code/hf/modeling_ngpt.py) give bit-identical logits on random weights, with and without partial RoPE + PKO. Logits at early positions do not change when later tokens are scrambled (causal).
  • A tiny random model goes export -> evaluate.py (CPU, and with --isolate yes): valid: yes (loads, lossless, BOS, causal, deterministic).
  • Gotcha: pip install kernels upgraded huggingface-hub to 2.x and broke transformers 5.17. Reverted to 1.31.0. The prebuilt FA3 kernel (varunneal/flash-attention-3, torch210-cu128 build) is loaded straight from a local copy, so no extra packages are needed at train time.

C4. Decontamination and data loading

  • PG-19 test+validation books removed from Gutenberg (147/150 found). WikiText-103 test+validation articles removed from Wikipedia (113/122 found by normalized title).
  • Validation sets: up to about 400 held-out docs per domain, truncated to 18k chars like the scorer. For sources whose files are grouped by language or site (code, multilingual and so on), docs are held out at document level from every file, and those docs are skipped at tokenization.
  • Loader check on real ClimbMix tokens: about 8 documents per 4096-token row. cu_seqlens padding of 48 segments/row is ample.

GPU experiments: plan and expectations (written before running)

Proxy protocol: d12 (768 wide, 12 layers, about 135M matmul params including lm_head), seq 4096, batch 0.5M, 1.62B tokens (12 tokens/param, nanochat's compute-optimal ratio), nanochat optimizer defaults. Scoring: eval_bpb.py, which reproduces evaluate.py's windowing, per domain on held-out docs. "core" = mean over fwraw (generic web), code, math, arxiv, books, wiki, stackex, reddit, news, pdfs; "all" = mean over every val domain.

ID Survey item Question Expectation
E0 §4 kernels FA3 vs FA2 correctness/speed; throughput d12-d36; FP8; B200 vs H100; 2-node scaling FA3 ≈ +10-20% over FA2 at 4k ctx; B200 ≈ 1.6-2x H100 per GPU; 2-node efficiency ≥ 85%
E1 §2 DataDecide, nanochat web-only ClimbMix vs DCLM ClimbMix better on edu/wiki-like text, DCLM better on generic web/reddit; both bad on code
E2 §2 DataDecide balanced multi-domain (50% web) vs web-only balanced wins "core" by ≥ 5%; slightly worse on web domains
E3 §2 35% web (more domain data) vs 50% small further gain on core, small loss on web; picks the operating point
E4 §1/§4 Marin, modded partial RoPE (64 of 128 dims) + PKO on long-window layers -0.5% to -1.5% BPB at equal steps, ~0 speed cost
E5 §4 Qwen gated attn head-wise output gate -0.3% to -1% BPB, ~1% speed cost
E6 §4 context seq 2048 vs 4096 at equal tokens 4096 better by ~0.2-1% on long-doc domains (books/arxiv/pdfs/code), ~equal elsewhere
E7 §3 Straight-to-zero final LR 0 vs 0.05 ≤ 0.3% difference
E8 scaling the chosen recipe at d16/d20 (and maybe d24) smooth power law in compute; used to predict the final BPB
E9 pilot final config at full width on the final hardware for ~30-60 min MFU, memory, checkpoint/resume on 16 GPUs

E0. Kernels, throughput, pipeline (GPU jobs jobA, jobB; about 0.5 + 0.5 H100-h)

Synthetic-token fwd+bwd benchmarks with torch.compile and SGD. Real-optimizer numbers follow in the d12 smoke run and in jobC.

model (seq 4096, SSSL) H100 FA3 tok/s/GPU H100 FP8 B200 FA2 tok/s/GPU B200 FP8 B200/H100
d12 (rows 8) 416k (MFU 38%) 649k 1.56x
d24 (rows 4) 90.3k (MFU 46%) 149.5k 1.66x
d32 (rows 2 / 4) 41.1k (MFU 46.5%) 47.3k (+15%) 75.0k 85.2k (+14%) 1.82x
d36 (rows 2 / 4) 30.1k (MFU 47%) 35.4k (+18%) 56.1k 65.9k (+17%) 1.86x
  • Doc-masked varlen attention matches per-document SDPA to bf16 noise: max |Δlogit| 0.009 on H100 (FA3 and FA2), 0.010 on B200 (FA2 runs on sm100).
  • FA3 vs FA2 on H100 at d24: 90.3k vs 88.7k, only +2%. With doc masking and 3/4 of layers at a 1024 window, attention is a small share. So the FA3 dependency is not worth it, and FA2 (in the image) is used everywhere.
  • PKO adds no measurable cost (90.5k vs 90.3k).
  • B200 is 1.86x an H100 per GPU at d36, at a 1.58x price, so B200 buys about 18% more tokens per budget-hour. Memory: 180 GB lets B200 run 4-row micro-batches at d36.
  • Pipeline on 1 H100 (jobA): d12 trains, stops at step 30 with a checkpoint, resumes to 60 (loss continuous), runs final eval, saves, exports to HF, and evaluate.py reports valid: yes (bpb 1.71 after 60 steps). Real-optimizer d12 MFU on 1 GPU: 35.7%.
  • Bug noted: nanochat's WD rule wd·sqrt(B/Bref)·Dref/D explodes for tiny D (smoke run: wd=14.6). Harmless for real runs (D ≥ 1B) but it will be clamped.

E0b. 2-node B200 scaling (job jobC_b200: 16 B200 × 8.4 min ≈ 3.5 H100-h)

  • Interconnect: 8 RDMA devices (EFA-style rdmap*) per node, NVLink (NV18) inside the node. NCCL all-reduce bus bandwidth on 2 GB: 641 GB/s across 2 nodes (16 GPUs) vs 735 GB/s inside one node. reduce_scatter: 361 vs 630 GB/s.
  • d36 real training (Muon+AdamW ZeRO-2 optimizer, B=1M tokens, micro_rows=4, ClimbMix):
    • 16 GPUs: 0.81M tok/s (50.6k/GPU, MFU 34.8% of 2.25 PF), 101 GB/GPU.
    • 8 GPUs: 0.42M tok/s (52.5k/GPU, MFU 36.5%).
    • Scaling efficiency 2 nodes vs 1 node: 96%. Optimizer step + comms cost about 10% vs the fwd+bwd-only benchmark (56.1k).
    • Compile + startup about 3 min.
  • Decision: the final run uses 2 nodes × 8 B200 (about 10.1 h for the 256 H100-h budget). Over 16 H100 for 16 h it gets about 13% more tokens, and wall clock is shorter, leaving more margin for retries.
  • Availability caveat: an 8×H100 job (m1_climb) stayed PENDING for over 30 min while B200 jobs started within about 10 min. gpu cancel does not remove a pending job, and the pending job still counts against the 16-GPU limit. run.sh must tolerate queueing.

E1/E2. Web backbone and multi-domain mixing at d12 (jobs m1_climb_b, m3_dclm, m5b_bal; 4-8 B200 each, about 1.6-2.1 H100-h each)

Protocol: d12, 1.62B tokens, seq 4096. eval_bpb on up to 400 held-out docs per domain, full documents with the scorer's windowing.

run mixture fwraw code math arxiv books wiki stackex reddit news pdfs multi core all
m1_climb_b ClimbMix 100% 1.090 1.016 0.998 1.057 1.318 1.072 1.126 1.262 1.059 1.036 2.252 1.1034 1.1218
m3_dclm DCLM 100% 1.063 0.899 1.026 1.082 1.211 1.049 1.034 1.213 1.013 1.031 1.980 1.0619 1.0843
m5b_bal ClimbMix 55% + code 14, math 7, wiki 6, books 5, arxiv 5, stackex 5, peS2o 2, pubmed 1 1.104 0.686 0.782 0.834 1.169 0.955 0.935 1.272 1.067 1.005 2.057 0.9809 1.0281
  • The multi-domain mix wins the domain mean by 11% (core 0.981 vs 1.103), with big gains on code (-33%), math (-22%), arxiv (-21%), stackex (-17%), wiki (-11%) and books (-11%). Generic-web BPB gets only slightly worse (fwraw +1.3%). This matches DataDecide.
  • DCLM is a better web backbone than ClimbMix for diverse text: better on fwraw, code, books, stackex, reddit and news. ClimbMix is better only on its own in-distribution val and edu-like text. So the final web share should lean on DCLM (tested next in m7/m9).
  • Expectation check: E2 expected ≥5%, got 11%. E1 confirmed (DCLM better on generic web/reddit).

E4/E5. PKO + partial RoPE; gated attention (m5b_pko, m5b_gate; 4 B200 each)

run core all Δcore vs m5b_bal
m5b_bal 0.9809 1.0281
m5b_pko (rope on 64/128 dims, PKO on L layers) 0.9780 1.0251 -0.30%
m5b_gate (head-wise sigmoid output gate) 0.9783 1.0254 -0.27%

Both improve every one of the 16 domains, by small amounts (single seed). Throughput cost is about 0 (PKO) and <1% (gate). The size is at the low end of expectations (Marin's 1.07-1.28x would be about 0.5-2%). The combination is tested in m5b_pkogate.

E4-E7 continued, and the web backbone inside the mix (jobs m5b_pkogate, m5b_s2048, m5b_lr0, m7_bal_dclm; 4 B200 each, ≈1.6 H100-h each)

run change vs m5b_bal core all Δcore
m5b_bal (baseline) 0.9809 1.0281
m5b_pkogate partial RoPE + PKO + head-wise attn gate 0.9742 1.0215 -0.68% (≈ sum of -0.30% and -0.27%; all 16 domains better)
m5b_s2048 train/declare 2048 ctx (window 512) 0.9905 1.0377 +0.98% (arxiv +2.1%, stackex +2.3%, pdfs +1.6%, code +1.6%)
m5b_lr0 final LR 0 instead of 0.05 0.9814 1.0285 +0.05% (noise)
m7_bal_dclm web = DCLM 30 + ClimbMix 25 (+multi 2%) instead of ClimbMix 55 0.9656 1.0014 -1.56% (fwraw -1.9%, reddit -2.5%, news -2.5%, pdfs -3.8%; multi 2.06 -> 1.79 with 2% data)

Decisions:

  • Adopt PKO + partial RoPE + head-wise output gate. The gains are additive, and none of the 16 domains got worse.
  • Keep 4096 context. 2048 is clearly worse. 8192 is to be tested.
  • Keep final LR 0.05 (D2Z made no difference here).
  • The web share leans on DCLM.

E3. Web share 50% vs 35%, and new domains (m9_bal2, m10_div2, m5b_wd08; 4 B200 each)

run mixture fwraw reddit news pdfs code math books multi core all
m7_bal_dclm web 55 (DCLM 30, Climb 25), no reddit/news/pdfs, multi 2 1.083 1.241 1.041 0.967 0.675 0.782 1.151 1.791 0.9656 1.0014
m9_bal2 web 50 (DCLM 24, Climb 18, PDFs 8) + reddit 3, news 2, multi 3 1.083 1.204 0.997 0.945 0.681 0.785 1.156 1.766 0.9577 0.9967
m10_div2 web 35 (DCLM 17, Climb 12, PDFs 6), more of every domain 1.096 1.206 1.000 0.959 0.662 0.775 1.148 1.771 0.9553 0.9971
m5b_wd08 m5b_bal with warmdown 0.8 instead of 0.65 0.9805 1.0282
  • Adding reddit/news/PDFs data (m9) fixes those domains: news -4%, reddit -3%, pdfs -2%.
  • 35% web (m10) is only -0.25% better on core, but +1.2% worse on generic web (fwraw, dclm, climbmix, fwedu), and "all" is flat (0.9971 vs 0.9967). The benchmark suite will also want web/edu data. Decision: about 48% web.
  • Warmdown 0.8 vs 0.65: no difference. Keep 0.65.

Final main mixture (configs/final_mix.json): dclm 24, climbmix 16, pdfs 8, code 14.5, math 7, wiki 5, books 5, arxiv 4, peS2o 2, pubmed 1, stackex 5, reddit 3.5, news 2, multi 3 (%).

E6b. Context 8192 vs 4096 (m5b_pkogate_s8192 vs m5b_pkogate; 4 B200)

  • core 0.9724 vs 0.9742 (-0.18%), all 1.0198 vs 1.0215 (-0.17%). Gains are on long-document domains (pdfs -0.4%, stackex -0.4%, arxiv -0.3%, math -0.3%).
  • That is about the same size as the extra cost: the 9 full-attention layers of d36 attend twice as far on long documents, about 3% fewer tokens at a fixed budget. It also doubles the row length for memory. Decision: keep 4096. 2048→4096 was worth 1%; 4096→8192 is about a wash at our budget.

E8a. Final recipe at d12, and the anneal phase (f_d12, f_d12_anneal; 4 B200 each, ≈1.6 H100-h each)

Final recipe = final main mixture + partial RoPE/PKO + attention gate, d12, 1.62B tokens.

run core all notes
f_d12 0.9450 0.9884 vs m9_bal2 0.9577 (the PKO/gate gain and the small mix changes compound)
f_d12_anneal 0.9452 0.9881 from 75% of training on, switch to the anneal mix (+FineWeb-Edu 10%, more math/wiki, less DCLM/reddit/news)

The anneal is BPB-neutral on average: fwedu -0.9%, math -0.7%, wiki -0.3%; reddit +0.6%, news +0.6%. Decision: adopt it. It costs nothing on the domain mean, and the literature (OLMo 2/3, Llama 3) says up-weighting educational/math data at the end of the LR decay helps the downstream task suite.

E9. Full-scale pilot through the real orchestrator (job final-train-1 = pilot, 2×8 B200, about 9.5 min ≈ 4 H100-h)

orchestrate.py, with the d36 final config and the job capped at 27 min:

  • The job launched on 2 nodes and the deadline was derived from the job's own start. The step-0 eval over 16 domains took 87 s (it includes compiling the eval graph).
  • Throughput on the final mixture: 0.75M tok/s (1.39-1.40 s per 1M-token step), 104 GB/GPU. That is 7% below the ClimbMix-only benchmark (0.81M): the multi-domain data has longer documents, and the arch now includes PKO and the gate.
  • The time-based async checkpoint was written at step 12. The deadline logic shrank the schedule from 26,000 to 80 steps and the run still ended with a full LR warmdown (lr_mult 0.068 at the last step).
  • The final eval and fp32 final save of 5.3B params (21 GB) took about 1 min. Export to HF (safetensors fp32, 21.3 GB) took about 3 min on the CPU machine.
  • Bugs found and fixed:
    1. KeyError: 'tokenizer' in export. Config values now fall back to train.py DEFAULTS.
    2. bash scripts that live in /workspace keep their file open, which blocks gpu sync, so the orchestrator would never see job outputs. run.sh now execs python; I verified the exec'd process holds no /workspace fds. Logs are append-and-close.
    3. A gpu sync running concurrently with the export made the final os.replace fail with EROFS. The rename now retries.
  • Margins tightened. The end-of-job reserve is now about 10 min: 3 min job slack, 2 min trainer slack, 5 min for final eval+save.
  • The exported d36 pilot model passes the official evaluator (valid: yes) on CPU in 2.6 min for 14 short docs (fp32, 5.3B params, ~25 GB RAM).
  • Retry test (final-train-1/1023, 1 node × 4 B200, d12): I cancelled attempt 1 by hand mid-run (exit 137). The orchestrator re-sized attempt 2 from the remaining budget and the trainer resumed from the latest complete checkpoint (model, per-rank optimizer shards, loader cursors, schedule state). That checkpoint was the step-1 one, because the 1.5-min interval had not elapsed again before the cancel.

E10. Bug found: sequential row order over sorted files (f_d12 vs f_d12_perm; 4 B200, ≈1.6 H100-h)

The loader read each source's stream in sorted-file order, and several sources are stored grouped: Stack-Edu is one language per file, FineWeb-2 one language per file, StackExchange by site, arXiv by date. A run that takes only part of a source therefore saw only the first few languages or sites. The fix maps row k of each source through a per-epoch bijection j = (a·i + c) mod n_rows with a coprime to n_rows. Rows are still contiguous 4097-token chunks, but they are drawn from all over the source.

run code multi stackex wiki books arxiv math core all
f_d12 (sequential) 0.652 1.788 0.888 0.949 1.140 0.837 0.779 0.9450 0.9884
f_d12_perm (permuted) 0.548 1.406 0.836 0.928 1.126 0.826 0.769 0.9233 0.9497
-2.3% core, -3.9% all; code -16%, multilingual -21%. All earlier mixture/arch comparisons
shared the same bug, so their relative conclusions stand, but they understate the value of the
domain data. The scaling series is re-run with the fix (f_d16_perm, f_d20_perm); the biased f_d20
was cancelled after 26 min (about 5.5 H100-h lost).

E11. Retry path through the orchestrator (job 1024, attempt 2 of the retry test)

After the manual cancel of attempt 1, attempt 2 resumed (step 1 -> 1907), finished, saved the final model, and the orchestrator exported it to HF format. The failure-recovery path works end to end.

E12. Eval parity and precision (job prec_test, 1 B200, ≈0.2 H100-h)

On the same docs (first 100 per domain), eval_bpb.py (training code, fp32) and the official evaluate.py on the exported HF model agree to 4 decimals: books 1.1510/1.151, code 0.7942/0.7942, fwraw 1.0787/1.0787, multi 1.7343/1.7343. bf16 inference differs by ≤0.0001 BPB. The export keeps fp32 weights, and the HF forward computes the logits in fp32.

E8b. Scaling series of the final recipe (permuted loader, no anneal, ratio 12): f_d12_perm, f_d16_perm, f_d20_perm

Jobs: f_d16_perm on 8 B200 for 25 min (≈5.3 H100-h); f_d20_perm on 8 B200 for 64 min (≈13.5 H100-h). d20 used batch 1M (like the final run); d12 and d16 used 0.5M.

run matmul params tokens C=6ND fwraw code math arxiv books wiki stackex reddit news pdfs multi core all
f_d12_perm 135M 1.62B 1.3e18 1.077 0.548 0.769 0.826 1.126 0.928 0.836 1.199 0.990 0.935 1.406 0.9233 0.9497
f_d16_perm 268M 3.22B 5.2e18 1.006 0.494 0.695 0.760 1.043 0.854 0.765 1.137 0.918 0.867 1.279 0.8537 0.8783
f_d20_perm 477M 5.73B 1.6e19 0.955 0.458 0.643 0.714 0.981 0.801 0.716 1.091 0.868 0.816 1.182 0.8042 0.8271
final d36 (extrapolated) 2444M 26.2B 3.8e20 0.82-0.85 0.36-0.39 0.51-0.54 0.59-0.62 0.82-0.85 0.67-0.69 0.59-0.62 0.97-0.99 0.74-0.77 0.69-0.70 0.95 0.68-0.70 0.69-0.72

Extrapolation: per domain, an exact 3-point fit of L = E + A·C^-α (upper end; α ≈ 0.10-0.20, E ≈ 0.3-0.7) and a pure power law L = A·C^-α (lower end; α ≈ 0.04-0.07). This is a 23x extrapolation in compute, so these are estimates, not measurements. The d20 run trained smoothly at batch 1M with the sqrt-scaled LRs, which supports using the same rules at d36.

E9b. Full-scale validation of the shipped recipe via run.sh (job 1030: 2×8 B200, 12 min ≈ 5 H100-h)

recipe/run.sh with the shipped final config (renamed run, job capped at 19 min) and the recipe's own data, code and paths. Sequence: data check (43.25B tokens available) → 2-node job → compile (3.8 min to step 20) → 0.74-0.76M tok/s with the permuted loader + background prefetch (prefetch hides the random-read cost; same as the pilot) → deadline-shrunk schedule (243 steps) → final eval + fp32 save → export (2 min) → official evaluator on CPU: valid: yes. Submit to "run complete" took 17.3 min. Memory 103.5 GB/GPU.

E12b. bf16 export (job bf16test, 1 B200, ≈0.2 H100-h)

The f_d12_perm model exported with bf16 weights (the HF forward still computes the logits in fp32): evaluate.py says valid: yes with full audits (deterministic, causal, consistent). Domain BPB is within 1e-4 of the fp32 export (books 1.1510/1.1510, code 0.7943/0.7942, fwraw 1.0788/1.0787, multi 1.7344/1.7343). Decision: ship bf16 weights. The d36 model drops from 21 GB to 10.6 GB, which fits any scoring GPU of ≥24 GB with room for 4k-token activations. These are the same bf16 values the matmuls saw in training.

GPU-hour accounting (from gpu list -a; H100-equivalent; elapsed × GPUs × rate)

group jobs H100-h
E0 kernels/benchmarks jobA (1×H100), jobB (1×B200) 0.7
E0b 2-node scaling jobC_b200 (16×B200, 8.4 min) 3.5
d12 mixture/arch/schedule ablations m5b_bal, m5b_pko, m5b_gate, m1_climb_b, m3_dclm, m5b_pkogate, m7_bal_dclm, m5b_s2048, m5b_lr0, m9_bal2, m10_div2, m5b_wd08, m5b_pkogate_s8192, f_d12, f_d12_anneal, f_d12_perm 26.5
scaling series f_d16 (seq. loader), f_d20 (cancelled), f_d16_perm, f_d20_perm 30.1
LR transfer test f_d20_lrx07 ≈13.5
pilot / validation / retry / smoke final-train-1 (pilot 16 GPUs), final-train-1/2 (retry), final-train-1 (smoke), final-train-1 (validation 16 GPUs) 10.4
eval/precision tests prec_test, bf16test 0.1
full-scale resume test resume_d36 ≈4
d24 exact-recipe run f_d24_final ≈28
benchmarks, d36 stability bench, stab_d36 ≈7.5
smoke re-tests final-train-1 ×2 ≈0.6
total 123.5 of 128 (from gpu budget at 03:55 UTC)

E13. LR transfer at batch 1M (f_d20_lrx07 vs f_d20_perm; 8 B200, ≈13.5 H100-h)

I repeated d20 at B=1M without nanochat's √(B/0.5M) scaling of all LRs and WD (×0.71).

run LR scaling core all
f_d20_perm √(B/B_ref) = 1.41 (shipped rule) 0.8042 0.8271
f_d20_lrx07 1.0 0.8047 (+0.06%) 0.8278 (+0.08%)
  • Mid-training, the lower LR led: EMA train loss at step 1000 was 3.191 vs 3.220. After the warmdown the higher LR is marginally ahead, as Wen et al. warn about early comparisons.
  • The optimum is flat within ±30% LR at d20, which makes the transfer to d36 low-risk.
  • Decision: keep the √-scaled LRs (Muon 0.0283, etc.).

E14. Full-scale resume (job resume_d36: 2×8 B200, 5.1 min ≈ 4 H100-h)

The 16-rank d36 checkpoint from the pilot (step 12, 37 GB: model 15.5 GB + 16 optimizer shards) was loaded on a fresh 2-node job. Training continued at step 12 with the same loss trajectory: step-20 loss 6.375 vs 6.368 in the original run, within bf16 non-determinism. Throughput was unchanged at 0.75M tok/s and memory at 103 GB/GPU. The job then saved a new resumable checkpoint at step 42. Load + compile to the first step took about 3.5 min. Checkpoint/resume at full scale works.

Decision summary (what the shipped recipe uses, and the experiment behind each choice)

choice value evidence
hardware 2 nodes × 8 B200, data parallel + ZeRO-2 E0, E0b: 1.86x H100/GPU, 96% 2-node efficiency
model nanochat d36 (2.45B matmul / 5.31B total params) survey §1 (ratio 10.5-12), E8b scaling, E9 throughput
tokens 25,000 × 1M = 26.2B (10.7 tok/param) budget ÷ measured 1.40 s/step
attention extras partial RoPE + PKO, head-wise output gate E4/E5 (-0.68% together)
context 4096 train = declared E6 (2048 +1%), E6b (8192 a wash)
data 15 sources, about 48% web led by DCLM E1-E3 (-11% vs web-only, -1.6% DCLM over ClimbMix)
anneal last 25%: +FineWeb-Edu, more math/wiki E8a (BPB-neutral; literature for tasks)
loader per-source bijective row permutation + prefetch E10 (-2.3% core / -3.9% all), E9b (no throughput loss)
optimizer nanochat MuonAdamW, √B-scaled LRs at 1M batch E13 (flat optimum at d20)
schedule 40 warmup, 65% linear warmdown to 0.05 E7 (alternatives tie)
export bf16 safetensors, fp32 logits E12/E12b (≤1e-4 BPB vs fp32)
robustness deadline-aware schedule, 30-min async ckpt, retries E9, E9b, E11, E14

E15. d24 with the exact final recipe, out-of-sample check of the scaling fit (job f_d24_final: 2×8 B200, 66 min ≈ 28 H100-h)

This is the final config (anneal mix included) at d24 (1536 wide, 780M matmul params) on 2 nodes, under a 90-min job deadline. The deadline logic shrank the schedule 8928 → 8653 → 7384 steps (7.74B tokens, ratio 9.9), partly because the first eval compiled its own graph (59 s). Throughput was 2.08M tok/s, MFU 29%, 68 GB/GPU. Training was smooth throughout, including the mixture switch at 75%.

core all code math wiki fwraw multi
d24 measured 0.7727 0.7947 0.435 0.607 0.767 0.921 1.133
predicted from the d12-d20 fit 0.7741 0.7958 0.438 0.612 0.769 0.924 1.120
error -0.18% -0.14% -0.6% -0.9% -0.2% -0.3% +1.1%

The 3-point law predicted the 4th point to 0.2%. The per-domain residuals match what the anneal does: up-weighted domains (fwedu -1.4%, math -0.9%) beat the prediction, down-weighted ones (multi, news, reddit) miss it slightly.

Refit on 4 points, extrapolated 10.6x to the final run (3.84e20): core 0.696 (E + A·C^-α, α = 0.116) / 0.679 (pure power law); all 0.715 / 0.699. Per domain (saturating / power law): code 0.385/0.368, math 0.521/0.513, arxiv 0.612/0.597, books 0.839/0.827, wiki 0.685/0.669, stackex 0.603/0.591, fwraw 0.840/0.823, reddit 1.006/0.978, news 0.779/0.746, pdfs 0.688/0.687, multi 0.999/0.965.

Post-d24 fixes (learned from E15)

  • Deadline over-reaction. In d24 the first 30-min checkpoint (step 3170) shrank the schedule 8653 → 7384 steps although throughput was unchanged (elapsed time per 200 steps was 0.50 s/step before and after). Cause: the step right after the checkpoint waited for the data prefetch thread, which the checkpoint-writing threads starved of the GIL. That single long step inflated the mean of the last 50 step times. Fix: the projection uses the median of the last 200 step times. The real overhead of checkpoints and evals still shows up as wall clock spent, so the logic still makes small, gradual adjustments.
  • Divergence recovery (untested on GPU by design, CPU-tested). A non-finite loss writes NAN_<step> and exits. The orchestrator then retries; on resume the trainer halves all LRs per NaN event and skips 200 steps of data, so the same batches are not replayed.
  • Both changes were re-validated with the run.sh smoke test (below).

E16. Zero-shot benchmarks of the scaling-series models (job bench: 4 B200, ≈0.3 H100-h)

code/bench_eval.py scores by log-likelihood, lm-eval-harness style. acc_norm = log-prob divided by continuation bytes; WinoGrande uses partial scoring. Splits: HellaSwag val (first 2000), ARC-E/C test, PIQA val, OpenBookQA test, WinoGrande-debiased val. These are evaluation-only; benchmark data is never used for training or selection.

model ARC-E ARC-C HellaSwag PIQA OBQA WinoGrande avg
d12 (1.6B tok) 46.6 23.6 39.0 64.2 30.4 51.1 42.5
d16 (3.2B) 52.3 28.6 44.0 68.4 31.4 52.3 46.2
d20 (5.7B) 54.8 29.2 46.3 70.1 33.8 53.0 47.9
d24 final recipe incl. anneal (7.7B) 60.8 31.7 48.9 71.9 36.4 56.3 51.0

Benchmarks improve smoothly with scale. The jump d20→d24 is largest on ARC/OBQA (knowledge, science), which is consistent with the anneal phase up-weighting FineWeb-Edu and math (scale and anneal are confounded here). d24 is roughly at GPT-2-XL (1.5B) level on these tasks with about half the matmul params and 1/4 of GPT-2's tokens. The final d36 has 10x d24's compute.

E17. d36 early-training stability at full LR (job stab_d36: 2×8 B200, 16.8 min ≈ 7.1 H100-h)

The exact final config (recipe/code, final.json), stopped after 600 steps. That covers the 40-step LR warmup, the 400-step Muon momentum warmup, and 160 steps at peak LR, with no deadline compression.

  • Smooth loss with no spikes (largest logged increase 0.038). It sits below d24 at every matched step: 2.827 vs 2.897 at step 600, 3.260 vs 3.341 at step 200.
  • Throughput 0.75-0.78M tok/s, with step time falling from 1.40 to 1.35 s as the run warms up; MFU 33.5%; 104 GB/GPU.
  • Consequence: at about 1.36-1.38 s/step the 10.08-h job fits about 25,400-25,800 steps after overheads. The planned schedule was raised from 25,000 to 25,400 steps (26.6B tokens). If the run goes slower, the deadline logic trims the tail.