Goal
Understand curvature as the next layer of information after the gradient.
The gradient tells us:
Which direction looks downhill right here?
The Hessian tells us:
How quickly is that downhill direction changing as we move?
That matters because optimization does not only depend on direction. It also depends on the shape of the loss surface.
Motivation
Gradient descent uses first-derivative information:
The gradient points in the direction of steepest local increase, so the negative gradient points locally downhill.
But the gradient alone does not tell us whether the local surface is:
- a broad shallow valley;
- a narrow steep canyon;
- a bowl;
- a ridge;
- a saddle.
Those shapes affect whether a learning rate is safe.
A step size that works in a flat direction may explode in a steep direction. A step size that is safe in a steep direction may crawl in a flat direction.
That is the optimization reason we care about curvature.
Prerequisites
- Lesson 26: Gradient Descent.
- Lesson 27: Stochastic Gradient Descent.
- Lesson 30: Learning Rate Schedules.
- Comfort with derivatives as local change.
- Comfort with matrices as transformations.
- Comfort with eigenvectors as special directions of a matrix.
Notation / Symbol Table
| Symbol | Plain-English name | Meaning |
|---|---|---|
| scalar function | A one-dimensional function. | |
| loss function | Loss as a function of model parameters. | |
| parameter vector | The values the optimizer changes. | |
| gradient | Vector of first partial derivatives. | |
| first derivative | Local slope in one dimension. | |
| second derivative | How the slope is changing. | |
| Hessian | Matrix of second partial derivatives. | |
| eigenvalue | Curvature scale in a Hessian eigenvector direction. | |
| direction vector | A direction in parameter space. |
One Dimension: Slope Versus Curvature
Start with a one-dimensional function:
The first derivative is:
This tells us the slope at each point.
The second derivative is:
This tells us that the slope changes at a constant rate.
Now compare:
Then:
and:
Both are bowls. But is a sharper bowl than .
That sharpness is curvature.
Curvature As “How Fast The Slope Changes”
A useful phrase:
The gradient tells you the current tilt. The second derivative tells you how quickly the tilt is changing.
For one-dimensional functions:
- means the curve bends upward like a bowl.
- means the curve bends downward like a hilltop.
- means no local quadratic bending in that direction.
This is local information. It describes the function near a point, not necessarily everywhere.
Why Curvature Affects Gradient Descent
Consider:
where .
Then:
A gradient descent update is:
Factor out :
The multiplier controls the behavior.
If is too large relative to , the update overshoots. If it is much too large, it diverges.
Since:
larger curvature means a smaller safe learning rate.
This is the link back to learning-rate schedules: the schedule changes the step size, but curvature helps explain why some step sizes are safe and others are not.
Two Dimensions: The Hessian
For a multivariable loss:
there is not just one second derivative. There are second partial derivatives.
The Hessian collects them into a matrix:
Read the diagonal entries as same-coordinate curvature:
- how the slope changes as changes;
- how the slope changes as changes.
Read the off-diagonal entries as interaction curvature:
- how the slope changes when changes;
- how the slope changes when changes.
For smooth losses, the two mixed partials are usually equal:
So the Hessian is often symmetric.
Worked Example: Diagonal Hessian
Let:
The gradient is:
The Hessian is:
Interpretation:
- curvature in the direction is ;
- curvature in the direction is ;
- there is no interaction term between and .
So the surface is much steeper in the direction than in the direction.
A learning rate that is comfortable along may bounce along .
Hessian Eigenvectors: Principal Curvature Directions
Because the Hessian is a matrix, it transforms direction vectors.
When is symmetric, its eigenvectors give special directions of curvature.
If:
then moving in direction has curvature strength .
For a Hessian:
- large positive means steep upward bowl direction;
- small positive means flat upward bowl direction;
- negative means downward-bending direction;
- mixed positive and negative eigenvalues indicate a saddle.
This connects back to earlier linear algebra:
The Hessian is locally telling us the shape of the loss surface by decomposing it into special curvature directions.
That is the same pattern as PCA and covariance geometry: use eigenvectors to find the important directions of a quadratic-like object.
Bowls, Hills, and Saddles
At a point where the gradient is zero, curvature helps classify the point.
| Gradient | Hessian behavior | Local shape |
|---|---|---|
| all eigenvalues positive | local minimum candidate | |
| all eigenvalues negative | local maximum candidate | |
| mixed signs | saddle point | |
| any Hessian | not stationary; still has slope |
A saddle point is especially important in high-dimensional optimization.
In one direction, it may curve upward. In another direction, it may curve downward.
So a point can have zero gradient without being a minimum.
The Local Quadratic Approximation
Near a point , a smooth loss can be approximated by:
Symbol table for this expression:
| Symbol | Meaning |
|---|---|
| Small proposed movement in parameter space. | |
| First-order change predicted by the gradient. | |
| Second-order correction from curvature. |
This formula says:
- start with the current loss;
- add what the gradient predicts;
- correct that prediction using curvature.
This is why second derivatives show up in optimization theory. They describe the local quadratic bowl that the optimizer is moving through.
Why We Do Not Usually Build The Full Hessian
For a model with parameters, the Hessian is an matrix.
If a model has one million parameters, the Hessian would have one trillion entries.
That is too large to store or invert directly in ordinary neural network training.
So modern optimizers usually do not build the full Hessian.
Instead, they use cheaper approximations or indirect signals:
- Adam uses running squared-gradient scale.
- Learning-rate schedules control the global step size over time.
- Second-order methods use curvature more directly, but at higher computational cost.
- Hessian-vector products can sometimes probe curvature without materializing the whole matrix.
For now, the goal is not to implement a full second-order optimizer. The goal is to understand what curvature means and why it affects training.
Connection To Programming
A Hessian for a two-variable scalar function can be represented as a 2x2 matrix.
For:
we can write:
function gradient(x: number, y: number): [number, number] {
return [2 * x, 20 * y];
}
function hessian(): [[number, number], [number, number]] {
return [
[2, 0],
[0, 20],
];
}
To inspect curvature along a direction , compute:
For a unit vector , this gives the curvature in that direction.
function curvatureInDirection(
hessian: [[number, number], [number, number]],
direction: [number, number],
): number {
const [x, y] = direction;
const hx = hessian[0][0] * x + hessian[0][1] * y;
const hy = hessian[1][0] * x + hessian[1][1] * y;
return x * hx + y * hy;
}
For direction [1, 0], the curvature is 2.
For direction [0, 1], the curvature is 20.
What Curvature Does Not Solve
Curvature information does not choose the right model.
It does not fix bad data.
It does not make nonconvex optimization easy.
It does not remove the need for validation checks.
It does explain why some regions of the loss surface are easy to optimize and others are awkward.
Why Hessians Show Up In ML
Hessians and curvature show up because training behavior depends on the local geometry of the loss surface.
They help explain:
- why learning rates can be unstable;
- why valleys can be slow to traverse;
- why saddle points are not minima;
- why coordinatewise scaling can help;
- why second-order methods are attractive but expensive;
- why flatness and sharpness are discussed in generalization.
You do not need the full Hessian to train a neural network today. But you do need the concept to understand many optimizer arguments.
Summary
The gradient is first-order information:
It tells us local slope.
The Hessian is second-order information:
It tells us local curvature.
The eigenvectors of the Hessian identify special curvature directions:
The eigenvalues tell us how curved the loss is in those directions.
Curvature matters because the same learning rate can be safe in flat directions and unstable in steep directions.
Exercises
- In your own words, explain the difference between a first derivative and a second derivative.
- For , compute and .
- For , compute the gradient and Hessian.
- In Problem 3, which direction is steeper: the direction or the direction? Why?
- Suppose a Hessian has eigenvalues and . What does that suggest about the local loss surface?
- Suppose a Hessian has eigenvalues and at a point where the gradient is zero. What kind of point is this likely to be?
- Explain why a learning rate that works in a flat direction might fail in a steep direction.
- Write TypeScript-style pseudocode for computing for a 2x2 Hessian and a 2D direction vector.
Looking Ahead
Curvature lets us distinguish broad bowls, steep valleys, and saddle points.
The next optimization question is:
When can we guarantee that local downhill movement behaves nicely?
That leads to convexity.
Completed Exercises
Handwritten work submitted after completing this lesson.



