Convexity & Why It Matters

Why some models always find the best answer and neural networks do not.

🟡 intermediate5 min readoptimization
A convex function is shaped like a bowl: draw a straight line between any two points on its curve, and the line never dips below it. That one property guarantees there is no false bottom, so any minimum you find is the best one. Linear regression, logistic regression and SVMs all have convex losses, which is why they train reliably. Deep neural networks do not. Their losses are full of saddle points and flat regions, yet gradient descent still finds good solutions surprisingly often.

What is a Convex Function?

A function f(x)f(x) is Convex if drawing a straight line segment between any two points on its graph shows that the function lies on or below the line segment:

f(λx+(1−λ)y)≤λf(x)+(1−λ)f(y)∀λ∈[0,1]f(\lambda x + (1-\lambda) y) \le \lambda f(x) + (1-\lambda) f(y) \quad \forall \lambda \in [0, 1]
  CONVEX FUNCTION (Bowl Shape)                 NON-CONVEX FUNCTION (Multiple Local Minima)
  Loss                                         Loss
   High ┤  \        Secant Line /               High ┤    /\      /\
        │   \   .--------------.                │   /  \    /  \
        │    \ /  Function    /                 │  /    \  /    \  Global Min
    Low ┴─────'──────────────'─────► x          Low ┴─'──────\'──────'──────────► x
            Single Global Min                         Local Min   Global Min

First and Second-Order Convexity Conditions

For twice-differentiable function ff:

  1. First-Order Condition: f(y)≥f(x)+∇f(x)T(y−x)f(y) \ge f(x) + \nabla f(x)^T (y - x) for all x,yx, y. (The 1st-order Taylor tangent line lies everywhere below the function).
  2. Second-Order Condition: Hessian matrix ∇2f(x)\nabla^2 f(x) is Positive Semi-Definite (∇2f(x)⪰0\nabla^2 f(x) \succeq 0) for all xx.

Convex vs Non-Convex ML Models

┌───────────────────────────────────────┬───────────────────────────────────────┐
│       CONVEX ML MODELS                │       NON-CONVEX ML MODELS            │
├───────────────────────────────────────┼───────────────────────────────────────┤
│ Linear Regression (MSE Loss)          │ Deep Neural Networks (MLP, CNN, LLM)  │
│ Logistic Regression (Cross-Entropy)   │ Matrix Factorization                  │
│ Support Vector Machines (Hinge Loss)  │ Autoencoders                          │
│ Lasso / Ridge Regression              │ Gaussian Mixture Models (GMM)         │
│ Single Global Minimum Guaranteed!     │ Thousands of Saddle Points & Minima!  │
└───────────────────────────────────────┴───────────────────────────────────────┘

Why Deep Learning Works Despite Non-Convexity

Deep neural networks are non-convex, yet Gradient Descent reliably trains them to state-of-the-art performance. Why?

  1. Saddle Points, Not Local Minima: High-dimensional geometry (Dauphin et al., 2014) proves true sub-optimal local minima are extremely rare. Most zero-gradient points are Saddle Points, which SGD with momentum escapes easily.
  2. Over-parameterization: Having millions of parameters creates many equivalent zero-loss paths through weight space.
  3. Implicit Regularization of SGD: Stochastic mini-batch noise acts as implicit regularization, kicking optimization out of sharp sub-optimal basins into broad flat minima.

Say this out loud

Convexity means the secant line between any two points lies above the function graph, guaranteeing that any local minimum is a global minimum. Models like Linear Regression, SVMs, and Logistic Regression are convex. Deep neural networks are non-convex, but SGD succeeds because high-dimensional zero-gradient points are mostly saddle points rather than local minima traps.

Follow-ups to expect

Check yourself

Question 1 of 3

What fundamental guarantee does Convex Optimization provide regarding local minima?

More in Math & Statistics

See all →
Bayes’ Theorem4 minCentral Limit Theorem4 minLaw of Large Numbers4 min