Gram Newton-Schulz: A Fast, Hardware-Aware Newton-Schulz Algorithm for Muon
Gram Newton-Schulz is a mathematically-equivalent rewrite of the Newton-Schulz polar-decomposition routine that Muon uses to orthogonalize its momentum matrix. Instead of iterating on the rectangular momentum matrix , the algorithm iterates on the small square symmetric Gram matrix , reducing FLOPs by ~55% (vs symmetric-GEMM Newton-Schulz) and ~68% (vs naive Newton-Schulz) at typical Muon aspect ratios . Paired with custom CuTeDSL symmetric-GEMM kernels for Hopper and Blackwell, the resulting GramMuon optimizer cuts orthogonalization wall-clock time by 40–50% in trillion-parameter MoE settings (Kimi K2 / GLM-5) while preserving training quality within 0.01 validation perplexity. A “restart” strategy stabilizes the otherwise numerically-divergent half-precision iteration.
Key claims
Section titled “Key claims”- Standard Newton-Schulz (5 iterations) on an matrix with aspect ratio costs FLOPs using symmetric GEMMs; the cost is dominated by ~ FLOPs per iteration of rectangular matmul. Most transformer weight matrices (MLP, MoE, GQA/MLA attention projections) are rectangular () [§“Algorithmic optimizations and Symmetric GEMMs”].
- The polar decomposition can be factored as ; Gram Newton-Schulz approximates by an iteration that uses only symmetric multiplications inside the loop, plus two rectangular matmuls (one to form upfront, one to apply at the end) [§“Gram Newton-Schulz”].
- For odd polynomials , the composed iteration can be computed from without materializing intermediate via scalar recurrences , with (Theorem 1) [§“Gram Newton-Schulz”, Theorem 1].
- For : Gram Newton-Schulz saves 55% of FLOPs vs standard Newton-Schulz with symmetric GEMMs, or 68% vs a typical implementation without symmetric GEMMs [§“Gram Newton-Schulz” FLOP analysis].
- Naive Gram Newton-Schulz is numerically unstable in bfloat16 due to two distinct failure modes: (1) spurious negative eigenvalues in — they should be in exact arithmetic, but bfloat16 noise introduces small negatives that grow exponentially because ; (2) eigenvector drift accumulating across iterations [§“Stability analysis”, Figs. 4–8].
- Restarting — re-initializing and at fixed intervals (e.g. every 2–5 iterations) — bounds the magnitude of spurious eigenvalues and controls eigenvector drift; this yields the stabilized algorithm [§“Stabilized Gram Newton-Schulz”, Figs. 9–10].
- GramMuon (Muon with Gram Newton-Schulz, 5 iterations, Polar Express coefficients, restart after iteration 2) achieves “effectively identical” pretraining quality to standard Muon — within 0.01 validation perplexity — while reducing the orthogonalization wall-clock step by 40–50% on trillion-parameter MoEs [§“Stabilized Gram Newton-Schulz”, §“GramMuon”].
- Custom CuTeDSL symmetric-GEMM kernels for Hopper (SM90) and Blackwell (SM100) exploit the fact that and are symmetric by construction, halving the cost of computing them by only writing the lower triangle and copying to the upper [§“Symmetric GEMM kernels in CuTeDSL”].
Method
Section titled “Method”The Muon optimizer uses Newton-Schulz iteration to approximate the polar decomposition of its momentum buffer, where . Standard Newton-Schulz repeatedly applies , with three matrix multiplications per iteration on the matrix — at typical Muon aspect ratios (), these rectangular matmuls dominate cost.
Gram Newton-Schulz exploits the identity . The authors prove (Theorem 1) that for any sequence of odd polynomials — which is the form Newton-Schulz update polynomials take — the composed iteration can be computed via scalar recurrences acting on rather than . Lifted to matrices, this becomes: maintain (an symmetric matrix) and (an matrix tracking with ); update and ; output . Only the upfront and final touch the rectangular dimension .
Naive lifting is numerically unstable in bfloat16: has spurious negative eigenvalues from rounding, which the iteration amplifies because the update polynomial satisfies for negative inputs. The fix is to restart: after a few iterations, replace and , which truncates accumulated negative-eigenvalue magnitude. The Stabilized Gram Newton-Schulz algorithm in the post does this once (after iteration 2) over the 5-iteration Polar Express schedule.
Custom CuTeDSL kernels for symmetric matrix multiplication (Hopper SM90, Blackwell SM100) write only the lower triangle of , , and before mirroring — halving compute for these operations and giving Gram Newton-Schulz a larger speedup than would come from FLOP reduction alone.
Results
Section titled “Results”- FLOP reduction: For (typical Muon weight matrices), Gram Newton-Schulz with symmetric GEMMs uses FLOPs vs for standard Newton-Schulz with symmetric GEMMs — a 58% reduction. Crossover with standard NS happens at (square matrices), where the methods are equivalent and the system falls back to standard NS + symmetric GEMMs to launch fewer kernels [§“Gram Newton-Schulz” FLOP table].
- Wall-clock on real models: 40–50% reduction in the Muon orthogonalization step’s runtime on trillion-parameter MoEs in the style of Kimi K2 [§“GramMuon”]. Figure 1 (referenced) shows AdamW vs Muon optimizer-step wall-clock on Llama at increasing sizes on B300.
- Training-quality preservation: GramMuon and Muon match within 0.01 validation perplexity over Llama-style pretraining runs [§“Stabilized Gram Newton-Schulz”]. The naive (unrestarted) variant exhibits catastrophic loss spikes and Inf outputs (Fig. 2).
- Stability: With restart-after-2 over 5 Polar Express iterations, ‘s largest singular value remains bounded ≤ ~12 and ‘s singular values stay below 1, vs unbounded divergence in the naive variant (Figs. 9–10).
Why it’s interesting
Section titled “Why it’s interesting”Gram Newton-Schulz is the textbook example of the IO-Aware Kernel Design template applied to optimizer-state computation rather than to attention. Like FlashAttention, Flash-KMeans, and FlashSampling, it (i) starts from an algebraic restructuring that is mathematically identical to the original, (ii) targets a specific GPU bottleneck (here: the cost of large rectangular matmuls relative to small symmetric ones on Hopper/Blackwell), and (iii) ships a hardware-aware kernel co-designed with the algorithm. The mechanism — exploit the symmetric structure of intermediate products that standard implementations were computing with general-purpose GEMMs — is the same lever FlashAttention-4: Algorithm and Kernel Pipelining Co-Design for Asymmetric Hardware Scaling pulls for backward attention via 2-CTA MMA. The IO-aware-kernel concept page now has an example from a fourth domain (after attention, k-means, and LM-head sampling); the open question on the concept page about “where else does the template apply” gets a direct datapoint.
It’s also a concrete counterpoint to the optimizer-side stability narrative on Training stability at scale. SSO (Controlled LLM Training on Spectral Sphere) wants to change what Muon’s Newton-Schulz computes; Gram Newton-Schulz wants to compute exactly the same thing, just faster. The two papers occupy orthogonal axes — quality (SSO) vs. wall-clock (GramMuon) — and could in principle compose. The “free lunch” framing here is rare and credible because the output is bit-for-bit identical up to floating-point error, validated by perplexity-matching at scale.
Finally: the failure-mode analysis (spurious negative eigenvalues amplified to , eigenvector drift in half precision) is a model of how to write up a numerical-stability investigation — diagnose with synthetic matrices in float64 vs bfloat16, plot the spectrum evolution, identify the polynomial growth factor exactly, propose a minimal fix (restart). Generalizable scaffolding for anyone debugging a half-precision matrix iteration.
See also
Section titled “See also”- IO-Aware Kernel Design — same template (algebraic rewrite + symmetric/structured GEMM kernels + math-exact output) applied to optimizer-state computation
- FlashAttention-4: Algorithm and Kernel Pipelining Co-Design for Asymmetric Hardware Scaling — by the same lab; FA4 also moves to CuTeDSL and exploits symmetric/structured matmul patterns on Blackwell
- Controlled LLM Training on Spectral Sphere — SSO is the quality-side Muon variant (“change what NS computes”); GramMuon is the wall-clock-side variant (“compute the same thing faster”). The two could stack.
- Training stability at scale — Muon is the recurring optimizer baseline in this cluster; GramMuon is a drop-in replacement
- This Simple Optimizer Is Revolutionizing How We Train AI [Muon] — refresher video on Muon mechanics for context
- Preconditioned Inexact Stochastic ADMM for Deep Models (PISA / SISA / NSISA) — another optimizer that benchmarks vs Muon (NSISA also uses NS orthogonalization on momentum); orthogonal axis (training-dynamics) but same Newton-Schulz primitive