JA EN
LearnCalculus & Optimization
·★ MEMBER·PAPER·9 min read

Convexity and Optimization — Why Deep Learning Works Even Though It Isn't Convex

Optimization textbooks teach a stark divide: convex problems are solvable, non-convex ones come with no guarantees. So why does deep learning — whose loss surface is provably non-convex — work at all? From convex sets and functions to saddle points and flat minima, this article connects the whole story in the language of landscapes.

ModalitytextTaskmath

Identifying and attacking the saddle point problem in high-dimensional non-convex optimization


The bottom of a bowl, and a mountain range in fog

Imagine playing a game blindfolded: find the lowest point around, using only the slope you feel under your feet.

If the arena is the inside of a salad bowl, the game is easy. Wherever you stand, keep walking downhill and you will reach the bottom — the one and only bottom.

If the arena is a mountain range shrouded in fog, all bets are off. Is the hollow you just walked into really the deepest valley, or just a puddle? The slope under your feet cannot tell you. You might even end up on a strange flat spot along a ridge, with no idea which way to go.

Convexity is the mathematical concept that separates the bowl from the mountains. And the loss surface of deep learning is, unmistakably, the mountains. Yet gradient descent — a method that does nothing but "walk downhill from where you stand" — works remarkably well in practice. This article unravels that puzzle in the language of terrain.

Convex sets and convex functions — shapes with no dents

Two foundational definitions first. Both boil down to nothing more than "connect two points with a line."

A convex set is a region with no dents. A set CC is convex when

λx+(1λ)yC(x,yC, λ[0,1])\lambda x + (1-\lambda)y \in C \quad (\forall x, y \in C,\ \forall \lambda \in [0,1])
(1)

In plain words: pick any two points x,yx, y inside CC and draw the straight segment between them — the entire segment stays inside CC. Here λ\lambda (lambda) is a fraction between 0 and 1 marking a position along the segment (0.5 is the midpoint). A disk is convex; a crescent moon is not, because the segment cuts across the missing part.

A convex function is one whose graph is bowl-shaped. A function ff is convex when

f(λx+(1λ)y)λf(x)+(1λ)f(y)f(\lambda x + (1-\lambda)y) \le \lambda f(x) + (1-\lambda)f(y)
(2)

In plain words: connect any two points on the graph with a chord (a straight line), and the graph always lies on or below that chord. The left side is "the function's value at a blend of the two points"; the right side is "the blend of the function's values," i.e. the height of the chord. The everyday observation that a bowl sags below its rim-to-rim string is the definition. f(x)=x2f(x)=x^2 is convex; sinx\sin x is not.

If a one-variable function is twice differentiable, the test gets even simpler: f(x)0f''(x) \ge 0 everywhere means convex. If the slope never stops increasing — never turns back downward — the shape is guaranteed to be a bowl.

What convexity buys you

Convex functions have a property that optimization can only dream of elsewhere:

Every local minimum is a global minimum.

Find a spot where no direction leads downhill, and you are guaranteed to be standing at the true bottom. Inside a bowl, being fooled by a puddle simply cannot happen. The reason falls straight out of the definition: if some point B were lower than your bottom A, the chord from A to B would dip below A along the way, so points near A would be lower than A — contradicting "A is a local minimum."

For differentiable convex functions there is also the first-order condition:

f(y)f(x)+f(x)(yx)f(y) \ge f(x) + \nabla f(x)^\top (y - x)
(3)

In plain words: draw the tangent plane (tangent line) at any point xx, and the entire function sits above it. f(x)\nabla f(x) (nabla, the gradient) is the vector pointing in the steepest uphill direction at xx. The power of this inequality: plug in f(x)=0\nabla f(x) = 0 and the right side collapses to f(x)f(x), proving in one line that "a point with zero gradient is a global minimum."

That is why convex problems — linear regression, logistic regression — are safe territory: gradient descent reaches the same answer from any starting point. Feel that safe world for yourself first.

FIG 1A ball rolls down a convex valley. With a sensible learning rate it always reaches the bottom, but crank the rate too high and it leaps over the valley and diverges — even convexity won't manage your learning rate for you

Everything so far is the first half of the textbook: "convex means solvable." The trouble is that deep learning lives outside this safe world.

That a neural network's loss function (input: the parameters; output: the training error) is not convex can be shown by a short argument, not just a vibe. The key is permutation symmetry.

What's behind this

§

Members-only from here

371 walkthroughs, 26 textbook chapters, 48 student units and 6 close readings — all included for $4.99/mo, with three new explainers every day. Cancel any time; access runs to the end of the period.

Already a member? Sign in to keep reading

References

  1. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. arXiv:1406.2572Paper page·PDF
  2. On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima. arXiv:1609.04836Paper page·PDF
  3. Sharpness-Aware Minimization for Efficiently Improving Generalization. arXiv:2010.01412Paper page·PDF

This article is written from the source paper above. Where they differ, the original is authoritative.

Comments

Sign in to comment