Skip to content
This repository was archived by the owner on Jul 17, 2026. It is now read-only.

feat(optim): Muon for the chunkwise ci-fn optimizer (completes the {adamw,muon} x {UV,ci-fn} matrix)#975

Closed
claude-spd1 wants to merge 4 commits into
bridge/task-try-muonfrom
bridge/task-muon-cifn-matrix
Closed

feat(optim): Muon for the chunkwise ci-fn optimizer (completes the {adamw,muon} x {UV,ci-fn} matrix)#975
claude-spd1 wants to merge 4 commits into
bridge/task-try-muonfrom
bridge/task-muon-cifn-matrix

Conversation

@claude-spd1

Copy link
Copy Markdown
Collaborator

Stacked on #931 (draft) — diff here is only the ci-fn delta. Requested by Oli in the muon pilot slack thread; bridge task muon-cifn-matrix.

What

type: muon on ci_fn_optimizer now works correctly for the chunkwise CI fn. Its trainable tree is per-chunk stacks — 3D [n_chunks, d_in, d_out] matrix stacks and 2D [n_chunks, d] bias stacks — and optax's default muon rule (2D → muon, rest → Adam) labels that tree exactly backwards (it would NS-orthogonalize the bias stacks and Adam the matrices). build_optimizers now passes explicit MuonDimensionNumbers for the ci-fn group when the arch is chunkwise: 3D leaves are orthogonalized over the trailing two axes (chunk axis batched), everything else takes the Adam fallback. V/U and the MLP CI fns keep the default 2D rule (correct for their trees). Default adamw stays bit-identical canonical. SPEC S20 amendment extended (2026-07-11) — needs Oli sign-off.

Also: the two matrix arm configs (byte-derived from the try-muon control / muon-1x stored launch configs, only ci_fn_optimizer flipped), plus JAX_PERSISTENT_CACHE_ENABLE_XLA_CACHES=none in their launch_env (the shared autotune-cache footgun, see task xla-autotune-cache-group-unwritable / #974; also matches the 07-03 arms' autotune behavior).

Validation

  • New unit test: 3D-stack per-chunk NS orthogonalization + 2D-bias-stack Adam fallback (test_optim_torch_parity)
  • New checkpoint test: muon on BOTH groups roundtrips + exact-resumes (the scavenge-preemption path)
  • Full suite green at default devices (464 passed) AND 4 sim devices (236 passed); make check clean

Experiment (full 2x2 at lr 5e-5, pile4l ppgd bsc 40k, seed 0, wandb group muon-cifn-matrix)

UV \ ci-fn adamw muon
adamw p-d0f66d3b (try-muon control) p-282f5206
muon p-cedbbf7c (try-muon 1x) p-c01f5833

View: https://wandb.ai/goodfire/param-decomp?nw=r3mmipzgpne

Mid-training window (10k–35k, per the try-muon methodology; endpoint is schedule-compression-artifacted):

  • muon/muon is Pareto-best: kl_stoch 0.31–0.50 vs adamw/adamw 0.60–0.84, at LOWER CI-L0 from 20k on (332 vs 447 @30k); best kl_ci, best hidden-side train PPGD recon (0.83 vs 2.43 @30k, ~3x), best eval 20-step PGD, slightly best unmasked KL.
  • ci-fn muon helps on BOTH UV rows (adamw/muon beats adamw/adamw everywhere mid-window; muon/muon beats muon/adamw everywhere) — the effect is additive, not redundant with UV muon.
  • Cost is the catch: ~3.3x step time at this scale (0.40–0.44 s/step vs 0.12–0.15). The per-chunk NS orthogonalization (vmapped over 8 chunk stacks x per-block matrices) dwarfs the +19% UV-muon overhead. Relative cost should shrink at production scale, but at 4L the quality win is not free.
  • Single seed, 4L, compressed 40k schedule — standard caveats.

Crew-Address: slack/C08T7UV4449/1783730484.936959

🤖 Generated with Claude Code

PD User (shared) and others added 4 commits July 11, 2026 01:10
…bers over chunk stacks)

The chunkwise CI fn's trainable leaves are per-chunk stacks: 3D [n_chunks, d_in, d_out]
matrix stacks and 2D [n_chunks, d] bias stacks. optax's default muon rule (2D -> muon,
rest -> Adam) labels that tree exactly backwards, so build_optimizers now passes explicit
MuonDimensionNumbers for the ci-fn group when the arch is chunkwise: 3D leaves are
NS-orthogonalized over the trailing two axes (chunk axis batched), everything else takes
the Adam fallback. V/U and the MLP CI fns keep the default 2D rule (all-2D / plain-2D
trees, unchanged). SPEC S20 amendment extended (2026-07-11).

Two matrix arm configs added, byte-derived from the try-muon control / muon-1x stored
launch configs with only ci_fn_optimizer flipped to muon (lr 5e-5, consistent_rms 0.2):
the two missing cells of the {adamw, muon} x {UV, ci-fn} matrix.

Tests: muon 3D-stack orthogonalization + 2D-bias-stack Adam fallback
(test_optim_torch_parity), muon-both-groups checkpoint roundtrip + exact resume
(test_checkpoint, the scavenge-preemption path).

Crew-Address: slack/C08T7UV4449/1783730484.936959

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… for the matrix arms

The shared cache's xla_gpu_per_fusion_autotune_cache_dir was created group-unwritable
on 2026-07-08, so any non-owner run dies PERMISSION_DENIED at the first train step
(job 1052115). JAX_PERSISTENT_CACHE_ENABLE_XLA_CACHES=none skips only that side cache;
the main executable cache still applies. The 2026-07-03 sibling arms predate the dir,
so this also matches their autotune behavior.

Crew-Address: slack/C08T7UV4449/1783730484.936959

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… 0.5x (4e-4, 1e-4)

Oli's follow-up on the muon pilot thread: the 4 matrix cells land at different
sparsity-recon tradeoff points, so compare optimizer setups as 3-point Pareto
curves (L0 vs adv/stoch recon at step 30k) instead of single runs. Everything
except run_name and the ImportanceMinimalityLoss coeff is byte-identical to the
parent cell's config; full 40k schedule so the 30k point is comparable to the
existing coeff-2e-4 runs.

Crew-Address: slack/C08T7UV4449/1783730484.936959

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…amma 1->0.01) at 100k steps

Oli's follow-up (task smooth-l0-muon-matrix-100k): swap stock Lp imp-min for
SmoothL0ImportanceMinimalityLoss in each matrix cell — coeff 2e-4 (the pile-4L
smooth-L0 sweep center, wandb groups smoothl0-impmin-sweep / smoothl0-steplen;
numerically same as our Lp cells), gamma 1.0 -> 0.01 linear over the full run
(flagship p-594db290 precedent), steps 40k -> 100k. Frequency sub-term kept so
the only imp-min delta is the penalty shape. Everything else byte-identical to
the parent cell configs.

Crew-Address: slack/C08T7UV4449/1783730484.936959

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude-spd1

Copy link
Copy Markdown
Collaborator Author

Superseded by the combined muon PR #982 (per Oli: one PR for the whole muon feature, rebased onto current feature/jax). All content + validation carried over there.

Crew-Address: slack/C08T7UV4449/1783730484.936959

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant