Subscribe
AI
8 min read

The Edge of Stability: How Progressive Sharpening and Hessian Dynamics Govern Deep Learning Optimization

Classical optimization theory suggests that large learning rates cause divergence, but modern deep networks enter a stable "Edge of Stability" regime. This post explains how progressive sharpening increases local curvature until it hits a threshold, where self-stabilization via cubic curvature…

Diagram illustrating the Edge of Stability regime showing Hessian eigenvalues hovering above the instability threshold while loss continues to decrease
Diagram illustrating the Edge of Stability regime showing Hessian eigenvalues hovering above the instability threshold while loss continues to decrease

The Edge of Stability (EoS) is a training regime in deep learning where gradient descent operates with large learning rates such that the top eigenvalue of the loss Hessian hovers just above the theoretical instability threshold of 2/eta. Rather than diverging, the network enters a stable limit-cycle or chaotic oscillation along the dominant curvature direction, allowing for steady optimization progress on long timescales despite non-monotonic behavior on short timescales.

In classical convex optimization, the behavior of gradient descent is dictated by the Lipschitz smoothness constant of the objective function. If a function f(θ)f(\theta) has an LL-smooth gradient—meaning the largest eigenvalue of its Hessian matrix is bounded by λmax⁡(∇2f(θ))≤L\lambda_{\max}(\nabla^2 f(\theta)) \le L—gradient descent with learning rate η\eta is guaranteed to monotonically reduce the loss if and only if η<2/L\eta < 2/L. When the step size exceeds this threshold (η>2/λmax⁡\eta > 2/\lambda_{\max}), standard quadratic approximations predict catastrophic divergence, with the parameter trajectory oscillating outward toward infinity.

Modern deep neural networks systematically violate this classical stability criterion without diverging. Across architectures spanning convolutional networks, multi-layer perceptrons, and transformers, full-batch and large-batch gradient descent routinely enter a training regime termed the Edge of Stability (EoS). In this regime, the top eigenvalue of the loss Hessian rises to and hovers directly above the theoretical instability threshold 2/η2/\eta. Instead of blowing up, the network enters a stable limit-cycle or chaotic oscillation along the dominant curvature direction on short timescales, while continuing to make steady optimization progress on long timescales.

Understanding the Edge of Stability resolves long-standing questions regarding why deep networks tolerate large learning rates, how gradient descent navigates non-convex loss surfaces, and why optimization dynamics exhibit an implicit bias toward flatter, generalizable minima.

1. The Classical Paradigm vs. Neural Network Realities

Standard optimization theory relies on the local quadratic approximation of the loss function L(θ)L(\theta) around the current parameter iterate θt\theta_t:

L(θt+1)≈L(θt)+∇L(θt)T(θt+1−θt)+12(θt+1−θt)T∇2L(θt)(θt+1−θt)L(\theta_{t+1}) \approx L(\theta_t) + \nabla L(\theta_t)^T (\theta_{t+1} - \theta_t) + \frac{1}{2} (\theta_{t+1} - \theta_t)^T \nabla^2 L(\theta_t) (\theta_{t+1} - \theta_t)

Substituting the standard gradient descent update step θt+1=θt−η∇L(θt)\theta_{t+1} = \theta_t - \eta \nabla L(\theta_t):

L(θt+1)≈L(θt)−η∥∇L(θt)∥2+η22∇L(θt)TH(θt)∇L(θt)L(\theta_{t+1}) \approx L(\theta_t) - \eta \|\nabla L(\theta_t)\|^2 + \frac{\eta^2}{2} \nabla L(\theta_t)^T H(\theta_t) \nabla L(\theta_t)

where H(θt)=∇2L(θt)H(\theta_t) = \nabla^2 L(\theta_t) is the Hessian matrix of second derivatives. Defining local sharpness S(θ)=λmax⁡(H(θ))S(\theta) = \lambda_{\max}(H(\theta)) as the largest eigenvalue of the Hessian:

L(θt+1)−L(θt)≤−η(1−ηS(θt)2)∥∇L(θt)∥2L(\theta_{t+1}) - L(\theta_t) \le -\eta \left(1 - \frac{\eta S(\theta_t)}{2}\right) \|\nabla L(\theta_t)\|^2

For the loss difference L(θt+1)−L(θt)L(\theta_{t+1}) - L(\theta_t) to remain strictly negative (ensuring monotonic descent), the term inside the parentheses must remain positive:

1−ηS(θt)2>0  ⟹  S(θt)<2η1 - \frac{\eta S(\theta_t)}{2} > 0 \implies S(\theta_t) < \frac{2}{\eta}

If S(θt)>2/ηS(\theta_t) > 2/\eta, the quadratic term dominates the linear descent term. In a purely quadratic landscape, iterating along the eigenvector v1v_1 corresponding to λmax⁡\lambda_{\max} leads to exponential divergence:

(θt+1−θ<em>)=(I−ηH)(θt−θ</em>)(\theta_{t+1} - \theta^<em>) = (I - \eta H) (\theta_t - \theta^</em>)

The projection along v1v_1 evolves as (1−ηλmax⁡)t(1 - \eta \lambda_{\max})^t, which oscillates with unbounded growth when ∣1−ηλmax⁡∣>1  ⟺  λmax⁡>2/η|1 - \eta \lambda_{\max}| > 1 \iff \lambda_{\max} > 2/\eta.

Progressive Sharpening and Edge of Stability Regimes

2. Progressive Sharpening and the Transition to EoS

Empirical investigations by Cohen et al. (arXiv:2103.00065) demonstrated that gradient descent on deep neural networks unfolds in distinct phases:

  1. Early Phase (Classical Descent): At initialization, network parameters typically sit in flat regions where λmax⁡(H)≪2/η\lambda_{\max}(H) \ll 2/\eta. The loss decreases monotonically, and trajectory dynamics conform closely to continuous-time gradient flow (θ˙=−∇L(θ)\dot{\theta} = -\nabla L(\theta)).
  2. Progressive Sharpening: As parameters move through the optimization landscape and fit training patterns, the local curvature increases. The top eigenvalue λmax⁡(H)\lambda_{\max}(H) climbs steadily across successive iterations.
  3. The Edge of Stability Plateau: When λmax⁡(H)\lambda_{\max}(H) reaches the critical threshold 2/η2/\eta, progressive sharpening ceases. Instead of exceeding 2/η2/\eta and triggering explosive divergence, the sharpness saturates and hovers just above 2/η2/\eta for the remainder of training.

During the EoS regime, optimization dynamics split across two distinct temporal scales:

  • Micro-scale (step-to-step): The training loss behaves non-monotonically, exhibiting high-frequency period-2 or chaotic oscillations. The parameter vector bounces back and forth across the walls of the local quadratic valley along the top eigenvector v1v_1.
  • Macro-scale (hundreds of steps): Despite violent local oscillations, the moving average of the training loss continues to descend steadily toward zero.

3. Mathematical Mechanics: Self-Stabilization and Cubic Curvature

Why does the optimizer not diverge when λmax⁡(H)>2/η\lambda_{\max}(H) > 2/\eta? The explanation lies in higher-order terms of the Taylor series expansion that quadratic approximations discard.

As analyzed by Damian, Nichani, and Lee (arXiv:2209.15594), the third-order directional derivative of the loss function creates a non-linear self-stabilization mechanism. Consider the third-order expansion along the dominant eigenvector v1v_1:

L(θ+δv1)≈L(θ)+δ∇LTv1+12δ2λmax⁡+16δ3∇3L(v1,v1,v1)L(\theta + \delta v_1) \approx L(\theta) + \delta \nabla L^T v_1 + \frac{1}{2} \delta^2 \lambda_{\max} + \frac{1}{6} \delta^3 \nabla^3 L(v_1, v_1, v_1)

When λmax⁡>2/η\lambda_{\max} > 2/\eta, an update step along v1v_1 overshoots the minimum of the quadratic approximation. In asymmetric or non-quadratic valleys, the local Hessian is state-dependent:

∇2L(θ+δv1)≈H(θ)+δ∇3L(v1,v1,⋅)\nabla^2 L(\theta + \delta v_1) \approx H(\theta) + \delta \nabla^3 L(v_1, v_1, \cdot)

When gradient descent overshoots and lands on a region with asymmetric cubic curvature, the resulting gradient update does not merely reverse direction along v1v_1; it induces a transverse displacement perpendicular to v1v_1. This lateral displacement shifts the parameter trajectory into neighboring regions of the parameter space where the local curvature λmax⁡(H)\lambda_{\max}(H) is lower.

This interaction produces a dynamical feedback loop:

  1. If λmax⁡\lambda_{\max} rises above 2/η2/\eta, gradient descent steps become unstable along v1v_1, amplifying oscillation amplitude.
  2. Larger oscillations explore outer regions of the valley, activating cubic and quartic terms that push the parameters laterally into flatter sub-basins.
  3. Entering flatter regions reduces λmax⁡\lambda_{\max} back toward 2/η2/\eta.
  4. If λmax⁡\lambda_{\max} falls below 2/η2/\eta, progressive sharpening resumes until λmax⁡≈2/η\lambda_{\max} \approx 2/\eta is restored.

The system dynamically regulates its own curvature, locking the trajectory onto the manifold where λmax⁡(H)≈2/η\lambda_{\max}(H) \approx 2/\eta.

4. Implicit Bias Toward Flat Minima

The discovery of the Edge of Stability provides a mechanistic explanation for why training with larger learning rates often yields better generalization performance on unseen test data, a phenomenon noted by Keskar et al. (arXiv:1609.04836) and Dinh et al. (arXiv:1703.04933).

In an optimization landscape containing multiple local minima of varying sharpness:

  • Small Learning Rates (η→0\eta \to 0): Gradient descent tracks continuous gradient flow. It can enter and settle into narrow, sharp ravines where λmax⁡(H)\lambda_{\max}(H) is high, because the stability condition λmax⁡<2/η\lambda_{\max} < 2/\eta is never violated.
  • Large Learning Rates (EoS Regime): Any basin where the local minimum has sharpness S>2/ηS > 2/\eta is dynamically unstable. Gradient descent cannot converge to a sharp minimum; the destabilizing oscillations along v1v_1 eject the trajectory from sharp valleys, forcing the optimizer to continue searching until it finds a broad, flat basin where S≤2/ηS \le 2/\eta.

EoS acts as an implicit regularizer that automatically prunes sharp minima from the set of reachable solutions, selecting flat minima with lower generalization error.

5. Extensions: Momentum, Adaptive Optimizers, and Non-Euclidean Metrics

While initial formulations focused on vanilla full-batch gradient descent, subsequent research has mapped the Edge of Stability across practical deep learning optimizers:

Momentum Methods

For Polyak momentum (heavy-ball) with momentum parameter β∈[0,1)\beta \in [0, 1), classical linear stability analysis places the stability threshold at:

λmax⁡(H)≤2(1+β)η\lambda_{\max}(H) \le \frac{2(1 + \beta)}{\eta}

Under Nesterov accelerated gradient descent, the effective threshold shifts to:

λmax⁡(H)≤2(1+β)η(1+2β)\lambda_{\max}(H) \le \frac{2(1 + \beta)}{\eta (1 + 2\beta)}

Empirical studies confirm that momentum optimizers enter an identical EoS regime, with sharpness hovering around their respective modified stability boundaries.

Adaptive Optimizers (Adam and RMSProp)

In adaptive gradient algorithms, the effective metric is non-Euclidean. The update step is preconditioned by a diagonal matrix Dt≈diag(vt+ϵ)−1D_t \approx \text{diag}(\sqrt{v_t} + \epsilon)^{-1}.

The relevant curvature metric is no longer the raw Hessian eigenvalue λmax⁡(H)\lambda_{\max}(H), but the maximum generalized eigenvalue of the preconditioned Hessian:

Sadaptive(θ)=λmax⁡(DtH(θ))S_{\text{adaptive}}(\theta) = \lambda_{\max}(D_t H(\theta))

As shown in recent non-Euclidean optimization frameworks (such as Mishkin et al., arXiv:2405.05313), adaptive optimizers exhibit directional progressive sharpening in the preconditioned metric space, operating at the boundary Sadaptive≈2/ηS_{\text{adaptive}} \approx 2/\eta.

6. Practical Implications for Large-Scale Model Training

The Edge of Stability directly impacts the stability and efficiency of large language model (LLM) pre-training:

  1. Learning Rate Warmup: At initialization, models undergo rapid structural adaptation. Without learning rate warmup, large initial steps can push the optimizer into extreme instability before self-stabilization dynamics establish. Warmup allows controlled progressive sharpening to reach the EoS boundary gradually.
  2. Multi-Frequency Instabilities and Loss Spikes: While self-stabilization easily manages instability along a single dominant eigenvector v1v_1, pre-training large models occasionally produces scenarios where multiple orthogonal directions simultaneously exceed 2/η2/\eta. When higher-order interactions cross-couple across multiple unstable directions, the self-stabilizing restoring force can break down, manifesting as sudden loss spikes observed during LLM runs.
  3. Curvature Diagnostics: Monitoring the Hessian spectral norm λmax⁡(H)\lambda_{\max}(H) via power iteration or the Lanczos algorithm provides a direct operational health metric. Tracking the ratio η⋅λmax⁡(H)/2\eta \cdot \lambda_{\max}(H) / 2 reveals whether training is operating safely in the EoS regime (≈1.0\approx 1.0) or approaching catastrophic multi-axis instability (>1.5> 1.5).

Sources

  • Cohen, J. M., Kaur, S., Li, Y., Kolter, J. Z., & Talwalkar, A. (2021). Gradient Descent on Neural Networks Typically Operates at the Edge of Stability. International Conference on Learning Representations (ICLR). arXiv:2103.00065
  • Damian, A., Nichani, E., & Lee, J. D. (2023). Self-Stabilization: The Implicit Bias of Gradient Descent at the Edge of Stability. International Conference on Learning Representations (ICLR). arXiv:2209.15594
  • Keskar, N. S., Mudigere, D., Nocedal, J., Smelyanskiy, M., & Tang, P. T. P. (2016). On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima. International Conference on Learning Representations (ICLR). arXiv:1609.04836
  • Dinh, L., Pascanu, R., Bengio, S., & Bengio, Y. (2017). Sharp Minima Can Generalize For Deep Nets. International Conference on Machine Learning (ICML). arXiv:1703.04933
  • Mishkin, A., et al. (2024). Directional Smoothness and the Edge of Stability in Deep Learning. International Conference on Machine Learning (ICML). arXiv:2405.05313
  • Hochreiter, S., & Schmidhuber, J. (1997). Flat Minima. Neural Computation, 9(1), 1-42. DOI:10.1162/neco.1997.9.1.1

Frequently asked questions

What is the classical stability criterion for gradient descent?

In classical convex optimization, gradient descent is guaranteed to monotonically reduce the loss if the learning rate eta is less than 2/L, where L is the largest eigenvalue of the Hessian matrix. If the step size exceeds this threshold, standard quadratic approximations predict catastrophic divergence.

How does progressive sharpening transition into the Edge of Stability?

Progressive sharpening occurs as network parameters move through the optimization landscape and fit training patterns, causing the local curvature (top eigenvalue of the Hessian) to climb steadily. When this sharpness reaches the critical threshold of 2/eta, it saturates and hovers just above this value for the remainder of training, defining the Edge of Stability plateau.

Why do deep networks not diverge when the Hessian eigenvalue exceeds 2/eta?

Divergence is prevented by higher-order terms in the Taylor series expansion, specifically the third-order directional derivative which creates a non-linear self-stabilization mechanism. As gradient descent overshoots due to high curvature, asymmetric cubic curvature induces lateral displacement into flatter regions, reducing the local Hessian eigenvalue back toward the threshold.

How does the Edge of Stability create an implicit bias toward flat minima?

The EoS regime acts as an implicit regularizer by dynamically destabilizing sharp minima where local sharpness S exceeds 2/eta. Gradient descent cannot converge to these sharp valleys because destabilizing oscillations eject the trajectory, forcing the optimizer to find broad, flat basins where S is less than or equal to 2/eta.

Does the Edge of Stability apply to adaptive optimizers like Adam?

Yes, adaptive optimizers like Adam exhibit directional progressive sharpening in a preconditioned metric space. For these algorithms, the relevant curvature metric is the maximum generalized eigenvalue of the preconditioned Hessian, which hovers around the boundary defined by the effective stability conditions of the specific optimizer.

AIDeep LearningOptimizationExplainers