Understanding the difference between local and global extrema is critical in machine learning because gradient descent and other optimization algorithms can get trapped in local minima, preventing us from finding the best possible solution. This concept explains why neural network training is hard and why we need techniques like random restarts, momentum, and adaptive learning rates.
At any local extremum, if f is differentiable, the gradient must vanish:
∇f(x∗)=0
Why? Suppose x∗ is a local minimum but ∇f(x∗)=0. Then there exists a direction d=−∇f(x∗) where f decreases (by definition of gradient). Moving slightly in that direction: x∗+ϵd gives f(x∗+ϵd)<f(x∗) for small ϵ>0, contradicting that x∗ is a minimum.
But: ∇f=0 is necessary but not sufficient. Critical points can be minima, maxima, or saddle points.
For a function f:Rn→R, compute the Hessian matrix:
Hij=∂xi∂xj∂2f
At a critical point x∗:
Local minimum: H is positive definite (all eigenvalues >0)
Local maximum: H is negative definite (all eigenvalues <0)
Saddle point: H has mixed-sign eigenvalues
Why does this work? The second-order Taylor expansion near x∗ is:
f(x∗+h)≈f(x∗)+∇f(x∗)Th+21hTHh
Since ∇f(x∗)=0:
f(x∗+h)−f(x∗)≈21hTHh
If H positive definite: hTHh>0 for all h=0 → function increases in all directions → local min
If H negative definite: opposite → local max
If mixed eigenvalues: increases in some directions, decreases in others → sadle
Step 3: Distinguishing Local from Global
There's no local test for global optimality. You must:
Find all critical points
Evaluate f at each
Check boundaries (if domain is bounded)
Compare all values—the smallest is the global minimum
Why is this hard in ML? Neural networks have millions of parameters, making exhaustive search impossible. We rely on optimization algorithms and empirical tricks.
Recall Explain to a 12-Year-Old (Feynman Technique)
Imagine you're playing a video game where you're blindfolded and trying to find the lowest point in a huge park with hills and valleys. You can only feel if the ground is sloping up or down under your feet.
A local minimum is like finding a small dip—maybe a pudle. If you take any step from that pudle, you go uphill, so it feels like the lowest point. But there might be a huge lake on the other side of the park that's way lower—that's the global minimum.
In machine learning, the "park" is all the possible ways to set your AI's brain (the numbers in the neural network). The "height" is how many mistakes the AI makes. We want the lowest point (fewest mistakes), but our algorithm (like taking downhill steps) might get stuck in a pudle instead of finding the lake.
That's why training AI is tricky—we need clever tricks to help it explore more of the park, not just settle for the first low spot it finds!
Think: "When building with LEGOs, you might make a small tower (local max) but miss that you could build a huge castle (global max) if you explored more pieces."
What is a local minimum? :: A point where the function value is lower than all nearby points within some neighborhood, but not necessarily the lowest point overall.
What is a global minimum?
The point where the function achieves its absolute lowest value across the entire domain.
What is the necessary condition for a point to be a local extremum?
The gradient must be zero: ∇f(x∗)=0 (making it a critical point).
How do you use the Hessian to classify a critical point?
Check eigenvalues—positive definite (all positive) means local min, negative definite means local max, mixed signs mean saddle point.
Why can gradient descent get stuck in local minima?
It only takes downhill steps based on local gradient information, so it converges to the first local minimum it encounters without exploring the full landscape.
Is every local minimum also a global minimum?
No—only in convex functions. In non-convex functions (like neural networks), local minima can have higher values than the global minimum.
Can a local extremum also be a global extremum?
Yes—an interior local extremum can coincide with the global extremum, and global extrema need not be unique (they can be achieved at multiple points, e.g. an interior point and an endpoint).
What is a saddle point?
A critical point where the Hessian has both positive and negative eigenvalues—the function decreases in some directions and increases in others, so it's neither a min nor max.
Why are saddle points common in high-dimensional optimization?
In high dimensions, the chance that all eigenvalues have the same sign (all positive or all negative) decreases exponentially, making saddle points more likely than local minima.
Dekho, jab bhi hum machine learning model train karte hain, toh ek "loss function" hota hai jo bata hai ki model kitna galat hai. Optimization ka matlab hai us loss ko kam karna—minimum dhoondhna. Lekin problem yeh hai ki local minimum aur global minimum mein fark hota hai.
Local minimum ek aisa point hai jahan loss apne as-pas ke points se kam hai, matlabagar thoda left ya right jao toh loss badhta hai. Lekin pore landscape mein dekhoge toh kahin aur ek aur bhi neeche point mil sakta hai—woh global minimum hai. Jaise ek gaon mein sabse neechi jagah ek kuan ho, lekin pore district mein ek gehri nadi ho—woh nadi global minimum hai.
Gradient descent jaisa algorithm sirf neeche ki taraf steps leta hai.Agar woh ek chhote kuan mein fas gaya, toh woh wahi ruk jayega, chahe gehri nadi kahi aur ho. Isliye deep learning mein hum momentum, adaptive learning rates, ya multiple random starts use karte hain taki algorithm landscape explore kar sake aur ek acha minimum dhundh sake. Non-convex functions (jaise neural networks) mein yeh problem bohot zyada hoti hai kyunki bahut sare local minima hote hain. Samajhna zaroori hai ki har critical point (jahan gradient zero ho) minimum nahi hota—woh sadle point bhi ho sakta hai, jahan kuch directions