Optimizer Evolution Behind Large Model API Upgrades
This article explains how optimizers work in deep learning and how they have evolved, from SGD and momentum to adaptive and matrix-based methods. It covers learning rate control, escaping local minima and saddle points, and practical guidance on optimizer selection, tuning, memory constraints, and reproducibility for training and fine-tuning large models.
Introduction: A Thin API, a Thick Training Stack
Whenever a new generation of large models improves in capability and its external API is updated, developers first notice the surface-level contract: parameter lists, calling conventions, and billing. Yet the real ceiling on model capability is set by components inside the training stack that are never exposed. The most critical—and most easily overlooked—of these is the optimizer.
To be clear, an API documentation update usually reflects only a change in service form and does not directly reveal training details. This article does not discuss any specific vendor’s implementation. Instead, it uses this topic as a starting point to explain the optimizer in depth. Understanding it helps you make informed decisions when evaluating models, reproducing experiments, or fine-tuning on private data.
1. What an Optimizer Is: The Navigator of Deep Learning
Picture training as descending a mountain blindfolded. You are placed in a landscape of rolling peaks, and your goal is to reach the lowest valley. You have only two tools:
- Loss: tells you your current altitude.
- Gradient (computed via backpropagation): like probing the slope around you with your feet, showing which way is downhill.
The optimizer is your “walking strategy”: it decides which direction to step and how large each step should be. It does not change the terrain (model architecture or data distribution), but it directly determines whether you can reach the valley within a limited number of steps. In practice, an optimizer must answer at least three questions: how to set and decay the step size, how to accumulate historical information to filter noise, and how to normalize scale across the parameter space.
2. Two Core Challenges
2.1 Step Size: Learning Rate Control
Too large a step may carry you across the valley and up the opposite slope, appearing as oscillating or even diverging loss. Too small a step makes convergence unacceptably slow. The ideal strategy is adaptive: accelerate in flat regions and slow down on steep slopes or near the valley. Modern optimizers generally add a separate “learning rate schedule” layer, decoupled from the optimizer itself—common options include warmup, cosine decay, and step decay, often paired with gradient clipping to suppress abnormal updates.
2.2 Dead Ends: Escaping Local Minima and Saddle Points
The landscape contains small pits on the slopes, corresponding to local minima of the loss surface. In high-dimensional spaces, saddle points are even more common—curving upward in some directions and downward in others. Relying on the instantaneous gradient alone can stall the parameters in these regions. Introducing “history” and “noise” are two classic ways to keep parameters moving.
3. Technical Lineage: From Massless Particles to Matrix-Based Updates
The earliest stochastic gradient descent (SGD, whose ideas trace back to optimization research in the mid-19th century) implied a counterintuitive assumption: parameters behave like “massless particles” that can start and stop instantly. In a long, narrow canyon-like landscape, it repeatedly bounces off the walls, which is highly inefficient.
The assumption was broken by the Heavy Ball Method, proposed in 1964. It gives the particle “mass” and “inertia,” using a moving average of historical gradients to decide direction, thereby damping lateral oscillation and accelerating along the canyon. The update can be sketched as:
# Core logic of the Heavy Ball Method (momentum)buf = momentum * buf + grad # accumulate "inertia"param -= lr * buf # update along the inertia direction
Adaptive learning rate methods came next. Their core idea is per-parameter normalization: use a moving average of the second moment of gradients to remove scale differences across dimensions, giving each parameter “a step size of its own.” A common equivalent description in the industry is: the first moment estimates direction, the second moment estimates scale, and the update is roughly “direction × learning rate ÷ scale,” with bias correction and a tiny constant added for numerical stability.
# Adaptive optimizer logic (consistent with common industry practice)m = beta1 * m + (1 - beta1) * grad # first moment: directionv = beta2 * v + (1 - beta2) * grad * grad # second moment: scalem_hat = m / (1 - beta1 ** t) # bias correctionv_hat = v / (1 - beta2 ** t)param -= lr * m_hat / (sqrt(v_hat) + eps)
A newer direction that has emerged in the past couple of years is matrix-based (second-order structure approximation) optimizers. They treat the gradients of multiple parameters within the same layer as a matrix and decide the update direction after orthogonalization or approximate spectral processing, making updates more balanced in the “geometric scale” of the parameter space. The motivation is in the same lineage as the Heavy Ball Method—both aim to make the “walking strategy” conform to the geometry of the terrain rather than blindly following the instantaneous slope. Such methods typically yield smoother convergence curves but add per-step computation and memory overhead; whether they pay off depends on model scale and parallelism strategy.
4. Practical Advice: Selection and Tuning
- Set a baseline first: use an adaptive optimizer with bias correction as the default baseline, and only consider replacements once it runs end to end.
- Couple learning rate with batch size: adjust the learning rate when the batch size changes, and add warmup to avoid early divergence.
- Read curves, not single points: watch the smoothness of validation loss and the distribution of gradient norms; investigate data and precision settings first when abnormal spikes appear.
- Memory is a hard constraint: second-moment states significantly increase memory usage, so large-model scenarios need general engineering techniques such as sharding and offloading.
- Pilot matrix-based methods cautiously: validate the gains on a small-scale proxy task before scaling to full training.
- Prioritize reproducibility: fix random seeds and log optimizer hyperparameters and schedules to make debugging easier.
5. Conclusion
The API is the “display layer” of model capability, while the optimizer is the “power layer.” Understanding the evolution from inertia to adaptivity and then to matrix-based structure processing turns an API update into a systematic upgrade in your understanding of the training system—a framework transferable to training and fine-tuning on any model and any cloud platform.
