Muon Optimizer for LLM Training: A New Paradigm for Cutting Memory Overhead
This article explains why optimizer state has become a major consumer of GPU memory in large-scale pretraining and how the Muon optimizer addresses it with matrix-level updates. You will learn the core mechanics behind element-wise adaptive optimizers, how momentum accumulation and orthogonalization reduce state memory from several times the parameter count to roughly one times, and why a hybrid rather than a replacement approach is needed at industrial scale. The article also covers spectral distribution shifts, parallelism conflicts, and numerical stability concerns, followed by a practical deployment checklist covering memory accounting, small-scale alignment, parallelism tuning, precision control, observability, and elastic scaling.
1. The Starting Point: Optimizers Are Eating Your Memory Budget
In the compute bill for large-scale pretraining, optimizer state has long played an underestimated role. Take the element-wise adaptive optimizers that have dominated the field: to give every parameter an independent adaptive step size, they must maintain two extra states in GPU memory, the first moment and the second moment. Under mixed-precision training, copies of the parameters and gradients add further overhead, so a single parameter often carries more than ten bytes of resident cost.
Scale that factor up to the trillion-parameter range, and optimizer state alone can occupy memory in the tens of terabytes. The significance of this number is not its absolute value but the structural space it takes away from larger batch sizes and longer contexts. Once the memory budget is tight, engineering practice usually forces a choice among three options: reduce the batch size, shorten the sequence, or introduce more parameter sharding and state offloading. All three lower throughput or increase communication volume, pushing training costs higher.
This is the fundamental reason matrix-based optimization is being reconsidered: if state overhead cannot be compressed, switch to an update paradigm that does not maintain two moments per parameter.
2. How It Works: From Element-Wise to Whole-Matrix
1. The Hidden Assumption of Element-Wise Adaptive Optimization
Traditional adaptive optimizers treat a weight matrix as N mutually independent scalars, estimating first- and second-order gradient statistics for each scalar separately and then computing updates element by element. The advantages are generality, friendliness to sparse gradients, and almost no tuning. The cost is that state memory scales linearly with the parameter count, and the update direction lacks any constraint from the geometry of the matrix as a whole.
2. The Core Operation of Matrix-Level Updates
A matrix-based optimizer treats a weight matrix as a single, indivisible high-dimensional geometric object. It first accumulates momentum on the gradient, then orthogonalizes the momentum matrix (in practice using a Newton–Schulz-style iterative approximation to avoid an expensive full decomposition), and finally adds the resulting orthogonal matrix back to the weights at a uniform scale. The flow looks like this:
# Pseudocode: illustrates the computation flow only, not a specific implementationbuf = momentum * buf + grad # 1. Momentum accumulationupdate = orthogonalize(buf) # 2. Orthogonalization (iterative approximation)W = W - lr * update # 3. Uniform-scale update
Because only one momentum state needs to be stored, optimizer memory drops from several times the parameter count to roughly one times. This is its most direct engineering benefit.
3. An Intuitive Analogy and Its Limits
You can think of element-wise optimization as a crowd of individuals each fighting their own battle, requiring a separate step-size instruction for every individual. Matrix-based optimization first arranges the individuals into a formation and then advances them together at a uniform pace. The difference in coordination overhead is obvious. But the analogy needs a boundary: in real training, not all parameters are suited to marching in formation, which is exactly the problem the next section addresses.
3. From Toy Scale to Production: Doubts and Responses
Matrix-based optimization was first validated only on small models in the hundreds-of-millions-parameter range. The community’s core doubt was whether convergence speedups at small scale extrapolate to billions, tens of billions, or trillions of parameters. Extrapolation typically fails in three places:
- Spectral distribution shifts: the condition numbers and singular value distributions of large-model weight matrices differ from those of small models, diluting the benefit of orthogonalization.
- Parallelism conflicts: tensor parallelism and pipeline parallelism split one logical matrix into shards, while orthogonalization needs global information across shards.
- Numerical stability: iterative orthogonalization at low precision tends to oscillate and needs higher-precision intermediate accumulation.
The key industrial response is a hybrid rather than a replacement approach: keep adaptive optimizers for structure-sensitive, small-parameter portions such as attention and embeddings, and apply matrix-based updates to the large hidden-layer matrices. At the same time, move the orthogonalization iterations onto communication primitives within each shard group, trading a small amount of collective communication for global consistency. Engineering practice also requires three supporting measures: keep a high-precision copy for the iterative process, apply per-layer norm clipping to updates, and decouple the learning rate from the update scale so existing tuning experience can be reused.
4. Deployment Checklist
- Start with memory accounting: estimate parameters in bytes, gradients in bytes, optimizer state in bytes, and activations in bytes separately, and confirm whether optimizer state is really the bottleneck.
- Align at small scale: match the target loss curve on a hundreds-of-millions-parameter model, then scale up level by level and watch whether the benefit decays.
- Tune the parallelism strategy together: confirm the sharding scheme does not break the global view orthogonalization requires, and adjust the sharding dimension if necessary.
- Control precision and stability: set high-precision accumulation and an update clipping threshold for iterative orthogonalization.
- Build observability: bring gradient norm, update norm, and state memory into logging services and monitoring alerts to form a regression baseline.
- Enable elastic scaling: run training jobs on a container platform and use object storage for checkpoint persistence, making reruns after failure and scale adjustments easier.
5. Conclusion
The value of matrix-based optimizers is not to replace existing solutions but to compress optimizer state from several times the parameter count back to roughly one times, returning precious memory budget to batch size and context length. For ultra-large-scale training, this structural saving often has more leverage than local tuning. In practice, start with memory accounting, take the hybrid approach as the main line, and rely on observability as a safeguard, validating and scaling up step by step in an environment with complete compute and data infrastructure such as Baidu AI Cloud.
