Muon Optimizer for LLM Training: How Matrix-Level Updates Cut Memory Costs
This article explains why optimizer state has become a major memory bottleneck in trillion-parameter LLM pretraining and how the Muon optimizer addresses it with matrix-level updates. It covers the shift from per-coordinate updates to whole-matrix orthogonalized updates, the resulting reduction in optimizer state memory, and the engineering work required to scale these methods: numerical stability, parameter layering, parallelism compatibility, and hyperparameter retuning. It closes with practical evaluation advice and a neutral outline of how cloud infrastructure can support the training workflow.
1. The Starting Problem: Optimizers Are a Memory Bottleneck in LLM Training
In pretraining at the trillion-parameter scale, compute procurement is only part of the cost. What often limits training throughput is GPU memory. Adaptive optimizers have remained the default because they maintain two state variables per parameter, a first moment and a second moment, which lets them adjust the learning rate for each coordinate individually. This element-wise adaptivity provides robust convergence, but the cost is memory overhead that scales roughly linearly with parameter count.
Consider mixed-precision training. Weights and gradients already consume substantial space, and adding two optimizer states of the same order as the parameter count can push the state portion into the multi-terabyte range. Once memory is consumed by state variables, the headroom left for batch size and context length shrinks sharply. Engineers are then forced to trade feasibility for more aggressive sharding, recomputation, and smaller micro-batches, which raises communication and scheduling overhead and inflates end-to-end training cost.
This is not an implementation flaw in any particular framework. It is an inherent property determined by the algorithm’s structure. That is why slimming down optimizer state has become such an attractive technical direction.
2. The Core Idea: From Per-Coordinate Updates to Whole-Matrix Updates
The key shift in matrix-level optimization is to treat a layer’s weight matrix as a single, indivisible high-dimensional geometric object rather than a collection of independent scalars. The update procedure typically has three steps:
- Accumulate momentum to produce a candidate update matrix with the same shape as the weights.
- Orthogonalize that matrix so its singular values become approximately uniform.
- Add the orthogonalized matrix to the weights with a single scaling factor.
Illustrative pseudocode (algorithm skeleton only, not a specific implementation):
# g: current gradient; m: momentum bufferm = beta * m + (1 - beta) * gu = orthogonalize(m) # approximate orthogonalization, a few iterationsw = w - lr * scale(u) # uniform update across the layer
The intuition behind orthogonalization is easier to grasp by analogy. Traditional methods let a crowd of individuals each decide their own step size, which is precise but hard to coordinate. Matrix-level methods first arrange all directions into a neat formation, then advance at a unified pace. Directions no longer race ahead of one another, the update is distributed more evenly across the parameter space, and the number of iterations needed to reach a comparable loss often drops significantly.
The memory ledger changes just as importantly. Matrix-level methods generally maintain only one momentum state, roughly halving state overhead, and orthogonalization involves only a few matrix multiplications and a short iteration, so the extra buffer is far smaller than a second element-wise moment.
3. From Experiments to Industry: What Scaling Actually Requires
Methods of this kind were initially validated only in small model races at the hundred-million-parameter scale, so the industry naturally questions whether they work at scale or only in small settings. Closing that gap requires four engineering pieces:
- Numerical stability: Orthogonalization iterations can become unstable at low precision, so higher precision must be retained in critical accumulation steps and updates should be norm-clipped.
- Parameter layering: Embedding layers, output heads, normalization, and biases are usually still handled by conventional adaptive methods, with matrix-level updates enabled only for the large hidden-layer matrices, forming a hybrid strategy.
- Parallelism compatibility: Tensor parallelism and pipeline parallelism split weight matrices, so orthogonalization must remain equivalent under that sharding semantics; otherwise the update direction diverges from the single-device case.
- Hyperparameter migration: Momentum coefficients, the unified scaling factor, and learning rate warmup need recalibration. Reusing old configurations directly tends to cause loss spikes mid-training.
Once these pieces are in place, the payoff appears: lower state memory frees up room for batch size and sequence length, reduces the recomputation and sharding overhead introduced purely to save memory, and increases output per unit of effective compute.
4. Practical Advice and Cloud Deployment
To evaluate this class of optimizer on your own workloads, follow an incremental validation path: align loss curves on small and medium models first, then scale up gradually while watching for stability. Keep a conventional optimizer as a baseline and run controlled experiments under the same compute budget, so randomness is not mistaken for an algorithmic gain.
For cloud implementation, a closed loop can be built from general-purpose capabilities: a container platform to run distributed training with elastic scaling, object storage for checkpoints and datasets, logging and monitoring with alerting to track loss, gradient norms, and memory levels, and a message queue to decouple data preprocessing from the main training pipeline. General cloud infrastructure from Baidu AI Cloud can support these training engineering needs as well.
In summary, the value of optimizer innovation lies not in swapping out a popular component, but in re-optimizing the constraint relationship among memory, batch size, and convergence steps, providing a more sustainable cost structure for ultra-large-scale training.
