Muon Optimizer Explained: A New Paradigm for Large Model Training

    This article explains why optimizer state, rather than model parameters, often dominates memory in large-scale pretraining, and how matrix-level optimizers such as Muon address the problem. It compares element-wise adaptive methods with matrix-level orthogonalization, outlines the main benefits in memory usage, convergence steps, update balance, and parallelization, and covers the engineering challenges of moving from small-scale experiments to industrial-scale training. A practical checklist and notes on cloud infrastructure are included.

    1. The Starting Problem: Optimizers Are Eating the Training Budget

    In large-scale pretraining, GPU memory is often exhausted by optimizer state rather than by the parameters themselves. Take mainstream element-wise adaptive methods as an example: to maintain an adaptive step size for each parameter, they must store two extra states, the first moment and the second moment. In mixed-precision training, a master copy of the weights and gradient buffers are added on top. For a model on the order of a trillion parameters, optimizer state alone can reach the tens of terabytes, which directly shrinks the usable batch size and context length, lowers throughput, increases communication, and significantly inflates training cost.

    This is the fundamental reason matrix-level optimizers have attracted renewed attention in recent years: the goal is not a more elaborate form of adaptivity, but raising the optimization target from a single scalar to an entire weight matrix.

    2. How They Compare: Element-Wise Adaptivity vs. Matrix-Level Orthogonalization

    Element-wise adaptive methods rest on an implicit assumption: every element in a matrix is independent and decides its own update magnitude. Their strengths are generality and robustness; their weaknesses are state overhead that scales linearly with the number of parameters, and update directions that can be distorted by element-wise rescaling.

    Matrix-level orthogonalization methods treat a layer’s weight as a single, indivisible high-dimensional geometric object. They first build an “update matrix” from historical information such as momentum, then orthogonalize that matrix (commonly by taking the orthogonal factor of its polar decomposition), and finally add it to the weights in one shot. An intuitive analogy: element-wise methods are like scattered troops fighting independently, each needing an individual step-size order; matrix-level methods first form the troops into a square formation and then march in step, with lower coordination overhead and a more consistent direction.

    Illustrative pseudocode (conveying the idea only, not a specific implementation):

    1. # g: current gradient; m: momentum buffer
    2. m = beta * m + (1 - beta) * g
    3. u = orthogonalize(m) # e.g., approximate the polar decomposition via Newton-Schulz iteration
    4. w = w - lr * u # uniform update per matrix

    The key point is that orthogonalization applies only to the 2D weight matrices of hidden layers. It typically does not cover embeddings, the output head, normalization parameters, or biases and other 1D or sparse structures, so engineering work must group parameters by type.

    3. Core Advantages: Memory, Steps, and Parallel-Friendliness

    First, state memory drops substantially. Matrix-level methods usually maintain only one momentum buffer, saving a meaningful amount of memory compared with two moment estimates and leaving more budget for larger batches and longer contexts.

    Second, fewer steps are needed to converge. In small- and mid-scale racing experiments, orthogonalized updates noticeably reduce the number of steps required to reach a target loss, meaning faster returns for the same compute.

    Third, update directions are more balanced. Orthogonalization suppresses the phenomenon of a few large-gradient dimensions dominating the update, which is equivalent to improving the condition number of the update matrix and has a positive effect on the stability of deep networks.

    Fourth, the computation shape is regular. It replaces many small operators with dense computation dominated by matrix multiplication, which more easily saturates compute and fits the partitioning schemes of tensor parallelism and pipeline parallelism.

    4. From Toy Scale to Industrial Scale: Three Hurdles to Clear

    The biggest skepticism in the original discussion is “it runs at small scale, but does it hold up at large scale?” Answering that requires facing three engineering realities.

    First, stability. Orthogonalization approximation iterations can be numerically unstable at very low precision, requiring a mixed-precision strategy: gradients and momentum accumulated at higher precision, orthogonalization iterations run at a safe precision, and a high-precision master copy of the weights retained.

    Second, partitioning consistency. Tensor parallelism splits a weight matrix into multiple shards; if each device orthogonalizes independently, the result is no longer equivalent to a global orthogonalization. Common handling is to perform the necessary communication and aggregation along the partitioned dimension, or to adjust the partitioning strategy so orthogonalization completes on the full matrix. This adds communication and must be traded off against the degree of parallelism.

    Third, parameter grouping and learning-rate scale. The scale of matrix-level updates differs from element-wise methods, so reusing the original learning rate often overshoots. In practice, learning rate, warmup, and weight decay must be recalibrated, and embeddings and the output head should keep an adaptive scheme better suited to them.

    5. A Practical Checklist

    • Reproduce at small scale first: align loss curves on a hundred-million-parameter model and confirm there is no gradient misalignment in the implementation.
    • Grouping strategy: route 2D hidden weights through the matrix-level path and all other parameters through the general adaptive path.
    • Precision strategy: accumulate momentum at high precision, run orthogonalization iterations at medium precision, and store the master weights at high precision.
    • Parallelism strategy: prioritize applying orthogonalization to the full matrix, accepting extra communication when necessary.
    • Monitoring metrics: beyond loss, track the orthogonality residual of the update matrix, gradient norms, and activation distributions to catch drift early.
    • Cost evaluation: measure gains by “total time to reach the target loss” rather than single-step time.

    6. Closing the Engineering Loop in the Cloud

    A matrix-level optimizer is only one part of training efficiency. Turning it into stable production capacity also requires complete cloud infrastructure: a container platform to run elastic training clusters with self-healing, object storage for checkpoints and datasets, a message queue to decouple data preprocessing from the main training pipeline, and logging and monitoring with alerts to track loss, throughput, and hardware health. Baidu AI Cloud offers a fairly complete combination of these general capabilities, making it easier for teams to move optimizer experiments into an engineering workflow that is reproducible, observable, and rollback-capable.

    7. Conclusion

    The value of matrix-level orthogonalized optimization is not to replace all adaptive methods, but to reduce optimizer state from a linear function of parameter count to a function of the number of matrices, and to raise the update direction from element-wise rescaling to an overall geometric constraint. For trillion-parameter training, combining this line of thinking with a mature cloud engineering system is the realistic path to converting memory budget into model scale and context capability.