1.2.10Calculus & Optimization Basics

Critical points and saddle points

2,273 words10 min readdifficulty · medium2 backlinks

What Are Critical Points?

Why does the gradient vanish? The gradient f\nabla f points in the direction of stepest ascent. At a critical point, there's no direction that immediately increases or decreases ff—the function is locally "flat." This doesn't tell us whether we're at a maximum, minimum, or saddle; it just says the first-order behavior is zero.

Derivation from first principles:

For ff to have a local extremum at x\mathbf{x}^*, moving slightly in any direction v\mathbf{v} shouldn't change ff to first order: f(x+ϵv)f(x)+ϵf(x)vf(\mathbf{x}^* + \epsilon \mathbf{v}) \approx f(\mathbf{x}^*) + \epsilon \nabla f(\mathbf{x}^*)^\top \mathbf{v}

For this to be an extremum, the linear term must vanish for all v\mathbf{v}, which forces f(x)=0\nabla f(\mathbf{x}^*) = \mathbf{0}.

Classifying Critical Points: The Hessian

Once we find f(x)=0\nabla f(\mathbf{x}^*) = \mathbf{0}, we examine the second-order behavior via the Hessian matrix.

Why the Hessian? Taylor expansion around x\mathbf{x}^* gives: f(x+d)f(x)+f(x)d+12dHdf(\mathbf{x}^* + \mathbf{d}) \approx f(\mathbf{x}^*) + \nabla f(\mathbf{x}^*)^\top \mathbf{d} + \frac{1}{2} \mathbf{d}^\top \mathbf{H} \mathbf{d}

Since f(x)=0\nabla f(\mathbf{x}^*) = \mathbf{0}, the behavior is governed by the quadratic form dHd\mathbf{d}^\top \mathbf{H} \mathbf{d}. The sign of this form determines whether ff increases or decreases as we move away.

Why eigenvalues? The eigenvalues of H\mathbf{H} are the curvatures along the principal axes. If all are positive, the function curves upward in every direction (a bowl). If mixed, it curves up in some directions and down in others (a sadle).

Figure — Critical points and saddle points

Saddle Points in Deep Learning

Why sadles dominate in high-D:
For a random symmetric matrix (a rough model of H\mathbf{H}), the probability of all nn eigenvalues having the same sign shrinks exponentially with nn. In R1000000\mathbb{R}^{1000000}, the chance of a local minimum is astronomically small; sadles are the norm.

Implication for optimization: Gradient descent can get stuck near saddles where f0\|\nabla f\| \approx 0 but the point is not a minimum. Algorithms like Adam, SGD with momentum, and sadle-free Newton methods help escape saddles by adding noise or using curvature information.

Common Mistakes

Active Recall

Recall Explain to a 12-year-old

Imagine you're playing a video game where you're a marble rolling on a bumpy surface, and you want to find the lowest valley. A critical point is anywhere the ground is perfectly flat—you stop rolling because there's no slope. But "flat" doesn't always mean you're at the bottom of a valley! You could be:

  • At the bottom of a bowl (minimum)—you found a low point, yay!
  • At the top of a hill (maximum)—you're at a high point, bad if you want low.
  • On a saddle (like horse sadle)—flat in the middle, but if you roll forward you go down, and if you roll sideways you go up. To figure out which, you check the curvature—does the ground curve up like a smile (minimum), down like a frown (maximum), or mixed (saddle)? In math, the Hessian matrix tells us the curvature in all directions at once.

Connections

  • Gradient Descent: Critical points are where gradient descent converges (or gets stuck)
  • Second-Order Optimization: Newton's method uses Hessian to jump toward minima, avoiding saddles
  • Loss Landscape Visualization: Tools like loss surface plots reveal the density of sadles in deep nets
  • Convex Optimization: In convex functions, every critical point is a global minimum—sadles impossible
  • Momentum and Adam: These optimizers help escape saddles via velocity/adaptive learning rates
  • Eigenvalues and Eigenvectors: Hessian's eigenvalues/vectors describe principal curvatures
  • Taylor Series: Second-order Taylor expansion motivates the Hessian classification

#flashcards/ai-ml

What is a critical point of a function ff? :: A point x\mathbf{x}^* where the gradient vanishes: f(x)=0\nabla f(\mathbf{x}^*) = \mathbf{0}. All partial derivatives are zero.

What does the Hessian matrix represent?
The matrix of second partial derivatives Hij=2fxixjH_{ij} = \frac{\partial^2 f}{\partial x_i \partial x_j}, capturing the curvature of ff at a point.
How do you classify a critical point using the Hessian's eigenvalues?
All positive → local minimum; all negative → local maximum; mixed signs → saddle point; some zero → degenerate (need higher derivatives).
Why are saddle points common in high-dimensional neural network optimization?
In high dimensions, the probability that all nn eigenvalues have the same sign is exponentially small. Most critical points have mixed-sign eigenvalues, making them sadles.
What is the quadratic form approximation near a critical point?
f(x+d)f(x)+12dHdf(\mathbf{x}^* + \mathbf{d}) \approx f(\mathbf{x}^*) + \frac{1}{2} \mathbf{d}^\top \mathbf{H} \mathbf{d}, where the gradient term vanishes at x\mathbf{x}^*.
How can you escape a saddle point in optimization?
Perturb along the eigenvector corresponding to the negative eigenvalue, or rely on noise from stochastic gradients and momentum to naturally escape.
What does a positive definite Hessian indicate?
The critical point is a local minimum—the function curves upward in all directions (all eigenvalues >0> 0).

What does an indefinite Hessian indicate? :: The critical point is a saddle—the function curves upward in some directions and downward in others (mixed-sign eigenvalues).

Concept Map

gradient vanishes

defined by

from

classified by

captures

from

analyze via

all positive

all negative

mixed signs

some zero

goal in ML

avoid in ML

Function f

Critical Point

grad f = 0

First-order Taylor term = 0

Hessian Matrix

Curvature / Second-order

Taylor Expansion

Eigenvalues lambda_i

Local Minimum

Local Maximum

Saddle Point

Degenerate

Loss Valley

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Critical points aur saddle points kya hain? Jab ap kisi function ka minimum dhundh rahe hain—jaise neural network ki loss—toh apko pehle wo jagah chahiye jahan gradient zero ho jaye, matlab f=0\nabla f = \mathbf{0}. Ye critical point kehlata hai. Lekin yahan problem hai: zero gradient ka matlab yeh nahi ki apko minimum mil gaya! Aap maximum par bhi ho sakte hain (jaise pahad ki choti), ya saddle point par—jahan ek direction mein surface neeche jata hai aur dusre mein upar (jaise ghode ki seat).

Classification kaise karein? Hessian matrix dekho—ye second derivatives ka matrix hai jo curvature bata hai. Agar Hessian ke sare eigenvalues positive hain, toh aap minimum mein hain (bowl shape). Agar sare negative, toh maximum (inverted bowl). Agar kuch positive aur kuch negative hain, toh sadle point hai. Deep learning mein problem yeh hai ki bohot saare parameters hone ke wajah se (millions!), critical points mein se zyada tar saddles hote hain, minima bahut rare hain.

Optimization mein kya hota hai? Gradient descent sadle points par slow ho jata hai kyunki gradient zero ke pas hota hai. Lekin modern optimizers (Adam, momentum, SGD with noise) sadles se escape kar lete hain—negative eigenvalue wali direction mein naturally perturb ho jate hain. Isliye practice mein saddleszyada problem nahi bante, bas thoda time lagta hai unse nikalne mein.

Real-world analogy: Socho ek hiker andhera mein pahaad par chal raha hai. Jahan zameen bilkul flat lage (zero slope = zero gradient), wahan ruk jata hai. Par flat zameen teen tarah ki ho sakti hai: valley (minimum—good!), hiltop (maximum—bad), ya saddle (ek taraf down, ek taraf up—confusing!). Hessian eigenvalues se aap batate hain kis tarah ki flatness hai, bina as-paas dekhe.

Go deeper — visual, from zero

Test yourself — Calculus & Optimization Basics

Connections