Convex vs Non-Convex Loss Surfaces
A convex loss surface is a single bowl — gradient descent always finds the bottom. A non-convex surface, like the one every neural network trains on, has many bumps and valleys, so the same algorithm might get stuck in a mediocre one and never know it.
Prerequisites: Surrogate Losses and Classification Consistency
Gradient descent's whole strategy is "walk downhill." That strategy comes with an unstated assumption: that any downhill path eventually reaches the one lowest point that exists. For a convex loss — think of a single smooth bowl — that assumption is guaranteed true, no matter where you start. For a non-convex loss — a landscape riddled with hills, ridges and separate dips — it is not, and "walk downhill" can strand you in a valley that is nowhere near the true global minimum, with no signal from the gradient itself telling you that a better valley exists somewhere else.
The analogy: a single valley vs. a mountain range in fog
A convex loss is a single valley: drop a ball anywhere on its slopes and it eventually settles at the one lowest point, whose depth doesn't depend on where you dropped it. A non-convex loss is a mountain range in thick fog: you can only feel the slope under your feet, so you walk downhill and stop where the ground flattens — but that flat spot could be the true lowest valley in the range, or a random pocket a few hundred meters up a different mountain. You can't tell from where you're standing, and your starting point determines which pocket you land in.
The formal distinction
A function is convex if, for any two points and any :
In words: the function's value at any point between two other points never sits above the straight line connecting their values — the graph never bulges upward between two points on it, which is exactly the "no separate hill blocking the path between two valleys" property a bowl has and a mountain range doesn't. For a convex loss, every local minimum is automatically the global minimum — there is only ever one basin. Linear regression's squared error and logistic regression's log loss are both convex in their weights. A deep neural network's loss, once you compose enough nonlinear layers together, is not: it has many local minima, saddle points (flat in some directions, sloped in others), and plateaus, and nothing in the formula guarantees they're all equally good.
Worked example 1: a convex bowl by hand
For , take , , : the midpoint is , giving . The convexity inequality's right side is . Since , the inequality holds — and in fact is the global minimum, reachable by gradient descent from literally any starting , because a parabola has exactly one basin.
Worked example 2: a non-convex surface with a false minimum
Consider , a landscape with two separate basins. Its derivative is zero near , , and — three flat points, not one. At the two basin bottoms: and . Gradient descent started near slides into the basin and reports convergence at loss — a real local minimum, correctly found, yet worse than the basin sitting just a few units away. Nothing about the algorithm's behavior at (zero gradient, positive curvature) reveals a better basin exists elsewhere.
Try starting the descent above from different points on a bumpy loss curve — watch how the final resting point depends on the starting point, which never happens on a single bowl.
On a convex loss, every local minimum is the global minimum, so gradient descent's starting point never matters for the final answer. On a non-convex loss — every deep neural network's training objective — gradient descent only guarantees a local minimum, and different initializations or optimizer settings can land in basins of meaningfully different quality.
What this means in practice
Because deep learning loss surfaces are non-convex, practitioners run training multiple times from different random initializations, use momentum-based optimizers that can carry through shallow bumps, and treat "did it converge" as a much weaker claim than "did it converge to a good solution." Classical models like linear and logistic regression get a much stronger guarantee for free — any solver that converges at all has found the actual best fit, full stop.
The common confusion is treating "the optimizer converged" (gradient near zero, loss stopped decreasing) as proof of finding the best possible solution. On a non-convex surface this only certifies a local minimum or saddle point, not a global one — and in high dimensions, saddle points (where the gradient vanishes but the point is a minimum in some directions and a maximum in others) are actually far more common than true local minima, and can look like convergence to a naive stopping rule that only checks gradient magnitude.
Related concepts
Practice in interviews
Further reading
- Boyd & Vandenberghe, Convex Optimization, ch. 3