Mathematical foundations
Gradient Methods, Conditioning, and Preconditioning
Connect gradient descent, step size, curvature, condition numbers, momentum, and preconditioning through the geometry of quadratic objectives.
By the end you can
- Derive gradient-descent behavior on a quadratic objective
- Explain how curvature and condition number affect convergence and oscillation
- Distinguish step-size scaling, momentum, adaptive scaling, and preconditioning
- Use diagnostics to tell poor geometry from a poor objective or noisy gradient
Visual
Gradient descent on an ellipsoidal bowl
For f(x)=½xᵀHx with positive definite H, each Hessian eigen-direction evolves on its own. The error along the eigenvector belonging to λᵢ is multiplied by 1−ηλᵢ at every step, so the method converges along that direction only while that factor stays inside the convergent range. That puts a ceiling on η, set by the largest eigenvalue, at the curvature 2/(step size).
The ceiling is not a safety margin that real training respects from below. Full-batch gradient descent on neural networks has been measured against it, by Cohen and four co-authors, at ICLR in 2021. The sharpness climbs until it reaches the threshold and then balances there: “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.”
A separate group restated the same regime independently at ICML in 2022 — “sharpness stabilizes around 2/LR and loss goes up and down across iterations, yet still with an overall downward trend” — and proved that two GD variants provably enter it.
The quadratic model is not being contradicted here. Training walks to the exact edge the quadratic model draws, and then stays on it.
1. Decompose the error
Express x in Hessian eigenvector coordinates.
2. Apply the update
Each coordinate is multiplied by 1−ηλᵢ.
3. Check stability
All factors must remain within the convergent range.
4. Compare rates
Small and large eigenvalues decay at different speeds.
5. Improve geometry
Rescale or precondition to reduce the spread.
The Hessian spectrum predicts stability and convergence speed, and real training runs sit just above the threshold it predicts rather than safely below it.
The negative gradient is local, not strategic
Gradient descent updates x ← x−η∇f(x). The gradient gives the steepest local Euclidean decrease, while η decides how far the method trusts that direction. On a curved landscape, the best step can differ sharply across directions. A single scalar learning rate must compromise between steep and shallow axes. Conditioning measures this imbalance. Poor conditioning creates zig-zag paths, slow progress, and sensitivity to step size even on a simple convex quadratic.
The price of that compromise has been measured, and it is not small. Take a large image classifier, leave the architecture and the objective alone, and change only the scale of the inputs each layer sees, by normalizing them. Ioffe and Szegedy did that in 2015, and their abstract reports the result: “Applied to 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 on ImageNet, and 4.8% test error, given as 4.82% in the ICML version.
The same abstract records the mechanical symptom. The method “allows us to use much higher learning rates” — which is what a step size looks like once it is no longer held hostage by the steepest direction in the problem.
Ioffe and Szegedy attributed the gain to reduced internal covariate shift. A paper at NeurIPS in 2018 showed that explanation does not hold, and that batch normalization instead makes the optimization landscape significantly smoother. The fourteenfold saving stands under either reading. What it buys is geometry, not capacity.
Many optimization difficulties come from mismatched geometry rather than mysterious nonconvexity.
Case
Polyak's heavy ball, 1964, and the speedup measured in the condition number
Momentum is old. Boris Polyak published the heavy-ball method in 1964. Four authors restated the result at ICML in 2013, and stated the size of the gain in the only unit that matters here: “Polyak (1964) showed that CM can considerably accelerate convergence to a local minimum, requiring √R-times fewer iterations than steepest descent to reach the same level of accuracy, where R is the condition number of the curvature at the minimum and µ is set to (√R − 1)/(√R + 1)”.
Both quantities are functions of the conditioning alone, and they move together. At R = 10 the saving is 3.2× and the constant that earns it is 0.519. At R = 100, 10.0× and 0.818. At R = 1,000, 31.6× and 0.939. At R = 10,000, 100.0× and 0.980 — the constant climbing toward 1 without ever reaching it.
The same 1964 parameter choice is restated independently in a 2024 paper by Wei and Chen, as β=((√L−√μ)/(√L+√μ))², with the accelerated local rate given in terms of √ρ where ρ=μ/L=1/κ. Conditioning is not a footnote about speed here. It is the quantity in which the acceleration is measured, which is why rescaling the variables and adding momentum are different interventions with a similar symptom.
One caution the record enforces: this is a result about a quadratic model of the curvature at the minimum, not a measured training run, and it quotes no measured speedup.
Figure
Comparison
Four ways to alter the optimization path
These methods may look similar in code but act through different mechanisms. The difference between the last two has now been settled on wall-clock time rather than argued from iteration counts.
MLCommons ran the inaugural AlgoPerf: Training Algorithms competition and announced the results on 1 August 2024: “The first iteration of the AlgoPerf: Training Algorithms competition attracted 18 submissions (with 15 being scorable) from 10 different teams. Scoring involved over 4000 individual training runs across the 14 workloads used in the benchmark.”
The external-tuning winner was Meta's Distributed Shampoo, which “provides an impressive 28% faster model training compared to the baseline” and took a $25,000 prize. The self-tuning winner, Schedule Free AdamW, delivered an “8% faster neural network training process”.
The competition results paper draws the conclusion: “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.” Preconditioning that models curvature across coordinates beat diagonal adaptive scaling on fixed hardware. It paid for its matrices every step and still finished first.
Learning-rate change
Scales the entire gradient by one factor.
- Simple global control
- Cannot correct directional imbalance
- Too large causes instability
- Too small wastes iterations
Momentum
Accumulates a velocity from past gradients.
- Damps repeated oscillation
- Accelerates persistent directions
- Adds state and tuning
- Can overshoot after regime changes
Adaptive diagonal scaling
Uses coordinate-wise gradient statistics.
- Cheap approximation to geometry
- Sensitive to parameterization
- May change implicit regularization
- Does not model cross-coordinate curvature
Preconditioning
Transforms the problem or gradient with a matrix.
- Can align updates with curvature
- Ranges from simple scaling to second-order methods
- Requires stable approximations
- Aims to improve effective conditioning
Key idea
A better condition number does not guarantee a better model
Optimization geometry concerns how easily an objective is minimized. It does not determine whether the objective represents the right task, or whether the solution generalizes. That gap has been constructed on purpose and then found in the wild.
There is a linearly separable binary classification problem on which GD and SGD reach zero test error while AdaGrad, Adam and RMSProp reach test errors arbitrarily close to one half. Five authors built it, and presented it at NIPS in 2017. The methods that adapt the geometry fit the training data and predict nothing.
Across several state-of-the-art deep models they found the same direction of failure: “We observe that the solutions found by adaptive methods generalize worse (often significantly worse) than SGD, even when these solutions have better training performance.” Better training performance was the evidence, and it pointed the wrong way.
Aggressive scaling can also change implicit biases, regularization interactions, and numerical behavior. Measure both optimization progress and downstream validation. Converging faster on the wrong objective does not make the system better.
Conditioning answers how hard the chosen objective is to optimize, not whether it deserves to be optimized.
Example
A two-dimensional quadratic with a narrow valley
Let f(x,y)=½(100x²+y²). Shewchuk works the same manoeuvre on a small system in a 1994 Carnegie Mellon report. Its section on preconditioning opens: “Preconditioning is a technique for improving the condition number of a matrix.” Then it reports what the cheapest version of it actually buys.
- Gradient: ∇f=(100x,y), so the x direction is one hundred times steeper.
- Stable step: η must be small enough for the x direction, limiting progress in y.
- Trajectory: Updates can alternate across the valley while moving slowly toward the minimum.
- Rescaling: Let u=10x; the objective becomes ½(u²+y²), which is isotropic. This is diagonal, or Jacobi, preconditioning, which Shewchuk says “is equivalent to scaling the quadratic form along the coordinate axes”. On his sample problem, “The condition number has improved from 3.5 to roughly 2.8”.
- Ceiling: With the perfect preconditioner M = A the transformed matrix “has a condition number of one, and the quadratic form is perfectly spherical, so solution takes only one iteration”. A coordinate transformation can turn a difficult search into a single step without changing the optimum.
Analogy
Steep walls make the downhill direction the wrong direction
Down a corridor that slopes gently forward between steep walls, steering directly downhill points mostly into a wall, and causes repeated corrections. Momentum remembers the forward component. Preconditioning changes the coordinate map so the corridor appears more circular.
The literature reaches for the same picture: “Intuitively, preconditioning is an attempt to stretch the quadratic form to make it appear more spherical, so that the eigenvalues are close to each other.” — Shewchuk, 1994.
The formal statement drops the corridor and keeps the guarantee. Templates for the Solution of Linear Systems, published by SIAM in 1994 and written by ten authors, puts it this way: “The convergence rate of iterative methods depends on spectral properties of the coefficient matrix. Hence one may attempt to transform the linear system into one that is equivalent in the sense that it has the same solution, but that has more favorable spectral properties. A preconditioner is a matrix that effects such a transformation.”
Equivalent in the sense that it has the same solution is the entire safety argument for the trick. It is why preconditioning is not a way of cheating on the answer. With stochastic gradients, or a landscape that shifts while it is being descended, the corridor itself appears to move.
Preconditioning changes the geometry seen by the optimizer, not the location of the desired solution.
Steps
Diagnosing slow or unstable optimization
Use targeted interventions instead of changing every hyperparameter at once. The probes below are real instruments with published readings, not metaphors.
The full Hessian spectrum of ImageNet-scale networks has been estimated with Hessian-vector products, by three authors at ICML in 2019. What they found is this lesson's anisotropy, counted: “the vast majority (> 99.99% of eigenvalues being close to 0)”, with a handful of large outliers separated from that bulk. They track the outliers with a scale-invariant ratio, ζ(t) := λ1(∇²L(θt))/λK(∇²L(θt)) — a condition number under another name — and state the consequence plainly: “For all directions where λi is small with respect to λ1, we expect convergence to be slow”.
The outliers are not a curiosity of the tail. In the network without batch normalization, “almost 99% of the energy is in the top few subspaces”. Nearly all of the stochastic-gradient signal lives inside the few steep directions that already cap the step size.
Their summary carries the diagnosis and the intervention in one sentence: “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 batch normalized networks, these two effects are almost absent.”
1. Plot loss and gradient norms
Separate divergence, plateaus, oscillation, and noise.
2. Inspect feature and parameter scales
Look for orders-of-magnitude differences and saturation.
3. Probe curvature
Use Hessian-vector products, local sweeps, or simple quadratic fits.
4. Test one geometry fix
Try normalization, rescaling, momentum, or a preconditioner.
5. Recheck validation
Confirm that easier optimization improves the metric and slices that matter.
Condition number summarizes anisotropy
In a positive definite quadratic, the spectral condition number κ=λmax/λmin compares the steepest and shallowest curvature directions. A large κ forces conservative steps for stability along the steep directions, which leaves slow movement along the shallow ones. Condition number depends on parameterization. Rescaling variables can dramatically improve optimization without changing the represented problem.
The cost of ignoring that has been audited, with certified numbers attached. In 1967 Longley appraised least-squares programs from the point of view of the user, in the Journal of the American Statistical Association, building on a macroeconomic least-squares problem whose design matrix is so collinear that regression programs disagreed on the answer. Cleve Moler records what became of it: “The Longley data set of labor statistics was one of the first used to test the accuracy of least squares computations.” The R Core Team documents the same 16 observations, taken from 1947 to 1962 on 7 variables, as “A macroeconomic data set which provides a well-known example for a highly collinear regression.”
NIST's Statistical Reference Datasets archive now certifies it: 1 response variable, 6 predictors, 16 observations, classified at the “Higher Level of Difficulty”. B0 = −3482258.63459582. Residual standard deviation 304.854073561965. R² = 0.995479004577296. The figures are published so that software can be checked against them, and the archive's stated purpose is improving “the accuracy of statistical software by providing reference datasets with certified computational results”.
A badly conditioned matrix is not an abstraction about convergence rates. It is a problem on which two correct-looking programs return different numbers, and someone had to certify which ones were right.
Case
December 1952: conjugate gradients promised a solution in n steps
Poor conditioning has been costed in machine time since 1952. Hestenes and Stiefel published the conjugate gradient method that December, in the Journal of Research of the National Bureau of Standards. The promise is the first two sentences of the abstract: “An iterative algorithm is given for solving a system Ax=k of n linear equations in n unknowns. The solution is given in n steps.”
They were writing for hardware and said so — “By a machine method, we shall mean one in which sequence-controlled machines are used.” — and the third of their five stated criteria was that “The procedure should be stable with respect to rounding-off errors.”
They survived by exploiting the spectrum rather than fighting it, and the size of that advantage is the same square root momentum earns. Shewchuk derives it in his 1994 Carnegie Mellon report, which cites the 1952 paper as reference [11]: to reduce the error by a factor ε, Steepest Descent needs roughly ½·κ·ln(1/ε) iterations and Conjugate Gradients roughly ½·√κ·ln(2/ε).
The condition number enters one linearly and the other under a square root — κ against √κ, the same law the heavy ball obeys.
Key takeaways
- Gradient descent follows local Euclidean steepest descent and relies on a step size to control trust in that direction. The quadratic stability ceiling is 2/(step size), and full-batch training on neural networks was measured hovering just above it.
- On quadratic objectives, Hessian eigenvalues independently determine stability and convergence rates. The measured spectrum of real networks: more than 99.99% of eigenvalues close to zero, with a few large isolated outliers holding almost 99% of the gradient energy when batch normalization is absent.
- A large condition number creates directional imbalance, zig-zagging, and slow progress — roughly ½·κ·ln(1/ε) iterations for Steepest Descent against ½·√κ·ln(2/ε) for Conjugate Gradients.
- Momentum accumulates persistent directions, reaching a given accuracy in √R-times fewer iterations with the constant (√R−1)/(√R+1) (Polyak, 1964). Preconditioning changes the geometry outright: 3.5 to roughly 2.8 for Jacobi on Shewchuk's example, and a condition number of one with the perfect preconditioner M = A.
- Conditioning depends on parameterization, so sensible rescaling can simplify an unchanged problem: normalizing layer inputs reached the same accuracy in 14 times fewer training steps (Ioffe and Szegedy, 2015).
- Optimization diagnostics must remain separate from evidence that the objective and resulting model are useful. Adaptive methods have been found generalizing worse than SGD even when their training performance was better.