How the Muon Optimizer Reduces Memory Pressure in Large Model Training

    A significant portion of memory pressure in large model training comes from optimizer states. This article analyzes the memory footprint of the Adam optimizer, explains how Muon works, where it actually saves memory, and the engineering challenges encountered during implementation.

    A large part of the memory pressure in training large models comes from the optimizer. This article first breaks down the memory footprint of Adam, then explains Muon’s methodology, where it truly saves memory, and the engineering issues to consider during deployment.

    1. Calculating the Memory Footprint

    Let’s take a model with 1.6 trillion (1.6T) parameters as an example, estimated using decimal units (1TB = 10^12 bytes):

    Item Bytes per Parameter Total
    Model Weights (BF16) 2 3.2 TB
    Gradients (BF16) 2 3.2 TB
    Adam first-order moment m & second-order moment v (FP32) 8 12.8 TB

    Adam’s two state variables total about 12.8TB (approximately 11.64TiB in binary units), which already exceeds the combined size of weights and gradients. This does not even account for the FP32 master weights commonly used in mixed-precision training (4 bytes per parameter, about 6.4TB) or the activations. Therefore, optimizer states are the primary focus in memory planning.

    This memory usage squeezes the space available for Batch Size and context length. To fit the states, teams often have to add GPU nodes, which drives up training costs.

    2. Adam’s Element-wise Approach

    Adam maintains an adaptive step size for each parameter individually. A 1000×1000 weight matrix is treated by Adam as one million independent parameters. Each parameter has its own historical momentum (m) and historical variance (v), and updates are computed one by one.

    This approach is flexible and widely applicable. The trade-off is that the number of states is directly proportional to the number of parameters—more parameters mean more states, with no shortcuts available.

    3. Muon’s Matrix-level Approach

    Muon updates a weight matrix in the hidden layers as a whole. It first maintains a momentum matrix, saving only this single state per parameter. It then orthogonalizes the momentum matrix to obtain a more directionally stable update matrix, which is added to the weights in one go.

    The intuition behind orthogonalization is to normalize the singular values of the matrix to around 1, preserving the main update directions while compressing unbalanced components. Mathematically, this can be solved exactly using SVD, but SVD is computationally expensive and impractical for large-scale training. In practice, Newton-Schulz iteration is typically used, requiring only a few matrix multiplications to approximate the orthogonal result. The number of iterations is a hyperparameter to tune, usually set to just a few steps.

    In terms of memory, Muon requires only one momentum state per parameter. If the momentum is saved in FP32, it takes 4 bytes per parameter, halving the state size compared to Adam. If saved in BF16, it drops to 2 bytes. This is the primary source of Muon’s memory savings.

    4. What Fewer Training Steps Really Mean

    Muon has gained attention partly because it achieved a target loss value using fewer steps in a small model training speedup competition. This indicates higher convergence efficiency under specific settings.

    However, a few points should be noted:

    • These results come from small models and specific data configurations, which cannot be directly generalized to all models.
    • Fewer steps do not equate to less total time, as the orthogonalization computation incurs additional overhead per step.
    • The optimal hyperparameters in the competition may not suit your task; parameters like the learning rate usually need readjustment.

    Therefore, to determine if Muon is effective, you should compare the total time and total cost required to achieve the same validation metrics on your own model and data.

    5. Applicability: Which Parameters Should Use Muon

    Muon’s design premise is that the weight is a 2D matrix where the overall structure of the matrix is meaningful. Common industry practices include:

    • Using Muon for 2D weight matrices in hidden layers.
    • Retaining AdamW for embedding layers, output layers (LM head), normalization layer parameters, and biases.

    There are two reasons for this. First, each row of an embedding layer corresponds to a token, making the geometric meaning of the whole matrix less obvious. Second, normalization layers and biases are 1D parameters, for which orthogonalization is meaningless. Grouping parameters this way means Muon’s memory savings primarily come from the hidden layers, and the overall savings depend on the proportion of hidden layer parameters in the total parameter count.

    Handing all parameters to Muon would also compress the embedding layer states, but the results may not be better. Selection should be based on experimental results.

    6. Engineering Challenges: Orthogonalization Computation and Synchronization

    There are two main engineering difficulties with Muon.

    First is the computational overhead. Each step of the Newton-Schulz iteration involves matrix multiplication; the larger the matrix, the higher the cost. This extra computation scales with the parameter size and must be measured separately in training throughput—it cannot be assumed to be negligible.

    Second is distributed synchronization. Large model training typically shards parameters across multiple GPUs, using strategies like ZeRO or FSDP. Orthogonalization requires operating on the complete matrix, so in a sharded scenario, it may be necessary to gather the full momentum matrix, compute, and then shard it back, which increases communication volume. A common practice is to allocate computation by layer or by matrix, allowing the orthogonalization of each matrix to be completed on a single GPU or a group of GPUs to control communication costs. The specific solution depends on the training framework and cluster network conditions.

    Therefore, when evaluating Muon, one should simultaneously record both the computational overhead and communication costs.