{"course":{"slug":"maths-you-need","title":"The Maths You Actually Need","url":"https://addaly.com/learn/maths-you-need","level":"intermediate","track":"deep"},"lesson":{"slug":"convexity-and-local-minima","title":"Convexity, and why nobody promises anything about deep networks","url":"https://addaly.com/learn/maths-you-need/convexity-and-local-minima","position":24,"of":76,"minutes":9,"answer":"A convex problem has one minimum that gradient descent is guaranteed to find, deep networks are not convex.","keyIdea":"A convex problem has one minimum that gradient descent is guaranteed to find, deep networks are not convex, and what saves them in practice is that most flat points in high dimensions are saddles rather than traps."},"body":{"format":"markdown","text":"## The shape that comes with a guarantee\n\nA function is convex if the straight line between any two points on its graph lies on or above the graph: a bowl, with no dents. The reason anyone cares is a guarantee: **a convex function has exactly one minimum region, and gradient descent with a sensible step size will find it, from any starting point.** No luck involved, no initialisation to tune.\n\nConvex problems include linear regression with squared loss, logistic regression, support vector machines, and lasso and ridge regression. This is why those methods are so reliable: run the fit twice on the same data and you get the same answer, because there is only one answer to get.\n\nTest for convexity in one variable by looking at the second derivative. `f(x) = x²` has `f'' = 2 > 0` everywhere: convex. `f(x) = x³` has `f'' = 6x`, negative for negative x: not convex. In many variables the equivalent is that the Hessian, the matrix of second derivatives, has no negative eigenvalues.\n\n## Neural networks are not convex, and it is not close\n\nAdd one hidden layer with a non-linear activation and convexity is gone. It is easy to see why: swap two hidden units, along with their weights, and you get a network computing exactly the same function with different parameters. Two distinct points, identical loss. A convex function cannot have two separate equally-low points with a rise between them, and a network with `n` hidden units in a layer has `n!` such copies of every solution. A layer of 100 units has more equivalent minima than there are atoms in the observable universe.\n\nSo there are no convergence guarantees for deep learning. None. Everything about why training works is empirical, and it is worth saying that plainly rather than implying there is a proof somewhere you have not read.\n\n## Why it works anyway: saddles, not traps\n\nThe intuition people carry from two-dimensional pictures (gradient descent trapped in a small local dip, missing the deep valley next door) turns out to be mostly wrong in high dimensions, and the reason is a counting argument.\n\nAt any flat point, the surface curves up or down in each of the directions given by the Hessian's eigenvectors. For that point to be a local minimum, it must curve *up* in every single one. In a million-dimensional space, that requires a million independent conditions to hold at once. A point where some directions curve up and others curve down is a **saddle**, and gradient descent escapes a saddle: it follows a downward direction out.\n\nBoth theoretical analysis of random high-dimensional surfaces and empirical measurement of trained networks support this picture: the flat points encountered during training are overwhelmingly saddles, and the local minima that exist tend to have losses close to one another. Being stuck is far less common than being slow.\n\nTreat this as the current best explanation rather than a settled fact. It is an active area, and the honest statement is that deep networks train reliably, that we have a plausible account of why, and that the account is not a proof.\n\n## Sharp and flat, and why it might matter\n\nA related and contested question is whether the *kind* of minimum matters. The proposal is that wide, flat minima generalise better than narrow, sharp ones, because a flat basin means small perturbations to the weights barely change the loss, and the test distribution is a small perturbation of the training one.\n\nThere is supporting evidence, there is a well-known counter-argument that sharpness can be manufactured or removed by rescaling weights without changing the function at all, and there are optimisers built on the idea, such as sharpness-aware minimisation, which do measurably help on some benchmarks. It is a live disagreement. Anyone presenting flat-minima theory as established is going beyond the evidence.\n\n## What follows for you in practice\n\n- **Initialisation matters** in a way it does not for convex problems. Different seeds give different final models, with different behaviour on edge cases even at identical accuracy.\n- **Reporting one run is reporting one draw.** If two configurations differ by half a point, run each three times before believing the difference. Seed variance on a small dataset is routinely larger than the effect people publish.\n- **Do not go hunting for the global minimum.** It almost certainly corresponds to memorising the training set. What you want is a good enough minimum that generalises, which is why regularisation and early stopping exist.\n- **Reach for convex methods when they fit.** If logistic regression solves your problem, its reproducibility and its interpretable coefficients are real advantages, not a consolation prize.\n\n## The rule to keep\n\nConvexity buys a guarantee, and deep learning gave it up in exchange for expressive power. What replaced the guarantee is the empirical observation that high-dimensional loss surfaces have far more saddles than traps, which is a good reason for confidence and not a substitute for running your experiment more than once."},"check":{"question":"Why are true local minima rare relative to saddle points in a loss surface with millions of parameters?","options":[{"text":"Because modern architectures use ReLU, which makes the loss piecewise linear and eliminates local minima.","correct":false,"tempting":"ReLU networks are piecewise linear in their inputs but not in their parameters, and the loss surface retains plenty of structure."},{"text":"Because the loss is bounded below by zero, so any flat point must be at or near the global minimum.","correct":false,"tempting":"Bounded below says nothing about how many distinct flat points exist between the start and the bottom."},{"text":"Because being a local minimum requires the surface to curve upward in every one of millions of directions simultaneously, whereas curving down in even one direction makes it an escapable saddle.","correct":true},{"text":"Because with enough parameters the loss surface becomes convex, so only one minimum exists.","correct":false,"tempting":"Adding parameters does not create convexity; the permutation symmetries alone guarantee it cannot be convex."}]},"prev":{"slug":"backpropagation-as-bookkeeping","title":"Backpropagation, and where the memory goes","url":"https://addaly.com/learn/maths-you-need/backpropagation-as-bookkeeping"},"next":{"slug":"curvature-momentum-and-adam","title":"Curvature, and what the optimisers are actually doing","url":"https://addaly.com/learn/maths-you-need/curvature-momentum-and-adam"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Convexity, and why nobody promises anything about deep networks', in The Maths You Actually Need. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/maths-you-need/convexity-and-local-minima (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Convexity, and why nobody promises anything about deep networks","courseTitle":"The Maths You Actually Need","module":{"index":3,"slug":"change-and-descent","title":"Change, slopes and the walk downhill"},"answer":null,"keyIdea":"A convex problem has one minimum that gradient descent is guaranteed to find, deep networks are not convex, and what saves them in practice is that most flat points in high dimensions are saddles rather than traps.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"the-shape-that-comes-with-a-guarantee","runs":[{"text":"The shape that comes with a guarantee"}]},{"t":"p","runs":[{"text":"A function is convex if the straight line between any two points on its graph lies on or above the graph: a bowl, with no dents. The reason anyone cares is a guarantee: "},{"text":"a convex function has exactly one minimum region, and gradient descent with a sensible step size will find it, from any starting point.","b":true},{"text":" No luck involved, no initialisation to tune."}]},{"t":"p","runs":[{"text":"Convex problems include linear regression with squared loss, logistic regression, support vector machines, and lasso and ridge regression. This is why those methods are so reliable: run the fit twice on the same data and you get the same answer, because there is only one answer to get."}]},{"t":"p","runs":[{"text":"Test for convexity in one variable by looking at the second derivative. "},{"text":"f(x) = x²","code":true},{"text":" has "},{"text":"f'' = 2 > 0","code":true},{"text":" everywhere: convex. "},{"text":"f(x) = x³","code":true},{"text":" has "},{"text":"f'' = 6x","code":true},{"text":", negative for negative x: not convex. In many variables the equivalent is that the Hessian, the matrix of second derivatives, has no negative eigenvalues."}]},{"t":"h2","id":"neural-networks-are-not-convex-and-it-is-not-close","runs":[{"text":"Neural networks are not convex, and it is not close"}]},{"t":"p","runs":[{"text":"Add one hidden layer with a non-linear activation and convexity is gone. It is easy to see why: swap two hidden units, along with their weights, and you get a network computing exactly the same function with different parameters. Two distinct points, identical loss. A convex function cannot have two separate equally-low points with a rise between them, and a network with "},{"text":"n","code":true},{"text":" hidden units in a layer has "},{"text":"n!","code":true},{"text":" such copies of every solution. A layer of 100 units has more equivalent minima than there are atoms in the observable universe."}]},{"t":"p","runs":[{"text":"So there are no convergence guarantees for deep learning. None. Everything about why training works is empirical, and it is worth saying that plainly rather than implying there is a proof somewhere you have not read."}]},{"t":"h2","id":"why-it-works-anyway-saddles-not-traps","runs":[{"text":"Why it works anyway: saddles, not traps"}]},{"t":"p","runs":[{"text":"The intuition people carry from two-dimensional pictures (gradient descent trapped in a small local dip, missing the deep valley next door) turns out to be mostly wrong in high dimensions, and the reason is a counting argument."}]},{"t":"p","runs":[{"text":"At any flat point, the surface curves up or down in each of the directions given by the Hessian’s eigenvectors. For that point to be a local minimum, it must curve "},{"text":"up","i":true},{"text":" in every single one. In a million-dimensional space, that requires a million independent conditions to hold at once. A point where some directions curve up and others curve down is a "},{"text":"saddle","b":true},{"text":", and gradient descent escapes a saddle: it follows a downward direction out."}]},{"t":"p","runs":[{"text":"Both theoretical analysis of random high-dimensional surfaces and empirical measurement of trained networks support this picture: the flat points encountered during training are overwhelmingly saddles, and the local minima that exist tend to have losses close to one another. Being stuck is far less common than being slow."}]},{"t":"p","runs":[{"text":"Treat this as the current best explanation rather than a settled fact. It is an active area, and the honest statement is that deep networks train reliably, that we have a plausible account of why, and that the account is not a proof."}]},{"t":"h2","id":"sharp-and-flat-and-why-it-might-matter","runs":[{"text":"Sharp and flat, and why it might matter"}]},{"t":"p","runs":[{"text":"A related and contested question is whether the "},{"text":"kind","i":true},{"text":" of minimum matters. The proposal is that wide, flat minima generalise better than narrow, sharp ones, because a flat basin means small perturbations to the weights barely change the loss, and the test distribution is a small perturbation of the training one."}]},{"t":"p","runs":[{"text":"There is supporting evidence, there is a well-known counter-argument that sharpness can be manufactured or removed by rescaling weights without changing the function at all, and there are optimisers built on the idea, such as sharpness-aware minimisation, which do measurably help on some benchmarks. It is a live disagreement. Anyone presenting flat-minima theory as established is going beyond the evidence."}]},{"t":"h2","id":"what-follows-for-you-in-practice","runs":[{"text":"What follows for you in practice"}]},{"t":"ul","items":[[{"text":"Initialisation matters","b":true},{"text":" in a way it does not for convex problems. Different seeds give different final models, with different behaviour on edge cases even at identical accuracy."}],[{"text":"Reporting one run is reporting one draw.","b":true},{"text":" If two configurations differ by half a point, run each three times before believing the difference. Seed variance on a small dataset is routinely larger than the effect people publish."}],[{"text":"Do not go hunting for the global minimum.","b":true},{"text":" It almost certainly corresponds to memorising the training set. What you want is a good enough minimum that generalises, which is why regularisation and early stopping exist."}],[{"text":"Reach for convex methods when they fit.","b":true},{"text":" If logistic regression solves your problem, its reproducibility and its interpretable coefficients are real advantages, not a consolation prize."}]]},{"t":"h2","id":"the-rule-to-keep","runs":[{"text":"The rule to keep"}]},{"t":"p","runs":[{"text":"Convexity buys a guarantee, and deep learning gave it up in exchange for expressive power. What replaced the guarantee is the empirical observation that high-dimensional loss surfaces have far more saddles than traps, which is a good reason for confidence and not a substitute for running your experiment more than once."}]}],"check":{"question":[{"text":"Why are true local minima rare relative to saddle points in a loss surface with millions of parameters?"}],"options":[{"text":[{"text":"Because modern architectures use ReLU, which makes the loss piecewise linear and eliminates local minima."}],"correct":false,"tempting":[{"text":"ReLU networks are piecewise linear in their inputs but not in their parameters, and the loss surface retains plenty of structure."}]},{"text":[{"text":"Because the loss is bounded below by zero, so any flat point must be at or near the global minimum."}],"correct":false,"tempting":[{"text":"Bounded below says nothing about how many distinct flat points exist between the start and the bottom."}]},{"text":[{"text":"Because being a local minimum requires the surface to curve upward in every one of millions of directions simultaneously, whereas curving down in even one direction makes it an escapable saddle."}],"correct":true,"tempting":null},{"text":[{"text":"Because with enough parameters the loss surface becomes convex, so only one minimum exists."}],"correct":false,"tempting":[{"text":"Adding parameters does not create convexity; the permutation symmetries alone guarantee it cannot be convex."}]}],"order":[0,3,1,2],"why":null},"prev":{"slug":"backpropagation-as-bookkeeping","title":"Backpropagation, and where the memory goes","minutes":10},"next":{"slug":"curvature-momentum-and-adam","title":"Curvature, and what the optimisers are actually doing","minutes":10}}}