File size: 68,722 Bytes
588095e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | # Optimizers & hyperparameter scaling for a ~1.5B dense LM on ~40B tokens (256 H100-h budget)
Compiled 2026-11-05. Scope: optimizer choice (AdamW vs Muon family), Muon variants and distributed implementation,
LR schedules, batch size, weight-decay scaling, LR/parameterization scaling, stability knobs, optimizer-state precision,
Muon wall-clock overhead. Ends with a concrete recommended configuration (Sec. 10) and ablations (Sec. 11).
**Tags**
- **[V\*]** read in the primary source *and* the specific numbers re-checked by the lead researcher in the source text.
- **[V]** read in the primary source during this research (by a delegated reader); not independently re-checked.
- **[I]** our inference / arithmetic. **[R]** recalled / secondary, not verified this session.
- Evidence strength: **S** strong (multiple scales, tuned baselines, independent group), **M** moderate, **W** weak
(single scale, untuned baseline, author-only claim).
---------------------------------------------------------------------------------------------------------------------
## 0. TL;DR
1. **Size of the prize is modest.** At 0.5–2B params and 1–8x Chinchilla, the speedup of the best optimizers over a
*well-tuned* AdamW is ~1.1x at 1.2B (Wen et al.; Muon −0.014 to −0.019 nats at 1x Chinchilla, −0.004 at 8x),
~1.03–1.07x for Moonlight-style Muon at 720M (Semenov et al.), 10–15% fewer tokens (Essential AI, 1–4B). Larger claims (1.4–2x)
come from weaker or differently-parameterized baselines. Recipe choices (WD timescale, decay-to-zero, batch) move
loss by similar amounts (0.01–0.06 nats). [V\*/V]
2. **Primary recommendation:** Muon (Moonlight RMS-matched: update = 0.2·sqrt(max(out,in))·O) on all hidden 2-D
matrices + AdamW on embedding / lm_head / 1-D params. Muon LR 8e-4, λ=0.2 (τ≈0.16), Nesterov momentum 0.95,
5 NS steps in bf16; AdamW groups LR 1.2e-3, β=(0.9,0.95), ε=1e-10. Linear warmup 1,000 steps then **linear decay
to zero**. Batch 1M tokens (38,147 steps for 40B). Clip 1.0. fp32 master weights + fp32 states. NS must be
**distributed** (microsoft/dion or round-robin + all-gather); plain `torch.optim.Muon` replicates NS on every rank
(≈7–13% step overhead at 1M batch, which would cancel most of the gain). [I, from V\* sources]
3. **Fallback (AdamW only):** LR 2e-3 (with QK-norm; ~1e-3 without), β=(0.9,0.95), ε=1e-10, λ=0.1 on 2-D matrices only
(τ≈0.13), warmup 2,000 steps, linear D2Z, batch 1M, clip 1.0. This is essentially Wen et al.'s tuned 1.2B config.
4. **Most valuable ablations:** (A) AdamW vs Muon, each LR-swept, at two proxy widths (to see the shrinking-speedup
trend) + a full-shape throughput test of the Muon implementation; (B) weight-decay timescale τ ∈ {0.06, 0.12, 0.25}
at the target tokens-per-parameter; (C) Muon add-ons (NorMuon, cautious WD, Hyperball/MuonH).
5. **Project code (Sec. 12):** /workspace/code already has a distributed nanochat-style MuonAdamW (Polar Express +
NorMuon + cautious WD, Keller LR convention). Its default matrix_lr 0.02·√(B/0.5M) gives a per-element Muon step at
d=2048 that is 3–6x the tuned 1.2–1.5B optima in the literature → sweep matrix_lr {0.007, 0.014, 0.028}; set
final_lr_frac 0 (D2Z); its T_epoch WD rule already lands at an effective τ ≈ 0.2.
---------------------------------------------------------------------------------------------------------------------
## 1. Setting arithmetic and rules of thumb [I]
- **Compute:** 256 H100-h × 989 TFLOP/s (dense bf16) = 9.1e20 peak FLOPs. For N_nonemb ≈ 1.44B (d=2048, L=28,
d_ff=5632), seq 4096, vocab ≈100k, D=40B: 6·N·D = 3.5e20, + causal attention (fwd+bwd ≈ 6·L·s·d ≈ 1.4e9
FLOP/token → 5.6e19), + lm_head 6·d·V ≈ 1.2e9 FLOP/token (4.9e19) ⇒ ≈4.5e20 FLOPs ⇒ **≈49% MFU sustained**
(incl. eval/ckpt).
At a realistic 40% MFU, D ≈ 33B tokens. Every 1% of optimizer overhead ≈ 0.35–0.4B tokens.
- **Steps:** 40e9 / 2^20 = **38,147 steps at 1M-token batch** (19,073 at 2M).
- **AdamW/Muon EMA timescale (Power Lines):** τ = B/(η·λ·D) = 1/(η_peak·λ·S), η = raw LR that multiplies the decay
term (PyTorch-style coupled WD: θ ← θ(1 − η_t λ)). Equivalently **λ = 1/(τ·η_peak·S)**.
- **Loss ↔ token-efficiency:** Wen et al.'s AdamW fit L = 21.43·N^−0.1555 + 276.42·D^−0.2804 + 1.732 [V\*] gives
dL/d ln D ≈ −0.083 nats at D=40B ⇒ **a 10% token-efficiency gain ≈ 0.008 nats ≈ 0.0027 bpb** (at ~4.3 bytes/token;
bpb = nats ÷ ln2 ÷ bytes/token). Seed noise at proxy scale ≈ 0.002–0.003 nats (Porian σ=0.002; nanochat ~0.002 bpb).
- **Muon LR conventions** (critical when copying numbers between papers; see Sec. 3.12):
per-element update RMS per unit LR = 1/sqrt(fan_in) for Keller "original" (sqrt(max(1,out/in))·O),
0.2 for Moonlight "match_rms_adamw" (0.2·sqrt(max(out,in))·O). ⇒ η_RMS ≈ η_Keller / (0.2·sqrt(fan_in));
at fan_in=2048: η_RMS ≈ 0.11·η_Keller. **All implementations decay weights with the raw η**, so keep η·λ fixed
(not λ) when switching conventions.
---------------------------------------------------------------------------------------------------------------------
## 2. Independent optimizer comparisons (what speedup survives at 0.5–2B?)
### 2.1 Wen, Hall, Ma, Liang — "Fantastic Pretraining Optimizers and Where to Find Them" (Sep 2025)
Link: https://arxiv.org/abs/2509.02046 · code https://github.com/marin-community/marin/tree/kaiyue/optimizers ·
runs https://wandb.ai/marin-community/optimizer-scaling
- **Setup [V\*]:** Llama-style, 32 layers, seq 4096; 130M (d=512), 300M (d=768), 520M (d=1024), 1.2B (d=1536,
d_ff=6144, 24 heads); DCLM-baseline + StarCoder2 + ProofPile2, Llama-3 tokenizer; JAX/TPU v5, fp32 params, bf16
activations; Chinchilla = 20 × non-embedding params; metric C4-EN val loss. 11 optimizers, coordinate-descent
sweeps (accept change if Δ>3e-3) at 6 regimes, then hyperparameter scaling laws h(N,D)=αN^−A D^−B+β to predict
1.2B (prediction within 3e-3 of a full 1.2B AdamW sweep).
- **Claims [V\*]:** speedups never exceed 1.4x; matrix-based (Muon, Soap, Kron, Scion) ≈1.3x below 520M, decaying to
≈1.1x at 1.2B; scalar-based <1.2x; Lion/Adam-mini ≤5% slower; rankings flip during LR decay → compare only at end
of training; Muon best at 1–4x Chinchilla, overtaken by Soap/Kron at 8x (and NAdamW/Soap beat Muon at 16x on
130M/300M); fitted law predicts Muon ≥ AdamW loss at 7B/1x. Scale-sensitive hyperparameters (Table 4): AdamW = LR,
warmup, WD, batch; NAdamW = LR, warmup; **Muon = LR only**; Soap = LR, warmup, block size.
- **1.2B results, C4-EN loss [V\*] (Tables 160–175):**
| Chinchilla | AdamW | NAdamW | Muon (lr .004) | Muon (lr .008) | Soap |
|---|---|---|---|---|---|
| 1x | 2.905 | 2.902 | 2.891 | **2.886** | 2.940 |
| 2x | 2.836 | 2.833 | **2.827** | 2.833 | 2.829 |
| 4x | 2.787 | 2.785 | **2.780** | 2.793 | 2.783 |
| 8x | 2.752 | 2.749 | **2.748** | – | 2.749 |
Gap vs AdamW shrinks with size at 1x: 130M AdamW 3.529 vs Muon 3.464 (−0.065); 520M 3.110 vs 3.073 (−0.037);
1.2B −0.014/−0.019. [V\*]
- **Tuned 1.2B configs [V\*]** (BSZ 256 × 4096 = 1.05M tokens):
- AdamW: lr 2e-3, β=(0.9, 0.98), ε=1e-10, λ=0.2, warmup 2000 (1x) / 1000 (2–8x), clip 2 (1x) / 1, min-LR 0.
1x ablations (Table 160): lr 4e-3 → 2.916, 8e-3 → diverged (7.35); BSZ 128 → 2.904, 512 → 2.928, 1024 → 2.985;
λ 0 → 2.946, 0.1 → 2.916; warmup 500/1000/4000 → 2.917/2.910/2.912; β2 0.95 → 2.909, 0.9 → 2.914;
β1 0.95 → 2.905, 0.98 → 2.909; clip 0/1 → 2.909/2.908; ε 1e-15…1e-25 → 2.907.
- NAdamW: β=(0.98, 0.98), lr 4e-3, λ=0.1, warmup 4000, clip 1.
- Muon (Algorithm 8): u = NS5(β·m + g) with Nesterov-style momentum β=0.98, Jordan coefficients
(3.4445, −4.7750, 2.0315), scale sqrt(max(1, rows/cols)), lr 4e-3 (8e-3 better at 1x), λ=0.1 (×lr), **warmup 0**,
**linear decay to 0 over the whole run**, clip 2, BSZ 256. AdamW part (embedding, lm_head, norms): lr 1.2e-3,
β=(0.8, 0.98), ε=1e-15.
- **Muon ablations at 520M, 1x [V\*] (Table 87, best 3.073):** decay fraction (WSD) 0.8/0.6/0.4/0.2 →
3.076/3.086/3.101/3.134 (full-length linear decay best); momentum 0.95/0.9/0.8 → 3.073/3.080/3.098; lr ×2/×4 →
3.095/3.147, ×8 diverged; λ 0 → 3.134, 0.2 → 3.091; BSZ 0.5M→1M/2M/4M → 3.080/3.115/3.188 (at 4x/8x Chinchilla the
1M batch was better than 0.5M); Adam-group lr 0.8e-3/1.6e-3/2.4e-3 → 3.076/3.072/3.073 (insensitive); Adam-group
β2 0.9/0.95/0.98 → 3.090/3.080/3.073. 130M (Table 82): decay 0.2 → +0.052, λ=0 → +0.068.
- **Implied WD timescales [I]:** AdamW τ = 0.24 (130M), 0.12 (520M), 0.11 (1.2B); Muon τ = 0.12 (130M), 0.06 (520M),
0.11 (1.2B, lr .004).
- **Evidence:** S (most careful independent sweep near our scale). Caveats: single seed; Muon tuned with constant
λ=0.1 (Wen II argues this is why the speedup decays); AdamW schedule shape not stated in the tables.
- **Applicability:** directly at our scale (1.2B, 1M batch, seq 4096). For ~1.3x Chinchilla, interpolating 1x/2x:
**Muon − AdamW ≈ −0.010 to −0.017 nats** [I].
### 2.2 Wen, Dang, Lyu, Ma, Liang — "Fantastic Pretraining Optimizers II: Hyperball Optimization" (Jun 2026)
Link: https://arxiv.org/abs/2606.16899
- **Method [V\*]:** wrapper for any base optimizer on attention/MLP matrices: W ← R·Normalize(W − η·R·Normalize(u)),
R = ‖W_0‖_F (init std 1/sqrt(d_in)); no weight decay; embeddings, norm gains, scalars stay on plain Adam. η is the
relative (angular) step size.
- **Claims [V\*]:** Qwen3-style + QK-norm, 1.2B, 1–8x Chinchilla: MuonW (constant-WD Muon) ≈10% token-equivalent over
the AdamW scaling law; **MuonH 20–30%**, gap grows with training length; starts worse, overtakes during LR decay.
Marin FineWeb-Edu speedrun 1x: AdamH/MuonH match WD baselines ≈10% larger. 8B / 159B tokens: MuonH 0.04 lower loss
than AdamW (hand-chosen HPs). LR transfer: drift ≈1.4x across depth 4–512 and width 128–2048 vs 2–4x for
AdamW/MuonW. 130M, 1–128B tokens: fitted L∞ 3.065 (MuonH) vs 3.079 (MuonW). modded-nanogpt Track 3 (steps to
≈3.279): AdamW 5625, MuonW 3325, NorMuonW 3250, AdamH 4875, MuonH 3325, NorMuonH 3250, KL-SOAP-H 3125.
Theory: with decoupled WD the equilibrium weight norm and the angular LR depend only on η·λ; transfer is sensitive to
WD scaling, not init scale.
- **Independent replication [V]:** nanochat PR #498 (MuonH, PyTorch; https://github.com/karpathy/nanochat/pull/498):
author-reported small gains at d24/d26; Karpathy could not initially reproduce the d26 gain and saw a ~3e-3 bpb
*loss* at d12; PR stale/unmerged. nanochat dev/LOG.md 2026-01-29 [V\*]
(https://github.com/karpathy/nanochat/blob/master/dev/LOG.md): "Hyperball/MuonH Experiments (Negative Result)" — at
d12, MuonH worse than baseline incl. LR sweep 2.5e-3–1e-2, learnable RMSNorm scales, init tweaks; AdamH on lm_head
"Broken - loss plateaus". Marin uses MuonH/AdamH for its 535B-A23B run (issue #8435) [V-search].
Related: HyperP (Ren et al., Microsoft, https://arxiv.org/abs/2603.28743, Mar 2026) — Frobenius-sphere + Muon,
WD a first-order no-op, still needs depth-μP, 1.58x over a strong Muon baseline at 6e21 FLOPs (abstract only) [V].
- **Evidence:** M (same group as 2.1, consistent baselines; replication mixed). **Applicability:** directly our scale;
worth an ablation (Sec. 11-C), not a default.
### 2.3 Semenov, Pagliardini, Jaggi — "Benchmarking Optimizers for LLM Pretraining" (Sep 2025)
Link: https://arxiv.org/abs/2509.01440 · code https://github.com/epfml/llm-optimizer-benchmark
- **Setup [V\*/V]:** Llama-style, GPT-2 tokenizer, FineWeb, **seq 512**, fp32 optimizer states, ~2,900 runs; largest
dense 720M (12 layers × 2048), batch 1984×512 ≈ 1M tokens, 8k/16k/48k steps (Chinchilla ≈14.4k). AdamW tuned grid
(Table 35) [V\*]: lr {1e-4, 3e-4, 5e-4, **1e-3**} (best at grid edge), warmup 2000, λ=0.1, cosine, clip {**0.1**, 0.5},
β1 {0.8, **0.9**, 0.95}, β2 {0.95, 0.99, **0.999**}.
- **720M final val loss at 8B/16B/48B tokens [V, decoded from figure ±0.001]:** AdamW 3.0045/2.9077/2.7935;
AdEMAMix 2.9804/2.8782/2.7750; MARS 2.9756/2.8807/2.7767; D-Muon (Moonlight-style) 2.9941/2.9007/2.7909; basic Muon
(no WD) 3.0006/2.9128/2.8143; SOAP 2.9952/2.9060/2.7978. At 48B: Sophia 2.8065, Prodigy 2.8039, Lion 2.8093,
Signum 2.8149, SF-AdamW 2.8287. ⇒ token-equivalent [I]: AdEMAMix ≈1.2–1.3x, MARS ≈1.2x, D-Muon ≈1.03–1.07x,
SOAP ≤1.06x (falls behind AdamW at 48B).
- **Recipe findings [V\*/V]:** z-loss does not improve final loss or spikiness (Fig. 16); codebase defaults (final LR
0.1x, z-loss, tiny WD) flip optimizer rankings (583M, 2M batch: AdamW 2.958 vs SOAP 2.961 with their recipe; with
z-loss + WD 1e-4 + decay to 0.1x, SOAP 2.978 beats AdamW 2.984); WD 0.1 best for ≥8.4B tokens (0.5 better only on
≤2B-token runs; 0 worst by 0.02–0.03); short warmup (1.56%) beats 25%; cosine to 0.01x beats 0.1x by 0.035; cosine ≈
linear < WSD (their WSD at half LR); β2 0.999 > 0.95 at small batch, but 0.95 won at 583M/2M batch.
- **Evidence:** M (broad, careful, but single seed, seq 512, shallow model, AdamW LR at grid edge).
**Applicability:** closest independent multi-optimizer data to our regime; says D-Muon ≳ AdamW but small; AdEMAMix is
the best Adam-family alternative.
### 2.4 Qiu et al. — "Hyperparameter transfer … matrix-preconditioned optimizers" (Dec 2025, v2 Jan 2026)
Link: https://arxiv.org/abs/2512.05620
- **Claims [V\*]:** with μP + independent WD scaled as 1/width (for *all* optimizers incl. AdamW), Muon, SOAP and
Shampoo get ≈**1.4x** compute multiplier over AdamW consistently from 190M to 1.4B (Wen-style Llama, FineWeb,
20 TPP, **ctx 1024, batch 128 seqs = 0.13M tokens**); under SP/constant HPs the speedup vanishes with scale (Muon
<1.1x at 1.4B); optimal LR roughly stable under μP; optimizer FLOPs not counted.
- **Evidence:** M (careful transfer study; small batch, Chinchilla-length only; authors argue it's a lower bound since
matrix optimizers like large batch). **Applicability:** suggests the Wen-I decay of Muon's speedup is partly an
artifact of constant WD/LR scaling; supports tuning WD via τ / width-aware rules.
### 2.5 Volkova et al. — "Towards Robust Scaling Laws for Optimizers" (Feb 2026)
Link: https://arxiv.org/abs/2602.07712
- **Claims [V]:** per-optimizer Chinchilla fits are ill-conditioned; shared exponents + optimizer factors ρ_N, ρ_D.
OLMo-2 (50M–1.53B) / LLaMA (47M–1.45B), 30–200 TPP, 0.5M batch, WSD, HPs swept at 50M with LR re-swept per size:
ρ_D Muon 2.08 (OLMo) / 1.41 (LLaMA) [V\*: 2.08±0.08, 1.41±0.08], SOAP 2.57 / 1.75, Scion 1.99 / 1.73, Shampoo
1.55 / 1.16; wall-clock (8×H100) Muon 1.01, SOAP 1.44.
- **Evidence:** M–W for magnitudes (fitted multipliers, large fit error for non-AdamW). **Applicability:** covers our
sizes but numbers are model-fit dependent; note Muon's wall-clock factor ≈1.0 with their implementation.
### 2.6 Everett & Qiu — "Optimizer Memory Schedules for Outscaling the Overtraining Axis" (Sep 2026)
Link: https://arxiv.org/abs/2609.04577
- **Claims [V\*/V]:** 51M–253M, 1–256x overtraining, LR swept everywhere, 0.5M batch: Muon and SOAP give roughly
constant token multipliers (≈1.4–1.7x) over AdamW across horizons; best WD ∝ sqrt(OT factor); **linear-to-zero beats
cosine-to-zero at 1x OT, cosine better at ≥8x**; best AdamW β2 rises 0.95 → 0.9992 from 1x to 128x (0.98 at
253M/1x); ADANA (log-time WD + momentum cooldown) outscales AdamW.
- **Evidence:** M (thorough but ≤253M). **Applicability:** directional (schedule, β2, WD vs horizon); magnitudes too
optimistic for 1.5B.
### 2.7 Essential AI — "Practical Efficiency of Muon for Pretraining" (May 2025)
Link: https://arxiv.org/abs/2505.02222 · blog https://www.essential.ai/blog/infra
- **Claims [V]:** 100M–4B, 10–50B tokens, batch 128K–16M, both optimizers swept, QK-norm, Adam β=(0.95,0.95) for
embedding/norm/logit params: Muon needs **10–15% fewer tokens**; advantage holds or grows with batch size (larger
critical batch); 1B/2B/4B each needed ~2B more AdamW tokens to reach 3.2 nats; at 1B/50B tokens Muon final train loss
0.02 below AdamW; μP + Muon transfers HPs (drift O(1/n)); "telescoping" sweep. Blog: extra NS FLOPs ≈ 5d/B per token;
2B model on 8×MI300X small batch: replicated NS = 43% of step time vs 10% layer-sharded.
- **Evidence:** M–S (tuned both, directly our scale; Muon-favorable authors; train loss). **Applicability:** high.
### 2.8 modded-nanogpt Track 3 (optimizer benchmark, fixed 124M model, 524k-token batch)
Link: https://github.com/KellerJordan/modded-nanogpt/tree/master/records/track_3_optimization
- **Claims [V]:** steps to 3.28 val loss: AdamW 5625 ("most likely undertuned"), Shampoo 4100, tuned Muon 3250
(lr .025, wd .05, Adam lr .7 embed / .004 head / .015 1-D, no warmup, no grad clipping), NorMuon 3250, Newton-Muon
3275, Muon without momentum 8225; best stacked recipe 2690. (The Hyperball paper quotes 3325 steps for its tuned
MuonW entry — different record/date.)
- **Evidence:** S for 124M rankings; W for transfer to 1.5B (Wen: speedups shrink with size).
### 2.9 Other comparison data points
- **Moonlight scaling law** (Sec. 3.3) [V\*]: Muon ≈2x (52% FLOPs) vs AdamW; AdamW LR & batch grid-searched, Muon
reused AdamW HPs. Larger than all independent estimates → treat as upper bound.
- **NorMuon** (Sec. 3.5) [V\*]: Muon 10.43% / NorMuon 21.74% fewer steps vs AdamW at 1.1B (6.08% / 13.91% at 5.4B).
- **SAMuon** (https://arxiv.org/abs/2608.25990, Aug 2026) [V]: 1B, 20B tokens: AdamW / Muon / SAMuon = 2.760 / 2.725 /
2.711 at 1M batch, 2.807 / 2.741 / 2.722 at 4M batch → Muon −0.035 at 1M, −0.066 at 4M (Muon degrades much less
with batch). W–M.
- **Cautious-WD paper** OLMo-1B/100B (Sec. 3.9) [V\*]: AdamW 2.65 vs Muon 2.51 (−0.14) — implausibly large vs Wen;
baseline quality questionable.
- **AlgoPerf** (https://arxiv.org/abs/2502.15015) [V]: Shampoo ≈28% faster than NAdamW, SF-AdamW ≈8%; no LM
pretraining workload → low applicability. **NVIDIA** (https://arxiv.org/abs/2607.20548) [V]: SOAP/Muon beat AdamW at
8B+ with 25M-token batches → wrong regime.
### 2.10 Synthesis table (speedup of Muon-family over AdamW near our scale)
| Source | Scale / data / batch | Baseline tuning | Muon (or best matrix opt.) vs AdamW |
|---|---|---|---|
| Wen I | 1.2B, 1–8x Ch., 1M | full sweeps + HP scaling laws | ≈1.1x; Δ −0.014/−0.019 (1x) → −0.004 (8x) |
| Wen II (Hyperball) | 1.2B, 1–8x Ch. | same as Wen I | MuonW ≈1.1x; MuonH 1.2–1.3x |
| Semenov | 720M, 8–48B tok, 1M, seq 512 | tuned; AdamW LR at grid edge | D-Muon 1.03–1.07x (AdEMAMix/MARS 1.2–1.3x) |
| Qiu et al. | 190M–1.4B, 20 TPP, 0.13M | μP + 1/width WD for all | ≈1.4x, flat with size (SP: <1.1x at 1.4B) |
| Essential AI | 100M–4B, 10–50B tok | both swept | 10–15% fewer tokens, grows with batch |
| NorMuon paper | 1.1B / 5.4B, 2M | no per-opt LR sweep | Muon 10.4% / 6.1% fewer steps |
| Moonlight | 0.4–1.5B compute-opt. | AdamW grid, Muon reuses | ≈2x |
| Volkova | ≤1.5B, 30–200 TPP, 0.5M | LR per size | ρ_D 1.41–2.08 (fit); wall-clock ≈1.0 |
**Bottom line [I]:** with standard (SP, constant-λ) recipes at 1–2B and ~1–2x Chinchilla, expect ≈1.05–1.2x
(Δ ≈ 0.01–0.017 nats ≈ 0.003–0.006 bpb). Claims of 1.4–2x need width-aware WD/norm control (Qiu, Hyperball) or weaker
baselines. Overhead must stay ≲3% for the gain to survive.
---------------------------------------------------------------------------------------------------------------------
## 3. Muon and its variants
### 3.1 Keller Jordan — Muon blog, KellerJordan/Muon repo, modded-nanogpt Track 1
Links: https://kellerjordan.github.io/posts/muon/ · https://github.com/KellerJordan/Muon ·
https://github.com/KellerJordan/modded-nanogpt
- **[V]** NS quintic coefficients (3.4445, −4.7750, 2.0315), 5 steps, bf16, X/(‖X‖_F + 1e-7); Nesterov "works a bit
better in every case"; AdamW for embeddings, final head, scalars/vectors (empirical rule); extra FLOPs ≤ T·m/B
(e.g. 5·768/524,288 ≈ 0.7%) — only if NS is not replicated per rank [I]; 1.5B GPT-2-XL-level HellaSwag in 10 vs 13.3
8×H100-hours (both tuned; single run; M).
- **Repo [V]:** defaults lr 0.02, wd 0, momentum 0.95, scale sqrt(max(1, rows/cols)); README example Muon lr 0.02,
wd 0.01 + AdamW lr 3e-4, β=(0.9,0.95); distributed class splits NS round-robin over ranks then `all_gather`.
- **Track 1 speedrun history [V]:** Polar Express adopted (Sep 29 2025, −10 steps), NorMuon (Oct 24 2025), cautious WD
(Nov 10 2025, −40 steps, ≈−1.6% time). Dec-2025 config: NorMuon lr 0.023, momentum ramp 0.85→0.95 over 300 steps,
β2 0.95, cautious wd 1.2 (×lr); Adam lr 0.008, β=(0.65,0.95) for embeddings/head/scalars; bf16 weights need an fp32
"mantissa" buffer (without: "substantially detrimental"); per-head-pair K/V orthogonalization saved 10 steps (Apr
2026; an earlier per-head attempt hurt); 30→15 logit softcap at 124M ("unlikely to scale").
- **Applicability:** good source of mechanics; numbers are 124M-specific.
### 3.2 PyTorch built-in `torch.optim.Muon` (PyTorch 2.10)
Links: https://docs.pytorch.org/docs/stable/generated/torch.optim.Muon.html ·
https://github.com/pytorch/pytorch/blob/main/torch/optim/_muon.py · https://github.com/pytorch/pytorch/issues/148819
- **[V\*] (2.10 source):** `Muon(params, lr=1e-3, weight_decay=0.1, momentum=0.95, nesterov=True,
ns_coefficients=(3.4445, -4.775, 2.0315), eps=1e-7, ns_steps=5, adjust_lr_fn=None)`.
`adjust_lr_fn`: None/"original" → sqrt(max(1, A/B)); "match_rms_adamw" → 0.2·sqrt(max(A, B)). 2-D params only
(ValueError otherwise). Momentum kept as EMA (`buf.lerp_(grad, 1-momentum)`, Nesterov `grad.lerp(buf, momentum)`).
NS in bf16. WD applied as `param.mul_(1 - lr*weight_decay)` with the **unadjusted** lr. **No DTensor/distributed
logic** — loops over params; under DDP every rank recomputes NS for every matrix; no FSDP2 path. Main branch adds
"spectral_unclamped" (sqrt(A/B)) [V].
- **Status [V]:** maintainers (issue #148819) kept it single-device; distributed Muon tracked separately; torchtitan has
experimental `flex_shard/dist_muon.py`.
- **Applicability:** fine for single-GPU proxies; for 16-GPU runs use a distributed implementation (Sec. 3.8, 3.13).
### 3.3 Liu et al. (Moonshot) — "Muon is Scalable for LLM Training" / Moonlight (Feb 2025)
Links: https://arxiv.org/abs/2502.16982 · https://github.com/MoonshotAI/Moonlight
- **[V\*]** Update W ← W − η(0.2·O·sqrt(max(A,B)) + λW): matches AdamW's typical update RMS (0.2–0.4) so Muon can
**reuse AdamW's LR and WD**; WD is needed for long runs (at 800M/100B tokens Muon without WD loses its early lead
[V]); AdamW for embeddings, lm_head, RMSNorm; "applying weight decay to the RMSNorm gamma parameter is crucial for
ensuring training stability" (their MoE). Shape-adjusted LR beat a global sqrt(H) factor (2.789 vs 2.812) [V\*].
Momentum 0.95; 5 NS steps (10 no better) [V].
- **Scaling-law runs [V\*] (Table 2):** 399M/545M/822M/1.1B/**1.5B** non-embedding; the 1.5B: 20 layers, hidden 2560,
**38.91B tokens, LR 8.305e-4, batch 256 × 8K = 2.1M tokens** (AdamW-optimal, reused for Muon). Fitted losses:
Muon 2.506·C^−0.052, AdamW 2.608·C^−0.054 → Muon needs ≈52% of FLOPs. AdamW HP laws: η(C) = 0.01273·C^−0.0575,
B(C) = 0.00652·C^0.414.
- **Production [V\*]:** WD 0.1 all stages; LR 4.2e-4 after 2k-step warmup; cosine to 4.2e-5; cooldown linear to 0.
- **Distributed [V\*/V]:** ZeRO-1 Muon: reduce-scatter grads → local momentum → gather full matrix (bf16) → NS →
keep local shard; communication (1, 1.25]× ZeRO-1 AdamW; optimizer latency 1–3% of forward-backward.
- **Evidence:** M (huge production validation; scaling comparison against grid-searched AdamW, but WD not swept and
2x is far above independent estimates). **Applicability:** its 1.5B/39B-token point is almost exactly our run.
### 3.4 Faster / better orthogonalization
- **Polar Express** (Amsel et al., https://arxiv.org/abs/2505.16932, ICLR 2026) [V]: minimax-optimal per-iteration
polynomials; GPT-2 774M: 1B tokens val 3.340 vs 3.398 (Jordan NS); 10B tokens with λ=0.1: 2.913 vs 2.921; >6 iterations
or exact SVD didn't help. Default in microsoft/dion and in the speedrun. M. Cheap to adopt.
- **Gram Newton-Schulz** (Dao lab, https://tridao.me/blog/2026/gram-newton-schulz/, Mar 2026; also in Dion3) [V]:
algebraically equivalent, up to 2x faster for rectangular matrices (symmetric kernels alone ≈25%); Gemma-1B all
weights on one H100: 75.1 → 55.4 ms; NS is 2–17% of end-to-end time depending on setup.
- **Turbo-Muon** (https://arxiv.org/abs/2512.04632) [V]: drops 1 of 5 NS steps, ≈−3% time. **Polar Switch**
(https://arxiv.org/abs/2610.26742, Oct 2026) [V]: 8.6–18.7% faster than Polar Express/Gram NS, same loss at 0.6–1B.
**"How much orthogonalization"** (https://arxiv.org/abs/2606.00371) [V]: cheaper cubic schedule within ≈1e-3 loss at
1–4B. **CANS** (https://arxiv.org/abs/2506.10935) [V]: small scale only.
- **DeepSeek-V4** (https://arxiv.org/abs/2606.19348, 2026) [V]: Muon in production with 10 NS iterations (8 Jordan +
2 with (2, −1.5, 0.5)), bf16 NS "remain[s] stable", RMS-match factor 0.18, q/kv RMSNorm (no QK-clip), MoE experts
orthogonalized separately.
- **Applicability [I]:** once NS is distributed it is ~1% of step time at 1.5B/1M batch → these are nice-to-haves;
Polar Express is free if using dion.
### 3.5 NorMuon (Li et al., Oct 2025)
Link: https://arxiv.org/abs/2510.05491
- **[V\*]** Muon + per-row (neuron-wise) second-moment normalization after NS, rescaled to RMS 0.2. 1.1B and 5.4B,
2M-token batch, depth-μP LR (base 4e-4 at depth 16, ∝1/sqrt(depth)), 1B-token warmup, fused QKV ("no improvement"
from splitting [V]). Steps saved vs AdamW: Muon 10.43% / NorMuon 21.74% (1.1B); 6.08% / 13.91% (5.4B).
FSDP2 5.4B on 16×A100 step time: AdamW 28.73 s, Muon 29.56 s (+2.8%), NorMuon 29.57 s (+2.9%), non-distributed NS
31.04 s (+8.1%).
- **Independent [V]:** Track 3: NorMuon = tuned Muon (3250 steps); Dion3 at 1B: tuned NorMuon (lr 0.01, μ 0.9)
"slight edge" over Muon. **Evidence:** M–W (no per-optimizer LR sweep). **Applicability:** +0–10% over Muon at 1.5B
[I]; available in dion → ablation candidate.
### 3.6 AdaMuon (Jul 2025)
Link: https://arxiv.org/abs/2507.11005
- **[V]** sign() before NS, element-wise second moment after, RMS-aligned to 0.2. GPT-2 125M–1.5B (~49B tokens,
61k-token batches, one shared LR for all optimizers): Muon saves 22–50% tokens vs AdamW; Qwen2.5-1.5B on 100B tokens:
AdaMuon −30.8% wall-clock vs Adam, −2.9% vs Muon. **Evidence:** W–M (LR not tuned per optimizer, tiny batch).
Low priority.
### 3.7 MuonClip / QK-Clip (Kimi K2) and attention-logit control
Links: https://arxiv.org/abs/2507.20534 · GLM-5 https://arxiv.org/abs/2602.15763
- **[V]** If a head's max pre-softmax logit S > τ, rescale W_q, W_k by sqrt(τ/S); τ=100 for K2. Vanilla Muon on a
9B-active/53B MoE produced logits >1000; in K2 12.7% of heads triggered in the first 70k steps, none afterwards;
τ=30 on a 0.5B/3B MoE had negligible loss effect. Needed because MLA cannot use QK-norm. DeepSeek-V4 (q/kv RMSNorm)
and GLM-5 (per-head "Muon Split") are stable without clipping. Moonlight observed max logits >100 early in some layers
(fraction ≈1e-4), decaying later [V].
- **Applicability [I]:** for a 1.5B dense model **use QK-norm and skip QK-Clip**.
### 3.8 Dion, Dion3 and the microsoft/dion repository
Links: https://arxiv.org/abs/2504.05295 · Dion3 https://arxiv.org/abs/2608.11612 · https://github.com/microsoft/dion
- **Dion [V]:** low-rank orthonormalized updates for very large sharded matrices; at 3B rank d/2–d/4 ≈ Muon; NS cost
20mn² + 10n³ FLOPs; LR 0.01 with sqrt(d_out/d_in) scaling, optimum ≈ constant over 160M–3B; Lion with 1/sqrt(d) LR
on lm_head beat tuned Adam.
- **Dion3 (Aug 2026) [V]:** 1B/100B tokens: tuned NorMuon 2.194, Dion3 (f=1/8) ≈0.01 better; 3–14B on 10B tokens beats
NorMuon by 0.011–0.027; 14B optimizer step on 8×B200 153.8 → 34.8 ms; separate Q/K/V and gate/up orthogonalization
≈0.2 ppl better at 430M (per-head worse).
- **Repo [V]:** `Muon` and `NorMuon` for single GPU, **DDP (pass `ddp_model.process_group`; otherwise every device
"redundantly perform[s] the same work")** and **FSDP2 (all-to-all)**; PyTorch ≥2.7; defaults lr 0.01, μ 0.95,
wd 0.01, `nesterov=False` ("better performance without it"), `adjust_lr` = "spectral_norm" | "rms_norm", Polar Express
on; options `cautious_wd`, `num_heads`/`split_sizes` for per-head/per-block NS, optional Gram NS; warns that
Muon/Dion on embeddings or lm_head gives "poor performance".
- **Applicability [I]:** no need for low-rank Dion at 1.5B; **the repo is the best ready-made distributed Muon for
FSDP2/DDP in PyTorch.**
### 3.9 Cautious Weight Decay (Chen et al., Oct 2025, v2 Feb 2026)
Link: https://arxiv.org/abs/2510.12402
- **[V\*]** Apply decoupled WD only on coordinates where update and parameter have the same sign (mask I(u·x ≥ 0)); no
new HPs. Grid-searched baselines at 338M/986M/2B (C4, 20 TPP) with gains for AdamW, Lion, Muon at every size. OLMo-1B,
100B tokens (Table 2): AdamW 2.65 → 2.56, Muon 2.51 → 2.42; random-mask control 2.82 / 2.73. Gain appears late
(during LR decay).
- **Evidence:** M–W (consistent across sizes, but 0.09-nat gains and a 0.14 AdamW–Muon gap at 1B are far larger than
any independent study; speedrun adoption gave ≈1.6% time at 124M). **Applicability:** one flag in dion
(`cautious_wd=True`) → cheap ablation; expect ≤0.01 nats [I].
### 3.10 Other variants (brief)
- **MuonBP** (https://arxiv.org/abs/2510.16981) [V]: block-periodic orthogonalization for tensor parallelism; 8B with
8-way TP: +8% throughput, 10–13% faster to target; AdamW baselines look undertuned. Not needed without TP.
- **SAMuon** (https://arxiv.org/abs/2608.25990) [V]: see 2.9; −13–16% tokens vs Muon at 1B. Single paper.
- **DynMuon** (https://arxiv.org/abs/2605.17109): 1.1B −10.6% steps vs Muon. **Muon²**
(https://arxiv.org/abs/2604.09967): LLaMA-1B ppl 10.21 vs 10.62. **Muown** (https://arxiv.org/abs/2605.10797): up to
2.7B. **Newton-Muon** (https://arxiv.org/abs/2604.01472): −6% steps on GPT-2-small, no gain in Track 3.
**Muon^p** (https://arxiv.org/abs/2606.13867): helps fine-tuning, worse than Muon for pretraining. [V] All W–M.
- **Drop-Muon** (CNN only), **AdaGO**, **REG**, **PolarGrad**, **Conda** (2.7x claim, C4, 131k-token batches): not
applicable / weak [V].
- **8-bit Muon** (https://arxiv.org/abs/2509.23106, v3 Feb 2026) [V]: 1.4B at Chinchilla, 5 seeds: fp32 Muon 2.495,
8-bit momentum 2.496, also 8-bit AdamW-routed params 2.508.
- **Survey** "Navigating LLM Valley" (https://arxiv.org/abs/2605.09176): qualitative only [V].
### 3.11 Hyperball / MuonH — see 2.2 (wrapper, 20–30% vs AdamW at 1.2B claimed; mixed replication).
Implementations: Marin/Levanter (JAX), Megatron-LM PR #6422 (`muon_h`), tonyf/muonium PR #3 (PyTorch DTensor:
muonh/normuonh/adamh), nanochat PR #498 (single-node PyTorch; MuonH matrix LR 0.02, "LR ∝ (data size)^−0.35") [V].
### 3.12 Practical Muon questions: parameter groups, QKV, LR conventions, width scaling
- **Which params use Muon [V]:** all hidden 2-D matrices (attention Q/K/V/O, MLP gate/up/down). **Embeddings, lm_head,
norm gains, biases, scalars → AdamW** in every production recipe (Moonlight, Kimi K2, DeepSeek-V4, Essential AI,
GLM-5, Wen/Marin); dion warns Muon on embedding/lm_head performs poorly. Conv/3-D params would need reshaping (n/a).
- **Fused QKV / gate-up [V]:** NorMuon: fused QKV no worse; Dion3/Gram-NS: separate Q, K, V and gate/up ≈0.2 ppl better
at 430M; per-head splitting hurt there (helps with MLA, GLM-5); speedrun gained from per-head-pair K/V at 124M.
**Recommendation [I]:** orthogonalize Q, K, V, O, gate, up, down as separate matrices (dion `split_sizes`).
- **LR conventions [V\*/I]:**
| Convention | Update for W ∈ R^{out×in} | per-element RMS per unit LR | Typical LR | Used by |
|---|---|---|---|---|
| Keller "original" | sqrt(max(1, out/in))·O | 1/sqrt(fan_in) | 0.02 (124M); 0.004–0.008 (1.2B, Wen) | KJ repo, torch default, Marin |
| Spectral | sqrt(out/in)·O | 1/sqrt(fan_in) (out≥in) | ≈0.01–0.02 | dion "spectral_norm", torch main "spectral_unclamped" |
| RMS-matched | 0.2·sqrt(max(out,in))·O | 0.2 | ≈ AdamW LR (4e-4–1e-3) | Moonlight/Kimi, torch "match_rms_adamw", dion "rms_norm", DSV4 (0.18) |
Conversions [I]: Wen's 1.2B optimum (Keller lr 0.004–0.008, d=1536) ≡ RMS-matched lr ≈ 5e-4–1e-3; Moonlight's
8.3e-4 (d=2560) sits in the same band. Caveat: JAX/Levanter may store weights as (in, out), which flips the MLP
rectangular factor (square matrices unaffected).
- **Width transfer [V/I]:** Wen's tuned Muon LR (Keller convention, constant λ=0.1) fell from 0.016 (d=512) to 0.008
(d=1024) to 0.004–0.008 (d=1536) — i.e. RMS-matched-equivalent LR ∝ ~1/width (SP-like). Dion/Essential AI report
≈constant optimum with spectral/μP scaling; MOGA (https://arxiv.org/abs/2603.09952) calls Muon's optimal LR "strongly
width dependent" [V]; Qiu et al.: μP + 1/width independent WD makes LR transfer [V\*]; Hyperball reduces width/depth
drift to ≈1.4x [V\*]. **Practical [I]:** don't extrapolate absolute LRs from tiny proxies; use the ~1–1.5B literature
values (Wen, Moonlight) for the target and proxies only for relative comparisons.
- **Momentum:** 0.95 Nesterov is standard (torch, Moonlight, KJ); Wen tuned 0.98 but 0.95 tied at 520M [V\*].
- **Warmup:** Muon tolerates none (Wen: 0; Track 3; Dion; Scion) [V\*/V]; production runs use short warmups
(Moonlight 2k, K2 500, DSV4 2000, Dion3 200 steps) [V]. AdamW-routed params still like some warmup [I].
- **Clipping:** Track 3 uses none; Scion/SAMuon/MuonBP clip only the AdamW params; Wen clipped globally at 2 [V\*/V].
NS normalizes the update anyway, so clipping only reweights what enters the momentum [I] → global clip 1.0 is
harmless.
- **Schedule:** Wen's Muon: full-length linear decay best (Sec. 2.1); Track 3 found separate cooldown fractions
(Adam 0.4, Muon 0.8) slightly better [V].
### 3.13 Wall-clock overhead of Muon at 1–2B with DDP/FSDP2
- **Measured [V\*/V]:** Moonlight ZeRO-1: 1–3% of forward-backward; NorMuon FSDP2 (5.4B, 16×A100): +2.8% (+8.1% if NS
not distributed); NVIDIA Megatron emerging-optimizers blog (Apr 2026,
https://developer.nvidia.com/blog/advancing-emerging-optimizers-for-accelerated-llm-training-with-nvidia-megatron/):
model TFLOP/s 1051→1029 and 713→686 (≈−2 to −4%); MuonBP: 5–10% with TP/FSDP gathers; Essential AI: replicated NS =
43% of step time for a 2B model at small batch on 8×MI300X vs 10% layer-sharded; Muon^p: `optimizer.step` 120.7 ms
for Llama3-1B on a single H100 (all NS on one GPU); Gram NS: Gemma-1B NS 75.1 → 55.4 ms on one H100.
- **Estimate for our model [I]** (d=2048, L=28, d_ff=5632, MHA, 1.44B non-embedding): NS cost per matrix per step =
5·(4m²n + 2m³) (m ≤ n) → per layer 4 × 2.58e11 (attn) + 3 × 5.58e11 (MLP) = 2.7e12 → **7.6e13 FLOPs per optimizer
step**. Step compute at 1M tokens ≈ 1.1–1.2e16 FLOPs ≈ 1.6 s on 16 H100 at 45% MFU.
- NS replicated on every rank (plain `torch.optim.Muon` under DDP): ≈0.11–0.15 s → **+7–9% (1M batch), +4% (2M)**,
up to ~13% if NS runs at low efficiency.
- NS sharded over 16 ranks: ≈8–10 ms compute + one bf16 all-gather of ≈2.9 GB of updated matrices
(≈10–15 ms intra-node NVLink; ≈40–70 ms across 2 nodes on 8×400G IB unless overlapped) → **≈1–4%**.
- Optimizer-state memory: Muon has one buffer (vs Adam's two) → irrelevant at this size (Sec. 9).
- **Recommendation [I]:** use dion (`Muon` with FSDP2, or DDP with `process_group`), `torch.compile` the NS,
bf16 NS, Polar Express coefficients; measure the step-time overhead at full shape before committing (target ≤3–4%).
---------------------------------------------------------------------------------------------------------------------
## 4. LR schedules
- **Bergsma et al., "Straight to Zero: Why Linearly Decaying the LR to Zero Works Best for LLMs"**
(https://arxiv.org/abs/2502.15938, ICLR 2025 [R], v2 Nov 2025) — **S, directly applicable.**
[V\*] 610M (μP), 20 TPP: best Linear-D2Z 2.571 vs best Linear-10x 2.591 (−0.77%); 1.7B at 80 TPP: ≈3.05% lower loss
than 10x; at 80 TPP Linear-D2Z ≈0.84% better than optimally tuned WSD with a 22.5% cooldown to zero. [V] D2Z beats
Cosine-D2Z at every LR (by 0.003–0.006); D2Z overtakes 10x from ~4 TPP and the gain grows with TPP (2.6% at 200 TPP);
D2Z's optimal peak LR is stable across TPP and batch. Mechanism: AdamW weights are an EMA of updates with
coefficients set by η_t·λ; linear D2Z weights late updates best. **Setup [V\*]:** 10% linear warmup, λ=0.1, no WD on
LN/biases; 1.7B = d 2048, 32 layers, d_ffn 5461, batch 504 × 2048 ≈ 1.03M tokens, 33,220 steps = 34.3B tokens,
warmup 3,322 steps; μP proxy d=256 with η̃=1.6e-2 → hidden LR 2e-3 at d=2048 [I]. **Very close to our run.**
- **Hägele et al., "Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durations"**
(https://arxiv.org/abs/2405.18392) — M. [V] constant LR + cooldown matches cosine-to-10%; (1−sqrt) cooldown beats
linear cooldown; gains saturate at ~20% cooldown; optimal constant LR ≈ half the optimal cosine peak; annealing to 0
sometimes hurt downstream; warmup 300 steps (1–3k for >100k steps). 33M–360M + 1B at 100B/460B tokens (1.8M batch,
LR 8e-4).
- **MiniCPM WSD** (https://arxiv.org/abs/2404.06395) — W–M. [V] 10% decay sufficient, 2.5% too short; μP base LR 0.01;
batch 3.93M; bs = 1.21e9 / L^6.24.
- **Wen et al., river-valley WSD** (https://arxiv.org/abs/2410.05192) — M. [V] decay fraction 8–12% insensitive; decaying
right after a spike cost +0.02.
- **Tissue et al., LR-annealing scaling law** (https://arxiv.org/abs/2408.11029) — M. [V] optimal WSD annealing ratio
≈10–20%; (1−sqrt) beats cosine at 10% annealing but loses at 50%; 500 warmup steps beat 100 or 0.
- **Luo et al., multi-power law** (https://arxiv.org/abs/2503.12811) — M. [V] loss-optimized schedule is WSD-like: decays
over ≈25% of steps to <1/20 of peak, shape ≈(1−τ)^1.5; beats cosine by >0.02.
- **Dremov et al., cooldown study** (https://arxiv.org/abs/2508.01483, TMLR) — W–M (210M). [V] with a 20% cooldown to 0,
"sqrt" and "lowered-linear 0.7" shapes best; higher β2 during cooldown helps.
- **WSM (checkpoint merging instead of decay)** (https://arxiv.org/abs/2507.17634) [V]: tested only on 16B-A1.4B MoE
from a 10.2T-token constant-LR checkpoint → low applicability to a fixed 40B budget.
- **Schedule-free AdamW:** matched or beaten by cooldown (Hägele); Semenov: SF-AdamW worst at 720M/48B (2.8287 vs
2.7935) [V] → not recommended.
- **Wen et al. Muon decay-fraction sweep [V\*]:** full-run linear decay (fraction 1.0) best; 20% WSD decay +0.061 at
520M, +0.052 at 130M (both at 1x). **Everett & Qiu [V\*]:** linear-to-zero beats cosine-to-zero at 1x OT; cosine wins
≥8x. **Semenov [V]:** final LR 0.01x beats 0.1x by 0.035; 1e-3x ≈ same (−0.001); for linear, best end ≈0.001x.
- **Warmup evidence:** Porian et al. (https://arxiv.org/abs/2406.19146) [V]: warmup tokens ≈ N is best — losses for
N/4, N/2, N, 2N, 4N, 8N, 16N = 3.546, 3.542, 3.532, 3.528, 3.536, 3.543, 3.586 (σ≈0.002); final LR 0.1/1/10% of peak
→ 3.444/3.442/3.440 (small models, 20 TPP). CompleteP/Celerity (https://arxiv.org/abs/2509.25087): warmup
min(10% of steps, 375M tokens) then linear D2Z [V]. Wen 1.2B AdamW: 2000 steps (≈2.1B tokens) best, 500/1000/4000
within +0.012 [V\*]. Kosson et al. (https://arxiv.org/abs/2410.23922): warmup counters large early angular updates
[V]. Smol Playbook: longer warmup "doesn't generally affect performance" for long runs [V].
- **Synthesis [I]:** for a fixed, known budget use **linear warmup ≈1–2B tokens (1,000–2,000 steps at 1M batch), then
linear decay to 0 (or ≤1% of peak)**. Expected gain vs cosine-to-10%: ≈0.5–1% loss (≈0.015–0.03 nats). Use WSD with a
≥20% (1−sqrt or linear) cooldown to 0 only if you need a resumable/extendable trunk (≈0.5–0.8% worse).
---------------------------------------------------------------------------------------------------------------------
## 5. Batch size
- **Zhang et al., "How Does Critical Batch Size Scale in Pre-training?"** (https://arxiv.org/abs/2410.21676, ICLR 2025
[R]) — M–S. [V] 85M–1.2B, C4, ctx 512, constant LR + weight averaging, no WD. CBS (20% step overhead vs linear
scaling) scales with data D, weakly with N at fixed D (B* = 621.3·N^0.087); Table 7 forecast ≈3,241 × 512 = 1.66M
tokens at 40B tokens; β1 0.95 slightly > 0.9; β2 0.95 for large batch/short runs, 0.99–0.9995 for long runs or
<262K-token batches.
- **Bergsma et al., "Power Lines: Scaling Laws for Weight Decay and Batch Size in LLM Pre-training"**
(https://arxiv.org/abs/2505.13738, NeurIPS 2025, v2 Nov 2025) — **S.** ~400 runs, 111M–3.3B, 20–1280 TPP, D2Z,
β=(0.9,0.95), μP. [V\*] **B_opt = 0.0306·D^0.383** sequences of 2048 tokens (λ tuned; R²=0.984; fixing λ distorts the
law, e.g. λ=0.1 gives 0.0123·D^0.429); **B_crit = 0.0471·D^0.462** (Zhang's converted coefficient 0.0559·D^0.47);
**τ_opt = 1.084·TPP^−0.527**; at fixed N, D the optimal λ ∝ B (τ_opt ≈0.21 across 63–2016 seqs at 610M/20 TPP).
[V] Measured 610M/20 TPP with tuned λ: batch 0.5M 2.563, 1M 2.570, 2M 2.592, 4M 2.637; tuning λ beat tuning η in 6/8
batch sizes. **Predictions for D=40B [I]:** B_opt ≈ 352 seq ≈ 0.72M tokens; B_crit ≈ 3,720 seq ≈ 7.6M tokens; with
D = D_min(1 + B/B_crit), a 1M batch costs ≈+4% tokens vs B_opt, 2M ≈+16%, 4M ≈+42% [I].
- **Merrill et al., "Critical batch size revisited"** (https://arxiv.org/abs/2505.23971, v3 Nov 2025) — M. [V] OLMo
1B/7B local CBS starts near 0 and grows, plateauing ≈4096 × 4096 ≈ 16.8M; for OLMo-1B CBS reaches 2048 seqs by 168B
tokens; batch warmup 1024→2048→4096 seqs (LR ×√2 per doubling): 2.5891 vs 2.6057 with 43% fewer steps.
- **Marek et al., "Small batch size training for language models"** (https://arxiv.org/abs/2507.07101) — M. [V] keep
β2's half-life in tokens fixed: β2* = β2^(B*/B); optimal LR grows slower than √B. Mainly relevant to small batches.
- **DeepSeek LLM** (https://arxiv.org/abs/2401.02954) — M. [V] η_opt = 0.3118·C^−0.125, B_opt = 0.2920·C^0.3271 (tokens;
C = M·D, M = non-embedding FLOPs/token); 2000-step warmup, multi-step 80/10/10 schedule, clip 1.0, WD 0.1.
**Ours [I]:** η ≈ 8.4e-4, B ≈ 1.55M (no QK-norm, step schedule).
- **Step Law / Predictable Scale Part I** (https://arxiv.org/abs/2503.04715, v7 Aug 2025) — M–S (~3,700 runs, 60M–1B).
[V] η = 1.79·N^−0.713·D^0.307 (N non-embedding), B = 0.58·D^0.571 (tokens); cosine to fixed 1e-5 floor. **Ours [I]:**
η ≈ 9.2e-4–1.0e-3, B ≈ 0.66M.
- **Porian et al.** (https://arxiv.org/abs/2406.19146) — M. [V] η = 3.7·N^−0.36, B = 0.7576·N^0.703 (as quoted in Step
Law Table 1) → η ≈ 1.8e-3, B ≈ 2.1M [I]; β2 0.99 for ≤192-seq batches, 0.95 for ≥256.
- **Bjorck et al.** (https://arxiv.org/abs/2409.19913) — M. [V] η* = 1.55e-3·N^−0.23·D^−0.32 (N, D in billions; 0.5M
batch; cosine to 10%) → ≈4.3e-4 [I]; Straight-to-Zero argues the D-dependence is largely an artifact of 10x decay.
- **Seesaw** (https://arxiv.org/abs/2510.14717) [V]: replace an LR cut by α with LR cut √α + batch ×α; ≈36% less
wall-clock at equal FLOPs at the CBS (150–600M). PaLM ramped 1M→2M→4M [R].
- **Muon and batch [V]:** Essential AI: Muon's advantage holds/grows with batch; SAMuon: AdamW +0.047 vs Muon +0.016 loss
going 1M→4M at 1B/20B tokens; Wen 520M Muon: 0.5M best at 1x, 1M best at 4–8x.
- **Wen 1.2B AdamW batch ablation (1x, 24B tokens) [V\*]:** 0.5M 2.904, 1M 2.905, 2M 2.928, 4M 2.985.
- **nanochat dev log [V\*]:** optimal batch 2^19 (0.5M) at d12, ≈2^20 (1M) at d26 (GPT-2 scale); now extrapolated with
Power Lines B ∝ D^0.383 from the d12 reference; batch-size ramping (1/8→1/4→1/2→1 with √LR scaling) gave "small gains"
not worth the complexity (not merged).
- **Synthesis [I]:** **1M tokens** (2^20; 256 × 4096) is within ≈0.005 nats of loss-optimal for both optimizers, gives
38k steps, and keeps per-GPU micro-batches efficient on 16 GPUs. 2M costs ≈0.01–0.02 nats for AdamW (less for Muon);
only consider it if it buys >5% throughput. No batch ramp needed for a FLOP-bound 40B-token run. If B changes, scale λ
∝ B (constant τ) and keep η roughly fixed (Power Lines).
---------------------------------------------------------------------------------------------------------------------
## 6. Weight decay
- **Wang & Aitchison, "How to set AdamW's weight decay as you scale model and dataset size"**
(https://arxiv.org/abs/2405.13698, ICML 2025 [R]) — M. [V] AdamW ≈ EMA of updates with timescale τ_iter = 1/(ηλ);
optimal τ in epochs stays constant (multi-epoch); under μP λ should grow with width.
- **Power Lines** (above) — S. [V\*] single-epoch LLMs: τ = 1/(ηλS), τ_opt = 1.084·TPP^−0.527 → **τ_opt ≈ 0.19 at our
26.7 TPP**; λ_opt ∝ B at fixed N, D.
- **Kosson et al., rotational equilibrium** (https://arxiv.org/abs/2305.17212) [V]: equilibrium angular update
√(2ηλ(1−β1)/(1+β1)) → only η·λ matters for scale-invariant weights. **Kosson et al. 2025**
(https://arxiv.org/abs/2510.19093, ICLR 2026 [R]) — M–S: μP's alignment assumptions break early; **independent WD
(constant ηλ) is what produces LR transfer**; μP then acts like an implicit warmup [V].
- **Qiu et al.** [V\*]: independent WD ∝ 1/width near-optimal across AdamW/Muon/SOAP/Shampoo. **Everett & Qiu** [V\*]:
best λ ∝ sqrt(overtraining factor). **Fan et al.** (https://arxiv.org/abs/2510.15262) [V]: λ ∝ √d (small scale, W–M).
**D'Angelo et al.** (https://arxiv.org/abs/2310.04415) [V]: in LLMs WD mainly improves optimization dynamics and
prevents bf16 divergences.
- **Hyperball** [V\*]: WD's role = setting equilibrium norm/angular LR; replacing it with a fixed-norm constraint gives
better transfer and (claimed) larger speedups.
- **nanochat dev log (Muon + cautious WD with linear/cosine WD decay to 0, matrix lr 0.02) [V\*]:** optimal WD at
compute-optimal horizons: d8/512 ch ≈0.40, d12/768 ≈0.22, d16/1024 ≈0.10, d20/1280 ≈0.08 → fitted WD ∝ 1/width^1.97;
later replaced by T_epoch scaling λ = λ_ref·sqrt(B/B_ref)·(D_ref/D) (Wang & Aitchison) in `base_train.py`.
Cautious WD and the WD-decay schedule were each "validated piece by piece to yield improvements" in nanochat.
- **Semenov** [V]: λ=0.1 best for ≥8.4B tokens; λ=0 worst (+0.02–0.03); basic Muon without WD degrades with scale.
**Moonlight** [V\*]: Muon without WD loses its lead on long runs; WD on RMSNorm gammas helped stability in their MoE.
- **PyTorch 2.10 AdamW** [V]: defaults β=(0.9, 0.999), λ=0.01, ε=1e-8; decay θ ← θ − γ_t·λ·θ (coupled to scheduled LR).
Do **not** keep these defaults.
- **Which params [V]:** no WD on norm gains/biases (Bergsma); OLMo 2 removed WD on embeddings (stopped embedding-norm
shrinkage and gradient-norm growth, fewer spikes); SmolLM3 no WD on embeddings (no loss change).
- **Implied τ of tuned/published configs [I]** (τ = 1/(η·λ·S), η = raw LR):
| Config | η | λ | S | τ |
|---|---|---|---|---|
| Wen AdamW 130M / 520M / 1.2B (1x) | 8e-3 / 4e-3 / 2e-3 | 0.1 / 0.2 / 0.2 | 5.1k / 10.2k / 23.0k | 0.24 / 0.12 / 0.11 |
| Wen Muon 130M / 520M / 1.2B (1x, Keller lr) | 1.6e-2 / 8e-3 / 4e-3 | 0.1 | 5.1k / 20.5k / 23.0k | 0.12 / 0.06 / 0.11 |
| Power Lines optimum (AdamW, 20 / 26.7 TPP) | – | – | – | 0.22 / 0.19 |
| Straight-to-Zero 1.7B (μP hidden lr) | 2e-3 | 0.1 | 33.2k | 0.15 |
| DCLM-1B (AdamW, 0.5M batch) | 3e-3 | 0.033 | 54.9k | 0.18 |
| Moonlight 1.5B (RMS-matched Muon & AdamW) | 8.3e-4 | 0.1 | 18.6k | 0.65 (WD not tuned) |
| OLMo 2 1B (4T tokens, ~2000 TPP) | 4e-4 | 0.1 | ≈1.9M | ≈0.013 (Power Lines predicts 0.020) |
- **Synthesis [I]:** tuned configs at 20–27 TPP cluster at **τ ≈ 0.1–0.2** (Muon possibly at the low end). For our
S = 38,147: AdamW η=2e-3 → λ=0.1 gives τ=0.13; RMS-matched Muon η=8e-4 → λ=0.2 gives τ=0.16 (λ=0.1 would give 0.33,
under-regularized by this evidence). Specify WD as τ, not λ.
---------------------------------------------------------------------------------------------------------------------
## 7. LR / parameterization scaling rules and open ~1–2B configs
- **μP (Tensor Programs V)** [R]: transfers LR/init across width (hidden LR ∝ 1/width for Adam).
**u-μP** (https://arxiv.org/abs/2407.17465) [V]: transfer breaks in a standard Llama setup unless non-parametric norms +
independent WD.
- **CompleteP** (Dey et al., https://arxiv.org/abs/2505.01618) — M–S. [V] depth parameterization α=1 (residual branches
×1/L, hidden LR η/m_N, WD λ·m_N, ε scaled); only α=1 transfers across 2–128 layers; 12–34% compute savings; τ_EMA
0.1407; ε 1e-16; warmup min(10%, 375M tokens) + linear D2Z; batch rule B = max(32, 0.7857·F^0.1527 − 306.8) seqs
(F = training FLOPs) → ≈790 seqs ≈ 1.6M tokens for us [I].
- **Everett et al., "Scaling exponents across parameterizations and optimizers"** (https://arxiv.org/abs/2407.05872) —
S (up to 26.8B, no WD). [V] all parameterizations transfer with correct per-layer exponents; for Adam recommends SP
with per-layer LR (embedding O(1), hidden and readout O(1/n)); ε: for SP ≤~1B "1e-8 likely acceptable but 1e-12 or
1e-15 may be preferable"; Adam-atan2 removes ε.
- **2601.05049** (https://arxiv.org/abs/2601.05049, MoE only) [V]: direct LR fitting beat μTransfer at 12B-A1.3B.
- **HyperP / Hyperball** [V\*/V]: norm-constrained Muon transfers LR across width/depth/tokens (data exponent ≈0.32).
- **Open configs [V unless noted]:**
| Model | Size / tokens | Peak LR | Batch | Schedule | Other |
|---|---|---|---|---|---|
| Wen et al. AdamW 1.2B (tuned) | 1.2B / 24–194B | 2e-3 | 1M | warmup 1–2k, to 0 | β (0.9,0.98), ε 1e-10, λ 0.2, clip 1–2 |
| Wen et al. Muon 1.2B (tuned) | 1.2B / 24–194B | 4e-3 (Keller) | 1M | no warmup, linear to 0 | μ 0.98, λ 0.1; Adam lr 1.2e-3 |
| Straight-to-Zero 1.7B (μP) | 1.7B / 34B | ≈2e-3 hidden | 1.03M | 10% warmup, linear D2Z | λ 0.1 |
| Moonlight scaling 1.5B | 1.5B / 39B | 8.3e-4 | 2.1M (8K ctx) | – | λ 0.1, AdamW & Muon same HPs |
| DCLM-1B-1x | ~1.4B / 28.8B | 3e-3 | 0.5M | 5k warmup, cosine to 3e-5 | λ 0.033, z-loss 1e-4, qk-LayerNorm |
| OLMo 2 1B | 1B / 4T | 4e-4 | ≈2.1M [R] | 2k warmup, cosine, linear anneal to 0 | clip 1, ε 1e-8, λ 0.1 (none on emb.), QK-norm, z-loss |
| SmolLM2-1.7B | 1.7B / 11T | 5e-4 | 2M | WSD, last 10% linear to 0 | β (0.9,0.95) |
| SmolLM3-3B | 3B / 11.2T | 2e-4 | 2.36M | WSD, last 10% to 0 | λ 0.1 (none on emb.), clip 1, no z-loss |
Qwen3 / Llama 3.2 1B do not publish pretraining optimizer HPs [V].
- **Synthesis [I]:** for AdamW at d≈2048 with QK-norm, 1M batch, D2Z, ~27 TPP: **η ≈ 2e-3** (Wen, Straight-to-Zero);
without QK-norm ≈1e-3 (DeepSeek/Step-Law formulas give 8e-4–1e-3 for non-QK-norm setups). RMS-matched Muon:
**η ≈ 6e-4–1e-3** (Wen converted, Moonlight). LR sensitivity: ×2 LR costs ≈0.01–0.02 nats (Wen 1.2B AdamW +0.011;
520M Muon +0.022).
---------------------------------------------------------------------------------------------------------------------
## 8. Stability knobs
- **QK-norm (RMSNorm on q, k):** enables higher LR (Wortsman et al., https://arxiv.org/abs/2309.14322: qk-layernorm
reduces LR sensitivity [V]); avoids Muon attention-logit growth (Kimi K2 needed QK-Clip only because MLA precludes
QK-norm; DSV4/GLM-5 stable with norms) [V]. Smol Playbook cites a possible long-context retrieval cost [V].
**Recommend: on.**
- **z-loss:** PaLM 1e-4·log²Z [V]; Wortsman: z-loss 1e-4 fixes output-logit divergence at small-scale proxies of large
LRs [V]; Smol Playbook 1B ablation: no effect on loss or downstream [V]; Semenov: no improvement, and z-loss + tiny WD +
10x decay degraded results [V\*]; OLMo 2: FlashAttention's fused CE z-loss backward diverged from a manual
implementation [V]. **Recommend: off (or 1e-4 in your own fused CE as insurance; expect ≈0 effect).**
- **Logit soft-capping:** Gemma 2 used 50 (attention) / 30 (final), no ablation; Gemma 3 replaced it with QK-norm; PyTorch
2.10 SDPA has no softcap (FlexAttention `score_mod` / FlashAttention ≥2.6 do); modded-nanogpt's 30→15 cap is 124M-
specific [V]; nanochat d24 sweep of the final-logit cap 5…30: 5 terrible, others ≈equal, 20 best by ≈1e-3 val loss
[V\*]. **Recommend: no attention softcap; final-logit cap optional (≤1e-3 effect).**
- **Gradient clipping:** 1.0 near-universal; Wen 1.2B: clip 0/1/2 within 0.004 [V\*]; Semenov tuned 0.1 at 720M [V\*];
ZClip (https://arxiv.org/abs/2504.02507, 1B/50B tokens, z=2.5, α=0.97) [V]: train loss 2.18 vs 2.34 at LR 1e-3 and
survives LR 3e-3 (baseline β2 0.999, λ 0.01 — weak); AdaGC (https://arxiv.org/abs/2502.11034) [V]: per-tensor
adaptive clipping, +1.3–2.5% downstream at 7B scale. **Recommend: global norm 1.0.**
- **ε:** Wortsman: 1e-8 → 1e-15 improved a 4.8B model, 1e-6 unstable [V]; Everett: 1e-8 OK ≤1B, smaller preferable [V];
Wen: 1e-10…1e-25 equivalent at 1.2B [V\*]; OLMo 2: 1e-5 → 1e-8 helped [V]. **Recommend: 1e-10.**
- **β1/β2:** β1 0.9 standard (Wen: 0.9≈0.95 at 1.2B AdamW; Zhang: 0.95 slightly better) [V\*/V]. β2: Wen 1.2B AdamW
0.98 (2.905) vs 0.95 (2.909) vs 0.9 (2.914) [V\*]; Everett & Qiu: tuned β2 0.98 at 253M/1x, rising with horizon [V];
Semenov: 0.999 best at small batch, 0.95 at 583M/2M batch [V]; Porian/Zhang: 0.95 for ≥256-seq batches [V].
**Recommend: 0.95 (robust); 0.98 is a ≤0.004-nat option.** Half-life at β2=0.95, 1M batch ≈13.5 steps ≈13.5M tokens
[I].
---------------------------------------------------------------------------------------------------------------------
## 9. Optimizer-state precision and memory
- **DeepSeek-V3** (https://arxiv.org/abs/2412.19437) [V]: BF16 AdamW moments "without incurring observable performance
degradation" (no numbers), fp32 master weights and grad accumulation, β2 0.95. M (huge scale, no ablation).
- **Topollai & Choromanska** (https://arxiv.org/abs/2603.16731, v2 Sep 2026) [V]: low-precision EMA updates "stall"
(round back to the stored value). At β2=0.999 a BF16 second moment stalls with probability 0.946 (nearest) / 0.825
(stochastic rounding). Clean 100M/2.6B-token ablation: fp32 states 3.155, BF16 states 3.181, BF16 + SR 3.156. [I] their
formula gives stall prob ≈0.03 at β2=0.95, 0.07 at 0.98, 0.13 at 0.99.
- **Collage** (https://arxiv.org/abs/2405.03637) [V]: BERT at β2=0.999: fp32 5.26 ppl vs BF16 states + compensated weights
5.99, pure BF16 8.67; GPT 1.3–6.7B at β2=0.95: BF16 states + compensated weights match fp32; pure BF16 6.7B 12.18 vs 11.13.
- **Fishman et al., FP8 at trillion-token scale** (https://arxiv.org/abs/2409.12517) [V]: FP8 moments work only as m in
E4M3 + v in E5M2; 7B/2T matched BF16.
- **BF16 master weights:** Zamirai et al. (https://arxiv.org/abs/2010.06192) [V]: all-bf16 BERT ppl 56.88 (nearest) vs
5.84 (stochastic rounding) vs 5.45 (Kahan) vs fp32 5.50. Ozkara et al. (https://arxiv.org/abs/2502.20566) [V]: all-BF16
+ SR, GPT-Neo 1.3B / **40B tokens**: val ppl 10.46 vs mixed-precision 10.48 vs BF16 nearest 11.81 (needed 2–4x higher
LR; single runs). M+Adam (https://arxiv.org/abs/2607.10611) [V]: 1B/1x: fp32 14.01, BF16 weights+states 15.64, +Kahan
14.85, +SR 14.35 (mixes weight and state precision).
- **8-bit Adam** (https://arxiv.org/abs/2110.02861) [V]: 1.5B LM ppl 9.0 vs 9.0 (single seed), needs block-wise
quantization + stable embedding. **8-bit Muon** [V]: 1.4B: 2.495 vs 2.496 (5 seeds) — Muon momentum is robust; the
AdamW-routed states are the sensitive part.
- **Tooling [V]:** torchao low-bit optimizers (8-bit/4-bit/FP8 states, `bf16_stochastic_round`, FSDP2-aware) have only
fine-tuning benchmarks; FSDP2 keeps fp32 sharded params and optimizer states by default (states = `zeros_like(p)`);
modded-nanogpt keeps Muon momentum fp32 ("FP32 for precision"); torchao float8 touches only `nn.Linear` matmuls
(rowwise +10%, tensorwise +25% on Llama3-8B/8×H100; small shapes can be slower; call
`precompute_float8_dynamic_scale_for_fsdp` after each step with float8 all-gather).
- **Memory arithmetic [I]:** 1.5B × (4 B master + 4 B grad + 8 B Adam m,v) = 24 GB total → **1.5 GB/GPU under FSDP2 over
16 GPUs** (24 GB/GPU even under plain DDP). BF16 moments would save 0.375 GB/GPU (0.5% of 80 GB). Activations dominate.
- **Bottom line:** keep **fp32 master weights + fp32 Adam moments + fp32 Muon momentum**; NS in bf16. BF16 states buy
nothing here and are risky at higher β2. Spend effort on throughput (compile, FP8 trial, micro-batch/checkpointing).
---------------------------------------------------------------------------------------------------------------------
## 10. Recommended configuration (~1.5B dense, ~40B tokens, 16×H100, PyTorch 2.10)
Assumptions: d_model 2048, 24–28 layers, SwiGLU (d_ff≈5632), RoPE, pre-RMSNorm + QK-norm, untied embeddings, seq 4096,
bf16 autocast, FSDP2 (or DDP). If embeddings are tied, the shared matrix goes in the AdamW embedding group.
### 10.1 Primary: Muon (RMS-matched) + AdamW
| Group | Parameters | Optimizer | Peak LR | Momentum / betas | ε | Weight decay (×lr_t) |
|---|---|---|---|---|---|---|
| M | W_q, W_k, W_v, W_o, W_gate, W_up, W_down (each orthogonalized **separately**; split fused QKV / gate-up) | Muon, update 0.2·sqrt(max(out,in))·NS(·) (torch `adjust_lr_fn="match_rms_adamw"`, dion `adjust_lr="rms_norm"`) | **8e-4** (≡ Keller-convention ≈7.2e-3 at fan_in 2048) | Nesterov μ=0.95 | NS eps 1e-7 | **λ=0.2** (τ = 1/(8e-4·0.2·38,147) ≈ 0.16) |
| A-emb | token embedding | AdamW | 1.2e-3 | (0.9, 0.95) | 1e-10 | 0 |
| A-head | lm_head (untied) | AdamW | 1.2e-3 | (0.9, 0.95) | 1e-10 | 0.1 |
| A-1D | all RMSNorm gains (incl. QK-norm), biases, scalars | AdamW | 1.2e-3 | (0.9, 0.95) | 1e-10 | 0 |
- **NS:** 5 steps, bf16, Polar Express coefficients (dion default) or Jordan's (3.4445, −4.7750, 2.0315).
- **Schedule (all groups, one multiplier):** linear warmup 0 → peak over **1,000 steps** (≈1.05B tokens, 2.6%), then
**linear decay to 0** at the final step (38,147 for 40B tokens; recompute S if D changes).
- **Batch:** **1,048,576 tokens/step** (256 × 4096), no ramp. If you must change B, keep τ fixed (λ ∝ B).
- **Clipping:** global grad-norm 1.0 over all parameters before the optimizer step.
- **Loss / arch knobs:** QK-norm on; no z-loss (optional 1e-4 in a self-written fused CE); no logit softcap.
- **Precision:** fp32 master params, fp32 Adam m/v, fp32 Muon momentum; bf16 compute and NS.
- **Implementation:** microsoft/dion `Muon` (FSDP2 all-to-all, or DDP with `process_group`) + `torch.optim.AdamW(fused=True)`
for the A-groups; `torch.compile` NS. **Do not** run `torch.optim.Muon` unsharded on 16 GPUs. Gate on a full-shape
throughput test: step-time overhead vs AdamW ≤3–4%.
- **Expected effect [I]:** ≈0.010–0.017 nats (≈0.003–0.006 bpb) better than the fallback at equal tokens (Wen 1.2B
interpolation), minus ≈1–3% tokens of overhead.
- **Uncertainties:** absolute Muon LR (plausible 6e-4–1e-3) and λ (τ 0.06–0.33 seen in the literature) — Sec. 11.
### 10.2 Fallback: AdamW only (lowest engineering risk)
| Group | Parameters | Peak LR | Betas | ε | Weight decay (×lr_t) |
|---|---|---|---|---|---|
| A-mat | all hidden 2-D matrices + lm_head | **2e-3** (≈1e-3 if no QK-norm) | (0.9, 0.95) | 1e-10 | **0.1** (τ = 1/(2e-3·0.1·38,147) ≈ 0.13) |
| A-emb/1D | embedding, norm gains, biases | 2e-3 | (0.9, 0.95) | 1e-10 | 0 |
Warmup **2,000 steps** (≈2.1B tokens; Wen 1.2B optimum), linear decay to 0, batch 1M tokens, clip 1.0, fused AdamW, fp32
states. Optional free tweak: NAdamW (β1 0.98, β2 0.98, lr 4e-3, λ 0.1, warmup 4000 per Wen) was −0.003 vs AdamW at 1.2B.
If a pure-Adam-family upgrade is wanted without Muon's systems work, AdEMAMix (β3 0.999, α 8, α/β3 warmed up over the
run; Semenov 720M: ≈−0.02 to −0.03 nats) is the next candidate, but it lacks independent ≥1B replication.
---------------------------------------------------------------------------------------------------------------------
## 11. The most valuable ablations (small scale)
**Proxy family (TPP-matched, same data mix, seq 4096, same schedule shape):**
- P1: d=512, 12 layers (≈50M non-emb), 27 TPP ≈ 1.35B tokens, batch ≈0.25M (≈1.4× its Power-Lines B_opt) — ≈1 H100-h/run.
- P2: d=1024, 12 layers (≈200M non-emb), 27 TPP ≈ 5.4B tokens, batch ≈0.5M — ≈6–7 H100-h/run.
(Costs [I] at ~35% MFU; double-check on your stack.)
**A. AdamW vs Muon (decides the optimizer).**
- P1: each optimizer at 4 LRs, factor-2 grid: AdamW {2, 4, 8, 16}e-3, Muon-RMS {1, 2, 4, 8}e-3 (Wen's 130M/d=512
optima: AdamW 8e-3, Muon Keller 1.6e-2 ≡ RMS-matched ≈3.5e-3; extend the grid if the best point is at an edge).
P2: each optimizer at its predicted-best LR and one neighbor (4 runs; Wen's 520M/d=1024 optima: AdamW 4e-3, Muon
Keller 8e-3 ≡ RMS ≈1.25e-3). The P1→P2 shift also gives an empirical width exponent to sanity-check the 1.5B LRs.
Plus a **full-shape throughput test** (1.5B,
16 GPUs, ~100 steps each for AdamW and the real distributed Muon; <1 H100-h).
- Decision rule [I]: Wen's gap shrinks 0.065 (130M) → 0.037 (520M) → 0.014–0.019 (1.2B). Adopt Muon if at P2 its best
loss beats AdamW's best by **≥0.03 nats** (on the Wen trend ⇒ ≈0.012–0.015 at 1.5B) **and** measured overhead ≤4%.
If the P2 gap is <0.02 nats, the 1.5B gain is likely ≤ the overhead → use AdamW.
- Cost ≈ 8 h (P1) + 26 h (P2) + 1 h ≈ 35 H100-h.
**B. Weight-decay timescale τ for the chosen optimizer (largest unexplained spread in the literature: 0.06–0.65).**
- At P1 (and one confirmation at P2) with LR fixed at its optimum: λ such that τ ∈ {0.06, 0.12, 0.25}. τ transfers
across N at fixed TPP (Power Lines), so set λ_main = 1/(τ_best·η_main·38,147). Also gives a read on whether Muon's
optimal τ is lower than AdamW's (Wen data hint ≈0.06–0.11).
- Cost ≈ 2 h (P1) + 6.5 h (P2) ≈ 9 H100-h.
**C. Muon add-ons (only if Muon wins A).**
- At P1 best LR/τ: NorMuon (dion `NorMuon`), Muon + cautious WD (`cautious_wd=True`), MuonH/Hyperball (no WD; 2 LRs).
Adopt only if ≥0.01 nats better at P1 **and** ≥0.005 at P2 with no extra overhead. Claimed gains: NorMuon +11% over
Muon (1.1B, author), CWD −0.09 nats (author, likely inflated), MuonH 20–30% vs AdamW at 1.2B (Wen II; mixed
replication; nanochat: negative at d12). With the project's code (NorMuon + CWD already on), C reduces to checking
that they still help at P2 (ablate off) — lower priority than A and B.
- Cost ≈ 5 h (P1) + 6.5 h (P2 confirm) ≈ 12 H100-h.
Total ≈ 55 H100-h (~20% of the main budget). **Lite version** (P1-only A+B + throughput test ≈ 12 H100-h) is
informative for τ but **overstates Muon's gain** (proxies <200M show 1.3–1.4x; Wen) — use the P2 decision rule if at all
possible. Optional D (if throughput matters): batch 0.5M vs 1M vs 2M at P2 with τ held fixed.
---------------------------------------------------------------------------------------------------------------------
## 12. Mapping to the project's current code (read-only review of /workspace/code, 2026-11-05)
`optim.py`/`train.py` are nanochat-derived (`MuonAdamW`) [V\*, read in code]:
- Muon: Keller shape scale lr·sqrt(max(1, rows/cols)); Polar Express 5 steps (bf16); MuonEq row equilibration; Frobenius
renormalization to sqrt(min(m,n)); NorMuon variance reduction (β2 0.9) that preserves the Frobenius norm ⇒ per-element
update RMS ≈ lr/sqrt(fan_in) (Keller convention); cautious WD applied as lr_t·wd·mask with the *shape-scaled* lr_t;
momentum 0.85→0.97 over 400 steps, 0.97, →0.90 during warmdown; ZeRO-2-style sharded update with async
reduce-scatter/all-gather (NS is distributed across ranks — good; still measure overhead at full shape).
- Hyperparameters: matrix_lr 0.02 × sqrt(B/2^19) (no width scaling; nanochat's own comment: √B scaling for Muon "not
studied carefully, assumption!"); weight_decay 0.28 × sqrt(B/2^19) × (1.16e9/D), cosine-decayed to 0; Adam groups:
wte lr 0.3·(d/768)^−0.5·√(B/2^19), β (0.8, 0.995); lm_head 0.008·(same scales), β (0.8, 0.96), wd 0.01; scalars
separate; ε 1e-10; warmup 40 steps; warmdown 0.65 (linear) to final_lr_frac 0.05; configs use B = 2^19 = 0.5M.
What the evidence implies if this code is used for d≈2048, D≈40B, B=1M [I]:
1. **Muon LR (highest-priority sweep):** per-element step ≈ 0.02·√2/√2048 ≈ 6.3e-4, i.e. ≈3.8x Moonlight's 1.5B setting
(1.7e-4) and 3–6x Wen's tuned 1.2B optimum (1–2e-4; Wen 520M: ×4 LR → +0.074, ×8 diverged). nanochat itself runs
≈6.9e-4 at d26 (d=1664, ~1M batch) at ≈8–12 TPP, and shorter horizons favor higher LR (Wen 1.2B: lr .008 best at 1x,
.004 at ≥2x). At 27 TPP the optimum is likely lower than nanochat's default: sweep matrix_lr (post-√B) ∈
{0.007, 0.014, 0.028} at the largest proxy; if forced to guess for d=2048, ≈0.01–0.014.
2. **WD:** the T_epoch rule gives λ ≈ 0.0115 → τ_peak = 1/(0.0283·0.0115·38,147) ≈ 0.08; with the cautious mask (~½ of
coordinates) and cosine WD decay the effective τ ≈ 0.2 — consistent with the τ ≈ 0.1–0.2 evidence. Power Lines
(τ_opt ∝ TPP^−0.527) suggests λ up to ≈1.7x higher at 27 TPP than a ~10-TPP-tuned reference; include in ablation B.
3. **Schedule:** set **final_lr_frac → 0** (D2Z evidence; a 5% floor plausibly costs ≈0.005–0.01 nats); consider
warmdown_ratio 0.8–1.0 at 27 TPP (Wen Muon 520M/1x: 0.6 → +0.013, 0.8 → +0.003 vs 1.0), noting nanochat found
0.5–0.65 best at its ~10 TPP; warmup 40 steps is fine for Muon but 200–500 steps is cheap insurance for the very
high-LR Adam embedding group over a 38k-step run.
4. **Batch:** nanochat's own extrapolation (B_ref 0.5M at D_ref 1.16e9, B ∝ D^0.383) gives ≈1.9M → 2M for D=40B, vs
Power Lines' absolute AdamW law 0.72M and Wen's Muon (1M better than 0.5M at 4–8x). 1M is the conservative choice;
2M halves optimizer-step overhead — test 1M vs 2M (ablation D) with τ held fixed.
5. **Adam-group LRs** (embedding 0.26, lm_head ≈6.9e-3 at d=2048, B=1M) are far above the ≥1B literature values
(Wen 1.2e-3, Moonlight 8.3e-4) but are nanochat's validated regime at d24–d32; Wen found the Adam-group LR flat over
3x. Keep unless proxies show instability.
6. **Hyperball/MuonH:** nanochat found it worse at d12 (negative result) → deprioritize ablation C's MuonH arm for this
codebase; NorMuon + cautious WD are already in the code.
---------------------------------------------------------------------------------------------------------------------
## 13. Open questions / risks
- Absolute LR at 1.5B is extrapolated from 1.2–1.7B literature (Wen, Straight-to-Zero, Moonlight); ×1.4 LR error ≈
+0.005 nats. Proxies only partially fix this unless μP/HyperP-style parameterization is adopted.
- The Muon speedup at ≥1B depends on how WD/norms are scaled (Wen I vs Qiu vs Hyperball disagree on magnitude, 1.1x vs
1.4x); none disagree on sign at 1–2x Chinchilla.
- Wen et al. did not state the AdamW schedule shape; their Muon used zero warmup — our 1,000-step warmup is a
conservative choice for the AdamW-routed groups.
- The 40B-token target needs ≈49% MFU over 256 H100-h; if MFU is ~40%, plan D ≈ 33B tokens and recompute S, λ (τ fixed),
warmup.
|