Full text not available for this paper
Does LLM Pre-Training Typically Occur at the Edge of Stability?
Summary (Overview)
-
Two Distinct Failure Modes of Quadratic Approximations: The paper identifies and systematically studies two ways quadratic approximations fail to predict neural network training dynamics: (1) Edge of Convexity (EoC) — an LR-independent failure caused by persistent negative Hessian eigenvalues that makes quadratic dynamics diverge regardless of learning rate, and (2) Edge of Stability (EoS) — an LR-dependent failure where quadratic dynamics diverge only when the LR exceeds a critical threshold.
-
Generalized EoS Definition: The authors propose a generalized definition of EoS for stochastic training with adaptive optimizers (including AdamW), based on whether increasing the LR induces significant divergence in quadratic dynamics while leaving true dynamics largely unchanged. For full-batch GD, this definition recovers the original EoS definition of Cohen et al. (2021).
-
Scalable Detection Methods: Efficient algorithms are designed to detect both EoC and EoS at scale with theoretical guarantees, using Hessian-vector products (approximately 9 GEMMs per linear layer) rather than forming the full Hessian.
-
Empirical Findings on LLM Pretraining: Across GPT-style models from 43M to 787M parameters trained on multiple datasets (FineWeb, C4, DCLM, OpenWebText, OpenWebMath):
- EoC is always observed during LLM pretraining
- EoS is prevalent but not universal — it disappears when LR becomes sufficiently small (e.g., after decay) or when batch size falls below a critical threshold (EBZ)
-
Key Correlation: The EoS batch size threshold (EBZ) shows a strong positive correlation (Pearson correlation 0.95) with the critical batch size (CBZ) across five datasets.
Introduction and Theoretical Foundation
Background
The paper builds on the classical optimization theory framework where gradient-based methods are analyzed through a local quadratic approximation of the loss function via second-order Taylor expansion:
This yields the descent lemma: loss decreases when the learning rate satisfies , where is the maximum Hessian eigenvalue.
The Edge of Stability (EoS) Paradox
Cohen et al. (2021) observed that full-batch gradient descent operates at the Edge of Stability: the largest Hessian eigenvalue concentrates near , placing dynamics at the stability boundary predicted by quadratic models. Yet the loss continues to decrease over long time scales, contradicting the descent lemma.
Gaps in Prior Work
The paper identifies three key limitations of existing research:
- Full-batch focus: Most EoS definitions assume full-batch training, while stochastic training dominates practice
- Positive curvature only: Studies focus on failures from large positive Hessian eigenvalues, ignoring negative eigenvalues
- Small-scale measurements: Direct Hessian analysis is limited to CIFAR-10 and ImageNet scale
Theoretical Foundation: Stochastic Quadratic Stability
The paper analyzes SGD on stochastic quadratics:
with error dynamics:
Definition 4.1 (Mean-Square Stability): The system is mean-square stable if for every initialization.
Proposition 4.2: For each fixed , there exist matrices and vector such that:
The system has bounded second moments if .
Two Instability Mechanisms
1. Negative Curvature Divergence: If , then along the corresponding eigenvector:
This grows unboundedly for every — the instability is LR-independent.
2. Positive Curvature Divergence: On the positive curvature subspace (projected via ), the critical LR is:
For full-batch GD with : .
For stochastic training, the second-moment transition decomposes as:
The covariance term can shift the stability boundary away from .
Methodology
Key Definitions
Definition 5.1 (Saddleness):
This measures negative curvature relative to positive curvature. For LLM pretraining, after warm-up.
Edge of Convexity (EoC): At checkpoint , training is at EoC when but saddleness is small.
Stochastic EoS: Training is at EoS when the current LR is close to the stochastic critical LR on the positive-curvature subspace: .
EoC Detection: Stochastic Power Iteration with Bisection
Algorithm 1 runs the shifted iteration:
with a fresh mini-batch at each step. Since , if , the mean iterate grows geometrically along the bottom eigenvector direction.
Theorem A.4 (Informal): The stochastic power iteration outputs satisfying:
EoS Detection: Compensated Local Simulation
Algorithm 3 compensates for negative curvature by adding penalty with , then simulates local AGM dynamics:
The estimate is the smallest LR in a grid for which displacement reaches a cutoff . EoS is declared when with .
Adaptive Gradient Methods (AGMs)
For AGMs with momentum and preconditioner, the effective curvature is:
The critical LR is characterized by the spectral radius of the second-moment operator:
Proposition A.3: The critical LR satisfies .
Computational Cost
Hessian-vector products cost approximately 9 GEMMs per linear layer (versus 3 for one gradient evaluation), computed via:
Empirical Validation / Results
Experimental Setup
- Models: GPT-extra-small (43M), GPT-small (104M), GPT-medium (344M), GPT-large (787M)
- Datasets: FineWeb-10B, OpenWebMath, OpenWebText, C4, DCLM
- Optimizer: AdamW (WD=0.1, , )
- LR Schedule: Warm-Stable-Decay (WSD) with 4% warmup and 20% decay steps
- Evaluation: Over 3,000 checkpoints from more than 100 pretraining runs
Key Results
1. EoS and EoC Are Widely Observed
Across model sizes from 43M to 787M, the bottom heatmaps in Figure 2 show a sharp transition from bounded displacement to explosion near LR factor 1.0, indicating the training LR sits at the critical threshold. Saddleness remains below 0.1 reference line, consistent with EoC.
2. Batch Size Dependence
Figure 4 shows:
- EoS emerges only above the EoS Batch Size (EBZ) threshold
- The critical LR factor decreases as batch size increases
- EBZ and CBZ show positive correlation (Pearson 0.95) across datasets
| Dataset | EBZ | CBZ |
|---|---|---|
| OpenMath | ~423 | ~400 |
| C4 | ~463 | ~450 |
| DCLM | ~435 | ~475 |
| FineWeb | ~577 | ~600 |
| OpenWebText | ~481 | ~500 |
3. LR Dependence
- Training can enter stable regime after LR decay: After abrupt LR drops, the transition moves to larger LR factors; with sufficiently large reductions, EoS does not return
- Training can enter extremely unstable regime with large LR: At peak LR 0.04, the estimated critical LR is only ~1/10 of the training LR on average
4. Model Scale Results
For GPT-small/medium/large:
- At optimal peak LRs: EoS observed at 51/60, 43/50, 29/30 checkpoints (respectively)
- EoC criterion satisfied at 44/60, 38/50, 26/30 checkpoints
- At extreme peak LRs (0.04): no LR factor in grid stays bounded at most checkpoints
Theoretical Guarantees
Theorem C.16 (Accuracy of expected EoS detector):
where is the finite-horizon error, controls the compensation error, and bounds the covariance mismatch.
Theoretical and Practical Implications
Theoretical Implications
-
Quadratic approximations have two distinct failure modes: The paper formalizes that negative curvature (EoC) and positive curvature (EoS) cause different types of instability, requiring separate treatment.
-
Stochastic EoS differs from full-batch EoS: The critical LR is not determined by alone but by the second-moment operator , which includes the covariance of mini-batch Hessians.
-
Weight decay and preconditioning matter: The effective curvature incorporates both the preconditioner and weight decay, generalizing prior definitions.
Practical Implications
-
LR schedule design: LR decay can move training out of the EoS regime into the stable regime, suggesting that aggressive decay schedules may reduce instability risks.
-
Batch size selection: The positive correlation between EBZ and CBZ suggests that batch sizes near the critical batch size for optimal loss also tend to place training at EoS.
-
Detection tools: The scalable detection algorithms (stochastic power iteration + compensated local simulation) provide practical tools for monitoring training stability in large-scale LLM pretraining.
-
Extremely unstable regime: Training with excessively large peak LRs enters a regime beyond EoS where the quadratic approximation predicts critical LR far below the training LR, correlating with worse final evaluation loss.
Conclusion
This paper systematically characterizes when and how quadratic approximations fail in LLM pretraining, identifying two distinct failure modes:
- Edge of Convexity (EoC): An LR-independent failure caused by persistent negative curvature, always observed in LLM pretraining
- Edge of Stability (EoS): An LR-dependent failure, prevalent but not universal — disappearing with small LRs (after decay) or small batch sizes (below EBZ)
The generalized definitions extend to stochastic training with adaptive optimizers, and the scalable detection methods enable monitoring at LLM scale. The positive correlation between EBZ and CBZ provides a practical link between stability thresholds and optimal training configurations.
Future Directions
- Other optimizers: Extending EoS analysis to optimizers like Muon
- Theoretical analysis: Developing solid theoretical explanations for realistic neural network training dynamics at EoS and EoC
- Understanding the mechanisms: Why does the loss continue to decrease despite operating at the stability boundary?
Related papers
- How to Loop Your Transformer: Loop Scaling, Specialization, and Parallel Inference
Looping transformers works best with Full-Stack Looping for fixed parameters, Middle-Stack for FLOP constraints, and gated parallel variants for inference efficiency.
- How Do Coding-Agent Harnesses Self-Evolve? An Empirical Study of Retrospective Adaptation
Retrospective harness self-evolution rarely reduces repeated work; only adaptations covering encountered instances succeed, while incomplete ones can add work.
- Accordion: Elastic-Depth Inference via Fixed-Prefix Layer Looping
Accordion enables one MoE model to serve five inference budgets via fixed-prefix layer looping, gaining 3.01 points across 37 tasks while retaining unlooped-path quality.