Search

Search papers and lessons

Acquisition Function

Level 3 · 13 min read

An acquisition function scores each candidate input by how promising it looks given a model's mean and uncertainty, so the next trial can be chosen by a cheap calculation instead of an expensive experiment.

On this page

  • Colour = topic mix
  • Probability
  • Linear algebra
  • Discrete math
  • Calculus
  • Inference
  • Reinforcement learning
  • ReadReady to readNot yet

TL;DR

An acquisition function is a score that says how worth trying each possible input is. It is computed from a model's prediction at that input: the predicted mean, which is the best guess, and the predicted uncertainty, which says how unsure the model is. The next experiment is placed where the score is highest. Because the score is cheap to compute, it can be checked at thousands of candidate inputs even when each real experiment is slow or costly.

Builds on: Gaussian Process Regression · Leads to: Bayesian Optimization, Expected Improvement

Where it's used

Tuning machine learning models. A team wants the best learning rate and regularization strength for a model that takes a day to train. Each trial is expensive, so they fit a Gaussian process to the trials so far and use an acquisition function to pick the next pair of settings. This is the standard use of Bayesian Optimization in hyperparameter search.

Chemistry and materials. A lab wants a catalyst with the highest yield, and each synthesis takes days. The acquisition function points the next experiment at a mixture that the model predicts to be good or that the model knows little about, so that the lab does not repeat similar mixtures.

Engineering design. Choosing the shape of an aircraft wing or the settings of a process controller involves simulations that take hours. The same scoring rule decides which simulation to run next, and the search can stop after a fixed budget of runs.

How it works

Take three candidate inputs. The model is a Gaussian process fitted to earlier trials. It predicts, at each candidate, a mean μ\mu and a standard deviation σ\sigma. The best value found so far is f∗=1.0f^* = 1.0, and we want larger values.

CandidateMean μ\muStd σ\sigma
A1.00.5
B0.61.0
C1.50.1
  1. Read the model. Candidate A is predicted to match the best so far, with moderate uncertainty. Candidate B is predicted to be a bit worse, but its uncertainty is large. Candidate C is predicted to be clearly better, and the model is fairly sure. Check: the three rows give three different kinds of situation.
  2. Measure the gap. Subtract the current best from each mean: μ−f∗\mu - f^* is 00 for A, −0.4-0.4 for B and 0.50.5 for C. A positive gap means the candidate is predicted to beat the best so far. Check: only C has a positive predicted gap.
  3. Standardise the gap. Divide by the uncertainty, z=(μ−f∗)/σz = (\mu - f^*)/\sigma. For A, z=0z = 0. For B, z=−0.4z = -0.4. For C, z=5z = 5. A large zz means the candidate is likely to beat the best. Check: zz counts how many standard deviations the candidate sits above the current best.
  4. Score with probability of improvement. This is the chance the candidate beats f∗f^*, which is Φ(z)\Phi(z), where Φ\Phi is the cumulative distribution of a standard Gaussian. The scores are 0.500.50 for A, 0.340.34 for B and essentially 1.001.00 for C. Check: a score of 0.50.5 means an even chance of beating the best.
  5. Score with expected improvement. This is the average amount the candidate is expected to beat f∗f^* by, counting zero when it does not. It is 0.1990.199 for A, 0.2300.230 for B and 0.5000.500 for C. Check: the score is always zero or more, and it is largest for C.
  6. Score with an upper confidence bound. Add a multiple of the uncertainty to the mean, μ+κσ\mu + \kappa\sigma, with κ=2\kappa = 2. The scores are 2.02.0 for A, 2.62.6 for B and 1.71.7 for C. Check: here B wins, because its large uncertainty is worth more than its low mean.
  7. Choose. Expected improvement and probability of improvement choose C, and the upper confidence bound chooses B. The rule is fixed in advance, and the choice depends on which score you pick.
flowchart LR
  T[Past trials] --> G[Gaussian process: mean and std at each candidate]
  G --> S[Acquisition score at each candidate]
  S --> P[Pick the candidate with the highest score]
  P --> R[Run the expensive experiment]
  R --> T

The plot shows how these scores depend on the predicted mean, when the uncertainty is fixed at 11 and the best so far is f∗=0f^* = 0. Probability of improvement rises towards 11 and then flattens. Expected improvement keeps rising as the predicted mean grows.

−2−1.5−1−0.500.511.5200.511.522.5predicted meanscore
  • probability of improvement
  • expected improvement
Two acquisition scores against the predicted mean, with the best so far at 0 and uncertainty 1. Probability of improvement saturates at 1, while expected improvement keeps growing with the mean.

The math

Definition: Acquisition function

Let ff be the unknown function to maximise, let μ(x)\mu(x) and σ(x)\sigma(x) be the posterior mean and standard deviation of ff at input xx given the trials so far, and let f∗f^* be the best observed value. An acquisition function a(x)a(x) is a score built from μ(x)\mu(x), σ(x)\sigma(x) and f∗f^*. The next trial is at the input that maximises a(x)a(x).

Write Φ\Phi for the cumulative distribution function of a standard Gaussian and φ\varphi for its density, so that φ(z)=e−z2/2/2π\varphi(z) = e^{-z^2/2}/\sqrt{2\pi}. The posterior of a Gaussian process is Gaussian at each input, so these two functions appear in the scores. Its uncertainty depends on the kernel chosen for the process.

Step 1 in symbols: the gap and the standardised gap

z(x)=μ(x)−f∗σ(x).z(x) = \frac{\mu(x) - f^*}{\sigma(x)}.

The numerator is how far the predicted mean sits above the best so far. Dividing by σ(x)\sigma(x) turns that gap into a number of standard deviations, which makes inputs with different uncertainties comparable.

Step 2 in symbols: probability of improvement

aPI(x)=Φ(z(x)).a_{\mathrm{PI}}(x) = \Phi\big(z(x)\big).

If the posterior is Gaussian, this is the probability that the true value at xx exceeds f∗f^*. It is 0.50.5 when z=0z = 0, and it tends to 11 as zz grows.

Step 3 in symbols: expected improvement

aEI(x)=(μ(x)−f∗) Φ(z(x))+σ(x) φ(z(x)).a_{\mathrm{EI}}(x) = \big(\mu(x) - f^*\big)\,\Phi\big(z(x)\big) + \sigma(x)\,\varphi\big(z(x)\big).

The first term is the gap times the chance of a gain. The second is the size of the spread that lies above f∗f^*. Its value is always zero or more. Check it with candidate B: z=−0.4z = -0.4, Φ(−0.4)=0.345\Phi(-0.4) = 0.345 and φ(−0.4)=0.368\varphi(-0.4) = 0.368, so aEI=(−0.4)(0.345)+1×0.368=0.230a_{\mathrm{EI}} = (-0.4)(0.345) + 1 \times 0.368 = 0.230.

Step 4 in symbols: upper confidence bound

aUCB(x)=μ(x)+κ σ(x),κ≥0.a_{\mathrm{UCB}}(x) = \mu(x) + \kappa\, \sigma(x), \qquad \kappa \ge 0.

Here κ\kappa sets the trade-off. With κ=0\kappa = 0 the score is the mean alone, which is pure exploitation. A large κ\kappa rewards uncertainty, which is exploration.

Step 5 in symbols: the choice

The next input is

xnext=arg⁡max⁡x a(x).x_{\text{next}} = \arg\max_x\, a(x).

The maximisation is over a cheap model, not the real function. In one dimension it is a grid search. In higher dimensions, a numerical optimiser such as a gradient-based method with random restarts is used, because a(x)a(x) is much cheaper than one experiment.

Worked examples

Example
Example 1: one candidate, by hand (tiny)

Take a candidate with μ=2\mu = 2, σ=1\sigma = 1, and best so far f∗=1f^* = 1.

  1. The gap is μ−f∗=2−1=1\mu - f^* = 2 - 1 = 1.
  2. The standardised gap is z=1/1=1z = 1 / 1 = 1.
  3. Probability of improvement is Φ(1)=0.841\Phi(1) = 0.841. The candidate has about an 84 percent chance of beating the best.
  4. Expected improvement is 1×Φ(1)+σφ(1)=0.841+0.242=1.0831 \times \Phi(1) + \sigma\varphi(1) = 0.841 + 0.242 = 1.083, using φ(1)=0.242\varphi(1) = 0.242.
  5. Interpret. The expected gain is about 1.081.08 units, which is larger than the gap of 11, because the spread adds to it. Probability of improvement says only "likely to win"; expected improvement says "by about this much".
Example
Example 2: three candidates, one winner (standard)

Use the table from How it works: A with (μ,σ)=(1.0,0.5)(\mu, \sigma) = (1.0, 0.5), B with (0.6,1.0)(0.6, 1.0), C with (1.5,0.1)(1.5, 0.1), and f∗=1.0f^* = 1.0.

  1. For C the gap is 0.50.5 and z=0.5/0.1=5z = 0.5 / 0.1 = 5. For A, z=0z = 0. For B, z=−0.4/1.0=−0.4z = -0.4 / 1.0 = -0.4.
  2. Probability of improvement: Φ(5)≈1.00\Phi(5) \approx 1.00 for C, Φ(0)=0.5\Phi(0) = 0.5 for A, Φ(−0.4)=0.345\Phi(-0.4) = 0.345 for B. The winner is C.
  3. Expected improvement: C gives 0.5×1.00+0.1×φ(5)≈0.5000.5 \times 1.00 + 0.1 \times \varphi(5) \approx 0.500. A gives 0+0.5×0.399=0.1990 + 0.5 \times 0.399 = 0.199. B gives 0.2300.230. The winner is C.
  4. Upper confidence bound with κ=2\kappa = 2: C gives 1.5+0.2=1.71.5 + 0.2 = 1.7, A gives 1.0+1.0=2.01.0 + 1.0 = 2.0, B gives 0.6+2.0=2.60.6 + 2.0 = 2.6. The winner is B.
  5. Interpret. The two improvement-based rules pick the candidate the model is most sure about, C. The upper confidence bound picks the candidate the model knows least about, B, because κ=2\kappa = 2 gives uncertainty a large weight. Neither answer is wrong; they encode different attitudes to risk.
Example
Example 3: the exploration weight in practice (realistic)

A tuning run has already tried 20 settings, and the best validation score so far is f∗=0.90f^* = 0.90. Two candidate settings are on the table.

  • Setting X is close to the best setting found. The model predicts μ=0.91\mu = 0.91 with σ=0.01\sigma = 0.01.
  • Setting Y is in an unexplored corner. The model predicts μ=0.85\mu = 0.85 with σ=0.08\sigma = 0.08.
  1. Gap for X: 0.91−0.90=0.010.91 - 0.90 = 0.01. Standardised gap: z=0.01/0.01=1z = 0.01 / 0.01 = 1.
  2. Expected improvement for X: 0.01×Φ(1)+0.01×φ(1)=0.01×0.841+0.01×0.242=0.01080.01 \times \Phi(1) + 0.01 \times \varphi(1) = 0.01 \times 0.841 + 0.01 \times 0.242 = 0.0108.
  3. Gap for Y: 0.85−0.90=−0.050.85 - 0.90 = -0.05. Standardised gap: z=−0.05/0.08=−0.625z = -0.05 / 0.08 = -0.625.
  4. Here Φ(−0.625)=0.266\Phi(-0.625) = 0.266 and φ(−0.625)=0.328\varphi(-0.625) = 0.328. Expected improvement for Y: −0.05×0.266+0.08×0.328=−0.0133+0.0262=0.0129-0.05 \times 0.266 + 0.08 \times 0.328 = -0.0133 + 0.0262 = 0.0129.
  5. Expected improvement favours Y, slightly, because Y's uncertainty is large enough to make a gain plausible. Interpret. If the team uses a rule that cares only about the mean, X always wins. The uncertainty term is what makes the search look at the unexplored corner.

Try it: Use f∗=1.0f^* = 1.0. Candidate P has μ=1.2\mu = 1.2 and σ=0.3\sigma = 0.3. Compute its standardised gap zz, and its probability of improvement, to two decimal places.

Answer: The gap is 1.2−1.0=0.21.2 - 1.0 = 0.2, so z=0.2/0.3=0.67z = 0.2 / 0.3 = 0.67. The probability of improvement is Φ(0.67)=0.75\Phi(0.67) = 0.75, to two decimal places. Check that the answer lies between Φ(0)=0.5\Phi(0) = 0.5 and Φ(1)=0.84\Phi(1) = 0.84, as it must, since 0.670.67 lies between 00 and 11.

Common mistakes and tradeoffs

Mistake: "The acquisition function is the objective." It is tempting to think the score is the quantity being optimised. In fact it is a cheap stand-in. The real objective is only evaluated at the chosen input, and that evaluation is the expensive step the score is designed to save.

Mistake: "Pick the highest predicted mean." It is tempting to think the best guess is the best trial. In fact that rule ignores uncertainty, so it can keep trying near one good point and miss a better region that the model has not sampled. Example 3 shows the effect.

Mistake: "Pick the most uncertain input." The opposite error is equally common. Choosing only by uncertainty explores the edges of the space forever and never refines a good point.

Mistake: "The upper confidence bound's κ\kappa is universal." It is tempting to copy a value of κ\kappa from one problem to another. In fact κ\kappa sets how much exploration you buy, and the right value depends on the noise, the number of trials left and the smoothness of the function.

When to use it. Use an acquisition function when each evaluation is expensive, the input space is continuous or has a few dimensions, and the model is a reasonable fit to the function. Expected improvement is a common default because it has no tuning parameter and balances gain against risk.

When not to use it. When evaluations are cheap, a plain random or grid search is simpler and just as good. When the input space has hundreds of dimensions, a Gaussian process model becomes expensive and less reliable, and the acquisition step becomes hard to optimise.

Alternatives. Thompson sampling draws one plausible version of the function from the model and tries its best point, which needs no separate score. Batch acquisition rules choose several inputs at once when experiments can run in parallel. Bandit algorithms, covered in Multi-Armed Bandit, make the same exploration choice in a different setting, where the rewards are not a smooth function of the input.

History

Harold Kushner's 1964 work on finding the maximum of a noisy curve is an early example of choosing the next measurement by a probability-of-improvement style rule. In the late 1970s, Jonas Mockus and colleagues in Lithuania applied Bayesian methods to searching for extrema, including an expected-improvement criterion. The idea spread to engineering design in the 1990s, when Donald Jones, Matthias Schonlau and William Welch (1998) gave an efficient global optimisation method built on expected improvement, which made it widely used. Upper confidence bounds were analysed in the bandit literature and then adapted to Gaussian processes by Srinivas and colleagues in 2010. Each of these rules appeared because a team needed a cheap way to choose the next expensive experiment.

Recap

  • An acquisition function turns a model's predicted mean and uncertainty into a score for each candidate input.
  • Probability of improvement asks how likely a candidate is to beat the best so far, expected improvement asks by how much on average, and the upper confidence bound adds a multiple of the uncertainty to the mean.
  • The mean rewards exploitation and the uncertainty rewards exploration; the scores differ in how they weigh the two.
  • The next expensive trial goes to the input with the highest score, found by optimising the cheap score.
  • The choice of score, and of κ\kappa for the upper confidence bound, changes which input is picked.

What to read next: Expected Improvement works out the most common score in full, and Bayesian Optimization puts the scores in the complete loop.

Check yourself

QuestionRecall: what does each of probability of improvement, expected improvement and the upper confidence bound measure, in one sentence each?Show answer

Probability of improvement is the chance that a candidate beats the best value so far. Expected improvement is the average amount by which it is expected to beat that value, counting zero when it does not. The upper confidence bound is the predicted mean plus a multiple of the uncertainty, so it rewards candidates that are predicted to be good or that the model knows little about.

QuestionComputation: a candidate has predicted mean μ=1.5\mu = 1.5 and standard deviation σ=0.5\sigma = 0.5, and the best so far is f∗=1.0f^* = 1.0. Find zz, the probability of improvement using Φ(1)=0.841\Phi(1) = 0.841, and the upper confidence bound with κ=1\kappa = 1.Show answer

The gap is 1.5−1.0=0.51.5 - 1.0 = 0.5, so z=0.5/0.5=1z = 0.5 / 0.5 = 1. The probability of improvement is Φ(1)=0.841\Phi(1) = 0.841. The upper confidence bound is μ+κσ=1.5+1×0.5=2.0\mu + \kappa\sigma = 1.5 + 1 \times 0.5 = 2.0.

QuestionWhy: explain why a rule that picks only the highest predicted mean can get stuck near a good point that is not the best.Show answer

The predicted mean ignores how unsure the model is. A point near a good trial has a high mean and a small uncertainty, so the rule keeps choosing nearby points and refines them. An unexplored region with a lower mean but a large uncertainty may hide a higher true value, and the mean-only rule never tests it. Adding an uncertainty term, as expected improvement and the upper confidence bound do, gives those regions a chance.

QuestionApplied: you are tuning a model whose validation score takes two days per trial, and you have budget for 10 more trials. Your first candidate from an upper confidence bound with a large κ\kappa lands in a region far from the best trial so far. Should you accept it, and what would you change?Show answer

A large κ\kappa is doing its job, which is exploration, but with only 10 trials left it may waste budget. Accept the first suggestion if the region is plausibly good, but consider a smaller κ\kappa or expected improvement, which spends more of the budget near good points. A reasonable plan is to run a few exploratory trials, then shift the trade-off towards exploitation as the budget runs out.

Sources