A local optimum is a point in the search space where the objective function cannot be improved by any small move to a neighboring solution, although a better solution may exist farther away. In optimization for artificial intelligence, it is called a local minimum when the goal is to minimize a loss and a local maximum when the goal is to maximize a reward, likelihood or score.
The concept matters because most practical algorithms, from gradient descent to hill climbing, only see the neighborhood of the current point. They stop or stall wherever no neighbor looks better, so the quality of the final answer depends on where the search starts, how far each step can reach and whether the problem is convex.
How a local optimum is defined
Formally, a point x* is a local minimum of a function f if there is a neighborhood radius r greater than zero such that f(x*) is less than or equal to f(x) for every feasible x within distance r of x*. A global optimum satisfies the same inequality for every feasible point, so every global optimum is also local, but not the other way around.
For smooth functions, calculus gives practical tests. The first-order condition requires a zero gradient at an unconstrained interior point. The second-order condition checks the Hessian matrix: a positive definite Hessian guarantees a strict local minimum, while mixed positive and negative eigenvalues indicate a saddle point instead. In discrete problems there is no gradient, so the definition depends on a chosen neighborhood structure, such as swapping two cities in a tour.
The following table summarizes the main kinds of stationary and optimal points that an optimizer can encounter.
| Point type | Gradient | Hessian eigenvalues | Can an optimizer escape? |
|---|---|---|---|
| Strict local minimum | Zero | All positive | Only with a large jump |
| Non-strict local minimum | Zero | Positive and zero | Sometimes, along flat directions |
| Saddle point | Zero | Mixed signs | Yes, with noise or curvature use |
| Global minimum | Zero | Positive or zero | No need to escape |
| Flat plateau | Near zero | Near zero | Slowly, if at all |
Why convexity removes the local optimum problem
In convex optimization, every local minimum is automatically a global minimum. A convex function over a convex feasible region has no separate valleys, so any point where no descent direction exists is the best possible answer. This property explains why linear programming, quadratic programming with a positive semidefinite matrix and logistic regression can be solved reliably to global optimality.
Non-convex optimization is different. Neural network training, clustering with k-means, mixed-integer problems and most combinatorial tasks contain many separate basins of attraction. An algorithm that follows local improvement ends in whichever basin contains its starting point, which is why the same model trained with different random seeds can reach different final losses.
| Problem class | Local equals global? | Typical AI example |
|---|---|---|
| Convex problems | Yes | Logistic regression, support vector machines |
| Smooth non-convex problems | No | Deep neural network training |
| Combinatorial problems | No | Traveling salesman, scheduling |
| Mixed-integer programs | No | Resource allocation with on-off decisions |
| Black-box functions | Unknown | Hyperparameter search |
Local optima in deep learning
Early neural network research treated bad local minima as the central obstacle to training. Later theoretical and empirical work changed that view for large models. In very high-dimensional loss surfaces, a random critical point is far more likely to be a saddle point than a minimum, because a minimum requires every one of millions of curvature directions to point upward.
For overparameterized networks, most local minima found in practice have training losses close to the best achievable value. The practical concern has shifted toward saddle points, plateaus and sharp minima. Sharp minima may fit the training data well yet generalize worse than flat minima, although the link between flatness and generalization remains an area of active debate rather than a settled rule.
Stochastic gradient descent helps in two ways. The noise from mini-batch sampling pushes parameters away from saddle points, and larger learning rates bias the search toward wider basins. Momentum, adaptive optimizers and learning-rate warmup further reduce the chance of stalling in a shallow region.
Strategies to escape or avoid a poor local optimum
No single method guarantees a global optimum for a general non-convex problem, so practitioners combine diversification, randomness and problem structure. The right choice depends on whether gradients exist, how expensive each evaluation is and how much time is available.
| Strategy | How it helps | Main cost |
|---|---|---|
| Random restarts | Samples many basins independently | Linear increase in compute |
| Simulated annealing | Accepts worse moves with falling probability | Sensitive cooling schedule |
| Tabu search | Forbids recently visited moves | Memory and tuning effort |
| Stochastic gradients | Noise shakes parameters out of saddles | Noisier convergence |
| Population methods | Explores many regions in parallel | Many function evaluations |
| Convex relaxation | Solves an easier global problem first | Gap to the original problem |
In combinatorial optimization, metaheuristics such as iterated local search perturb a good solution and then reoptimize it. Exact methods such as branch and bound avoid the issue entirely by proving optimality, at the price of potentially exponential running time.
Common misconceptions and practical warnings
Several recurring errors come from treating every local optimum as a failure or from assuming that a converged algorithm has found the best answer.
- A zero gradient is not proof of a minimum: it may be a saddle point or a maximum.
- A local optimum is not always bad: in deep learning it is often good enough.
- Convergence messages describe the algorithm, not the quality of the solution.
- More restarts give diminishing returns once most basins have been sampled.
- The neighborhood definition matters: a richer move set creates fewer local optima in discrete search.
A practical safeguard is to report the spread of results across several runs. If different seeds give very different objective values, the problem is likely rugged and deserves stronger global search or a better formulation.
A plain-language summary
Imagine hiking in thick fog and trying to reach the lowest point in a valley. You can only feel the ground near your feet. You keep stepping downhill until every direction goes up. That spot is a local optimum. It is the lowest place you can see, but a deeper valley may lie beyond the next ridge.
Computers searching for the best answer face the same problem. They improve step by step and stop when no small change helps. The answer is good nearby, not necessarily best overall. Trying several starting points or allowing a few uphill steps helps find better valleys.
An example from practice
A logistics team plans daily delivery routes for 40 vans and about 900 stops using a local search algorithm that swaps stops between routes. A single run starting from a simple greedy plan finishes in two minutes with a total distance of 12,400 kilometers and reports that no swap improves it further.
The analysts suspect a poor local optimum, so they run the same algorithm from 20 randomized starting plans and add a simulated annealing phase that occasionally accepts slightly longer routes. The best run reaches 11,650 kilometers, about six percent shorter, while the worst run stays near the original result. The team adopts the multi-start approach as standard practice and keeps the run-to-run spread as a quality indicator for each day’s plan.