What is convex optimization?
Convex optimization is the problem of minimizing a convex function over a convex set. A function is convex when the straight line between any two points on its graph never dips below the graph, so it has one bowl and no false bottoms. Every local minimum of a convex problem is a global minimum, which makes these problems reliably solvable.
Many classic ML models are convex: linear and logistic regression, ridge and lasso, and support vector machines. For them, training finds the best possible parameters regardless of where it starts. Deep networks are not convex, so their loss surfaces have local minima, saddle points, and flat regions. Knowing which properties are lost explains why initialization, momentum, and learning-rate choices matter so much for them.
Key ideas
- A convex function lies below every chord between two points on its graph.
- In a convex problem, every local minimum is a global minimum.
- A twice-differentiable function is convex when its second derivative, or Hessian, is non-negative everywhere.
- Non-convex functions can have many local minima, and the start point decides which one gradient descent finds.
- Saddle points have zero gradient but curve up in some directions and down in others.
- Momentum averages past gradients, which helps an optimizer roll through small bumps and flat regions.
Common questions
Which machine learning models have convex loss functions?
Linear regression with squared error, logistic regression with cross-entropy, ridge and lasso regression, and linear support vector machines are all convex in their parameters. Adding a hidden layer with a nonlinear activation breaks convexity, because swapping two hidden units gives a different set of weights with the same loss.
Why do neural networks train well despite being non-convex?
Large networks seem to have many good minima with similar loss, so landing in any of them is usually fine. Most bad critical points in high dimensions are saddles rather than minima, and noisy gradients move past them. Over-parameterization also tends to connect good solutions through low-loss paths.
What is a convex set?
A set is convex if the straight segment between any two of its points stays inside it. Balls, boxes, half-spaces, and the probability simplex are convex; a ring or a crescent is not. Convex optimization requires both a convex objective and a convex feasible set.
How are convex problems solved in practice?
Smooth problems use gradient methods or Newton's method; problems with constraints often use interior-point methods. Libraries such as CVXPY let you write the problem in mathematical form and pass it to a solver. For large ML problems, first-order methods such as SGD or coordinate descent are usually preferred because each step is cheap.
Related explainers
- Gradient Descent — Optimizing by following the slope downhill
- Optimizers — SGD, momentum, and Adam — smarter gradient descent
- Constrained Optimization — Lagrange multipliers — optimization with constraints
- Partial Derivatives & Gradients — Extend single-variable derivatives to functions of multiple variables and gradient vectors
- Eigenvalues & Eigenvectors — How matrices transform space — eigenvectors, eigenvalues, and decomposition
- Regularization — Dropout, L1, and L2 — keeping models honest
References
- Boyd & Vandenberghe, "Convex Optimization", Cambridge University Press (free PDF)
- Dauphin et al. (2014), "Identifying and attacking the saddle point problem in high-dimensional non-convex optimization"
- Li et al. (2018), "Visualizing the Loss Landscape of Neural Nets"
- Goodfellow, Bengio & Courville, "Deep Learning", ch. 8 Optimization for Training Deep Models
Last updated