Optimizer Evolution in the Long-Context LLM Era: A Closer Look at Muon

    This article examines how optimizer choices shape large language model training as context windows expand to million-token scale. It reviews the three core problems an optimizer must solve, traces the progression from plain SGD through momentum and adaptive methods, and explains how matrix-based momentum approaches such as Muon orthogonalize the momentum matrix for more balanced updates. It also covers engineering practices for long-context training and offers practical selection guidance.

    1. Background: Why Interface Upgrades Put Pressure on Training

    A recent preview release from an open-source model series came with public API documentation. The most talked-about capability was million-token-scale long context, along with improvements in inference efficiency. For users, changes at the API layer are only the visible result. What actually determines whether those capabilities can be delivered reliably is the optimization strategy used during training.

    Long context creates three kinds of direct pressure:

    1. As sequence length grows, the memory and compute cost of attention rises non-linearly.
    2. As parameter count grows, optimizer state memory can approach or even exceed the size of the model weights themselves.
    3. As training runs for more steps, the loss curve becomes more prone to spikes, oscillation, and divergence.

    So the optimizer is no longer a minor question of “how to walk downhill.” It is a core engineering variable that determines whether training finishes, stays stable, and stays cost-efficient.

    2. Three Problems an Optimizer Must Solve

    Using the classic blindfolded-descent analogy: the loss function tells you your current altitude, the gradient tells you the slope under your feet, and the optimizer decides the direction and size of each step. A mature optimizer has to handle three problems at once.

    2.1 Step Size Control (Learning Rate Scheduling)

    Too large a step overshoots the valley, causing loss oscillation or even divergence. Too small a step converges extremely slowly. The ideal behavior is to speed up in flat regions and slow down in steep ones, which requires an adaptive mechanism rather than a single global step size.

    2.2 Escaping Local Minima and Saddle Points

    The loss surface contains many shallow pits and saddle points. Relying on the instantaneous gradient alone can get stuck easily, so historical information or noise perturbation is needed to help cross them.

    2.3 Consistency of Parameter Updates

    Gradient scales differ enormously across parameter layers (for example, the embedding layer versus attention projection layers). Treating them uniformly tends to make some layers update too aggressively while others barely move.

    3. Technical Progression: From Massless Particles to Methods with Physical Intuition

    3.1 Stochastic Gradient Descent: The Massless Particle Assumption

    Standard gradient descent traces back to classical optimization ideas from the nineteenth century. Its implicit assumption is that the particle has no mass and can start or stop instantly. This performs very poorly in narrow canyon terrain: the update direction bounces back and forth between the two walls, and much of the effective descent speed is cancelled out.

    3.2 Momentum: Adding Physical Intuition of Inertia

    In the 1960s, researchers studying optimization theory proposed that giving the particle “mass” and “inertia” could significantly improve convergence in canyon terrain. This is the idea behind the Heavy Ball method, whose update can be abstracted as:

    1. # Illustrative pseudocode: momentum
    2. v = momentum * v + grad # accumulate historical direction to form inertia
    3. param -= learning_rate * v # update along the inertia direction

    The benefit of inertia is that lateral oscillation cancels out while the effective longitudinal component is accumulated and amplified. In practice the momentum coefficient is usually set near 0.9, with the exact value tuned to the task and data distribution.

    3.3 Adaptive Methods: Scaling Step Size per Parameter

    Later adaptive methods maintain a running estimate of the second moment of the gradient for each parameter and use it to scale the step size, so sparse or low-frequency parameters receive larger updates. These methods are widely adopted in deep learning practice, but the cost is that the number of optimizer states doubles, which significantly increases memory overhead.

    A general form looks like this:

    1. # Illustrative pseudocode: adaptive optimizer
    2. m = beta1 * m + (1 - beta1) * grad
    3. v = beta2 * v + (1 - beta2) * grad * grad
    4. m_hat = m / (1 - beta1 ** t)
    5. v_hat = v / (1 - beta2 ** t)
    6. param -= learning_rate * m_hat / (sqrt(v_hat) + eps)

    4. Matrix-Based Momentum Optimization (Muon-Style Methods)

    A class of newer optimizers that has drawn attention in recent training practice differs in one key way: it orthogonalizes or whitens the momentum matrix itself and uses that for the parameter update, instead of scaling element by element.

    4.1 Core Idea

    Orthogonalizing the momentum matrix is equivalent to projecting the update direction onto a more uniform distribution of directions, preventing a few singular directions from dominating the update. The intuitive effect is that update magnitudes are more balanced across directions, reducing training instability caused by an excessively large condition number in the weight matrix.

    4.2 Difference from Element-Wise Adaptive Methods

    • Element-wise methods: maintain second-order statistics for each scalar parameter, with fine granularity but large state overhead.
    • Matrix-based methods: process momentum at the matrix level, with relatively controllable state overhead, which fits better with large-scale workloads dominated by matrix multiplication.

    4.3 Engineering Implementation Notes

    • Applicable targets: mainly two-dimensional weight matrices; embedding layers, normalization layers, and biases usually still use general adaptive methods.
    • Compute cost: orthogonalization introduces additional matrix operations, so its impact on end-to-end throughput needs to be evaluated.
    • Numerical stability: it needs to be paired with gradient clipping, update magnitude constraints, and a reasonable warmup strategy.
    • Hybrid strategy: in practice, a combination of “matrix-based method + adaptive method” is common rather than a global replacement.
    1. # Illustrative pseudocode: matrix-based momentum update
    2. buf = momentum * buf + grad
    3. update = orthogonalize(buf) # orthogonalize the momentum matrix
    4. param -= learning_rate * update

    5. Supporting Practices for Long-Context Scenarios

    The optimizer cannot be tuned in isolation. It has to work together with the following engineering measures:

    1. Parallelism strategy: the combination of data parallelism, tensor parallelism, pipeline parallelism, and sequence parallelism determines how optimizer state is partitioned.
    2. Memory management: optimizer state offloading, recomputation, and low-precision state storage all affect convergence behavior.
    3. Monitoring and alerting: build monitoring and automatic rollback mechanisms for loss spikes, gradient norms, and update magnitudes.
    4. Data-side governance: bucketing and truncation strategies for long samples directly affect the upper bound of long-context capability.

    6. Selection Guidance and Conclusion

    • If you prioritize training stability and large-scale convergence efficiency, evaluate matrix-based momentum methods first, but always run small-scale controlled experiments beforehand.
    • When memory is tight, prefer options with lower state overhead, combined with state offloading and low-precision storage.
    • Any optimizer replacement should follow the experimental discipline of “single variable, reproducible, with a baseline.”
    • Improvements in interface capability are the combined result of training, data, and engineering optimization, and should not be attributed to a single technique.

    Overall, the main thread of optimizer evolution runs from “massless particles” toward methods with physical intuition and structural priors. Understanding this main thread is more valuable than memorizing any specific name.