Memory Bottlenecks in Large Model Training: Understanding the Muon Optimizer

    This article examines why optimizer states, rather than model parameters, often become the primary memory bottleneck in large-scale training. It explains how matrix-level updates with orthogonalization reduce optimizer memory from two states to one, addresses common concerns about convergence and compute overhead, and outlines practical engineering considerations for adopting a hybrid optimizer setup.

    1. The Starting Point: Why Optimizers Become a Memory Bottleneck

    In training models with massive parameter counts, GPU memory often becomes a hard constraint before compute does. Many people’s first reaction is to blame the parameters themselves. Yet for a model on the order of a trillion parameters, mixed-precision training alone requires terabytes of memory just for parameters and gradients. The truly overlooked “invisible heavyweight” is the optimizer state.

    Take the adaptive optimizers that have long been mainstream in the industry. Their core idea is adaptivity: maintain a first moment and a second moment for every parameter, use the first moment of historical gradients to estimate direction and the second moment to estimate scale, and thereby assign an independent step size to each coordinate. This “element-wise adaptivity” delivers excellent convergence stability, but at the cost of storing two extra statistics per parameter, each with the same shape as the parameter itself. In mixed-precision training, parameters and gradients are typically kept in half precision, while optimizer states generally remain in single precision for numerical stability. As a result, the state overhead significantly exceeds the parameters themselves.

    The math becomes more intuitive at scale: for a model on the order of a trillion parameters, just the two single-precision moment states correspond to tens of terabytes of memory demand (the exact figure varies with parallel partitioning and precision strategy). This directly squeezes the space available for three things:

    • The per-device batch size, which in turn affects throughput and gradient noise levels;
    • Context length, since activation memory for long-sequence training is already tight;
    • Freedom in parallel strategy, such as whether you can avoid extra partitioning and communication introduced solely to store states.

    The conclusion is clear: optimizer state is a long-undervalued variable in the training cost curve, and any approach that compresses it will amplify gains along three paths: larger batches, longer contexts, and fewer nodes.

    2. An Alternative Approach: Updating the Weight Matrix as a Whole

    The update of a traditional adaptive optimizer can be summarized as a “per-coordinate” view: flatten the weight matrix into a pile of unrelated scalars, each maintaining its own momentum and second-moment scale, each deciding how far to move in this step. The mental model is a crowd of individuals acting on their own.

    Matrix-level optimization takes a different view: a 1000×1000 weight matrix is not a million independent scalars, but a single object in a high-dimensional geometric space. During the update, momentum is accumulated in the usual way, then the momentum matrix is orthogonalized (engineering practice commonly uses an iterative approximate orthogonalization to avoid the costly direct decomposition), producing a set of approximately orthogonal update directions that are then added to the weights all at once.

    An accessible analogy: an adaptive optimizer is like a group of soldiers scattered freely, each adjusting their pace by their own judgment—flexible, but requiring a large amount of “command information” (i.e., state variables). Matrix-level optimization first forms the troops into a square formation, then advances the whole at a unified rhythm, with minimal command overhead.

    The memory savings come from exactly this: there is no longer a need to store a second same-shaped second-moment statistic per parameter, and the state drops from “two matrices” to roughly “one matrix,” substantially reducing optimizer memory usage. At the same time, orthogonalization balances the scale of updates across singular directions, which in practice often shows up as a noticeable reduction in the number of training steps needed to reach the same loss.

    Illustrative update logic (pseudocode, expressing the idea only):

    1. # Pseudocode: core steps of a matrix-level orthogonalized update
    2. momentum = beta * momentum + grad # maintain only one momentum state
    3. update = orthogonalize(momentum) # iterative approximate orthogonalization yields an approximately orthogonal matrix
    4. weight -= lr * update # add the whole update at once

    Note that orthogonalization itself adds computational overhead, and it typically applies only to the two-dimensional weights of hidden layers. Embedding layers, output heads, normalization parameters, and biases generally still use adaptive updates. This kind of “hybrid optimizer” is a common engineering practice.

    3. The Inevitable Challenge: Can a Square Formation Go into Battle?

    Once this class of methods appeared, it quickly met a sharp counter-question: on a battlefield, who keeps marching in a square formation? You still have to spread out into skirmish lines, so it looks neat but isn’t practical. In engineering terms, this challenge breaks down into three testable questions.

    First, does orthogonalization lose the scale information that adaptivity provides? The answer is partial loss, but not total loss: the matrix-level method moves “scale adaptivity” from the element level up to the matrix level, compensated by a unified learning rate schedule (for example, scale normalization based on matrix shape). The observed behavior indicates this trade-off pays off for tasks like language modeling.

    Second, does the extra computation cancel out the memory gains? Orthogonalization is an iteration of several matrix multiplications—dense operations that are friendly to tensor cores. In large-model scenarios where compute is relatively abundant and memory is relatively tight, trading compute for memory is usually a positive deal.

    Third, does it apply to all layers? It does not. Element-wise adaptivity remains more reliable for sparse, low-rank, or one-dimensional parameters, so the deployed form is almost always a hybrid scheme: matrix-level updates for some layers, adaptive updates retained for others.

    4. Engineering Implementation Points

    If you want to try this class of optimizer in your own training stack, consider the following:

    1. Layer strategy: enable matrix-level updates only for the two-dimensional weights of hidden layers, keep adaptive updates for the remaining parameters, and expose these switches as configuration items to facilitate ablation experiments.
    2. State and parallelism: after reducing state, re-evaluate the parallel partitioning scheme and allocate the saved memory budget to batch size or context length, so the gains are actually realized.
    3. Numerical stability: the number of orthogonalization iterations, the momentum coefficient, and learning rate scaling all need to be tuned jointly with the precision strategy. It is advisable to get a small-scale run working early in training before scaling up.
    4. Observability: combine logging services and monitoring alerts to track gradient norms, the orthogonality deviation of update matrices, loss curves, and throughput, avoiding a hidden regression where memory is saved but convergence worsens.
    5. Reproducibility and elasticity: run training jobs containerized on a container platform, and write checkpoints to object storage, to support fault tolerance and recovery across large-scale clusters.

    5. Summary

    The memory overhead of optimizer states is a key part of moving large-model training from “able to run” to “cheap to run.” The idea of using the matrix as the update unit and orthogonalizing the update directions replaces two adaptive states with one momentum state, and swaps element-wise fine-grained scheduling for matrix-level coordinated advancement, showing a practical cost advantage in language model training. It is not a panacea—skirmish lines still have their reasons to exist, and hybrid use is the engineering norm. For teams whose throughput and context length are being held back by memory, this class of methods is worth adding to the candidate list for optimizer selection, and validating systematically on platforms such as Baidu AI Cloud with elastic compute and full observability capabilities.