LLM Training Optimizers Explained: From SGD to Muon and Matrix-Based Updates
This article traces the evolution of optimizers used in large language model training, from plain stochastic gradient descent and momentum methods to adaptive optimizers and the newer matrix-based approach represented by Muon. It explains the three core problems optimizers must solve, how each generation addresses them, and why optimizer choice shapes what a model can achieve under a fixed compute budget. Practical engineering guidance and common pitfalls are included for teams running distributed training.
1. Why Interface Capabilities Come Down to an Optimizer Contest
When people discuss a new generation of LLM APIs, the conversation usually centers on context length, structured output, and call stability. What actually sets the ceiling on those capabilities is the optimizer and parallelism strategy used during training. The interface is only the external surface; training efficiency determines how many iterations you can run on a given compute budget and how low you can push the loss. Understanding optimizers is therefore a prerequisite for understanding why a newer model is stronger.
Think of training as descending a mountain blindfolded. The loss function tells you your current altitude, the gradient tells you the slope under your feet, and the optimizer is the strategy in your head: it decides which direction to step, how large the step should be, and whether you are allowed to carry momentum across a flat stretch or a long narrow valley. The quality of that strategy shows up directly in convergence speed, stability, and final accuracy.
2. Three Core Problems an Optimizer Must Solve
- Step size control (learning rate scheduling). Steps that are too large overshoot the valley floor, causing the loss to oscillate or diverge; steps that are too small stretch the training cycle indefinitely. The ideal strategy accelerates in flat regions and slows down in steep regions or near a minimum.
- Escaping local minima and saddle points. High-dimensional non-convex spaces contain many small pits partway up the slope and saddle points where the gradient is close to zero. Relying only on the instantaneous gradient direction makes it easy to get stuck.
- Uneven parameter scales. Gradient magnitudes differ enormously across layers and parameters, so a single uniform step size makes some parameters oscillate while others barely move.
3. Technical Lineage: From Naive Descent to Temporal Smoothing
The idea of stochastic gradient descent traces back to mid-nineteenth-century research on finding extrema. Its update depends only on the current gradient estimate, which is equivalent to a “massless particle”: it can start and stop instantly. That contradicts physical intuition, and in long narrow valley-shaped terrain it bounces back and forth between the two walls, making effective forward progress very slow.
In 1964, the Soviet mathematician Boris Polyak proposed the heavy ball method, which introduced “mass” and “inertia.” It replaces the instantaneous gradient with a moving average of historical gradients, giving the parameter update momentum so it can accumulate speed along the main axis of a valley and suppress lateral oscillation. The update can be written as:
# Core form of the heavy ball / momentum method (illustrative)v = mu * v + lr * grad # inertia term accumulates historical directionparam -= v # update along the accumulated direction
The momentum method developed later decouples the coefficient into a “momentum term plus current gradient,” which makes the hyperparameters clearer in meaning. It remains one of the basic building blocks of LLM training today.
4. The Adaptive Era: A Cheap Approximation of Second-Order Information
The real turning point was giving each parameter its own effective step size. Adaptive optimizers represented by root-mean-square normalization maintain a moving average of squared gradients and rescale gradients element by element, which mitigates the uneven parameter scale problem. Adding bias correction and decoupled weight decay produced what is now the de facto default configuration for LLM training. In engineering practice, this is usually combined with:
- Learning rate warmup, to avoid large early gradients destroying the initialization;
- Cosine or linear decay, to ensure fine convergence in later stages;
- Gradient clipping, to limit update explosions caused by outlier samples;
- Mixed precision and loss scaling, to reduce memory and bandwidth pressure.
The pseudocode looks like this:
m = beta1 * m + (1 - beta1) * gradv = beta2 * v + (1 - beta2) * grad * gradm_hat = m / (1 - beta1 ** t)v_hat = v / (1 - beta2 ** t)param -= lr * (m_hat / (sqrt(v_hat) + eps) + wd * param)
These methods are essentially a diagonal approximation built from first-order information. They are cheap and robust, but they make no use at all of the directional structure between parameters.
5. Matrix Optimizers: Treating the Update as a Matrix Problem
The core breakthrough of the newer generation of optimizers is treating a layer’s gradient as a matrix rather than a long list of independent scalars, and orthogonalizing the update (approximating zero singular values with singular values evenly distributed) so that the update scale becomes roughly consistent across all directions. The intuitive effect is that the update is no longer dominated by a few principal directions, the “valleys” in parameter space are flattened, and the same compute budget often reaches a lower loss in fewer steps.
The structure can be summarized in three steps:
G = compute_grad(layer) # gradient matrix of shape m x nO = orthogonalize(G) # iterative approximation replaces expensive SVDparam -= lr * (O + wd * param) # orthogonalized direction + decoupled decay
The key point is approximating orthogonalization with a few Newton iterations, reducing the complexity from the cubic cost of a full singular value decomposition to the same order as matrix multiplication. It is also naturally suited to tensor parallelism and distributed sharding. In addition, momentum and adaptive scaling are folded into the same set of matrix operations, which reduces the size of optimizer state held in memory.
6. Engineering Recommendations and Common Pitfalls
- Set learning rates per layer. Matrix-based updates generally do not apply to embedding layers, normalization layers, or the output head, which should keep the existing adaptive strategy.
- Tune the number of orthogonalization iterations empirically. Too few gives large approximation error; too many eats into the parallel gains.
- Coordinate with the parallelism strategy. The choice of sharding dimension directly affects the communication volume of orthogonalization, so benchmark against your cluster topology.
- Put monitoring in place early. Beyond loss, watch gradient norms, update norms, and activation distributions to catch divergence sooner.
- For cloud-based practice, use a container platform to run distributed training, with object storage for checkpoint persistence and logging plus monitoring and alerting services for observability, so long-running jobs do not fail silently.
7. Summary
The main thread of optimizer evolution runs from the “massless particle” to the “heavy ball with inertia,” then to “per-parameter adaptivity,” and now toward “matrix-structure awareness.” Understanding that thread lets you shift your focus from parameter count to training methodology and compute efficiency when evaluating the interface capabilities of a new model generation, leading to better engineering decisions in model selection, fine-tuning, and inference deployment.
