En 30 secondes
A simple optimization model predicts that training should diverge when its steepest curvature passes a learning-rate-dependent threshold. Yet neural network experiments can oscillate and stabilize near that boundary instead. Stanford’s Suhas Kotha explains a model of this self-stabilization and how momentum and adaptive scaling alter the picture. Sharpness can also influence training speed, but its relationship with performance on unseen data is mixed: different studies find opposing correlations, and the same function can have different measured sharpness under different parameterizations.
- 1Training can stabilize where a quadratic predicts divergenceSharpness can rise above the nominal 2 / learning-rate threshold, then fall as the parameters oscillate. The shown full-batch runs settle near the boundary instead of simply blowing up.
- 2Central flow models the average rather than every oscillationThe approximation includes a sharpness-related term and averages away alternating displacements. The informative checks include whether it predicts average loss and individual-example outputs.
- 3Minibatch noise can change momentum’s stability effectThe idealized full-batch and small-batch regimes lead to different gradient correlations. In the shown experiments, increasing momentum moves their stability thresholds in opposite directions.
- 4Adaptive scaling creates another route to stabilityIn scalar RMSProp, stronger oscillations can raise the tracked gradient scale and reduce the effective step, in addition to affecting raw sharpness.
- 5Flatness is not a universal generalization measureStudies report both positive and negative correlations between sharpness and error. Reparameterizing a network can change measured sharpness without changing the function it computes.
- 6SAM trains against nearby perturbations, but its explanation is subtleSharpness-aware minimization seeks a low-loss neighborhood. Small-batch analysis suggests that its benefits may involve average-case effects rather than only the sharpest direction.
- 7Pretraining loss alone can miss a fine-tuning tradeoffIn one study, sharpness-aware pretraining produced slightly worse initial loss but less forgetting after fine-tuning. Kotha presents this as a setting where the subsequent use of a model matters.
À retenir
- In the full-batch experiments shown, sharpness can hover around the nominal stability boundary instead of making training diverge.
- Averaging oscillating training dynamics can reveal a trajectory that central-flow models attempt to predict.
- Momentum and adaptive scaling change the effective stability picture; their effects depend on the training regime.
- Do not treat flatness alone as a universal predictor of generalization: evidence and parameterization both complicate the comparison.
- Sharpness-aware minimization can help in experiments, but its mechanism may differ from its original intuition.
Lire le texte remanié, chapitre par chapitre
The stability threshold is not the end of training
A fixed quadratic predicts divergence beyond a curvature threshold. Neural network experiments instead show oscillation and stabilization near it.
This lecture examines sharpness: roughly, how quickly loss curves in its steepest parameter direction. We will use it to study the edge of stability, the interaction with optimizer components, and the unsettled relationship between flat regions and a model's performance on unseen data.
For a simple quadratic, gradient descent converges when the learning rate is small enough, but an excessive step makes it oscillate away from the minimum. In multiple dimensions the steepest direction imposes the limiting condition: its sharpness must stay below 2 divided by the learning rate for the familiar quadratic stability argument.
A neural network training experiment does something more surprising. Sharpness rises and can cross that threshold; the parameters start oscillating in the sharpest direction. Rather than the run simply blowing up, sharpness then falls, rises again, and stabilizes around the threshold.
Changing the learning rate changes the threshold: a smaller learning rate raises 2 divided by the rate, and the observed sharpness stabilizes around a higher value. These initial examples use full-batch gradient descent, in which each update uses the entire training set; related phenomena also appear in other settings, but the details differ.
Modeling self-stabilization with central flow
A higher-order local term and time averaging provide a model for the center of an oscillating trajectory. Kotha distinguishes assumptions from predictions tested against training.
The key idea is self-stabilization. Approximate the loss locally as parameters are displaced along the top Hessian eigenvector, the sharpest direction. A quadratic approximation describes the oscillation, but a third-order term adds a contribution related to the gradient of sharpness that can reduce sharpness during training.
There is no guarantee that a third-order approximation captures every higher-order effect. It is a proposed explanation that can be tested against observed training. The analysis can also be extended beyond the single largest eigenvalue, although starting with that direction makes the picture easier to follow.
A common analysis replaces discrete updates with a continuous differential equation called gradient flow. Early in the shown run, it predicts the behavior reasonably well. Once the edge of stability is reached, however, it predicts ever-increasing sharpness rather than the stabilization observed in the experiment.
Central flow is a different approximation designed for that oscillatory regime. It includes the additional sharpness-related term, then averages over time so the alternating displacement cancels out. The result aims to track the center of the trajectory rather than predict each individual oscillation.
After this averaging, the model contains the ordinary gradient and a sharpness-regularization term. The size of that term depends on the magnitude of oscillation. To determine its schedule, the derivation imposes the empirically motivated assumption that sharpness stays stable once training enters the edge-of-stability regime.
The resulting equation reproduces the stabilized sharpness and gives predictions for other quantities, including average loss and a network's output on an individual example. It is a model of averages rather than a forecast of every loss spike. Comparing predictions with real runs checks whether the simplifying assumptions retain useful information.
A student points out that stability itself is not surprising if the equation explicitly assumes stable sharpness. Kotha agrees and identifies the more informative predictions as average loss and example-level outputs: those were not simply set to their observed values by imposing the sharpness constraint.
Asked whether this explains double descent, Kotha distinguishes optimization along a single training trajectory from generalization as the amount of data changes. The course experiments largely use a one-pass regime. A central-flow model might predict a rise and fall within a particular run, but that is not the usual formulation of double descent.
The framework can be extended to multiple eigenvectors, yielding predictions for sharpness directions that reach the boundary and others that do not. Individual predictions and loss may oscillate considerably even when a time-averaged trajectory remains comparatively smooth.
How oscillation and the river-valley picture fit
The average trajectory can follow a flatter direction while individual updates bounce across steep walls. Annealing changes both the effective boundary and the oscillation.
The connection to the earlier river-valley picture is that weights bounce between steep walls while their average moves along the flatter river direction. Central flow tracks that averaged movement. Adding an estimate of the oscillation component back can improve predictions of the actual loss and gradient norm along the noisy trajectory.
There are two movements to keep distinct: parameters oscillate across a sharp direction, while sharpness itself also changes and can move above and below its threshold. Together they affect how far the trajectory is from the center of the valley.
A student asks what happens as the learning rate is annealed. In the discussion, the instructors explain that slower updates can reduce oscillation while the stability threshold rises; if progressive sharpening continues to track the boundary, the model may move into a sharper region even as it gets closer to the valley center.
Why progressive sharpening happens in the first place is not settled, the instructors say. It is an empirical tendency in the examples; the self-stabilization mechanism is intended to explain what happens after sharpness approaches the boundary, not to provide a complete account of why sharpness rises.
Momentum behaves differently with full and small batches
Alternating full-batch gradients and noisy minibatch gradients accumulate differently. The displayed experiments show opposite shifts in the stability threshold as momentum increases.
The earlier analysis leaves out ingredients of modern optimizers: momentum, minibatches and adaptive scaling. The lecture considers them separately, with the caveat that a complete account combining all of them has not been solved.
Momentum accumulates recent gradients. In an idealized full-batch oscillatory regime where successive gradients have similar magnitude and alternate direction, the alternating terms partially cancel. Under the convention used in the lecture this dampens the effective update and raises the expected sharpness threshold by a factor related to one plus the momentum coefficient.
With small minibatches, gradient noise changes that intuition. Consecutive noisy gradients can have cosine similarity closer to zero even if an underlying oscillation exists. Treating those updates as approximately independent leads to a different accumulation of variance, so the predicted effect of momentum on the stability threshold can reverse.
In the displayed experiments, increasing the momentum coefficient raises the threshold in the full-batch case but lowers it in a small-batch regime. These are regime-specific results, not a universal rule that momentum always sharpens or flattens training. A full theory of minibatch behavior remains open.
Adaptive scaling changes effective sharpness
Scalar RMSProp couples gradient normalization with curvature, creating a second stabilization mechanism. Central-flow comparisons explore how sharpness regularization affects training speed.
To study adaptivity, begin with scalar RMSProp. It tracks an exponential moving average of the squared gradient norm and divides the gradient update by a function of that average. Unlike the usual per-parameter version, this simplified algorithm uses one shared scale for all parameters.
Because that scale changes, the nominal learning rate alone no longer describes the effective step. The analysis tracks effective sharpness, combining curvature with the scaled step size. In the experiment, raw sharpness can grow while this normalized quantity stabilizes around the predicted boundary.
There are now two routes to stabilization. Oscillation can change the actual sharpness, as in the earlier analysis, but larger oscillations can also increase the tracked gradient scale. That reduces the effective step size and changes effective sharpness even without the same reduction in the raw curvature.
The averaging coefficient determines how quickly the tracked gradient scale responds. With a slower-moving average, that second stabilizing effect is weaker or delayed, and the observed raw sharpness can follow a different trajectory. The normalized quantity may still settle near its stability boundary.
A scalar-RMSProp central flow tracks both the averaged weight trajectory and the evolving gradient scale. The oscillation schedule is chosen to fit the local approximation and the observed effective-sharpness constraint. In the displayed results the resulting equations track several quantities, including loss and the change in raw sharpness.
One way to understand the scalar optimizer is as balancing its effective step size against the current curvature. The sharpness-related term is still present as well: the algorithm is not merely adjusting the step to a fixed landscape, but is also associated with movement toward reduced sharpness.
A theoretical comparison removes that sharpness-regularization term from the central-flow model while retaining adaptation. In the shown result, loss then falls more slowly: sharpness grows more, the permitted effective step shrinks faster, and training slows. This is an analysis of the modeled dynamics, not a promise that every real run behaves identically.
Kotha uses that picture to give an interpretation of the learning-rate setting in an adaptive optimizer. Raising the nominal rate can change sharpness regularization and thereby the effective step; because the gradient is normalized, it does not necessarily translate directly into proportionally larger parameter updates.
From scalar to per-parameter RMSProp
Per-coordinate scaling acts as a diagonal preconditioner. The lecturer describes what a central-flow analysis suggests and identifies unresolved cases.
Full RMSProp applies adaptive scaling per parameter rather than using a single global scale. This can be viewed as diagonal preconditioning: each coordinate's update is rescaled separately. It is not obvious in advance whether that particular scaling resembles a useful curvature-based preconditioner.
In the shown RMSProp run, loss has fewer conspicuous spikes, while individual coordinates still oscillate. The relevant curvature is now that of the effectively preconditioned system rather than the raw Hessian alone. The lecture reports that this effective quantity also displays edge-of-stability behavior in the examples.
The central-flow analysis can be generalized to this per-parameter setting, although the equations become more involved. Kotha describes an optimization problem that characterizes the resulting preconditioner: one constraint enforces stability, while another term relates to the effective step sizes across directions.
Ignoring a second term for intuition, minimizing the trace of the preconditioner corresponds to making effective learning rates larger while respecting the stability constraint. In the presented analysis, this can make progress faster than an unadjusted gradient flow. Removing the diagonal restriction as well yields a connection to the Hessian.
The full characterization includes an additional term related to the gradient, which can make the resulting behavior slower than the hypothetical simplified objective. Kotha treats this as a way to reason about what RMSProp is doing and a possible starting point for designing better optimizers, rather than a finished prescription.
Several limits remain. The sharpness analysis is cleaner in the mean-squared-error settings discussed than for cross-entropy; minibatches and full modern optimizers are not completely explained, and central-flow predictions can break down at higher learning rates. The cause of progressive sharpening also remains an open question.
Flat minima and the limits of generalization claims
Some studies find sharpness predictive, while others show contrary results. Parameterization makes simple comparisons even harder.
Sharpness matters to the optimization story because curvature affects stable step sizes and therefore training speed. It is also discussed in a different setting: generalization when data are limited. A model can keep reducing loss on repeated training examples while its validation loss worsens through overfitting.
A common intuition says a flat minimum may be more robust than a sharp one: if the test loss landscape differs somewhat from the training landscape, a small shift around a broad region might hurt less than a shift near a narrow minimum. This is an intuition to test, not a general proof.
One study comparing many proposed generalization measures found sharpness among the more promising predictors, though not a perfect one. Other studies find the opposite relationship in some settings, with sharper solutions associated with lower error. Kotha emphasizes that the empirical picture is mixed.
There are also clean counterexamples, and measured sharpness depends on how a network is parameterized. Two sets of weights can compute the same function yet have different Hessian-based sharpness values. That makes the meaning of a raw sharpness comparison difficult to interpret across parameterizations.
What sharpness-aware minimization can and cannot show
SAM optimizes against nearby perturbations and helps in some experiments. Its mechanism and its usefulness for later fine-tuning remain active questions.
Changing learning rate or batch size can indirectly affect sharpness. Sharpness-aware minimization, or SAM, instead seeks parameters whose nearby alternatives also have low loss. It approximates a worst-case perturbation within a small neighborhood, then updates against the loss at that perturbed point.
The original SAM results show gains over ordinary stochastic gradient descent on several benchmarks, including settings with corrupted labels. In those experiments, the difference becomes especially interesting as label noise increases. That motivates the algorithm but does not by itself establish a single explanation for why it helps.
A later analysis finds that SAM's strongest generalization can occur at small batch sizes. In the batch-size-one case, the quantity being optimized can resemble an average-case perturbation rather than the maximum-curvature intuition used to motivate the method. Its empirical success may therefore reflect more than simply minimizing the sharpest direction.
This illustrates a common research pattern: a simplified model suggests an algorithm, the algorithm works in some experiments, and later analysis finds a different or more complicated mechanism. Even an imperfect intuition can help generate a useful method, provided its limits are not mistaken for a theorem.
One pretraining study asks whether a flatter starting region makes later fine-tuning less destructive. Models pretrained with SAM have slightly worse but similar initial performance in the example; after fine-tuning, they show less forgetting of the original pretraining task than the comparison models.
The same work also considers indirectly changing sharpness through the learning rate. Its reported tradeoff suggests that accepting some pretraining-loss cost can improve the balance between retained pretraining performance and fine-tuning performance. If a model will be fine-tuned, validation loss before fine-tuning alone may not predict the outcome.
Kotha closes by describing sharpness as a particularly uncertain but sometimes productive mental model. Limiting sharpness can matter for optimization speed, and some studies show generalization or fine-tuning benefits, but the relationship is not universal. Directly controlling the relevant notion of sharpness remains difficult.
Sur la même chaîne
1:22:20EN
1:14:45EN
20:46EN
1:20:02EN
1:08:53EN
1:10:50EN