Orply.

In Transformer Pretraining, Weight Decay Helps Control Effective Learning Rate

Tatsunori HashimotoStanford OnlineThursday, November 26, 202616 min read

Stanford computer science professor Tatsunori Hashimoto argues that deep-learning optimizers should be judged less by guarantees across all convex problems than by how efficiently they train neural networks. In a Stanford CS312 lecture, he uses a noisy quadratic model to explain why larger batches eventually yield diminishing returns and why momentum helps more at large batch sizes. He then argues that, in transformers, weight decay often matters because it controls weight norms and therefore the effective learning rate—a relationship Hyperball is designed to manage directly.

Deep-learning optimizers trade general guarantees for speed on a narrow problem class

Tatsunori Hashimoto frames optimization as central to model training: it determines how quickly loss falls, affects compute requirements, and can influence generalization. Changes from SGD to Adam and from Adam to Muon have brought meaningful improvements in training efficiency, particularly for large, compute-constrained language models. Hashimoto shows examples of optimizer comparisons in which training loss falls more efficiently with newer methods, and argues that robust improvements to optimizers would be valuable across machine learning.

That practical record sits uneasily beside the theory of first-order optimization. Classical methods are often designed for broad classes of convex problems and judged by how closely they approach an optimum. Deep-learning practice, Hashimoto argues, has different priorities. Training usually does not continue until a model reaches exact stationarity; the goal is to reach a useful solution quickly, despite irreducible uncertainty in the data. And the optimizer does not need to work for every objective. It needs to work for deep neural networks.

The familiar SGD update is simple: subtract the gradient, scaled by a learning rate. In practice, important choices extend well beyond that rule. Batch size changes the noise in the gradient estimate. Preconditioning rescales or transforms gradients, effectively changing the coordinates of the optimization problem. Momentum carries information from earlier gradients into later updates. AdamW combines momentum and preconditioning, then applies weight decay directly in the update rather than incorporating it into the loss. Its first-moment estimate tracks a decaying average of gradients; its second-moment estimate tracks squared gradients and scales the update. Hashimoto notes that with roughly constant gradients, the two estimates can cancel in a way that makes Adam behave like sign-based SGD.

These choices can produce different trajectories even on a quadratic loss. A high learning rate can cause divergence; preconditioning can reduce the back-and-forth motion of gradient descent in a narrow valley; momentum can accelerate progress when gradients keep pointing in a similar direction. The point is not that one ingredient is always best, but that their effects depend on the problem and on one another.

Hashimoto uses Adam’s convergence history to illustrate the difference in priorities. The original Adam paper’s convergence proof had a flaw, and for every choice of its beta parameters there is a convex example on which Adam does not converge. He describes a failure mode in which the method can cycle near a minimum: gradients become very small, the second-moment term affects the update, and the optimizer can be pushed away from the bottom. The sign-SGD analogy helps explain why: if updates continue to follow the sign rather than shrinking with the gradient magnitude, they can keep oscillating near a minimum. Hashimoto adds a qualification: with sufficiently high beta 2, Adam can be made to converge on every convex instance. But he does not treat the proof issue as a practical failure. Language models are not generally trained to first-order stationarity, and the aim is not to guarantee convergence on every convex instance.

An audience member notes that choosing hyperparameters after fixing a problem differs from choosing a problem after fixing the parameters. Hashimoto agrees that the distinction matters, while maintaining that choosing a parameter such as beta with some knowledge of the problem’s curvature is not unusual; he compares this to choosing a learning rate with knowledge of a smoothness bound. He uses Adam’s convergence issue less as a complaint than as an example of differing priorities: the practical objective is to find an optimizer that works well for the relevant problem class.

This specialization runs in both directions. Neural-network architectures can be designed to be easier for first-order methods to optimize; residual connections and layer normalization are examples Hashimoto cites. Then optimizers can be designed to exploit properties of those architectures, such as scale invariance. Understanding deep-learning optimization therefore requires more than asking which method has the best general convergence guarantee. It requires identifying the behavior that matters in a training run, then connecting it to the mechanics of the updates.

The noisy quadratic model explains why bigger batches eventually stop paying off

To study interactions among batch size, learning rate, momentum, and preconditioning, Hashimoto turns to the noisy quadratic model, or NQM. Its simplifying assumptions make it tractable: the quadratic loss is diagonalized, so each coordinate has its own curvature; gradient noise is Gaussian and aligned with those same coordinates; and averaging a batch of size B divides the noise variance by B. Each coordinate can then be analyzed separately.

The alignment assumption is doing important work. A general quadratic has directions of different curvature, and a general noise covariance need not point along those same directions. In the NQM, both are expressed in a shared coordinate system. That means updates in one coordinate do not become entangled with those in another, and the dynamics can be worked out coordinate by coordinate. Batching is also represented in a deliberately simple way: independent examples are averaged, so the variance in the gradient noise falls in proportion to the batch size. These assumptions make precise calculations possible; they are not a claim that neural-network training has exactly this structure.

The model makes important quantities solvable and offers predictions that Hashimoto says align reasonably well with experiments. Rather than finding an ideal optimizer for the toy problem, the analysis asks what familiar algorithms—plain SGD, momentum, and preconditioned SGD—do under its assumptions. More sophisticated methods could solve or improve the toy problem; the point is to understand the behavior of simple algorithms.

With a fixed learning rate and batch size, noisy SGD does not simply settle at the minimum. In each coordinate, the update combines a contraction toward the minimum with a random perturbation. The curvature determines how quickly the deterministic part contracts; the noise variance depends on the coordinate and falls as batch size increases. Expected risk approaches a steady state rather than zero. Hashimoto describes the resulting behavior as a stationary distribution around the minimum. In the NQM, the steady-state risk can be reduced by lowering the learning rate or increasing the batch size, but those choices affect how quickly the algorithm approaches the minimum. The analysis treats the learning rate and batch as coarse-grained controls rather than replacing SGD with a more elaborate method designed to eliminate both costs.

The resulting trade-off helps explain critical batch size. At small batch sizes, gradient noise is substantial. Increasing the batch reduces noise, allowing a larger learning rate and fewer steps to reach a target loss. But the learning rate cannot keep increasing indefinitely. For a quadratic, the maximum stable learning rate is 2 divided by the largest curvature. Beyond that limit, the updates diverge. Once the learning rate reaches this stability wall, further batch increases still reduce noise, but no longer permit the same increase in step size. The gains in steps to target then diminish sharply.

Hashimoto’s slide on batch size and learning rate illustrates this pattern: the learning rate rises roughly linearly with batch size until it reaches a stability wall, after which the steps-to-target curve shows diminishing returns. The transition is a soft limit on the value of batching, not a hard maximum batch size. When an audience member asks whether adding noise could help reach larger batches, Hashimoto says no: in this model, additional noise increases steady-state error without improving the expected convergence rate, and it does not move the stability wall. The wall comes from curvature. Increasing batch size helps by reducing noise; adding noise back does not change the underlying stability constraint.

The distinction between convergence and residual risk also gives a rationale for learning-rate schedules. An audience member observes that actual training can lower the learning rate near the end, making the steady-state term less important earlier in training. Hashimoto agrees: a larger learning rate can support faster early progress, then annealing it can reduce steady-state error later. He notes that this resembles the logic behind averaging and convergence results in convex optimization, even as it is used in deep-learning training.

Momentum has a more conditional role. Its behavior depends on whether a coordinate is overdamped or underdamped. In the overdamped regime, the trajectory descends comparatively smoothly. In the underdamped regime, it oscillates through the bowl. Momentum’s convergence is fastest near the transition between the two regimes. Far into the overdamped regime, Hashimoto says, momentum can be matched by plain SGD with a suitable effective learning rate. In the underdamped regime, oscillation can waste steps rather than speed convergence.

The most slowly converging coordinate matters when there are multiple curvatures and one momentum setting is shared across them. If all coordinates are underdamped, lowering momentum can improve them. But as momentum changes, a high-curvature coordinate may become overdamped and then start limiting convergence. The optimum therefore has at least one coordinate in the overdamped regime. The analysis holds momentum shared across coordinates; choosing different momentum values per coordinate would amount to a more elaborate, preconditioned method. Hashimoto’s point is not that momentum always accelerates every direction, but that a shared setting has to work across directions with different curvature.

The practical implication is a counterintuitive interaction with batch size. At small batches, noise pushes the learning rate down to keep steady-state error manageable. Momentum’s larger effective steps can then be counterproductive. At large batches, noise is lower, so there is room to take bigger steps; momentum can help reach effective step sizes that plain SGD cannot use without instability. In Hashimoto’s account, momentum’s benefit is not simply that it always makes progress faster. It becomes useful when the noise level and stability constraints leave room to exploit its larger effective steps.

Hashimoto points to experiments consistent with this pattern. In language-model and CIFAR-10 results from the NQM paper, methods were similar at low batch sizes, while momentum-based methods separated from SGD at larger batches. The charts compare steps needed to reach a target loss or accuracy across batch sizes. At small batches, the curves are close; at larger batches, methods such as heavy-ball momentum and Adam show larger gains. Hashimoto suggests that when gradients are very noisy, there is less useful structure for more sophisticated optimizer components to exploit. Once batching reduces that noise, their differences become clearer.

The experimental plots support a broad pattern, not every detail of the model. When asked how deeply the NQM analysis generalizes to nonlinear models, Hashimoto says he has concrete predictions that match language-model observations, but would put much less confidence in the model’s detailed phase diagrams lining up with language-model behavior. That distinction matters: the model is useful for deriving intuitions about batch, noise, and optimizer components, but it is not a complete account of neural-network training dynamics.

A paper on small-batch language-model training offers a related comparison. The slide Hashimoto discusses shows validation-loss curves for GPT-3 (1.3B) and GPT-2 (124M) trained with several optimizers at batch sizes 1 and 512. In the GPT-3 comparison, the authors’ batch-size-one SGD run roughly matches the AdamW training curve from the GPT-3 configuration; the slide caption says that at GPT-2 scale, tuned Adam and Adafactor at batch size one match AdamW at batch size 512. Hashimoto calls the results counterintuitive, but does not treat them as a practical recommendation. Batch size one is poor from a systems perspective, where large batches support parallelism; he also notes that it can be useful in data-constrained settings, a topic outside the lecture’s focus. The narrower point is that sophisticated optimizer components may matter less when the batch is very small and gradient noise dominates.

Preconditioning has a related trade-off in the NQM. The model considers a simple family in which the preconditioner is the Hessian raised to a power p. With no preconditioning, p is zero; with p equal to one, the quadratic is perfectly preconditioned. In the noiseless case, stronger preconditioning improves convergence by rescaling directions with different curvature. In the noisy case, that rescaling also affects noise: boosting a narrow direction’s update boosts the noise in that direction too. The convergence-rate term improves with stronger preconditioning, while the steady-state error can worsen.

As with momentum, large batches make the cost of noise amplification less consequential, allowing more of the convergence benefit to be used. Hashimoto returns to the batch-size plots to show that Adam’s preconditioning advantage, like momentum’s, appears more clearly at larger batches. The NQM offers a way to understand why changing noise levels can alter the trade-off.

The quadratic model remains a rough guide, not a complete description. Hashimoto contrasts its clean predictions with full-batch neural-network training curves in which higher learning rates produce jagged losses while still converging quickly. In the basic quadratic picture, without momentum, one expects smoother convergence or divergence, not strong oscillations alongside fast progress. He treats this as evidence that neural-network optimization has phenomena the simple model does not explain. The useful question is where its assumptions capture the behavior at hand.

Layer normalization turns weight growth into an effective-learning-rate problem

The lecture’s second thread starts with a training observation: transformer parameter norms tend to grow over time when weight decay is absent. Tatsunori Hashimoto proposes a mechanism based on the scale invariance introduced by layer normalization and RMS normalization. If a linear transformation is followed by a normalization operation, scaling the transformation’s weights up or down has little effect on the normalized output. The loss then depends weakly on the weights’ magnitude.

For a scale-invariant component, the gradient is tangent to the sphere of constant weight norm. A step along that tangent moves the weights away from the sphere, increasing their norm. Weight decay pulls them back. The two effects can balance at an equilibrium norm, whose value in the toy example depends on the learning rate and the weight-decay coefficient. Without weight decay, the norm can keep growing.

Hashimoto illustrates this with a simple two-dimensional example: parameters move around a direction favored by the loss, while their tangent updates increase the norm. Runs with different starting norms but the same weight decay move toward a shared equilibrium. A run without weight decay continues to drift outward. The equilibrium in the toy example depends on both the learning rate and weight decay, so changing either can change the norm trajectory.

Transformers are not completely scale invariant. Hashimoto distinguishes internal weights controlled by normalization from the output head, which feeds into the softmax and whose scale represents confidence. Embeddings may also carry useful information in their norms, and normalization parameters such as gamma control layer output scale. Many internal transformer weights are close enough to scale invariant for norm drift to matter. He notes that residual-stream scale and normalized query-key vectors are examples where the architecture makes scale less consequential, while the output head is not normalized in the same way.

The norm matters because it changes the size of subsequent updates. For the angular movement of scale-invariant weights, Hashimoto cites an effective learning rate proportional to the nominal learning rate divided by the squared parameter norm. As norms grow, the effective step shrinks. The loss may be nearly indifferent to the norm itself, yet optimization is not: uncontrolled norm growth gradually takes control away from the practitioner over the learning rate.

That loss of control is visible even when the nominal schedule is explicit. In the toy example, a changing learning rate shifts the equilibrium norm the system would approach at a fixed rate. The actual norm can lag behind that moving target. Because the norm is larger than the target in the illustrated trajectories, the effective learning rate can fall below the nominal schedule. Weight decay can therefore affect the path of optimization not only by shrinking parameters, but by influencing the norm that modulates future angular steps.

This also clarifies why weight decay can matter even when the aim is not to regularize model complexity. In one-pass training regimes, Hashimoto argues, weight decay primarily controls the effective learning rate by controlling norms. Changing weight decay can therefore have an effect similar to changing the learning rate. He points to earlier work connecting learning rate, regularization, and parameter norm, and to an experiment on one-pass language-model training in which weight decay was removed while the effective-learning-rate trajectory associated with the original run was replayed. The resulting loss curves reportedly tracked the weight-decay run, supporting the view that effective step size explains much of weight decay’s effect in that setting.

Hashimoto notes that weight decay has other effects, including on the Jacobian norm, which he does not discuss here. His narrower point is that in one-pass pretraining, its role in controlling effective learning rate can be central enough that tuning weight decay resembles tuning the learning rate.

A changing learning-rate schedule complicates the balance. At a fixed learning rate, the toy system has a corresponding equilibrium norm. If the learning rate changes, the target equilibrium changes too, and the actual norm may lag behind it. One proposed response, associated in the lecture with AdamC, is to make weight decay change with the learning rate: set the current decay coefficient to the base decay coefficient multiplied by the current learning rate divided by the maximum learning rate. Hashimoto presents this as a way to keep the gradient-to-weight ratio, and thus the norm equilibrium, more nearly constant as the schedule changes. He says the approach produced gains in the work he cites.

A more direct way to control norms is Hyperball, which wraps a base optimizer such as AdamW or Muon. In the general wrapper, the base optimizer proposes an update; the update direction is normalized; a step is taken using the chosen radius and learning-rate schedule; and the resulting parameter matrix is projected back onto a sphere of radius R. A reasonable default is to set R to the Frobenius norm of the matrix at initialization.

The lecture’s application does not project every parameter in the model. Hashimoto says to leave embeddings, normalization gains, and the output head unprojected. The output head’s norm carries information about confidence; normalization gains control layer output scale; and embedding norms may carry useful information. The projected weights are the internal MLP and attention weights, which are more tightly controlled by normalization. This distinction is central to the method as presented: a general optimizer wrapper can be applied to a parameter matrix, but the lecture’s model-specific choice is which matrices to constrain.

The rationale is to keep norms fixed where scale is largely irrelevant to the loss but still affects the update size. Hyperball does not simply project the whole model onto a unit ball: the radius is set per matrix, and some parameter groups remain unconstrained. Its basic form normalizes the proposed update direction, then returns the updated matrix to its prescribed radius.

Hashimoto reports that the Hyperball variants AdamH and MuonH performed consistently better at scale in the results shown. The slide compares final loss across model sizes and training curves for an 8B model; it also shows the norm of the value-projection weights staying controlled under Hyperball, while standard AdamW’s value-projection norm is not constrained in the same way. That chart illustrates the norm behavior of the plotted parameter group, not a measurement of every model weight. Hashimoto describes the loss differences as small but potentially meaningful, and points out that Hyperball weights remain at their initialization norms by construction. When asked about a late change in the AdamW curve, he attributes it to the learning-rate schedule.

The lecture’s hyperparameter-transfer figure varies depth from 4 to 512 layers at fixed width and training tokens, plotting final validation loss against learning rate for AdamW, Muon, and their Hyperball variants. In the displayed results, the best learning rate drifts less for Hyperball variants—about 1.4 times across the depth range—than for AdamW and Muon, whose drift is shown as roughly two to four times. Hashimoto cautions that transfer is not perfect: the same hyperparameters do not work unchanged across every setting. The method is, in his account, more robust and forgiving.

~1.4×
reported optimal-learning-rate drift for Hyperball variants across depths 4–512

A related study presented in the lecture also reports benefits from controlling magnitude and direction, with experiments that Hashimoto says broadly align with the Hyperball results. He uses this convergence of related approaches to make a broader point: seemingly minor observations about norm curves can lead to consequential optimizer changes. Hyperball’s rationale depends on properties of transformer architectures, especially the role of normalization and scale. It is an example of the design loop Hashimoto emphasizes: understand how a model’s structure shapes optimization, then build an optimizer that uses that structure.

The frontier, in your inbox tomorrow at 08:00.

Sign up free. Pick the industry Briefs you want. Tomorrow morning, they land. No credit card.

Sign up free