Skip to content
AI.info

Training and optimization

Curvature, Conditioning, and Preconditioning

Develop practical intuition for anisotropic loss landscapes, condition numbers, diagonal preconditioning, and the limits of curvature language.

By the end you can

Visual

A narrow valley constrains one global step size

Different directions tolerate very different movements, and the tolerance is not a metaphor. Run full-batch gradient descent and the largest eigenvalue of the training-loss Hessian climbs until it hovers just above 2/(step size), then stays there. Cohen, Kaur, Li, Kolter and Talwalkar measured that in 2021 and named the regime the Edge of Stability. So one scalar learning rate does more than feel uncomfortable in the steep direction. It sets a ceiling on how sharp that direction is allowed to get.

FigureLayers · 4 layers
  1. 01

    Steep direction

    Small movement causes a large objective change.

  2. 02

    Shallow direction

    Large movement produces only gradual progress.

  3. 03

    Global learning rate

    One scalar must remain safe in the steep direction.

  4. 04

    Preconditioned coordinates

    Rescaling attempts to make progress more balanced.

Conditioning describes uneven local sensitivity

In a simple quadratic problem, the ratio between the largest and the smallest relevant curvature decides how hard one fixed step size will be. Deep networks are not fixed quadratics. The intuition survives contact with them anyway, and in the full-batch case the link between the step size and the steepest direction has been measured rather than assumed. A 2021 paper named that regime the Edge of Stability: “In this regime, the maximum eigenvalue of the training loss Hessian hovers just above the numerical value 2 / (step size), and the training loss behaves non-monotonically over short timescales, yet consistently decreases over long timescales.” The sharpest curvature does not sit still waiting to be measured. It rises until it meets the largest value the chosen step size can survive. Then it stays there. An independent group analysed the same regime in 2022 and reported that “sharpness stabilizes around 2/LR and loss goes up and down across iterations, yet still with an overall downward trend”.

Two things follow that a reader can use. The threshold is a number you can compute from your own configuration — 2/(step size) — not an impression. And a loss curve that rises across short windows while falling over long ones is the signature of that regime, not automatic evidence of a broken run.

Poor conditioning otherwise shows up as oscillation in some directions while others barely move. Parameterization, normalization, data scale and architecture all shape it. Two optimizers were built for exactly this problem. K-FAC came from Martens and Grosse in 2015; it approximates large blocks of the Fisher matrix as Kronecker products of two smaller matrices, and is “only several times more expensive to compute than the plain stochastic gradient”. Shampoo followed in 2018. It “maintains a set of preconditioning matrices, each of which operates on a single dimension, contracting over the remaining dimensions”, at a runtime per step its authors report as comparable to “simple gradient methods such as SGD, AdaGrad, and Adam”.

Optimization can be slow because coordinates are badly scaled, not because gradients are absent.

Analogy

Walking through a long, narrow canyon

Steep walls punish sideways steps while the floor slopes gently toward the exit. A safe stride for the walls makes forward progress slow.

Canyon walls at least stay where they are. Curvature here belongs to the coordinates the parameters happen to be written in, and it moves again with every stochastic batch. That is why rescaling directions can improve progress without describing a fixed landscape. Worse for the picture, the walls grow toward the stride. At the Edge of Stability the sharpest direction rises until it sits just above 2/(step size). A smaller step does not find you a gentler canyon. It raises the sharpness the run is willing to reach.

Conditioning asks whether the coordinate system makes useful directions unnecessarily difficult.

Comparison

Ways training systems respond to uneven geometry

Each method uses a different approximation, and several of these rows now carry a measured price rather than an adjective.

Changing the coordinate system before optimization is the cheapest intervention, and the one with the largest published effect on step count. In 2015 Ioffe and Szegedy inserted normalization into a state-of-the-art image classification model: “Batch Normalization achieves the same accuracy with 14 times fewer training steps, and beats the original model by a significant margin.” An ensemble of batch-normalized networks reached 4.9% top-5 validation error (4.8% test error) on ImageNet; the conference copy gives that ensemble result as 4.82% top-5 test error. The cost written in the table — altered model behavior — is real. But the benefit is 14 times fewer steps on a named model, not merely "simpler gradient scales".

Momentum accumulates persistent directions and damps some oscillation. It works from temporal history alone and carries no coordinate matrix. A diagonal adaptive optimizer uses coordinate-wise gradient magnitudes as a scale, which suits heterogeneous coordinates, at the price of extra state and a basis-dependent notion of geometry.

The second-order row is the one usually dismissed on memory and computation. It has now been tested head-to-head. MLCommons announced the results of the inaugural AlgoPerf: Training Algorithms benchmark competition on 1 August 2024: 18 submissions from 10 teams, fixed hardware, multiple workloads, a $25,000 prize. The external-tuning winner was Distributed Shampoo, from a Meta team. It scored 0.78 and trained models about 28% faster than the baseline. The self-tuning winner, Schedule Free AdamW, scored 0.85 for an 8% speedup — a different ruleset, with the tuning budget written into the rules. The competition's own analysis states the conclusion plainly: “The winning submission in the external tuning ruleset, using Distributed Shampoo, demonstrates the effectiveness of non-diagonal preconditioning over popular methods like Adam, even when compared on wall-clock runtime.” The cost of richer curvature is still memory and computation. What is no longer safe is the assumption that the cost goes unrepaid in wall-clock time.

FigureComparison · 4 columns

Feature or parameter scaling

Change the coordinate system before optimization.

  • Examples: normalization and standardization
  • Benefit: simpler gradient scales
  • Cost: altered model behavior
  • Limit: not full curvature correction

Momentum

Accumulate persistent directions and damp some oscillation.

  • Approximation: temporal history
  • Benefit: faster shallow progress
  • Cost: overshoot
  • Limit: no coordinate matrix

Adaptive optimizer

Use coordinate-wise gradient magnitudes as a diagonal scale.

  • Approximation: diagonal statistics
  • Benefit: heterogeneous coordinates
  • Cost: extra state
  • Limit: basis-dependent

Second-order method

Estimate richer curvature or solve a local model.

  • Approximation: Hessian or related matrix
  • Benefit: geometry-aware steps
  • Cost: memory and computation
  • Limit: noisy nonconvex settings

Example

Practical clues without forming a Hessian

These observations motivate a conditioning diagnosis. They do not prove one. Two of them have been followed all the way to a measurement, and it is worth seeing what the measurement looked like.

The full Hessian spectrum of an ImageNet-scale network stopped being a thought experiment in 2019, when Ghorbani and colleagues built a scalable estimator for it. A change of scale could now be tested against the spectrum itself: “In non-batch normalized networks, we observe the rapid appearance of large isolated eigenvalues in the spectrum, along with a surprising concentration of the gradient in the corresponding eigenspaces. In a batch normalized network, these two effects are almost absent.” The clue and the cure sit in the same picture. Outlier eigenvalues, gradient piling into their eigenspaces, and both effects almost gone once the coordinates are normalized.

Layerwise imbalance has a documented case too. LARS trains ResNet on ImageNet in minutes using layerwise adaptive learning rates, and it performs poorly on attention models like BERT. That failure is what a “layerwise adaptive large batch optimization technique called LAMB” was built for, published in 2020: “In particular, for BERT training, our optimizer enables use of very large batch sizes of 32868 without any degradation of performance. By increasing the batch size to the memory limit of a TPUv3 Pod, BERT training time can be reduced from 3 days to just 76 minutes.” Note both halves. Per-layer rescaling was the fix. And a per-layer rule that worked on ResNet was the thing that failed first on BERT. A conditioning story has to be tested on the model in front of you.

  • Layerwise imbalance: One module oscillates while another receives update ratios too small to matter — the failure LAMB was built for, after LARS's layerwise rule trained ResNet on ImageNet in minutes yet performed poorly on attention models like BERT.
  • Scale sensitivity: Modest feature normalization changes permit a much larger stable learning rate; the same intervention shows up in the Hessian spectrum, where large isolated eigenvalues appear rapidly without batch normalization and are almost absent with it.
  • Zig-zag trajectory: Momentum helps progress through a valley where plain SGD alternates across steep sides; at the Edge of Stability the loss itself moves non-monotonically over short timescales while decreasing over long ones, so wobble alone is not yet a verdict.
  • Optimizer gap: An adaptive method trains rapidly while unscaled SGD requires extensive rate tuning — and at AlgoPerf the gap ran the other way as well, Distributed Shampoo's non-diagonal preconditioning scoring 0.78 and training models about 28% faster than the baseline on fixed hardware.
  • Precision fragility: Small rounding or reduction changes produce large behavior differences in selected directions.

Key idea

Sharpness is parameterization-dependent and easy to overclaim

A region described as sharp can become flatter after a function-preserving reparameterization. Local Hessian measures also depend on scale, normalization, and the chosen neighborhood.

A 2017 paper put an argument under that caution. Its authors hold that “most notions of flatness are problematic for deep models and can not be directly applied to explain generalization”. For rectifier networks they construct equivalent models at “arbitrarily sharper minima”. The function does not change. Only the coordinates do.

The stronger warning is that a geometric explanation can be widely repeated, sit in the title of the paper that introduced the method, and still fail when someone tests it. Batch normalization was published as a way of "Reducing Internal Covariate Shift". Santurkar, Tsipras, Ilyas and Madry tested that mechanism in 2018 and rejected it: “In this work, we demonstrate that such distributional stability of layer inputs has little to do with the success of BatchNorm. Instead, we uncover a more fundamental impact of BatchNorm on the training process: it makes the optimization landscape significantly smoother.” The technique kept working throughout. Only the explanation of why it worked was replaced. And the replacement is itself a geometric claim — a smoother landscape, gradients that become more predictive and stable. Which means it too has to name its measurement rule.

Curvature diagnostics can guide optimization, but they should not be treated as universal explanations of generalization or model quality. Full derivations of Hessians, positive definiteness, and constrained optimization belong to the mathematical foundations path. Here the focus is observable training behavior, and the practical question is whether a change improves useful progress robustly enough to justify its state, compute, and complexity.

Geometry language is useful only when its coordinates and measurement rule are stated.

Steps

Probe a conditioning hypothesis

Use controlled changes that target scale rather than everything at once. Two of the five steps below now have a published reference standard to imitate.

Step 2, normalizing inputs, is the intervention Ioffe and Szegedy measured in training steps — 14 times fewer to the same accuracy. It is also the intervention measured in the Hessian spectrum, where the large isolated eigenvalues are almost absent once normalization is present. "Did normalization help?" therefore has a step-count answer and a spectral answer. They can disagree.

Step 3, comparing optimizers fairly, is what AlgoPerf formalized: fixed hardware, multiple workloads, separate external-tuning and self-tuning rulesets, and scoring on wall-clock runtime. The scores of 0.78 for Distributed Shampoo and 0.85 for Schedule Free AdamW mean something only because the tuning budget was written into the rules. A comparison that leaves tuning effort unstated measures the tuner, not the optimizer.

If you can afford one measurement beyond loss curves, take the largest Hessian eigenvalue and hold it against 2/(step size). The Edge of Stability result tells you where it is expected to sit. That turns a vague sense of instability into a prediction that can fail.

FigureProcess · 5 steps
  1. 1. Inspect layerwise scales

    Measure activations, gradients, parameters, and relative updates by module.

  2. 2. Normalize inputs

    Test whether feature scaling changes the stable learning-rate range.

  3. 3. Compare optimizers fairly

    Tune plain SGD, momentum, and an adaptive method under matched budgets.

  4. 4. Freeze unrelated choices

    Hold data, objective, augmentation, and checkpoint policy constant.

  5. 5. Examine the tradeoff

    Record convergence speed, validation behavior, memory, and sensitivity across seeds.

Key takeaways