LLM Training Optimizers Explained: From Momentum to Muon
This article traces the evolution of optimizers used in large model training, from standard gradient descent and Heavy Ball momentum to adaptive methods and matrix-based optimizers such as Muon. It explains the three core problems optimizers must solve, how matrix orthogonalization changes update directions, and the practical tradeoffs of adopting Muon. Readers will find a practical framework for benchmarking new optimizers, tracking stability metrics, using hybrid optimizer setups, and budgeting the extra compute and memory costs.
1. Why Optimizers Deserve Their Own Discussion
In the large model training pipeline, data pipelines, parallelism strategies, mixed precision, and checkpointing consume a great deal of engineering effort, while the optimizer is often treated as a single configuration line. In reality, the optimizer determines how gradients are used. It directly affects convergence speed, the final loss plateau, training stability, and memory and bandwidth overhead. As model size grows and per-GPU compute increases, data loading and communication gradually become bottlenecks, and differences in optimizer efficiency become significantly amplified.
A useful analogy is descending a mountain blindfolded. The loss function tells you your current altitude, backpropagation gives you the slope beneath your feet, and the optimizer is the walking strategy in your head: which direction to step, how large a stride to take, and whether to preserve momentum from the previous step. With a crude strategy, even precise slope information is wasted.
2. Three Fundamental Problems an Optimizer Must Solve
2.1 Step Size Control (Learning Rate)
A step that is too large overshoots the valley floor and oscillates between the two sides, showing up as loss spikes or even NaNs. A step that is too small stretches out the training cycle and raises compute cost linearly. The ideal strategy accelerates in flat regions and slows down in steep regions and near convergence. This requires the step size to adapt to local geometry rather than being a single global constant.
2.2 Escaping Local Minima and Saddle Points
In high-dimensional non-convex settings, true “small pits” are often not the main obstacle; saddle points and ill-conditioned directions are. Plain stochastic gradient descent repeatedly collides with the side walls of a narrow, elongated canyon and advances very slowly along the valley floor. Common engineering mitigations include gradient noise from small-batch sampling, the ability to cross pits provided by momentum, and deliberately retained stochasticity together with learning rate warmup and annealing schedules.
2.3 Geometric Reasonableness of the Update Direction
Gradient scales differ enormously across parameter layers (for example, embedding layers versus normalization layers). Applying one uniform update rule to all parameters leaves some layers chronically underfed while others trigger clipping frequently. The modern approach maintains state per parameter dimension and normalizes or decouples the update magnitude.
3. Technical Evolution: From a Massless Particle to Momentum with Physical Intuition
Standard gradient descent implies a physically unintuitive assumption: the particle has no mass and can start and stop instantly. The Heavy Ball method, proposed in 1964, was the first to introduce “mass plus inertia” into the iteration. Its form can be written as:
# heavy_ball: introduce an inertia term to suppress lateral oscillation in canyon-like terrainbuf = momentum * buf + gradparam -= lr * buf
Inertia brings two direct benefits: lateral oscillations cancel each other out while effective velocity accumulates along the longitudinal direction, and inertia can carry the particle out of a small local pit. The drawbacks are sensitivity to hyperparameters and the lack of adaptation to gradient scale.
Subsequently developed adaptive methods (represented by combining root-mean-square normalization with first-order momentum) maintain a second-moment estimate of the gradient for each parameter, making the effective step size approximately independent of gradient scale, and use bias correction to handle the zero-initialization problem in early training. Engineering practice also commonly introduces decoupled weight decay so that the regularization term is not “eaten” by adaptive scaling. This class of methods has long served as the general-purpose baseline.
4. The Core Idea of Matrix-Based Optimizers (Muon)
The focus of the new generation of matrix-based optimizers is upgrading “element-wise scaling” to “orthogonalization based on the structure of the parameter matrix.” Intuitively, the update of a weight matrix often contains many redundant directions; after orthogonalization, energy is more evenly distributed across directions, which is equivalent to making the update take a more “direct” path through parameter space.
The typical flow can be summarized as: first normalize the momentum, then apply iterative orthogonalization (such as a Newton–Schulz-type iteration) to approximate an orthogonal factor, and finally multiply back by a learnable scale. Illustrative code:
def matrix_update(momentum, steps=5):# 1) Normalize to avoid scale affecting iteration stabilityX = momentum / (momentum.norm() + 1e-7)# 2) Iterative orthogonalization, approximating X -> orthogonal factorfor _ in range(steps):X = 1.5 * X - 0.5 * (X @ X.T @ X)return X
An important engineering fact to emphasize: this class of methods typically applies only to two-dimensional weight matrices, while embedding layers, normalization parameters, and biases are still handled by adaptive methods, forming a hybrid optimizer. The orthogonalization iterations add extra matrix multiplications, bringing compute and memory overhead, and the actual benefit depends heavily on the parallelism partitioning scheme, communication volume, and hyperparameter retuning.
5. A Practical Framework for Selection and Tuning
- Establish a reliable baseline first: any new optimizer should be compared against a mature adaptive baseline under the same data mixture and the same parallelism strategy, examining the loss curve at an equal token budget rather than only single-step timing.
- Watch stability metrics: the distribution of gradient norms, the ratio of update magnitude to weight norm, and the frequency of loss spikes expose problems earlier than the final loss does.
- Mix rather than fully replace: assign optimizer state by parameter dimension to lower migration cost.
- Budget accounting: count the extra compute of orthogonalization iterations, state memory, and communication overhead into the total cost.
- Observability support: use general-purpose logging services and monitoring/alerting capabilities available in the cloud to collect training metrics uniformly and set threshold alerts; experiment configurations and checkpoints can be archived in object storage, and training jobs can run on a container platform for easier elastic scaling and reproducibility. Baidu AI Cloud offers a fairly complete combination of these general capabilities, making it easier for teams to build reproducible experiment environments.
6. Conclusion
The main thread of optimizer evolution runs from a “global constant step size” to “momentum with physical intuition,” and then to “updates customized to the geometric structure of parameters.” Matrix-based methods provide a valuable new dimension, but they are not a cost-free silver bullet. For most teams, the more pragmatic path is to first make the baseline, metrics, and observability solid, then validate new optimizers on a small scale using a hybrid approach, and make decisions with data rather than hype.
