Breaking the Memory Wall in Large-Scale Training: A Deep Dive into Matrix Optimizers Like Muon

    This article explains why optimizer state memory becomes a bottleneck in trillion-parameter training and how matrix-based optimizers such as Muon address it. It covers the memory cost of element-wise adaptive optimizers, the shift to whole-matrix updates with a single momentum buffer and orthogonalization, the numerical rationale based on condition numbers, industrial-scale validation and engineering concerns, and a practical checklist for measuring, mixing, and monitoring optimizer choices.

    Breaking the Memory Wall in Large-Scale Training: A Deep Dive into Matrix Optimizers

    1. Background: Why the Optimizer Becomes the Bottleneck

    When people discuss trillion-parameter models, the conversation usually starts with attention architecture, data mixtures, and parallelism strategies. A more basic question gets skipped: how much memory do the optimizer states themselves consume?

    Element-wise adaptive optimizers have long been the default. The idea is to maintain two statistics per parameter, a first moment and a second moment, and scale the step size for each coordinate independently using a moving average of historical gradients. This design gives excellent convergence robustness, but it also means memory overhead grows linearly with parameter count, with a constant that is not small.

    Take mixed-precision training and do a rough order-of-magnitude estimate:

    • The weights themselves: about 2 bytes per parameter;
    • Gradients: about 2 to 4 bytes per parameter;
    • First moment plus second moment: typically 4 bytes each if kept in fp32.

    That is 8 bytes per parameter for optimizer state alone. For a 1.6T-parameter model, this approaches 13TB of memory, which only fits with sharding and offloading. The consequences cascade: less room for the micro batch, a higher ratio of activation recomputation, harder context-length scaling, worse communication and pipeline bubble ratios, and ultimately a significantly higher training cost per token.

    The key takeaway is not that adaptive optimizers are bad. It is that their memory cost model is tightly coupled to parameter scale, so marginal returns diminish at extreme scale.

    2. The Shift: From Element-Wise Optimization to Whole-Matrix Optimization

    Matrix optimizers, represented by methods such as Muon, change the level of abstraction. Instead of treating weights as N unrelated scalars, they treat each layer’s weights as a high-dimensional geometric object, a matrix, and decide the update direction for that matrix as a whole.

    An analogy makes the difference clear:

    • An element-wise adaptive optimizer is like a crowd of soldiers each acting on their own, choosing stride length from their own history: flexible, but hard to coordinate;
    • A matrix optimizer is like a formation marching in step: align the formation first, then advance together, with low coordination overhead and a consistent direction.

    In engineering terms, this change brings two direct benefits:

    1. Less state: no second moment per parameter is needed, momentum state is usually a single buffer, and optimizer memory drops from the 8-bytes-per-parameter range to the 2-to-4-bytes-per-parameter range;
    2. Cleaner updates: orthogonalizing the matrix composed of gradient and momentum flattens the singular values of the update matrix, avoiding training oscillation caused by a few directions taking oversized steps.

    Illustrative pseudocode (structure only, not a specific implementation):

    1. # Element-wise adaptive: two states per parameter
    2. m = beta1 * m + (1 - beta1) * g
    3. v = beta2 * v + (1 - beta2) * g * g
    4. w -= lr * (m / (sqrt(v) + eps))
    5. # Matrix-based: one momentum buffer plus orthogonalization
    6. buf = momentum * buf + g # same shape as the weight matrix
    7. update = orthogonalize(buf) # polarize the matrix into orthogonal/semi-orthogonal form
    8. w -= lr * update

    Here orthogonalize intuitively means taking the polar decomposition of the matrix and keeping its orthogonal factor, which is equivalent to setting all singular values of the update matrix to 1. Implementations usually avoid a full SVD and use a Newton–Schulz-type iterative approximation instead, because it is friendly to matrix multiplication and runs well under tensor parallelism and low precision.

    3. Why Orthogonalization Works: Convergence Through the Lens of Condition Number

    Orthogonalization is not an aesthetic choice about tidying the formation. It has a clear numerical basis.

    The condition number of a matrix, the ratio of the largest to the smallest singular value, determines how much the effective step size of gradient descent varies across that subspace. A larger condition number means some directions step too far while others barely move, and convergence is held back by the slowest direction. Orthogonalizing the update matrix forces all directions to advance with the same step size, which is effectively an implicit preconditioning of that layer.

    This also explains why the gains show up mainly in hidden-layer weight matrices: embedding layers, output heads, and parameters with strong sparsity have different gradient distributions and geometric meaning, so keeping element-wise adaptive updates there is usually safer. The common industry practice is a hybrid approach: matrix updates for the bulk of hidden layers, adaptive updates for boundary layers, balancing stability and memory.

    4. From Toy Scale to Industrial Scale: Objections and Responses

    Early on, these methods showed step-count advantages only in small-model races at the hundred-million-parameter scale, which drew a sharp objection: does speedup at small scale extrapolate? Gradient noise, scale differences across layers, and parallel partitioning all change behavior in large-model training, so does the “formation” turn into rigid dogma?

    Industrial deployment answers on four points:

    1. Scale extrapolation validation: scaling experiments from the billion to the hundred-billion parameter range confirm that the speedup ratio and stability do not collapse with scale;
    2. Numerical stability engineering: error accumulation from orthogonalization iterations under low precision must be controlled, usually by keeping a small amount of high-precision accumulation and trading off iteration count (too few is inaccurate, too many cancels out the memory gains);
    3. Hyperparameter transfer: the learning-rate scale of matrix updates differs from adaptive methods and needs recalibration, together with warmup and decoupled weight decay;
    4. Coordination with parallelism: orthogonalization acts on a single weight matrix, so the tensor-parallel partitioning scheme affects its correctness. The partitioned matrix must remain semantically complete, or the partitioning dimension must be adjusted.

    5. Recomputing the Memory Ledger: Where the Savings Go

    If optimizer state drops from 8 bytes per parameter to 4 bytes per parameter, a 1.6T model frees up several terabytes of memory. Reasonable uses for that budget include:

    • Raising the micro batch to improve arithmetic intensity and hardware utilization in matrix multiplications;
    • Relaxing the activation recomputation policy to reduce wasted compute from repeated forward passes;
    • Extending context length without immediately increasing the degree of parallelism;
    • Reducing reliance on host-side parameter offloading and easing PCIe and interconnect bandwidth pressure.

    It is worth stressing that end-to-end throughput gains are not automatic. They depend on whether the original bottleneck was memory capacity. If the bottleneck is communication or compute, memory saved by the optimizer only becomes extra parallelism headroom rather than linear speedup.

    6. A Practical Checklist

    • Measure before replacing: quantify the actual share of optimizer state, activations, and fragmentation, and confirm whether memory is the binding constraint;
    • Layered hybrid strategy: matrix updates for hidden layers plus adaptive updates for boundary layers is a fairly stable default starting point;
    • Small-scale extrapolation curves: first plot loss-vs-steps and loss-vs-compute curves in the 0.1B to 1B range, then decide whether to scale up;
    • Monitor numerical health: track gradient norms, update matrix norms, and orthogonalization iteration residuals, and fall back to adaptive updates when anomalies appear;
    • Running on the cloud: training jobs can run on a container platform, with object storage holding checkpoints and datasets, plus logging and monitoring with alerting to observe throughput, memory, and loss curves for reproducible experiment management.

    7. Summary

    The value of matrix optimizers is not “smarter math.” It is a different memory cost model: from a two-state structure linearly coupled to parameter count to a single state plus one matrix orthogonalization. It demotes the optimizer from a primary cost item to a secondary one, giving batch size, context length, and parallelism strategies room to be tuned again. For teams preparing to push into large-scale training, what deserves investment is a rigorous set of scaling experiments and numerical monitoring, not a blind optimizer swap.