| Landscape | |
|---|---|
| the model's parameters (weight vector), the variable the loss depends on | |
| the loss at parameters ; in the course's runs, validation loss in nats per token | |
| the Hessian , the matrix of second derivatives of the loss | |
| the -th eigenvalue of the Hessian , the curvature of the loss along eigendirection | |
| the loss at a critical point (a point where ) | |
| the index of a critical point, the fraction of Hessian eigenvalues that are negative there | |
| Averaging | |
| the weights of two trained models whose average is tested | |
| the pretrained starting point shared by two fine-tuned models | |
| midpoint barrier , the loss of the weight average minus the average loss; for a convex loss, and counts as averaging working | |
| Best | the lower of the two models' losses (the better endpoint) |
| Ens | the loss of the ensemble, the model whose next-token probabilities are |
| Avg | the loss of the weight average |
| the number of updates in the shared prefix, trained once before two runs fork | |
| the number of updates in each of the two branches after a fork, each with a different data order | |
| task vector , the change in weights made by fine-tuning on one task | |
| Training | |
| learning rate (Lecture 5's noisy-quadratic slides write ) | |
| decoupled weight-decay coefficient; each AdamW update multiplies the weights by (.1 in d8) | |
| per-example gradient-noise variance along Hessian eigendirection , in the noisy quadratic model | |
| batch size, the number of examples averaged into each gradient (the slides write ) | |
| the loss along Hessian eigendirection after steps, in the noisy quadratic model | |
| noise floor , the loss along direction that a constant learning rate settles at | |
| exponential moving average (EMA) of the weights, , used only for evaluation | |
| decay of the weight EMA ; averages over about 1,000 updates | |
Context. Training moves parameters downhill on a loss over millions of coordinates that no one can plot directly. Practitioners still use mental pictures of that landscape to decide whether two models can be averaged, why runs end with a learning-rate decay, or whether a flat training curve means the optimizer is stuck. Lecture 5 of Hashimoto and Kotha's Stanford course CS 312 Deep Learning Alchemy (Fall 2026) examines three such pictures: loss basins, the river valley, and critical points. Assignment 3 and Quiz 3 test the first two on the course's model organismthe course's depth-8 transformer language model ("d8"), pretrained for 9,375 AdamW updates (about 614M tokens) at peak learning rate .003 and weight decay .1, with a linear decay of the rate to zero; each course experiment changes one part of this recipe. Reading note: Prediction as understanding: the d8 model organism.
Models that share enough training history land in a common basina region of weight space around a minimum where the loss is close to convex, so that averaging the weights of two models inside it gives a loss no worse than the average of theirs, so their weights can be averaged. Fine-tunes of one pretrained checkpoint and runs forked late enough in pretraining share a basin, whereas independently pretrained models do not. At a constant learning rate, the iterate bounces across the steep walls of a valley while drifting down a flat river at its floor. Decaying the rate or averaging the iterates removes the bounce and exposes that progress. In high-dimensional random-field models, almost every high-loss critical point is a saddle rather than a local minimum, and local minima sit near the global minimum. Gradient descent escapes strict saddles on its own.
Setting. Two probes test these pictures in the literature and on d8. To test whether two models share a convex basin, the d8 experiments track the midpoint barrierhow much worse the averaged weights are than the average of the two losses; for any convex loss on validation loss, By Jensen's inequality, any convex loss satisfies ; the experiments count as averaging working. Each pair is reported through three losses: Best for the lower endpoint loss, Ens for the ensemblethe model whose next-token probabilities are , the average of the two models' probabilities that averages predicted probabilities, and Avg for the weight average . The Hessian, the matrix of second derivatives of the loss; along an eigenvector with eigenvalue , the loss near a critical point changes like in the coordinate along it captures local curvature, and Lanczos iterationa Krylov method that builds the subspace spanned by from Hessian-vector products alone; the eigenvalues of restricted to that subspace approximate its extreme eigenvalues, and the Hessian itself is never formed estimates its top eigenvalues from Hessian-vector products without forming .
What it changes in practice. Averaging fine-tunes of one checkpoint usually beats keeping the best single run. Pretraining runs become averageable only after a long enough shared prefix. In a constant-rate run, progress shows up in a weight average or after a short cooldowna final stretch of training in which the learning rate is decayed to zero, which lets the iterate settle and shows the progress made at the higher rate. Reading note: Learning-rate schedules and batch size. Under AdamW with learning rate and decoupled weight decay at every update; is the weight-decay coefficient (.1 in d8), and decoupled means the shrink is applied to the weights directly, outside AdamW's per-coordinate rescaling of the gradient step, a learning-rate change leaves a transient of about updates, roughly 3,300 on d8. Training needs no special machinery to avoid saddles or bad local minima.
Two independently pretrained models do not share a basin. On d8, two runs from different random seeds reach validation losses of 2.942 and 2.939 nats per token, yet their 50/50 weight average scores 7.795. Along the straight line between them, the loss rises smoothly to that peak. Part of this barrier comes from permutation symmetryreordering the hidden units of a layer, together with the matching rows and columns of the weight matrices on either side, leaves the network's function unchanged: two runs can learn the same function with their hidden units in different orders. Aligning units before averaging with Git Re-Basin (Ainsworth et al., 2022) or optimal-transport fusion (Singh and Jaggi, 2019) lowers the barrier, though the matched average still trails an ensemble of the two models.
Independent minima are still joined by simple curved paths. Garipov et al. (2018) connect independent minima of image classifiers by a one-bend polygonal chain or a quadratic Bezier curve. Training loss and test accuracy stay nearly flat along the path. To fit a curve, they hold the endpoints fixed and minimize expected loss at a uniformly random value of the curve parameter. Their Fast Geometric Ensembling exploits this geometry by running short learning-rate cycles and saving checkpoints, yielding an ensemble for the cost of one training run. Within a single run, loss often falls monotonically along the line from initialization to final weights, more reliably under SGD than under Adam (Lucas et al., 2021).
Fine-tunes of one pretrained model share a basin. Starting from a shared pretrained checkpoint keeps fine-tuned weights close enough for linear interpolation to work. WiSE-FT (Wortsman et al., 2021) interpolates linearly between zero-shot and fine-tuned weights. It improves accuracy both in distribution and under distribution shift, and often beats sweeps over learning rate, epochs, and weight decay. In reasoning models, interpolating the last fine-tuning checkpoint with an earlier one restores coverage measured by pass@kthe probability that at least one of sampled answers is correct, estimated from samples with correct as (Chen et al., 2021). Reading note: RL and the set of solvable problems and improves single-sample accuracy at the same time (Dang et al., 2025). Model soupsweight averages of several models fine-tuned from the same pretrained weights, with different seeds or hyperparameters; the greedy soup adds a model to the average only if held-out accuracy does not fall (Wortsman et al., 2022) average several fine-tunes at zero extra inference cost. Gains grow with the angle between the displacements and , so soups vary hyperparameters across runs. A greedy soup, which adds a model only when it improves held-out accuracy, beats a uniform average.
Task arithmetic adds and subtracts fine-tuning displacements as directions. Ilharco et al. (2022) define a task vector, the change in weights made by fine-tuning on one task for a model fine-tuned on one task. Adding two task vectors gives a model both capabilities, while subtracting a task vector removes its capability. Negating target task vectors cuts a pretrained ViT-L/14's accuracy on those tasks from 64.8% to 19.0%, while control-task accuracy moves only from 75.5% to 72.9%.
Forked pretraining runs share a basin once the shared prefix is long enough. Fort et al. (2020) train a parent network for a short prefix and branch off children with different data orders. Past a brief parent phase, the error barrier between children drops near zero. On d8, the same test runs at a constant learning rate of .003 after warmup. A shared prefix of updates splits into two independent branches of updates with different data orders. Across this grid, the ensemble always matches or beats the weight average, and a too-short prefix leaves the weight average worse than the better endpoint. Counting losses within .01 as equal (lowest first): at , Avg = Ens < Best; at and , Ens < Avg < Best. Staying in one basin depends on how far the branches drift relative to how settled the prefix was at the split.
A constant learning rate leaves a noise floor that decay or averaging removes. The noisy quadratic model explains why constant-rate runs plateau and why cooldowns or weight averages drop the loss right away. It splits the loss into independent Hessian eigendirections. Along direction , with curvature , per-example gradient-noise variance , and batch size , SGD at learning rate gives expected loss after steps The first term decays the starting error geometrically. The second rises to the noise floor, the loss along Hessian eigendirection once the starting loss has decayed away; gradient noise keeps it up, and it grows with the learning rate . Reading note: Noisy quadratics and weight norms , which is roughly proportional to while stays well below 2. Decaying lowers this floor directly; averaging the iterates (Polyak averaging) cuts a single direction's noise term like over steps. Measured transformer Hessians fit this diagonal model loosely: their eigenvalues decay smoothly, and most, though not all, are positive (Meterez et al., 2026).
In the river-valley picture, a high learning rate hides progress that a decay reveals. Wen et al. (2024) interpret this anisotropy geometrically: the high-curvature directions form the walls of a valley and the low-curvature directions a river along its floor. A large learning rate bounces the iterate from wall to wall while letting it move quickly down the river. Successive full-batch updates show negative cosine similarity from that bounce (Xing et al., 2018), though SGD noise blurs the sign. Total loss reflects height up the walls, so progress down the river stays hidden until a cooldown drops the iterate to the floor. Branching a cooldown off a constant-rate run therefore matches a cosine schedule tuned to that exact length (Hägele et al., 2024).
Cooldown schedules, horizon-free schedules, and weight EMAs serve multiple budgets from one run. One cooldown approach branches a decay off a long constant phase at each target budget (MiniCPM; Hu et al., 2024). Because the optimal peak rate falls with training length, that branch finishes somewhat worse than a schedule tuned for each length. A second cooldown variant, Wen et al.'s WSD-S, resumes high-rate training directly from a decayed checkpoint. Horizon-free schedules instead lower the peak rate continuously, for instance as the inverse square root of the step. An evaluation-only EMAexponential moving average of the weights, , used only for evaluation; decay averages over about 1,000 updates averages across the wall-to-wall bounce to estimate river-floor loss without a cooldown.
On d8, an EMA closes most of the gap to a cooldown. At a constant learning rate of .003, d8 reaches validation loss 3.099 with raw weights. Adding a EMA drops it to 2.973, closing about 73% of the gap to a linear decay to zero. When the schedule decays to zero, the EMA hurts only slightly at the very end, where its 1,000-step window lags the descending weights.
Under AdamW, learning-rate changes settle on the weight-decay timescale . Each AdamW update moves every weight by roughly regardless of gradient scale, so its effect on the function depends on relative to the weight norm. When weights have grown, the same produces smaller relative steps. Decoupled weight decay multiplies the weights by per update, so the weight norm and relative step size adjust to a new over about updates. As a rule of thumb, any learning-rate change leaves a transient of about that length. In dip-and-rewarm runs, lowering the rate temporarily drops the loss below the control as the iterate slides down the valley walls. Restoring the rate then creates an overshoot above the control until the transient fades. Across d8 schedule runs, that overshoot tracked the learning-rate area removed, the sum over updates of the rate given up.
In high-dimensional random fields, high-loss critical points are saddles. At a critical pointa point where the gradient is zero: a local minimum if every Hessian eigenvalue is positive, a saddle if some are negative and some positive, let be the loss and the indexthe fraction of the Hessian's eigenvalues that are negative at a critical point. For high-dimensional Gaussian random fields, Bray and Dean show that rises monotonically with . The Hessian has a random-matrix semicircle spectrum that sits rightward at low loss, with all eigenvalues positive near the global minimum, and shifts leftward at high loss, picking up many negative eigenvalues. High-loss critical points are therefore saddles with overwhelming probability, while index-0 minima cluster near the global minimum. Dauphin et al. (2014) test this on a one-hidden-layer MLP on downsampled MNIST and CIFAR-10. Using Newton's method, which converges to critical points of any index, they recover a rising error-versus-index curve. They attribute gradient descent's apparent stalls to plateaus around saddles. Plain Newton's method, , divides each eigendirection's gradient by its eigenvalue , stepping toward a saddle along negative-curvature directions. Their saddle-free Newton divides by and steps away.
Exact models and optimization theory confirm that gradient descent avoids strict saddles. Several tractable problems have no spurious local minimalocal minima whose loss is above the global minimum. Both a one-hidden-layer linear network under square loss (Baldi and Hornik, 1989) and positive semidefinite matrix completion (Ge et al., 2016) have only saddles and global minima. Yun et al. (2018) nevertheless construct neural networks with bad local minima. From a random start with a small fixed step, gradient descent almost surely avoids every strict saddlea critical point whose Hessian has at least one strictly negative eigenvalue, so a descent direction exists; if every point with a small gradient either has a Hessian eigenvalue below a fixed negative level or lies near a local minimum around which the loss is strongly convex (the robust strict-saddle property), noisy gradient descent reaches a point near a local minimum in polynomially many steps (Ge et al., 2015) (Lee et al., 2016). When its iterates converge and every saddle is strict, they therefore reach a local minimizer almost surely. Adding occasional random perturbations lets gradient descent escape strict saddles with a step count polylogarithmic in dimension (Jin et al., 2017). From very small initialization, deep linear networks are conjectured to pass near a sequence of saddles, one plateau each, before reaching a global minimum. Jacot et al. (2021) prove the passage between the first two saddles and support the rest with experiments. In Lecture 5's reading, saddles vastly outnumber local minima, surviving local minima sit near optimal loss, and gradient descent is not permanently blocked by them. These results still leave open how long training lingers near a saddle.
Caveats. All three pictures are cartoons. Two-dimensional loss slices depend heavily on architecture, with skip connections smoothing them (Li et al., 2018). A network landscape can even be engineered to match almost any chosen picture (Skorokhodov and Burtsev, 2019). The river valley redraws the convex noisy quadratic, and Lecture 6 revises what sets the steepness of its walls. Weight averaging also mixes two distinct effects. In WiSE-FT, an EMA during fine-tuning behaves differently from interpolating the start and end points, so averaging along one trajectory differs from averaging across a basin. The critical-point theory rests on random-field models and small networks.
Terms
- basin
- region around a minimum where the loss is close to convex, so weight averages of models inside it do no worse than the models' average loss
- midpoint barrier
- ; counts as averaging working
- ensemble vs average
- average of the two models' predicted probabilities vs the model with averaged weights; the ensemble never needs a shared basin
- WiSE-FT, model soup
- interpolate a fine-tune with its starting point; average several fine-tunes of one model
- task vector
- ; add to give a skill, subtract to remove it
- forked runs
- two runs sharing a prefix of training; averageable once the prefix is long enough compared with how far the branches travel
- noise floor
- steady-state loss per direction at a constant learning rate, roughly proportional to while
- river valley
- steep walls where a large step bounces, a flat river along the floor where progress happens; decay or averaging shows the progress
- EMA
- ; helps at a constant rate, lags slightly at the end of a decay to zero
- AdamW weight-decay timescale; how long a learning-rate change takes to settle (about 3,300 updates in d8)
- index
- fraction of negative Hessian eigenvalues at a critical point; rises with the loss there
- saddle-free Newton
- Newton step with each eigenvalue replaced by , so it moves away from saddles
Sources
Lecture 5, “Loss Landscapes Part 1: Basins, River Valley, Critical Points” (Oct 13, 2026), of Stanford CS 312 Deep Learning Alchemy, Fall 2026. Taught by Tatsunori Hashimoto and Suhas Kotha; course staff Kaiyue Wen and Tristan Thrush (CAs).
Course site Lecture slides Online quiz Quiz answers Assignment Assignment code
The lessons, experiments, figures and quiz problems in this note are the course's, shown here with the instructors' permission.
- Tatsunori Hashimoto and Suhas Kotha. CS 312 Deep Learning Alchemy, Lecture 5: Loss Landscapes Part 1: Basins, River Valley, Critical Points. Stanford, Fall 2026.
- Tatsunori Hashimoto and Suhas Kotha. CS 312 Deep Learning Alchemy, Quiz 3: Optimization 2 (with answer slides). Stanford, Fall 2026.
- Tatsunori Hashimoto and Suhas Kotha. CS 312 Deep Learning Alchemy, Assignment 3: Optimization 2. Stanford, Fall 2026.
- Timur Garipov et al. Loss Surfaces, Mode Connectivity, and Fast Ensembling of DNNs. NeurIPS, 2018.
- Kaiyue Wen et al. Understanding Warmup-Stable-Decay Learning Rates: A River Valley Loss Landscape Perspective. ICLR, 2025.
- Yann Dauphin et al. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. NeurIPS, 2014.
- Mark Chen et al. Evaluating Large Language Models Trained on Code. arXiv preprint, 2021.
- Mitchell Wortsman, Gabriel Ilharco, Samir Yitzhak Gadre, Rebecca Roelofs, Raphael Gontijo-Lopes, Ari S. Morcos, Hongseok Namkoong, Ali Farhadi, Yair Carmon, Simon Kornblith, and Ludwig Schmidt. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. International Conference on Machine Learning, 2022.
- Rong Ge, Furong Huang, Chi Jin, and Yang Yuan. Escaping From Saddle Points: Online Stochastic Gradient for Tensor Decomposition. Conference on Learning Theory, 2015.
Connected notes
SGD's expected loss is the gradient-descent loss plus a term from noise injected while the loss is still of order one, so SGD noise matters only when the kernel decays more slowly than the gradient-descent loss.
- Transformers Learn In-Context by Gradient DescentIn-context learning · Hyperparameters set what the loss leaves free
In one-layer linear self-attention, the loss depends only on the product and leaves the scale split between the label-value scalar and the key-query matrix free; gradient flow conserves , which pins the limit on the hyperbola of equivalent global minima.
- The information exponentHigh-dimensional SGD · Averaging out gradient noise
Smoothing the loss over a cap of radius shrinks gradient noise faster than the squared signal up to , which lowers the sample cost from to the correlational-query lower bound .
- Convergence theory for MuonNanoGPT speedrun · Hyperparameters set what the loss leaves free
When every update has spectral norm at most , decay applied as confines the weights to a spectral-norm ball of radius . The learning rate does not enter the radius and sets only the speed at which the weights get there.