Optimizers Behind Long-Context LLMs: From Gradient Descent to Muon
This article traces the history of neural network optimizers, from gradient descent and momentum methods to adaptive optimizers such as Adam and AdamW. It then explains Muon, which orthogonalizes weight updates with Newton-Schulz iteration, and covers its advantages for large-scale training and what engineers can take from these developments.
1. Starting from an API Document: Context Length Is Not the Only Story
A major LLM provider recently released preview documentation and an API for its next-generation model. Features such as ultra-long context and agent capabilities drew wide discussion. Most developers focus on what the model can do. For machine learning engineers, a more useful question is how such a model was trained efficiently.
When training a very large model can cost tens of millions of dollars, each percentage point of training efficiency saves a substantial amount of compute. One of the core components that determines training efficiency is the optimizer, which is often treated as infrastructure. The most closely watched optimizer development in the industry recently is the large-scale use of Muon, a new optimizer, in mainstream LLM training. This article uses Muon as a starting point to review the technical history of optimizers.
2. What an Optimizer Does: A Navigation Strategy for Deep Learning
To understand optimizers, we can use the classic “walking downhill” analogy. Imagine you are blindfolded in a mountain range, and your goal is to reach the lowest point of a valley. You have two tools:
- Loss function: tells you your current altitude.
- Gradient (computed by backpropagation): like probing the ground with your foot to sense its slope, it tells you which direction leads downhill.
An optimizer is the decision strategy. It determines which direction to step next and how far to go. An optimizer typically answers three questions.
1. How big a step to take: learning rate control
Mathematically, step size corresponds to the learning rate. A step that is too large may carry you past the valley floor and up the opposite slope, causing the loss to oscillate and fail to converge. A step that is too small makes training unacceptably slow. A good optimizer adjusts step size adaptively. It speeds up on flat ground and slows down carefully on steep slopes or near the bottom. This is the motivation for adaptive learning rate methods, the family of algorithms that scale step sizes based on the history of squared gradients.
2. How to avoid getting stuck in small pits: escaping local minima
Real loss surfaces contain many local minima, which are like small pits on a mountainside. If you only follow the instantaneous gradient, you can easily fall into one and mistakenly believe you have reached the bottom. The optimizer needs a mechanism that helps parameters cross shallow pits and keep exploring toward deeper valleys.
3. Is the update direction reliable: processing and correcting gradients
Raw gradients are often noisy, because mini-batch sampling introduces variance. They are also anisotropic, because gradient scales differ greatly across parameters. Modern optimizers commonly preprocess gradients, for example with momentum smoothing or second-moment normalization, before determining the final update direction. This is where Muon comes in, as discussed later.
3. From a Massless Particle to a Heavy Ball: The Birth of Momentum
The earliest optimization method was stochastic gradient descent (SGD), whose idea can be traced back to the steepest descent method proposed by Cauchy in 1847. Standard gradient descent, however, implicitly assumes that parameters behave like a massless particle that can start and stop instantly. This conflicts with physical intuition.
In 1964, the Soviet mathematician Boris Polyak, while studying optimization theory, noticed a problem. In narrow, valley-shaped terrain, where curvature differs greatly across directions in the loss surface, standard gradient descent bounces back and forth between the valley walls and advances in a zigzag pattern. This is very inefficient. He proposed an improvement with strong physical intuition: give the particle mass and inertia. This became the well-known Heavy Ball Method:
v_t = β · v_{t-1} + ∇L(θ_t) # accumulated velocity (inertia)θ_{t+1} = θ_t − η · v_t # update parameters using velocity
Here, β is the momentum coefficient. With inertia, oscillations along the narrow axis cancel out and decay, while progress along the long axis accumulates and speeds up. This idea later evolved into SGD with momentum and inspired variants such as Nesterov accelerated gradient.
Optimizer development then proceeded along two main paths. The first is the adaptive learning rate path. It maintains a separate learning rate scale for each parameter, based on estimates of the first and second moments of historical gradients. This path culminated in Adam and its corrected version, AdamW, which are now the de facto standard in deep learning. The second is the structured update path, which has regained attention in recent years. Instead of scaling gradients element by element, it designs update rules from the overall geometric structure of parameter matrices. Muon is a representative of this path.
4. The Core Idea of Muon: Orthogonalizing the Update Matrix
Muon (MomentUm Orthogonalized by Newton-Schulz iteration) is motivated by a simple observation. Neural network weights are two-dimensional matrices, but traditional optimizers such as SGD and AdamW treat them as collections of independent scalars and ignore their spectral structure. When the singular values of a gradient matrix are highly uneven, the update direction is dominated by a few large singular values, and the parameter update becomes skewed.
Muon approximately orthogonalizes the momentum-accumulated update matrix. Mathematically, this means computing the semi-orthogonal factor of the matrix, also called the orthogonal polar factor, so that the singular values of the update are pushed toward 1. A typical workflow looks like this:
# Illustrative pseudocodem = beta * m + grad # accumulate momentumU = newton_schulz(m, steps=5) # approximate orthogonalization via Newton-Schulz iterationparam -= lr * scale * U # apply the update
The Newton-Schulz iteration is an algorithm that uses only matrix multiplications. A few rounds of matrix products and additions or subtractions approximate the orthogonalized result. This makes it well suited to efficient GPU execution, and it avoids the expensive full SVD decomposition.
This design has several properties worth noting:
- More balanced updates: After orthogonalization, the step size is consistent across all singular directions. This reduces the problem of ill-conditioned curvature and works as a low-cost approximation of second-order information.
- Decoupling from parameter shape: The effective step size of element-wise optimizers depends on the gradient scale of each parameter. The spectral norm of an orthogonalized update is controllable, so learning rates transfer more easily across layers and matrices. The cost of hyperparameter tuning drops significantly.
- Engineering friendliness: Newton-Schulz iteration requires only matrix multiplication, so it fits naturally into tensor parallelism and distributed training pipelines. In practice, Muon is typically applied to the two-dimensional hidden-layer weights of a network. Embedding layers, normalization parameters, biases, and similar parameters are still handled by AdamW, forming a hybrid optimizer configuration.
To be objective, Muon did not appear from nothing. Its ideas are rooted in earlier work on spectral normalization, second-order methods such as Shampoo, and preconditioned optimizers based on matrix factorization. Its real contribution is bringing structured updates into production-scale training of models with hundreds of billions of parameters or more, at very low computational overhead. Public experiments have shown sample efficiency advantages at large scale. For teams with limited training budgets, this matters: the same compute can yield a lower final loss.
5. Implications for Engineering Practice
For developers who want to benefit from large model training or fine-tuning, several general lessons stand out:
- Understanding optimizers matters more than blind hyperparameter tuning: The coupling among learning rate, momentum, and weight decay determines training stability. When switching optimizers, previous hyperparameter experience often does not transfer directly.
- Structured updates are a trend: Optimizers are moving from element-wise adaptation toward matrix-level preconditioning, which exploits the geometric structure of parameters. Co-designing optimizers with model architecture, for example adjusting layer width ratios or initialization schemes for a specific optimizer, is worth watching.
- Consider system efficiency across the full training pipeline: Optimizer compute overhead must be evaluated together with memory usage and communication patterns. In practice, general-purpose cloud platforms offer container services, object storage, and monitoring and alerting. These help teams build reproducible, observable training pipelines so they can focus on the algorithms.
6. Conclusion
From Cauchy’s steepest descent, to Polyak’s inertia-based heavy ball, to Muon with its matrix orthogonalization at the core, more than 170 years of optimizer development have followed one simple question: how to make parameters move more stably and faster across complex loss surfaces. Behind long-context models and agent capabilities are many such invisible infrastructure innovations. Understanding them is a necessary step for every deep learning engineer moving from using off-the-shelf tools to building their own.
