Search

Search papers and lessons

Global Optimization

Level 2 · 11 min read

Global optimization finds the lowest value of a function anywhere in its domain, not just a nearby valley, which is hard because a local method can get stuck in the wrong one.

On this page

  • Colour = topic mix
  • Calculus
  • Optimization
  • Probability
  • Linear algebra
  • Losses & regularization
  • Optimizers
  • Sign in to see your progress

TL;DR

Global optimization means finding the smallest value a function takes over its whole domain, not just the smallest value in the valley you happen to be standing in. Gradient descent is fast, but it only finds a local minimum, and it can settle in the wrong valley. Global methods pay extra work to search more widely, and no method can guarantee the answer without some assumption about how smooth the function is.

Where you'll see it: fitting model settings where the error surface has many valleys, predicting the shape of a molecule by finding its lowest-energy arrangement, and tuning the design of a circuit or a mechanical part.

Intuition

Many valleys, one deepest

Picture a landscape with several valleys. Drop a ball at a random point and let it roll downhill. It stops at the bottom of whichever valley it landed in. That bottom is a local minimum: nothing nearby is lower. The lowest valley overall is the global minimum, and the ball has no way to know whether it found it.

Gradient descent is the ball rolling downhill. It is very good at reaching the bottom of the valley it starts in, and it has no way to tell whether a lower valley exists elsewhere. Global optimization is the question of how to look beyond the valley you are in, without searching every point of the landscape.

The plot below shows a one-dimensional example with two valleys. The left valley is the local one, and the right valley is the global one.

−2−1.5−1−0.500.511.5200.511.5xf(x)
  • f(x)
The point at x = -1 is a local minimum with value 0.5. The point at x = 1 is the global minimum with value 0.

Convexity is the special case that makes this easy

A convex function is shaped like a single bowl, with no false valleys. For a convex function every local minimum is the global minimum, so gradient descent is enough. Global optimization is the study of what to do when the function is not convex, which covers most of the problems that matter in practice. The key difficulty is that a local method cannot tell a deep valley from a shallow one just by looking at the slope where it stands.

The math

Definitions

Let f:X→Rf: \mathcal{X} \to \mathbb{R} be a function on a domain X\mathcal{X}, such as a box in Rn\mathbb{R}^n. A point x⋆\mathbf{x}^\star is a global minimiser if

f(x⋆)≤f(x)for every x∈X.f(\mathbf{x}^\star) \le f(\mathbf{x}) \quad \text{for every } \mathbf{x} \in \mathcal{X}.

A point x0\mathbf{x}_0 is a local minimiser if the same inequality holds for every x\mathbf{x} in some neighbourhood of x0\mathbf{x}_0. Every global minimiser is a local minimiser, but not the other way round. Gradient descent, from Gradient Descent, converges to a point where the gradient is zero, which is a local minimiser under the usual conditions. It has no mechanism to compare that point with the rest of X\mathcal{X}.

Why convexity helps

If ff is convex, then for any two points the chord between them lies on or above the graph. A consequence is that a point where the gradient vanishes is a global minimiser. A non-convex function can have many such points, each a local minimiser with a different value. The gap between the best and worst of them can be arbitrarily large.

A lower bound from smoothness

Global methods often rely on a bound on how fast the function can change. Say ff is LL-Lipschitz on an interval, meaning ∣f(x)−f(y)∣≤L∣x−y∣|f(x) - f(y)| \le L|x - y| for all xx and yy in it. Take an interval II with centre cc and half-width rr. For any xx in II we have ∣x−c∣≤r|x - c| \le r, so

f(x)≥f(c)−Lr.f(x) \ge f(c) - L r.

The right-hand side is a lower bound on the function over the whole interval, computed from one evaluation. If the best value found so far is UU, and f(c)−Lr>Uf(c) - Lr \gt U, then no point in II can beat UU, so the whole interval can be discarded. This is the basis of branch and bound: split intervals, bound each one, and discard the ones that cannot contain the minimum. The method works only when a Lipschitz constant LL is known or can be bounded, which is the assumption that Lipschitz Continuity describes.

What cannot be guaranteed

Without some assumption, no finite procedure can certify the global minimum of a continuous function. Take any function that is zero on a large region and place a very narrow dip somewhere in it. A finite set of evaluation points can miss the dip entirely, and nothing in the samples reveals that it exists. The Lipschitz bound is what rules this out, because a narrow dip needs a steep slope, and a steep slope is limited by LL.

Worked examples

Example
Multi-start gradient descent on two valleys

Use the function f(x)=min⁡((x−1)2,  (x+1)2+0.5)f(x) = \min\big((x-1)^2,\; (x+1)^2 + 0.5\big) on the real line. On the branch (x+1)2+0.5(x+1)^2 + 0.5 the minimum is at x=−1x = -1 with value 0.50.5. On the branch (x−1)2(x-1)^2 the minimum is at x=1x = 1 with value 00. The two branches are equal at x=−0.125x = -0.125, so starting points to the left of −0.125-0.125 fall into the left valley and points to the right fall into the right valley.

  1. Start at x0=−0.5x_0 = -0.5. This is on the left-valley side, so use the branch (x+1)2+0.5(x+1)^2 + 0.5. Its derivative is 2(x+1)2(x+1).
  2. Gradient at x0x_0: 2(0.5)=12(0.5) = 1. With step size η=0.25\eta = 0.25, the update is x1=−0.5−0.25⋅1=−0.75x_1 = -0.5 - 0.25 \cdot 1 = -0.75.
  3. Gradient at x1x_1: 2(0.25)=0.52(0.25) = 0.5. So x2=−0.75−0.25⋅0.5=−0.875x_2 = -0.75 - 0.25 \cdot 0.5 = -0.875.
  4. Each step halves the distance to −1-1, so the iterates converge to x=−1x = -1 and f=0.5f = 0.5. This is a local minimum, not the global one.
  5. Start at x0=0.5x_0 = 0.5 instead. The branch (x−1)2(x-1)^2 is now the smaller one, with derivative 2(x−1)2(x-1). The first step is x1=0.5−0.25⋅2(−0.5)=0.75x_1 = 0.5 - 0.25 \cdot 2(-0.5) = 0.75, and the iterates converge to x=1x = 1 with f=0f = 0.
  6. A simple multi-start strategy runs the local method from several points and keeps the best result. Here, starting points at −2,−0.5,0,0.5-2, -0.5, 0, 0.5 and 22 give two sets of results. Starts at −2-2 and −0.5-0.5 end at −1-1, and starts at 00, 0.50.5 and 22 end at 11. Keeping the best of these gives the global minimum, 00.

Interpretation: a single run from the wrong side reports a plausible answer that is wrong by 0.5. Running from several points and keeping the best is a cheap first defence, though it is not a guarantee, since a valley narrower than the spacing of the starts can be missed.

Example
Pruning an interval with a Lipschitz bound

Keep the same function on [−2,2][-2, 2]. Each branch has slope at most 6 in absolute value there, so ff is 6-Lipschitz on this interval. The best value found so far is U=0U = 0, from the point x=1x = 1.

  1. Consider the interval [−1.05,−0.95][-1.05, -0.95]. Its centre is c=−1c = -1 and its half-width is r=0.05r = 0.05.
  2. The centre value is f(−1)=0.5f(-1) = 0.5.
  3. The lower bound over the interval is f(c)−Lr=0.5−6⋅0.05=0.5−0.3=0.2f(c) - Lr = 0.5 - 6 \cdot 0.05 = 0.5 - 0.3 = 0.2.
  4. Since 0.2>U=00.2 \gt U = 0, no point in this interval can be lower than the best value found, so the interval is discarded.
  5. A wider interval [−1.5,−0.5][-1.5, -0.5], with centre −1-1 and half-width 0.50.5, gives the bound 0.5−6⋅0.5=−2.50.5 - 6 \cdot 0.5 = -2.5. This is below UU, so it cannot be discarded yet, and it must be split further.

Interpretation: the bound becomes useful only when intervals are narrow enough. The width at which the centre value of 0.50.5 can be ruled out is r<0.5/6≈0.083r \lt 0.5 / 6 \approx 0.083. Splitting continues until every interval is either discarded or small enough to be certain.

Tradeoffs and failure modes

MethodIdeaStrengthWeakness
Multi-start local searchRun gradient descent from many random points, keep the bestSimple, parallel, reuses existing local solversCan miss a narrow valley, and cost grows with the number of starts
Grid or exhaustive searchEvaluate ff on a fine gridEasy to reason about in one or two dimensionsCost grows exponentially with dimension
Simulated annealingRandom moves, accepting uphill moves with a probability that shrinks over timeEscapes local minima without gradientsNeeds a cooling schedule that is hard to tune
Basin hoppingLocal minimisation, then a random jump, then accept or reject the new basinGood on rugged landscapes such as molecular energiesResults depend on the jump size and acceptance rule
Branch and boundSplit intervals and prune with a Lipschitz lower boundCan certify a global minimum to a toleranceNeeds a known Lipschitz constant, and cost grows fast with dimension

A common mistake is to trust a single local run. Another is to assume that more random starts always help: in high dimensions the chance that a random start lands near the global valley can be tiny. Tuning matters too. Simulated annealing that cools too quickly freezes into a local valley, and one that cools too slowly wastes its budget.

For machine learning, the picture is different. Training a large neural network is non-convex, but in practice the local minima found by gradient methods often have similar loss values, so a single good run is usually acceptable. The hard cases are those with a few deep, isolated valleys, such as molecular energy surfaces and design problems with a small number of good solutions.

History

Local search with random moves is much older than the modern theory. In 1953, Nicholas Metropolis and colleagues proposed a random-walk method for simulating physical systems, which accepted uphill moves with a probability that depends on the energy difference and the temperature. This acceptance rule later became the engine of simulated annealing.

In 1983, Scott Kirkpatrick, Charles Gelatt and Mario Vecchi used the same idea as an optimisation method, slowly lowering a temperature parameter so that the search could leave local valleys early and settle into a good one late. The method caught on because it needed nothing from the function except the ability to evaluate it, and it worked on problems such as circuit layout, where no gradient was available.

In the late 1990s, David Wales and Jonathan Doye applied basin hopping to the structures of small clusters of atoms that interact through the Lennard-Jones potential. Their approach combined local minimisation with random jumps between basins. It found lowest-energy structures that were hard to reach with plain local search, and it remains a standard tool in computational chemistry. The broader theory was shaped by the no-free-lunch results of Wolpert and Macready in 1997, which showed that no single search method is best on every function.

Check yourself

QuestionWhy can gradient descent get stuck at a point that is not the global minimum, and what property of a convex function prevents this?Show answer

Gradient descent moves only in the direction of decreasing slope. Near a local minimum the slope is zero or points back into the valley, so the method stops there regardless of what lies elsewhere. A convex function has a single bowl, so every local minimum is also the global minimum. Convexity removes the false valleys that trap the method.

QuestionFor f(x)=min⁡((x−1)2,(x+1)2+0.5)f(x) = \min((x-1)^2, (x+1)^2 + 0.5), starting at x0=−0.25x_0 = -0.25 with step size η=0.25\eta = 0.25, what is x1x_1, and which minimum does the method head toward?Show answer

At x0=−0.25x_0 = -0.25, the two branches are (x−1)2=1.5625(x-1)^2 = 1.5625 and (x+1)2+0.5=1.0625(x+1)^2 + 0.5 = 1.0625. The second is smaller, so the derivative is 2(x+1)=2(0.75)=1.52(x+1) = 2(0.75) = 1.5. The update is x1=−0.25−0.25⋅1.5=−0.625x_1 = -0.25 - 0.25 \cdot 1.5 = -0.625. The method heads toward x=−1x = -1, the local minimum with value 0.5, because −0.25-0.25 lies left of the boundary at −0.125-0.125.

QuestionWhy does a Lipschitz bound make global minimisation of a continuous function possible in principle, when without one no finite search can certify the minimum?Show answer

With a bound LL on the slope, the value near any sample is limited: nothing within distance rr of a point can be lower than f(c)−Lrf(c) - Lr. So a narrow dip cannot hide between samples, because it would need a slope steeper than LL to exist. The bound lets an algorithm rule out whole intervals with finitely many evaluations. Without it, a dip of any width can be placed between samples and go unseen.

QuestionYou run gradient descent on a neural network from ten random initialisations and get ten different final losses. What does this suggest, and what would you check?Show answer

It suggests the loss surface has several local minima, or flat regions, that the starts reach differently. Whether this matters depends on the spread. If the losses are close and the held-out performance is similar, the local minima are probably acceptable. If the spread is large, you would check the initialisation scheme, the learning rate, and whether the final models perform differently on held-out data. Running more starts and keeping the best on validation data is the standard multi-start response.

Sources