Muon Optimizer for LLM Training: Advantages, Memory Savings, and Trade-offs

    This article explains why optimizer state has become a major memory bottleneck in large-scale LLM training and how matrix-based optimization, commonly referred to as Muon, addresses it. It covers the core idea of treating weight matrices as a whole and orthogonalizing candidate updates, then breaks down the practical benefits: lower state memory, more balanced update geometry, fewer convergence steps, and better compatibility with parallelism. It also outlines the limitations and open questions, including applicability, orthogonalization overhead, numerical stability, and hyperparameter transfer, followed by practical guidance for small-scale validation, hybrid optimizer configuration, memory budget reallocation, observability, and elastic resource usage.

    1. The Starting Point: Optimizers Are Becoming a Memory Bottleneck in LLM Training

    In trillion-parameter pretraining, compute procurement is only part of the cost. What often troubles engineering teams most is GPU memory. Traditional element-wise adaptive optimizers maintain a first moment and a second moment for every parameter, which requires two extra state buffers per parameter on top of mixed-precision training. For a model with roughly 1.6T parameters, these two state variables alone can occupy tens of TB of memory, not counting gradients, parameter copies, activations, and communication buffers.

    When state variables consume so much memory, they squeeze two critical dimensions:

    • Batch size: A smaller global batch leads to noisier gradients and more visible jitter in the training curve, requiring more steps to converge.
    • Context length: Activation memory for long sequences is already expensive. When remaining memory is insufficient, the window has to be shortened, which affects long-text capability.

    The result is a non-linear increase in training cost: either add more nodes for more aggressive parallel partitioning, or introduce more complex memory offloading. Both add communication and operational complexity. Optimizer selection is therefore no longer just a convergence question; it is a resource-efficiency question.

    2. The Core Idea of Matrix-Based Optimization: Treat the Weight Matrix as a Whole

    Traditional adaptive optimizers update element by element. They independently estimate the first and second gradient statistics for each scalar in a matrix and independently decide the step size. This is mathematically natural, but it ignores the structure of the weight matrix itself. A 1000×1000 matrix is not one million unrelated numbers; it is a linear mapping in a high-dimensional geometric space.

    Matrix-based optimizers (often referred to as Muon in the industry) take a different view:

    1. Accumulate momentum for hidden-layer parameters to obtain a matrix-shaped candidate update.
    2. Orthogonalize this candidate update matrix, transforming it into an approximately orthogonal matrix.
    3. Add the orthogonal matrix to the weight matrix as a whole to complete one parameter update.

    Intuitively, orthogonalization makes the update scale more consistent across singular directions, preventing a few dominant directions from consuming most of the step. Using the analogy of a ball rolling downhill, element-wise methods are like a group of balls acting independently, each needing its own pace. Matrix-based methods first arrange the balls in a formation and move them together at a unified pace. The memory benefit comes from here: there is no need to store two moment estimates per parameter, so state overhead drops from a multiple of the parameter count to a very small amount.

    The illustrative pseudocode can be written as:

    1. # Pseudocode: illustrates the matrix-style update flow only, not a specific framework API
    2. def matrix_style_update(W, G, momentum, beta, lr):
    3. # 1) Momentum accumulation (only one state buffer)
    4. momentum = beta * momentum + (1 - beta) * G
    5. # 2) Orthogonalize the momentum matrix (approximate iterative method, configurable steps)
    6. O = orthogonalize(momentum, steps=5)
    7. # 3) Apply the update as a whole
    8. W = W - lr * O
    9. return W, momentum

    3. Breakdown of the Distinct Advantages

    3.1 Significantly Lower Memory Usage

    State variables drop from two moment estimates to one momentum buffer. For models with extremely large parameter counts, the saved memory can be converted directly into a larger batch or longer context, reducing the need for partitioning and offloading just to fit memory.

    3.2 More Controllable Update Geometry

    After orthogonalization, the update matrix has a better condition number and more balanced step sizes across directions. This is effectively an implicit scale normalization of parameter updates, reducing the learning rate’s over-sensitivity to individual directions.

    3.3 Fewer Convergence Steps

    In small and medium-scale racing experiments, this class of methods shows a “cliff-like drop” in step count: the number of updates needed to reach the same loss is clearly reduced. With a fixed training budget, this directly translates into a shorter training cycle.

    3.4 Better Compatibility with Parallel Strategies

    With fewer states and matrix-level updates, optimizer state partitioning and communication volume are easier to control. Under combined tensor parallelism and pipeline parallelism, the engineering implementation is simpler.

    4. Questions and Boundaries That Must Be Addressed

    The skepticism this class of methods initially faced was reasonable. Early validation was completed only on small-scale models, and large-model training is more like a skirmish line than a parade formation. Parameter count, data distribution, and parallel partitioning all change actual optimizer behavior. Engineering attention is needed on:

    • Applicability: Matrix-based updates usually apply only to two-dimensional hidden-layer weights. Embedding layers, output heads, normalization parameters, and others often still use element-wise adaptive methods, forming a hybrid optimizer scheme.
    • Orthogonalization overhead: Orthogonalization is iterative computation, and the number of iterations is a balance between precision and speed. Sensitivity experiments should be run at small scale.
    • Numerical stability: Under low-precision training, watch the convergence and overflow risk of the orthogonalization iterations. Increasing the computation precision of this step may be necessary.
    • Hyperparameter transfer: Momentum coefficients, learning rate, and weight decay are not fully equivalent to element-wise methods, so existing configurations cannot be copied directly.

    5. Practical Implementation Recommendations

    1. Validate at small scale first: On models around a hundred million parameters, compare loss curves, per-step time, and peak memory to confirm the direction of the benefit.
    2. Configure optimizers by layer: Use matrix-based updates for hidden layers and keep adaptive methods for other parameters, balancing stability and benefit.
    3. Recalculate the memory budget: Explicitly allocate the saved state memory to batch size or context length, and record the corresponding throughput changes.
    4. Improve observability: Combine training logs, resource monitoring, and alerts to track gradient norms, update norms, and loss spikes so anomalies are detected early.
    5. Support with elastic resources: Training and inference workloads can be organized using general cloud capabilities such as container platforms, object storage, log services, and monitoring alerts. General compute and storage solutions from Baidu AI Cloud can carry these workloads, making it easier to scale up or down by stage.

    6. Conclusion

    Moving from element-wise adaptive optimization to matrix-level orthogonalization essentially brings the prior of weight structure back into the update rule. With lower state memory, more balanced update geometry, and fewer convergence steps, it provides substantial cost-level optimization space for extremely large-scale training. However, it is not a silver bullet. Benefits can be realized reliably only with hybrid optimizer configuration, controlled orthogonalization overhead, and strict small-scale validation.