For vector→vector functions, all the partial derivatives assemble into the Jacobian matrix jacobian matrix All partial derivatives of a vector→vector function: Jᵢⱼ = ∂f(x)ᵢ/∂xⱼ. defined in ch. 4 — open in glossary : for , with . And derivatives of derivatives — second derivatives — tell us how the slope itself will change as we move: they measure curvature curvature What second derivatives measure: whether a gradient step under/over-delivers vs the linear prediction (negative: better; positive: worse, can overshoot). defined in ch. 4 — open in glossary , i.e. whether a gradient step will deliver as much improvement as the slope promised.
Fig 4.4 (recreated) — curvature bends reality away from the gradient’s linear forecast.
The Hessian
With multiple input dimensions the second derivatives collect into the Hessian matrix hessian matrix H(f)ᵢⱼ = ∂²f/∂xᵢ∂xⱼ — the Jacobian of the gradient; symmetric (a.e.), so real eigenvalues + orthogonal eigenbasis; dᵀHd is directional curvature. defined in ch. 4 — open in glossary :
Term by term
| all second derivatives — equivalently, the Jacobian of the gradient | n×n | |
| symmetric wherever second partials are continuous (differential operators commute) — true almost everywhere in DL, so §2.7 gives real eigenvalues + an orthogonal eigenbasis | symmetric | |
| the second derivative along unit direction d: an eigenvalue when d is an eigenvector; otherwise a 0–1-weighted average of eigenvalues (closer eigenvectors weigh more). λmax and λmin bound it | scalar |
How does curvature interact with a gradient step? Take the second-order Taylor approximation around and substitute the step :
Term by term
| where we are | baseline | |
| the improvement the SLOPE promises — always a decrease | linear term | |
| the curvature correction: when this outgrows the linear term, the "descent" step goes UPHILL. If gᵀHg ≤ 0 the approximation says any ε helps (don’t trust it far); if positive, the best step is ε* = gᵀg / gᵀHg | quadratic term |
Worked example — the worst-case step size
If happens to align with the eigenvector of , then and . With : ε* = 0.25 — any constant learning rate above makes steps land higher than they started (try ε > 2 in the lab below, where λmax = 1). To the extent f is locally quadratic, the Hessian’s eigenvalues SET the scale of the learning rate.
The second derivative test
At a critical point (), the Hessian’s eigenvalues decide what you’re standing on — the multivariate second derivative test second derivative test At a critical point: H positive definite → local min; negative definite → local max; mixed eigenvalue signs → saddle; a zero eigenvalue → inconclusive. defined in ch. 4 — open in glossary :
| Hessian at ∇f = 0 | Verdict |
|---|---|
| positive definite (all λ > 0) | local minimum |
| negative definite (all λ < 0) | local maximum |
| some λ > 0 AND some λ < 0 | saddle point — max on one cross-section, min on another |
| all nonzero λ same sign, some λ = 0 | inconclusive (flat along the zero-eigenvalue cross-section) |
Fig 4.5 (recreated as contours) — the quintessential saddle : both eigenvalue signs present. In > 1 dimension, saddles don’t need zero eigenvalues — just mixed signs.
Ill-conditioning: the canyon
In multiple dimensions there is a different second derivative in every direction; the condition number condition number How sensitive a function's output is to input perturbation; for a matrix, maxᵢⱼ|λᵢ/λⱼ| — large means error amplification, an intrinsic property. defined in ch. 4 — open in glossary of the Hessian measures how much they disagree. A poorly conditioned Hessian is a canyon: one direction curves steeply (the walls, ), another barely at all (the floor, ). Gradient descent suffers doubly — it wastes steps zigzagging down the walls, and the step size must stay small enough for the walls, making floor progress glacial. This is the book’s fig 4.6, live:
step 0/45 · f = 137.20
Canyon regime: GD zigzags down the steep walls (λmax direction) while crawling along the floor (λmin direction) — ε must stay small for the walls, so progress along the floor is slow. Try the momentum optimizer.
Newton’s method — using the Hessian to steer
The zigzag exists because gradient descent is blind to curvature. Newton’s method newtons method Jump to the critical point of the local second-order Taylor: x* = x⁽⁰⁾ − H⁻¹∇f; exact in one step for positive definite quadratics; attracted to saddles. defined in ch. 4 — open in glossary solves the local second-order Taylor model exactly:
Term by term
| rescales the gradient by inverse curvature: big steps along flat directions, small steps along steep ones — exactly what the canyon needs | n×n | |
| the critical point of the local quadratic model — for a truly positive definite quadratic, the minimum in ONE application (toggle it in the lab); otherwise iterate | n×1 |
What this really says — and the catch
Gradient-only methods are first-order; Hessian-using methods are second-order. Newton’s method jumps to the nearest critical point — which is wonderful near a minimum and harmful near a saddle (it jumps TO the saddle; §8.2.3). Gradient descent at least isn’t attracted to saddles unless the gradient aims at them.
What guarantees can we get?
DL objectives are too complicated for most classical guarantees. Two partial refuges: Lipschitz continuity lipschitz continuous |f(x) − f(y)| ≤ L‖x−y‖₂: rate of change bounded by L — the weak guarantee most DL objectives can be given. defined in ch. 4 — open in glossary — , a weak bound (“small input change ⟹ small output change”) that many DL problems can be given with minor modifications — and convex optimization convex optimization Optimization restricted to functions with positive semidefinite Hessian everywhere: no saddles, every local minimum global; in DL mostly a subroutine/analysis tool. defined in ch. 4 — open in glossary , the most successful specialized field: Hessian positive semidefinite everywhere, hence no saddles and every local minimum global. Most DL problems can’t be expressed convexly, so convexity survives mainly as a subroutine and a source of analysis ideas.
Check yourself — curvature and the Hessian
1.In the GradientDescentLab with κ = 5, why does the trajectory zigzag instead of heading straight for the minimum?
2.You raise ε past 2 (with λmax = 1) in the lab. Predict the behavior, and connect it to the Taylor analysis.
3.At a critical point the Hessian has eigenvalues (+3, −1). What is the point, and why?
4.Why does Newton's method fix the canyon — and when is it dangerous?
5.What makes convex functions so friendly to optimize, and what is their role in deep learning?