Training Dynamics & the Edge of Stability
Large learning rates, sharpness and catapults.
Classical optimization theory says: keep the learning rate below , where bounds the curvature, and every step will lower the loss. Neural networks are routinely trained at learning rates that break this rule, and they train well. This lesson derives the stability threshold, then follows what happens beyond it: progressive sharpening and the edge of stability, the self-stabilizing mechanism behind them, and the catapult in which the loss spikes and the curvature collapses. It ends with what warmup, batch size and large learning rates do through curvature, and what that may mean for generalization.
What you’ll learn
- Derive the stability thresholds for gradient descent and for heavy-ball momentum, and explain why gradient descent can only settle stably at minima with sharpness at most .
- Describe progressive sharpening and the edge of stability, and derive the self-stabilization mechanism from a cubic Taylor expansion.
- Solve the catapult dynamics of a wide two-layer linear model exactly, and identify its lazy, catapult and divergent phases.
- Explain how warmup, batch size and large initial learning rates act through curvature, and separate what is established about generalization from what is debated.
Stability on a quadratic
Let with . A gradient step multiplies the error by , so in the eigenbasis each coordinate evolves on its own:
Every coordinate with shrinks if and only if . For it flips sign at every step while shrinking; above it grows geometrically along . The largest eigenvalue decides:
Heavy-ball momentum, , , gives per coordinate, with characteristic polynomial . Both roots lie inside the unit circle exactly when (for )
Near a minimum of a non-quadratic loss, linearize: a minimum is linearly stable for gradient descent with step only if its sharpness is at most . So gradient descent cannot converge to a minimum sharper than , except from exceptional starting points (the minimum itself, for one): the learning rate selects among minima. With mini-batches the condition also involves how much the per-example curvatures vary, so stochastic gradient descent is selective in a different way (Wu, Ma & E, 2018).
Progressive sharpening and the edge of stability
The classical guarantees (Convergence Rates of Gradient Descent) assume for the curvature bound of the whole path, which makes the loss decrease monotonically. Cohen, Kaur, Li, Kolter & Talwalkar (2021) measured what full-batch gradient descent actually does on standard networks (fully connected, convolutional and Transformer models, with squared or cross-entropy loss), and found two regularities:
- Progressive sharpening. The sharpness rises steadily during training, until it reaches (with cross-entropy loss it often drops again near the end of training).
- The edge of stability. It then stops rising, and instead of diverging, gradient descent keeps the sharpness hovering just above for the rest of training. The loss goes up and down over short timescales, yet keeps decreasing over long ones. Lower mid-run and the sharpness climbs to the new .
So for neural networks, the step size is not chosen to fit the curvature; the curvature adapts to the step size. The analog for adaptive methods holds for a preconditioned sharpness: for Adam with it equilibrates near , the stability threshold of the method (Cohen et al., 2022), though unlike gradient descent, Adam can keep advancing into higher-curvature regions while its preconditioner adapts.
Think first Where does Adam's threshold come from? (Adam's momentum is an exponential average, .)
An exponential average is heavy-ball momentum with the step rescaled: is the heavy ball with effective step . The heavy-ball condition gives , applied to the eigenvalues of the Hessian after preconditioning by Adam's per-coordinate scaling (treated as fixed, and ignoring the bias correction, which tends to 1).
Why does gradient descent not simply diverge once ? On a quadratic the curvature is fixed, so nothing can stop the growing oscillation. In a network the curvature depends on , and the oscillation itself moves to places where the curvature is lower.
Self-stabilization
Expand around a reference point where . Let be the top Hessian eigenvector and the gradient of the sharpness, and track two numbers: the displacement along the unstable direction, , and the excess sharpness, .
Along , a gradient step multiplies by . Above the threshold () the oscillation grows; below it, it shrinks:
The cubic term. A third-order Taylor expansion of the loss adds to the gradient, and is exactly the gradient of the top eigenvalue. So the oscillation itself produces a step down the sharpness gradient, of size proportional to . Meanwhile the rest of the gradient raises the sharpness at the progressive-sharpening rate . Assuming, as their sketch does, that , and with their normalization of :
The two equations form a negative feedback loop. Sharpness above makes the oscillation grow; a large oscillation drives the sharpness below ; then the oscillation decays and progressive sharpening resumes. Over a cycle the sharpness hovers at , and the drift of cancels when the average equals : the oscillation is exactly as large as needed to cancel progressive sharpening. Damian, Nichani & Lee prove that, under their assumptions, gradient descent at the edge of stability stays close to projected gradient descent on the set : an implicit bias toward stable, flatter regions.
A related line of work proves edge-of-stability behavior in simplified settings. Arora, Li & Panigrahi (2022) showed that normalized gradient descent, and gradient descent on , provably enter the edge of stability and then move along the manifold of minimizers by a deterministic flow that decreases the sharpness. In both pictures the instability is not noise to be tolerated: it is a mechanism that steers training toward flatter regions.
In the self-stabilization picture, what brings the sharpness back down after it overshoots ?
- The oscillation that builds up along the top eigenvector: through the loss's cubic term it adds to the gradient, so each step moves the parameters by , lowering the sharpness
- The noise of stochastic gradients
- An automatic reduction of the learning rate
- Weight decay shrinking the weights
Show the answer
A. The oscillation that builds up along the top eigenvector: through the loss's cubic term it adds to the gradient, so each step moves the parameters by , lowering the sharpness
The analysis is for full-batch gradient descent with a fixed step and no regularization. The oscillation is caused by the instability itself, and its square, through , pushes the parameters down the sharpness gradient until again.
Catapults: the large-learning-rate phase
Lewkowycz, Bahri, Dyer, Sohl-Dickstein & Gur-Ari (2020) found a model in which large-learning-rate training can be solved exactly: a two-layer linear network of width , , fitting one example with input 1 and target 0 under . Its neural tangent kernel is the scalar , which plays the role of the curvature.
Gradient descent updates and . Multiply out after the step:
Expand after the step in the same way; the cross terms contribute and the squared terms :
For large and , read off three phases. Lazy (): , and moves only by , the NTK regime. Catapult (): grows exponentially until is of order ; then the second equation, with , drives down until , and converges: the loss spikes, the curvature collapses, and training ends somewhere flatter. Divergent (): , so a growing raises , which makes grow faster.
In this model with and a large width, what is the largest learning rate at which training still converges?
Show the answer
2
. Between () and , training catapults: in a simulation with and , a step of drove the loss from about up to about before it fell to zero, and the curvature ended near , far below . A step of diverged. The peak loss is of order , so wider models spike higher.
Lewkowycz et al. found the same three regimes in realistic deep networks, with a narrow band of large but stable learning rates beyond the lazy phase, and the best test performance often inside that band. The catapult and the edge of stability can be read as two faces of one fact: gradient descent at a large step size reduces curvature until the step is stable.
Warmup, batch size and large learning rates
Warmup. Many models start training in regions of high curvature, where the learning rate that works well later would be unstable. A warmup raises gradually over the first steps (Goyal et al., 2017, used a linear warmup to train ImageNet models with very large batches). Gilmer et al. (2022) studied the Hessian across many tasks and found that successful choices of initialization, architecture and heuristics let the early trajectory avoid or escape high-curvature regions into flatter ones that tolerate larger steps; in their experiments warmup improved stability as much as batch normalization, layer normalization or Fixup. In the language of this lesson, warmup gives self-stabilization time to lower the sharpness before gets small.
Batch size. With mini-batches the stability condition tightens: each step uses a noisy Hessian, and the fluctuations add to the effective curvature. The smaller the batch, the smaller the largest stable step.
Large learning rates and generalization. Since gradient descent can only settle where the sharpness is at most , a large learning rate restricts training to flatter regions; Jastrzębski et al. (2020) found that the early learning rate shapes the rest of the trajectory: a large one reduces the variance of the gradient and improves the conditioning of its covariance, while a small one leaves the loss surface badly conditioned. Whether that helps generalization is a separate question.
Li, Wei & Ma (2019) constructed a two-layer setting where it provably does, and traced the effect to the order in which patterns are learned: a small learning rate first memorizes patterns that are easy to generalize but hard to fit, and then generalizes worse on patterns that are hard to generalize but easy to fit, while a large initial rate picks up the hard-to-fit patterns only after it is annealed. In CIFAR-10 experiments, a small patch added to the images was memorized at once by the small-learning-rate model but ignored by the large-learning-rate model until annealing, and it hurt the small-learning-rate model's accuracy on unmodified images. But flatness is not invariant under reparameterization, and no general theorem links sharpness to test error; the evidence is weighed in Why Big Networks Generalize.
Key takeaways
- On a quadratic, gradient descent converges iff , and heavy-ball momentum iff . Near a minimum this becomes a selection rule: gradient descent can only settle where the sharpness is at most .
- Full-batch training of networks shows progressive sharpening up to and then the edge of stability, where the sharpness stays near while the loss keeps falling, non-monotonically. Adam's analog equilibrates near for a preconditioned sharpness.
- Self-stabilization: growing oscillations along the top eigenvector, through the loss's cubic term, push the sharpness back below ; in effect, gradient descent tracks projected gradient descent on .
- In the two-layer linear model, and give lazy (), catapult () and divergent phases.
- Warmup lets curvature fall before large steps; smaller batches lower the stable step size; large initial learning rates reach flatter regions, and in some settings provably generalize better, but the link from flatness to generalization is not settled.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Gradient descent runs on a quadratic whose Hessian has largest eigenvalue 50. For which step sizes does it converge?
- Any , since the function is convex
Show the answer
B.
Convergence needs , i.e. . Between and the top coordinate overshoots and flips sign each step but still shrinks.
Heavy-ball momentum (, ) with runs on the same quadratic, . What is its stability limit?
- , the same as gradient descent
Show the answer
C.
The characteristic roots lie inside the unit circle iff , so . Momentum tolerates larger steps, at the price of slower, oscillating convergence near the limit.
A network trained at a step size of sits at the edge of stability, its sharpness near . You cut the step to and keep training with full batches. What did Cohen et al. (2021) observe in this experiment?
- The sharpness falls to about 50, to stay at the edge of stability
- The sharpness stays near 100 for the rest of training, since training is now stable
- Training diverges: the oscillation that held the sharpness down is suddenly too weak
- The sharpness starts rising again, up to the new threshold , and hovers there
Show the answer
D. The sharpness starts rising again, up to the new threshold , and hovers there
Halving doubles the threshold to . Gradient descent is stable again, so progressive sharpening resumes, and the sharpness climbs until it meets the new threshold (or training ends). At the edge of stability gradient descent acts like constrained optimization: the step size caps the sharpness, and the cap moves with .
In the two-layer linear model of Lewkowycz et al., with , you train with . What happens?
- The loss decreases monotonically and stays near 2, as in the NTK regime
- The loss diverges, because
- The loss first grows, then drops below and the loss converges to zero
- Nothing: the parameters do not move
Show the answer
C. The loss first grows, then drops below and the loss converges to zero
lies between 2 and 4: the catapult phase. makes grow until , the update then lowers until , and training converges in a flatter region.
Further reading
- J. M. Cohen, S. Kaur, Y. Li, J. Z. Kolter & A. Talwalkar, "Gradient descent on neural networks typically occurs at the edge of stability," International Conference on Learning Representations (ICLR) (2021).
- A. Damian, E. Nichani & J. D. Lee, "Self-stabilization: the implicit bias of gradient descent at the edge of stability," ICLR (2023).
- A. Lewkowycz, Y. Bahri, E. Dyer, J. Sohl-Dickstein & G. Gur-Ari, "The large learning rate phase of deep learning: the catapult mechanism," arXiv:2003.02218 (2020).
- Y. Li, C. Wei & T. Ma, "Towards explaining the regularization effect of initial large learning rate in training neural networks," Advances in Neural Information Processing Systems 32 (2019).
- J. Gilmer, B. Ghorbani, A. Garg, S. Kudugunta, B. Neyshabur, D. Cardoze, G. E. Dahl, Z. Nado & O. Firat, "A loss curvature perspective on training instabilities of deep learning models," International Conference on Learning Representations (ICLR) (2022).