AI Computer Institute
Expert-curated CS & AI curriculum aligned to CBSE standards. A bharath.ai initiative. About Us

The Optimization Landscape: Local Minima, Saddle Points & Momentum

📚 Machine Learning⏱️ 24 min read🎓 Grade 10
✍️ AI Computer Institute Editorial Team Updated: August 2026 CBSE-aligned · Peer-reviewed · 24 min read
Content curated by subject matter experts with IIT/NIT backgrounds. All chapters are fact-checked against official CBSE/NCERT syllabi.

Every time a machine learning model "learns," it is really doing one thing: walking downhill on a surface it cannot see. The surface is the loss function — a number that measures how wrong the model's predictions are — plotted against every value its weights could take. Training is nothing but repeatedly asking "which direction is downhill from here?" and taking a small step that way. This chapter is about the shape of that surface, because the shape decides whether the walk succeeds, stalls, or gets fooled into thinking it has arrived when it hasn't.

Here is the trap. If you have only ever solved calculus problems where a function has one derivative-zero point and it is obviously the minimum, you will assume that "the gradient is zero" and "we found the best answer" mean the same thing. They do not. A flat point on a loss surface can be a genuine minimum, a genuine maximum, a place where the surface merely paused before continuing downhill, or — once you have more than one weight — a saddle point, which curves down in some directions and up in others at the same time, like the middle of a horse's saddle or a mountain pass. Telling these apart, and knowing what to do about the ones that are not true minima, is the entire subject of this chapter.

Warm-up: when the landscape really is a simple bowl

Start with the case where calculus gives you a clean, unambiguous answer, so you know what "easy" looks like before we make it hard on purpose.

Suppose you want to predict a student's mock-test score from a single "study-intensity index" x (a toy composite number from 1 to 3 — not a real survey, just data to differentiate). You use the simplest possible model, a line through the origin: predicted score = w·x, where w is the one weight you must learn. Your three data points are (x, y) = (1, 40), (2, 45), (3, 85).

The loss function is mean squared error:

L(w) = (1/3) [ (40 - w·1)² + (45 - w·2)² + (85 - w·3)² ]

To find the best w, differentiate with respect to w and set the result to zero — this is exactly the "gradient equals zero" condition, just in one dimension:

dL/dw = (2/3) [ -(40 - w) - 2(45 - 2w) - 3(85 - 3w) ]
      = (2/3) [ -40 + w - 90 + 4w - 255 + 9w ]
      = (2/3) (14w - 385)

Setting dL/dw = 0 gives 14w = 385, so w* = 27.5. Is this a minimum? Differentiate once more:

d²L/dw² = (2/3)(14) = 28/3 ≈ 9.33

Since 28/3 is positive everywhere (it doesn't even depend on w), the curve bends upward at every point, which means the loss function is a single parabola-shaped bowl with exactly one flat point, and that flat point must be the global minimum. There is nowhere else for the ball to roll. At w = 27.5, the predicted scores are 27.5, 55, and 82.5 — close to the actual 40, 45, 85, which is the best a single straight line through the origin can do for this data.

This is the picture most students carry out of Class 11-12 calculus: one critical point, obviously a minimum, done. It is also the picture that quietly breaks down the moment your model has more than one weight and your loss function is not a perfect quadratic — which is every real neural network.

Building the vocabulary: critical points, and why "flat" is not enough

A critical point of L(w) is any w where dL/dw = 0 — the tangent line is horizontal. Three things can happen there:

  • The curve bends upward around it (d²L/dw² > 0) → it's a local minimum.
  • The curve bends downward around it (d²L/dw² < 0) → it's a local maximum.
  • The curve doesn't clearly bend either way (d²L/dw² = 0) → you must look more closely, because it could be an inflection point where the function was decreasing, paused for an instant, and kept decreasing.

That third case is the one gradient descent cannot tell apart from a real minimum just by checking "is the slope zero?" — and it is far more common in practice than a first course in calculus suggests. Consider a loss function engineered to show this cleanly:

L(w) = w⁴ - 4w³ + 2

Differentiate:

dL/dw = 4w³ - 12w² = 4w²(w - 3)

Setting this to zero: w = 0 (a repeated root, since is squared) or w = 3. Two critical points. Take the second derivative to classify them:

d²L/dw² = 12w² - 24w = 12w(w - 2)

At w = 3: d²L/dw² = 12(3)(1) = 36 > 0, so this is a genuine local minimum. Computing the loss there, L(3) = 81 − 108 + 2 = −25, and since L(w) → +∞ as w → ±∞ with no other candidate minimum anywhere, w = 3 is in fact the global minimum.

At w = 0: d²L/dw² = 12(0)(−2) = 0. The second-derivative test is silent — it neither confirms nor denies. This is exactly the ambiguous case, and it is where most students reach for the wrong shortcut ("zero second derivative, so it must be an inflection, so let's move on"). You have to actually check whether the first derivative changes sign. Since dL/dw = 4(w − 3), and ≥ 0 always, the sign of the derivative is controlled entirely by the factor (w − 3), which is negative for every w < 3 — including both w = −0.1 and w = +0.1. The derivative is negative just to the left of 0 and negative just to the right of 0. It never changes sign. The function was already decreasing, went momentarily flat at w = 0 (L(0) = 2), and kept decreasing. That is a stationary inflection point, not an extremum of any kind — gradient descent sitting there sees a zero gradient and, if it stopped there, would report a "solution" 27 units of loss worse than the real one.

−1 0 1 2 3 4 w 0 −10 −25 L(w) w=0: dL/dw=0 but NOT a minimum (stationary inflection – keeps falling) w=3: global minimum L(3) = −25

Two weights change everything: the saddle point

Everything above used one weight, so "curves up" versus "curves down" was the only choice available. Real models have thousands, millions, sometimes billions of weights, and once you have two or more, a third option opens up: a critical point can curve up in one direction and down in another, simultaneously. That is a saddle point, and it is the single most important idea in this chapter for understanding why deep learning training behaves the way it does.

Take the loss function L(w, v) = , a function of two weights. Its gradient is the vector of partial derivatives:

∂L/∂w = 2w      ∂L/∂v = -2v

Both vanish only at (w, v) = (0, 0), so that is the only critical point. To classify it in two dimensions, the single second derivative is replaced by the Hessian, the 2×2 matrix of all second partial derivatives:

H = | ∂²L/∂w²    ∂²L/∂w∂v |   =  | 2   0 |
    | ∂²L/∂v∂w    ∂²L/∂v²  |      | 0  -2 |

The 2D analogue of the second-derivative test uses the determinant D = Lww·Lvv − (Lwv)²:

  • D > 0 and Lww > 0 → local minimum (curves up in every direction)
  • D > 0 and Lww < 0 → local maximum (curves down in every direction)
  • D < 0 → saddle point (curves up in some directions, down in others)
  • D = 0 → inconclusive, as before

Here D = (2)(−2) − 0² = −4, which is negative, so the origin is a saddle. Concretely: walk along the w-axis (holding v = 0) and L = rises on both sides — that's a valley. Walk along the v-axis instead (holding w = 0) and L = − falls on both sides — that's a ridge. The same point is simultaneously the bottom of one valley and the top of one ridge, which is exactly why it looks like a horse's saddle, or the flattest point of a mountain pass between two peaks.

Contour map: L(w, v) = w² − v² (saddle at the origin) −2−1 12 21 −1−2 w v saddle point (0,0) level curve L = 1 (valley direction, along w) level curve L = −1 (ridge direction, along v) gray diagonals: L = 0 (momentarily flat directions)

Why saddle points, not bad local minima, are the real obstacle

Here is a fact that surprised researchers when it was worked out carefully: in a network with a huge number of weights, true local minima that are meaningfully worse than the global minimum are rare. Saddle points are what you run into constantly. Yann Dauphin and colleagues made this precise in a widely cited 2014 paper, Identifying and Attacking the Saddle Point Problem in High-Dimensional Non-Convex Optimization, using ideas from random matrix theory to argue that as the number of weights grows, almost every critical point on the loss surface is a saddle rather than a minimum or maximum.

You can build the intuition yourself without the heavy machinery. At any critical point, the Hessian has one eigenvalue per weight, and (very roughly, if you imagine the curvature in each direction as being about equally likely to be positive or negative) a true minimum needs every single one of those eigenvalues to be positive at once. If a network has n = 1,000 weights and each curvature direction is a coin flip between "curves up" and "curves down," the chance all 1,000 land the same way is about 2 × (1/2)1000 — a number with hundreds of zeros after the decimal point. Real networks are not literally coin flips, but the same crowding effect is real: the more weights you have, the more directions there are for at least one of them to curve the "wrong" way, so a point that is flat in every direction is overwhelmingly more likely to be a saddle. This is also why, in high dimensions, the local minima that do exist tend to sit close in loss value to the true global minimum — getting stuck at a badly wrong minimum is not usually the danger. Getting stuck crawling across a wide, nearly flat saddle region is.

To make this concrete, go back to two weights and add curvature: L(w, v) = w⁴ − 2 + , a "double well." Setting both partial derivatives to zero, ∂L/∂w = 4 − 4w = 4w( − 1) and ∂L/∂v = 2v, gives three critical points: (0, 0), (1, 0), and (−1, 0). At the origin, Lww = 12(0)² − 4 = −4, Lvv = 2, so D = (−4)(2) = −8 — another saddle, with L(0,0) = 0. At (±1, 0): Lww = 12(1) − 4 = 8 > 0, Lvv = 2 > 0, so D = 16 > 0 with Lww > 0 — both are genuine local minima, and both give L = 1 − 2 = −1. Two equally good "answers" and one saddle sitting exactly between them, which is a fair miniature of what a real, million-weight loss landscape looks like: many equally good basins, separated by saddle ridges, none of them a unique "correct" answer.

Momentum: giving gradient descent a memory

Plain gradient descent has no memory. At every step it looks only at the current slope and moves proportionally to it: wt+1 = wt − η·L′(wt), where η (eta) is the learning rate. Near a saddle or a stationary inflection like the one at w = 0 in our quartic example, the gradient itself becomes tiny — that is exactly what "flat" means — so plain gradient descent's steps shrink to almost nothing right when it most needs to keep moving.

Momentum fixes this by carrying a running "velocity" forward from step to step, the way a heavy ball rolling downhill carries speed through a brief flat patch instead of stopping the instant the slope momentarily vanishes:

v(t+1) = β·v(t) - η·L′(w(t))
w(t+1) = w(t) + v(t+1)

Here β (beta, typically around 0.9) controls how much of the previous velocity survives each step. When β = 0, this collapses exactly to plain gradient descent — momentum is a strict generalisation, not a different algorithm.

Worked trace. Use the same quartic loss, L′(w) = 4 − 12, with η = 0.05. Suppose the optimizer arrives at w = 0.1 already carrying velocity v = 0.05, built up while descending the steeper slope to the left, and is about to cross the near-flat shelf around w = 0.

def grad(w):
    return 4*w**3 - 12*w**2

def vanilla_gd(w, eta, steps):
    trace = [w]
    for _ in range(steps):
        w = w - eta * grad(w)
        trace.append(w)
    return trace

def momentum_gd(w, v, eta, beta, steps):
    trace = [w]
    for _ in range(steps):
        v = beta * v - eta * grad(w)
        w = w + v
        trace.append(w)
    return trace

print(vanilla_gd(0.1, 0.05, 3))
print(momentum_gd(0.1, 0.05, 0.05, 0.9, 3))

Tracing vanilla_gd by hand: grad(0.1) = 4(0.001) − 12(0.01) = −0.116, so w1 = 0.1 − 0.05(−0.116) = 0.1058. Then grad(0.1058) ≈ −0.1296, giving w2 ≈ 0.1123. Then grad(0.1123) ≈ −0.1456, giving w30.1196. Net displacement after three steps: 0.1196 − 0.1 = 0.0196.

Tracing momentum_gd: v1 = 0.9(0.05) − 0.05(−0.116) = 0.045 + 0.0058 = 0.0508, so w1 = 0.1508. Then grad(0.1508) ≈ −0.2592, so v2 = 0.9(0.0508) + 0.05(0.2592) ≈ 0.0587, giving w2 ≈ 0.2095. Then grad(0.2095) ≈ −0.4898, so v3 = 0.9(0.0587) + 0.05(0.4898) ≈ 0.0773, giving w30.2868. Net displacement: 0.2868 − 0.1 = 0.1868.

Compare the two net displacements directly: 0.1868 ÷ 0.0196 ≈ 9.5. In the same three steps, across the same near-flat shelf, momentum travelled almost 9.5 times farther than plain gradient descent, because it never fully forgot the velocity it built up on steeper ground before entering the flat region. Plain gradient descent, with no memory, immediately mirrors whatever tiny local slope it currently feels and crawls.

This is not a free lunch. The same inertia that carries momentum through a flat shelf can carry it past a narrow minimum it should have stopped in, causing oscillation, which is why momentum is normally paired with a learning rate small enough to keep the overshoot controlled, and why more refined variants (Nesterov momentum, Adam) exist to manage this trade-off. But the core idea — accumulate velocity so that flat, low-gradient regions of the loss surface don't stall training — is the reason virtually every modern deep learning optimizer builds on momentum rather than plain gradient descent.

Common misconception: "zero gradient means I've found the answer"

This is worth stating as bluntly as possible because it is the single most common error students make once they meet optimization past a basic parabola: a zero gradient is a necessary condition for a minimum, never a sufficient one. You saw it fail in one dimension at w = 0 in the quartic (flat, but the function kept falling), and you saw the two-dimensional version of the same failure at every saddle point in this chapter (flat, but curving up in one direction and down in another). The only way to be sure a critical point is actually a minimum is to check the curvature around it — the second-derivative test in one dimension, the Hessian determinant test in two or more. In a trained neural network with millions of parameters, nobody computes the full Hessian to check this directly; instead, practitioners watch whether the gradient's magnitude has genuinely gone to (near) zero and stayed there while the loss has also stopped falling — a saddle typically shows a temporary gradient dip followed by the loss continuing to decrease once momentum (or noise from mini-batch training) pushes the optimizer past it.

Where this maps onto your exams

The one-variable half of this chapter — critical points, the first- and second-derivative tests, distinguishing minima, maxima, and inflection points — is precisely CBSE's Class 12 "Application of Derivatives" unit, and it is a guaranteed scoring topic in IIT-JEE and BITSAT, where questions routinely construct a cubic or quartic and ask you to classify every critical point exactly the way this chapter just did. The two-variable Hessian/determinant test is the natural next step once you reach multivariable calculus, and it is exactly the mathematics that a GATE-level course in optimization or machine learning builds on. Olympiad-style problems sometimes ask you to construct a function with a prescribed number and type of critical points (build your own quartic with a saddle-like inflection, the way this chapter did) — which is genuinely good practice for the reasoning above, not just the formulas. If you take away one exam-relevant habit from this chapter, make it this: whenever you set a derivative to zero, immediately ask "and is this actually an extremum?" before you write down your answer.

Practice

  1. Q1. For L(w) = − 3w + 2, find every critical point and classify each using the second-derivative test.
    Answer: L′(w) = 3 − 3 = 3(w−1)(w+1), critical points at w = 1 and w = −1. L″(w) = 6w. At w=1, L″=6>0 → local min, L(1)=0. At w=−1, L″=−6<0 → local max, L(−1)=4.

  2. Q2. Using the same through-the-origin regression setup as the warm-up, fit w to the data (1,10), (2,25), (3,26) by minimizing L(w) = (1/3)Σ(yiwxi)². What is w*, and is it a minimum?
    Answer: Σxi² = 1+4+9 = 14, Σxiyi = 10+50+78 = 138, so w* = 138/14 = 69/7 ≈ 9.86. d²L/dw² = (2/3)(14) = 28/3 > 0, so yes, it is the unique global minimum.

  3. Q3. Classify the critical point of L(w, v) = at the origin using the Hessian determinant test.
    Answer: Gradient (−2w, 2v) vanishes only at (0,0). Lww=−2, Lvv=2, Lwv=0, so D = (−2)(2) − 0 = −4 < 0: a saddle point (the mirror image of this chapter's example, with the valley and ridge directions swapped).

  4. Q4. Explain, using L(w) = , why a zero derivative at w = 0 does not make it a local extremum.
    Answer: L′(w) = 3 ≥ 0 for every w, so the derivative never changes sign around w = 0 — the function is increasing on both sides. It is a stationary inflection point, exactly the same failure mode as w = 0 in this chapter's quartic example.

  5. Q5. At wt = 0.3 with existing velocity vt = 0.02, current gradient gt = −0.4, η = 0.1, β = 0.8, compute one momentum step and compare its displacement to plain gradient descent's displacement from the same point.
    Answer: Momentum: vt+1 = 0.8(0.02) − 0.1(−0.4) = 0.016+0.04 = 0.056, so wt+1 = 0.356 (displacement 0.056). Vanilla: wt+1 = 0.3 − 0.1(−0.4) = 0.34 (displacement 0.04). Ratio: 0.056/0.04 = 1.4 — momentum's step here is 40% larger.

Summary

A loss surface's flat points come in more varieties than a single-variable calculus course prepares you for: true minima, true maxima, one-dimensional stationary inflections, and — once you have two or more weights — saddle points, which curve down in some directions and up in others simultaneously. The Hessian determinant test (D = LwwLvvLwv²) is the direct generalisation of the second-derivative test you already know, and D < 0 is the signature of a saddle. In the huge parameter spaces of real neural networks, saddle points vastly outnumber bad local minima, which is why the practical danger in training is not "getting trapped in the wrong bowl" so much as "crawling for a very long time across a nearly flat ridge." Momentum addresses exactly that failure mode by carrying velocity from step to step, so the optimizer can cross a region of near-zero gradient using speed it built up earlier rather than stalling the instant the local slope goes flat — at the cost of a tendency to overshoot narrow minima, which is why every practical optimizer built on this idea also has to manage that trade-off.

← Beyond Accuracy: Precision, Recall, F1, and AUC-ROCFeature Selection: Choosing What Matters →

Found this useful? Share it!

📱 WhatsApp 🐦 Twitter 💼 LinkedIn