Acquisition Functions
Chapter 11 built the Bayesian optimization loop and ran it with one rule for choosing the next evaluation: the posterior mean plus a multiple of the posterior standard deviation. The rule worked, but its weight was a knob, and Figure 11.3 showed that turning the knob too far either way costs a great deal. A reader may reasonably ask whether there is a principled way to decide how much uncertainty is worth.
This chapter gives several answers. Each acquisition function starts from a statement about what an evaluation is for: beating the best value seen so far, improving the final recommendation, or learning where the maximum is. From that statement and the Gaussian posterior, the formula follows, and the balance between exploring and exploiting comes out of the derivation instead of being set by hand. We derive the classic acquisition functions one at a time, look at all of them on the same posterior in one and then two dimensions, and end with the problem every one of them leaves behind: finding the maximum of the acquisition function itself, which in many dimensions is a hard optimization problem of its own.
12.1 What an acquisition function is #
Recall the setting. After evaluations the data are , and the Gaussian process posterior gives every input a Gaussian belief about , with mean and standard deviation (Chapter 8). An acquisition function scores each input, and the loop evaluates the objective where the score is highest (Definition 11.1).
The cleanest way to build such a score is to say what we would be happy to have at the end and then ask how much one more evaluation is expected to add. Write for the utility of a data set: a number that says how good our situation is if we stop with data . If we evaluate at and observe , the utility changes from to . We do not know before evaluating, but the posterior says what it is likely to be, so we can average over it.
Given a utility , the one-step lookahead acquisition function is the expected gain in utility from one more evaluation at :
where averages over the outcome under its posterior predictive distribution given .
Different utilities give different acquisition functions. Table 12.1 previews the ones in this chapter. Two of them, the upper confidence bound and Thompson sampling, do not come from a utility at all; they come from the bandit problems of Section 13.2, where they have guarantees of a different kind (Chapter 13).
| Acquisition function | What an evaluation is worth | Section |
|---|---|---|
| Probability of improvement (PI) | the chance of beating the best value seen so far | Section 12.2 |
| Expected improvement (EI) | the expected amount by which the best value seen so far rises | Section 12.3 |
| Upper confidence bound (UCB) | an optimistic estimate of the value at the input | Section 12.4 |
| Thompson sampling (TS) | the chance that the input is the maximizer | Section 12.5 |
| Knowledge gradient (KG) | the expected rise in the value of the final recommendation | Section 12.6 |
| Entropy search (ES, PES, MES) | the expected information about the maximizer or the maximum | Section 12.7 |
12.1.1 Why look only one step ahead #
Equation (12.1) looks one evaluation ahead, as if the next evaluation were the last. That is a simplification. With evaluations left, the optimal choice now depends on what we will be able to do afterward, and the next evaluation is worth more if it sets up good later ones. Writing that out gives a dynamic program in which every future outcome branches into every future choice. It is the optimal policy, and it is also, in Kushner's words, "virtually impossible to compute" (Kushner, 1964; quoted in Garnett, 2023, sec. 12.3).
So almost all acquisition functions in use are myopic: they are optimal if the next evaluation is the last one, and only approximately optimal otherwise (Frazier, 2018). The approximation may be better than it sounds. In a few special problems where the optimal multi-step policy can be computed, the myopic rules come close; in one such study, cited by Frazier (2018), the knowledge gradient came within 98% of optimal. Myopia also has a cost that is easy to see, though: a rule that ignores the future undervalues exploration, because the payoff of exploring arrives later. Several of the rules below add exploration back in one way or another.
Sources cited in Section 12.1 3
- Kushner (1964) A New Method of Locating the Maximum Point of an Arbitrary Multipeak Curve in the Presence of Noise
- Garnett (2023) Bayesian Optimization
- Frazier (2018) A Tutorial on Bayesian Optimization
12.2 Probability of improvement #
The oldest rule asks the simplest question: how likely is it that beats the best value seen so far (Kushner, 1964)? Write for that value, the incumbent. With exact evaluations, it is the value of the best input we could recommend right now.
The posterior says that is Gaussian with mean and standard deviation . The probability that it exceeds the incumbent by at least a margin follows in three steps.
- Standardize: is a standard normal variable (Section 4.3).
- Rewrite the event: is the same as .
- Use , by the symmetry of the standard normal density.
In terms of Definition 12.1, PI is the expected gain of a utility that is 1 if the best value improves by at least and 0 otherwise.
PI has a well-known flaw: it counts improvements but ignores their size. With , an input whose mean sits just above the incumbent and whose standard deviation is tiny has PI close to 1, and the rule prefers it to an uncertain input that might improve on the incumbent by a lot. The result is a search that creeps along in tiny steps near the best point. The margin is the fix. Raising it asks for improvements that are worth having, which pushes the mean term in Equation (12.2) below zero for most inputs; then the only way to have a sizable probability is a large , and the rule explores.
How large should be? Kushner suggested starting high and lowering it as the search proceeds (Brochu et al., 2010), and his papers discussed adjusting it by hand during the search (Garnett, 2023, sec. 12.3). Jones found the method "extremely sensitive to the choice of the target": too small and the search stays local, too large and it never refines a promising solution (Jones, 2001; quoted in Brochu et al., 2010). The next section's rule makes the margin far less important, because it accounts for the size of the improvement directly.
Sources cited in Section 12.2 4
- Kushner (1964) A New Method of Locating the Maximum Point of an Arbitrary Multipeak Curve in the Presence of Noise
- Brochu et al. (2010) A Tutorial on Bayesian Optimization of Expensive Cost Functions, with Application to Active User Modeling and Hierarchical Reinforcement Learning
- Garnett (2023) Bayesian Optimization
- Jones (2001) A Taxonomy of Global Optimization Methods Based on Response Surfaces
12.3 Expected improvement #
Instead of asking whether the incumbent improves, ask by how much, on average. Evaluating at raises the best value seen from to . The gain is the improvement , which is zero when falls short, and its expectation under the posterior is the expected improvement:
This is Equation (12.1) with the utility , the best value observed. EI is usually credited to Močkus and his colleagues (Močkus, 1975; Frazier, 2018), with an earlier explicit formula traced to Šaltenis in 1971 (Garnett, 2023, sec. 12.3), and it became standard through the EGO algorithm of Jones et al. (1998).
The difference is a Gaussian variable, since is a known number. So everything reduces to one fact about Gaussians, which we state for any Gaussian because Section 19.4 uses it for a different one.
Let be Gaussian with mean and standard deviation . We want .
- Write with standard normal (Section 4.3).
- is zero unless , that is, unless . Therefore , where is the standard normal density.
- Split the integral into two: .
- The first integral is , by the symmetry of .
- For the second, the density satisfies , so has antiderivative , and . With and , the second integral is .
- Combine the two terms.
When , is the constant and the expectation is , which is also the limit of Equation (12.4) as .
For expected improvement, take , with the same optional margin as in PI. Its mean is and its standard deviation is :
This is the closed form that Jones et al. (1998) made standard, with the margin as a later addition. Brochu et al. (2010) report experiments by Lizotte suggesting that , scaled by the signal variance if necessary, works well in almost all cases.
12.3.1 Reading the formula #
The two terms of Equation (12.5) are exploitation and exploration in one expression. The first is large where the mean is above the incumbent. The second is large where the standard deviation is large. Unlike the upper confidence bound, nobody chose the exchange rate between them: it comes out of the integral.
Three properties make this precise. Write for the right-hand side of Equation (12.4).
- EI is never below the improvement of the mean. Since is convex, Jensen's inequality gives . Uncertainty can only add value.
- At a mean equal to the incumbent, EI is about . With , Equation (12.4) gives . This is the example of Section 2.6, where the improvement of the mean is zero but the expected improvement is not.
- EI increases with both the mean and the uncertainty. The partial derivatives are and (Exercise 12.1), and both are positive. More uncertainty always makes EI larger, wherever the mean is.
The last property is where EI and PI part ways. PI's derivative with respect to is , which is negative whenever : once the mean is above the incumbent, PI prefers certainty. Figure 12.1 shows both quantities for a single input.
Three settings show the difference.
A mean below the incumbent. The figure opens with . Both PI and EI grow as grows: the only way to beat the incumbent is for the function to be higher than the model expects, and more uncertainty makes that more likely.
A mean above the incumbent. Set . Now PI falls as grows, because a wider belief puts more weight on falling short. EI still rises: the extra weight on large improvements outweighs the extra weight on falling short, which costs nothing, since improvement is never negative.
A tiny, certain improvement. Set and . PI is about 0.84, while EI is only about 0.05. An input with and has a PI of only 0.38, but its EI is about 0.27, about five times larger. EI ranks the second input higher; PI ranks the first.
Far from the data in a large domain, or late in a run when the incumbent is
high, is very negative and Equation (12.5) is the difference of
numbers so small that floating point rounds them to zero. The acquisition
function then has value and gradient exactly zero on most of the domain, and
a gradient-based optimizer started there cannot move. Ament et al. (2023)
argued that this numerical problem, rather than the idea of expected
improvement, is behind EI's inconsistent and often weak performance in the
literature, and proposed LogEI, which computes with formulas that
stay accurate in the tail. Its maximizers are the same as EI's or nearly so,
and in their experiments it matched or beat more recent acquisition
functions. BoTorch provides it as LogExpectedImprovement.
Two practical notes complete the picture. First, Equation (12.5) assumes exact evaluations, so that is a known value. With noise the best observed value is itself uncertain and biased upward, and several noisy variants replace it; Section 14.2 compares them. Second, a real application shows the formula at work. Snoek et al. (2012) tuned machine learning algorithms with expected improvement, averaging Equation (12.5) over samples of the Gaussian process hyperparameters instead of fixing them. They also modeled the training time with a second Gaussian process and maximized expected improvement per second, which prefers inputs that are both promising and quick to evaluate. Chapter 22 replays a problem of this kind.
Sources cited in Section 12.3 7
- Močkus (1975) On Bayesian Methods for Seeking the Extremum
- Frazier (2018) A Tutorial on Bayesian Optimization
- Garnett (2023) Bayesian Optimization
- Jones et al. (1998) Efficient Global Optimization of Expensive Black-Box Functions
- Brochu et al. (2010) A Tutorial on Bayesian Optimization of Expensive Cost Functions, with Application to Active User Modeling and Hierarchical Reinforcement Learning
- Ament et al. (2023) Unexpected Improvements to Expected Improvement for Bayesian Optimization
- Snoek et al. (2012) Practical Bayesian Optimization of Machine Learning Algorithms
12.4 Upper confidence bounds #
The upper confidence bound is the rule Chapter 11 already used:
Its principle comes from the bandit literature (Section 13.2) and is called optimism in the face of uncertainty: act as if the world were as good as it plausibly could be, then let the evaluation correct you. If the optimism was justified, the evaluation finds a good input; if not, the evaluation shrinks there and the inflated estimate deflates, so the rule moves on.
The weight has a probabilistic reading. Under the posterior, , so Equation (12.6) is a quantile of the belief about . With it is the 97.7% quantile, and maximizing it picks the input whose plausible best case is highest.
What should be? Srinivas et al. (2010) answered with a schedule that grows slowly with the number of evaluations . For a finite domain of candidate inputs and a confidence parameter , their GP-UCB rule uses
and they proved that with this schedule the regret grows sublinearly, so the average gap to the maximum goes to zero (Section 13.4 gives the theorem and its proof). The schedule is just large enough that, with probability at least , the bands contain the true function at every candidate and every step at once. For continuous domains, the schedule gains a term proportional to (Srinivas et al., 2010).
The numbers show how cautious the theory is. With candidates and
, Equation (12.7) gives at
and at : five to six standard deviations of
optimism. Figure 11.3 found weights of 1 to 2 best on the running
example, and weights near 6 noticeably worse. The authors themselves found
that their algorithm improved when was scaled down by a factor of 5
(Srinivas et al., 2010). In practice, libraries take a constant from
the user; BoTorch's UpperConfidenceBound computes the mean plus
times the standard deviation. The schedule matters for the
proof, which needs exploration that never switches off. A constant that works
well over a fixed budget is a different, practical question.
Sources cited in Section 12.4 1
- Srinivas et al. (2010) Gaussian Process Optimization in the Bandit Setting: No Regret and Experimental Design
12.5 Thompson sampling #
The oldest idea in this chapter is from 1933. Thompson (1933) considered two medical treatments of unknown effectiveness and proposed assigning each new patient a treatment with the probability that it is the better one, given the evidence so far. For a Gaussian process the rule is:
- Draw one function from the posterior given (Section 8.5).
- Evaluate the objective where that sample is largest: .
The first step is the only random one, and it is what makes the rule work. Given the data, the sample and the unknown have the same distribution, so the maximizer of has the same distribution as the maximizer of :
This is called probability matching: Thompson sampling evaluates each region exactly as often as the model believes the maximum lies there. A region the model is sure is poor is almost never chosen. A region that could hide the maximum is chosen in proportion to how likely that is, however uncertain the rest of the model is.
Thompson sampling has no weight or margin to tune, and it parallelizes naturally: to choose ten evaluations at once, draw ten samples and take each one's maximizer. Its guarantees are close to those of UCB. Russo and Van Roy (2014) established a connection between posterior sampling and upper confidence bound algorithms that converts regret bounds proved for UCB algorithms into Bayesian regret bounds for posterior sampling, including one for Gaussian process models, and Chowdhury and Gopalan (2017) proved a regret bound for a Gaussian process version when the unknown function is fixed rather than drawn from the prior.
The cost lies in step 1. A sample on a grid of inputs needs a Cholesky factorization of the posterior covariance, , which limits exact sampling to a few thousand inputs. In more dimensions, implementations draw the sample on a candidate set, a few thousand points chosen to cover the promising regions, or draw approximate sample functions that can be evaluated anywhere, built from a finite set of random basis functions (random features) or from a prior sample corrected by the data (pathwise updates), and maximize them with gradients (Rahimi and Recht, 2007; Wilson et al., 2020). Section 12.9 explains why the choice of candidate set becomes the hard part in many dimensions.
Sources cited in Section 12.5 5
- Thompson (1933) On the Likelihood that One Unknown Probability Exceeds Another in View of the Evidence of Two Samples
- Russo and Van Roy (2014) Learning to Optimize via Posterior Sampling
- Chowdhury and Gopalan (2017) On Kernelized Multi-armed Bandits
- Rahimi and Recht (2007) Random Features for Large-Scale Kernel Machines
- Wilson et al. (2020) Efficiently Sampling Functions from Gaussian Process Posteriors
12.6 Knowledge gradient #
Expected improvement makes a quiet assumption: at the end, we recommend one of the inputs we evaluated, the one with the best observed value (Frazier, 2018). Often we would happily recommend an input we never evaluated, if the model is confident it is good. And with noisy evaluations, no observed value can be trusted at face value anyway, so the natural recommendation is the input with the highest posterior mean (Section 11.2.3).
The knowledge gradient takes that recommendation seriously. Its utility is the value of the final recommendation: if we stopped now, we would recommend the maximizer of the posterior mean, and its expected value under the posterior is
One more evaluation at changes the posterior mean everywhere, not only at , so it can raise even if itself turns out to be mediocre. Plugging this utility into Equation (12.1) gives the knowledge gradient:
The value of a query in this sense is the expected value of the final recommendation after one more answer. A query that maximizes it is one-step Bayes optimal: if the session ended after this one evaluation, no other choice would leave a better recommendation in expectation, and the knowledge gradient is the acquisition function that picks it. Section 19.4.1 relies on exactly this property when queries are pairs of options.
To compute Equation (12.9) we need to know how the posterior mean moves when one observation arrives.
Let the next observation be with noise variance . (This is the noise variance that the rest of the book writes ; it is renamed in this section only, because the posterior variance stands next to it in every formula.) Write for the posterior covariance between and given .
- Given , the pair is jointly Gaussian with means and , variance of equal to , and covariance , since the noise is independent of .
- Conditioning on (Section 4.5) gives .
- Before we observe it, is Gaussian with mean zero and standard deviation , so it equals that standard deviation times a standard normal .
- Substitute into step 2.
Every point of the new posterior mean moves by a multiple of the same standard normal , because a single number, the outcome , moves them all. Inputs strongly correlated with move a lot; inputs far from hardly move. So the knowledge gradient is
Three consequences follow from this form.
- KG is never negative. The maximum of functions is convex, and has mean zero, so by Jensen's inequality the expected maximum is at least the maximum at , which is . Information never hurts in expectation.
- An exact repeat is worth nothing. If was already evaluated without noise, and for every , so nothing moves and . With noise (), repeating an evaluation can still be worth something, which is why KG handles noisy problems gracefully (Frazier, 2018).
- With two inputs in play, KG is Clark's formula. If the maximum in Equation (12.11) runs over only two inputs, it is the maximum of two jointly Gaussian values, and , and its expectation is the formula of Clark (1961) (Section B.5). The same formula returns in preferential Bayesian optimization (PBO), where a query is a pair of options and the acquisition function is the expected utility of the better one (EUBO, Equation (19.3)); with noise-free answers it has the knowledge gradient's one-step optimality (Section 19.4.1).
The knowledge gradient also clarifies expected improvement. If the recommendation must be an evaluated input and evaluations are exact, the utility in Equation (12.1) becomes the best observed value, and the one-step gain is exactly EI (Frazier, 2018). EI is the knowledge gradient of a decision maker who will only recommend what has been measured.
Figure 12.2 makes the lookahead visible.
Look where the violet curves fan out. At the default candidate, in the unexplored gap on the right, the fantasies spread widely: a high outcome would put a new maximum of the mean there, a low one would leave the old maximum in place. Since a low outcome cannot lower (the old maximum is still available) while a high one raises it, the average rises.
Move the candidate onto an evaluated point. The violet curves collapse onto the blue one and the readout shows KG equal to zero, the second consequence above. Now move it a little to either side: KG jumps back up. Two exact evaluations very close together reveal the slope of between them, and near the top of a bump a slope can move the maximum of the mean. The narrow notches in the strip are this effect.
Compare with the strip. The knowledge gradient is largest around the current best region, not in the middle of the widest gap. Near the best point, an evaluation directly moves the maximum of the mean; in the far gap, an outcome must be large to matter at all. KG explores less than UCB with , a pattern Figure 12.3 shows again.
Add noise. Set the noise to 0.2. The fantasies spread less, because a noisy outcome moves the mean less, and the notches widen into valleys. At the evaluated inputs on the broad bump, KG is now slightly positive: a second noisy measurement there could still move the maximum of the mean. At the evaluated input in the dip near it stays at zero, since no outcome there could make that region the best.
The knowledge gradient was introduced for choosing among a finite set of alternatives with independent beliefs (Frazier et al., 2008) and extended to correlated beliefs (Frazier et al., 2009), the setting of a Gaussian process on a grid. On a finite set, Equation (12.11) can be computed exactly: the maximum of the lines is a piecewise linear function of , and integrating each piece against the normal density gives a closed form (Frazier et al., 2009); Figure 12.2 does exactly this. On a continuous domain the inner maximum has no closed form, and implementations estimate KG by simulating outcomes, re-solving the inner maximization for each (Frazier, 2018), or, as in BoTorch, by optimizing the candidate together with one maximizer per simulated outcome in a single "one-shot" problem (Balandat et al., 2020). (Section 11.5 tells how the knowledge gradient and expected improvement were entangled at their origin.)
Sources cited in Section 12.6 5
- Frazier (2018) A Tutorial on Bayesian Optimization
- Clark (1961) The Greatest of a Finite Set of Random Variables
- Frazier et al. (2008) A Knowledge-Gradient Policy for Sequential Information Collection
- Frazier et al. (2009) The Knowledge-Gradient Policy for Correlated Normal Beliefs
- Balandat et al. (2020) BoTorch: A Framework for Efficient Monte-Carlo Bayesian Optimization
12.7 Entropy search #
The rules so far value an evaluation by what it does for a final answer. A different family values it by what it teaches about the maximum. The posterior over induces a distribution over the location of the maximum, : draw a function from the posterior, find where it is largest, and repeat. Where this distribution is spread out, we do not know where the maximum is. An evaluation is valuable if it is expected to concentrate the distribution.
Entropy, from Section 6.1, measures the spread of a distribution in a way that depends only on probabilities, not on distances. Entropy search picks the evaluation that most reduces the entropy of in expectation:
The expected reduction in entropy is the mutual information between the outcome and (Section 6.3), and Equation (12.12) is Equation (12.1) with the negative entropy of as the utility. The idea was proposed by Villemonteix et al. (2009) and independently by Hennig and Schuler (2012), who coined the name (Garnett, 2023, sec. 12.4).
Computing Equation (12.12) is hard: the distribution of has no closed form, its entropy must be approximated, and that approximation must be repeated for every hypothetical outcome . Two reformulations made the idea practical.
Predictive entropy search uses the symmetry of mutual information. The information that carries about equals the information that carries about , so
The first term is the entropy of a Gaussian, available in closed form; the second averages over sampled maximizers, each requiring an approximation of how knowing would change the prediction at (Hernández-Lobato et al., 2014). Exact ES and PES are the same function; their approximations differ (Frazier, 2018).
Max-value entropy search (MES) changes the target: it asks for information about the maximum value , a single number, instead of its location (Wang and Jegelka, 2017). Knowing tells us one simple thing about : it cannot exceed . So the belief about given is the Gaussian posterior cut off above , a truncated Gaussian whose entropy has a closed form. Averaging over sampled maximum values gives
which is equation (6) of Wang and Jegelka (2017). The samples can be taken as the maxima of posterior sample functions, or drawn from a cheaper approximation of their distribution. Each term is large when is small, that is, when the sampled maximum is not far above the mean at , measured in standard deviations: an evaluation there could reveal whether the maximum is about that high. The authors report that MES matches or improves on ES and PES at a fraction of the cost, and that it is much less sensitive to the number of samples (Wang and Jegelka, 2017).
Sources cited in Section 12.7 6
- Villemonteix et al. (2009) An Informational Approach to the Global Optimization of Expensive-to-Evaluate Functions
- Hennig and Schuler (2012) Entropy Search for Information-Efficient Global Optimization
- Garnett (2023) Bayesian Optimization
- Hernández-Lobato et al. (2014) Predictive Entropy Search for Efficient Global Optimization of Black-box Functions
- Frazier (2018) A Tutorial on Bayesian Optimization
- Wang and Jegelka (2017) Max-value Entropy Search for Efficient Bayesian Optimization
12.8 Comparing them #
Each rule has now been derived on its own. To see how differently they behave, Figure 12.3 puts all six on one posterior of the running objective. You play the optimizer: click the plot to evaluate the objective anywhere, and watch where each rule would go next.
The default posterior has four evaluations: two on the broad bump, one in the dip after it, and one at the far right. The tall bump near sits in an unexplored gap. Some guided experiments:
The rules disagree. PI, EI, MES, and KG choose near the broad bump, at between about 0.19 and 0.27, where the mean is already close to the incumbent and a modest improvement is likely. UCB with goes into the gap, to , where the upper edge of the band is highest. Thompson sampling depends on its sample: press New samples a few times and its choice jumps among the broad bump, the gap, and the left edge, roughly in proportion to the violet bars.
Raise the margin. Move up from 0.01. At , EI already switches to the gap: asking for an improvement of at least 0.1 makes the small, likely gains near the broad bump worthless. PI holds on to the broad bump until reaches 0.39. Both rules change their choice abruptly at some margin, which is the sensitivity that Jones warned about.
Run the loop. Pick a rule and press Evaluate its maximum repeatedly, then press Reset and try another. Every rule reaches the tall bump eventually, by different routes: UCB goes there first, EI, KG, and MES after one more evaluation on the broad bump, PI after two, and Thompson sampling later still. On this posterior PI happens to come within 0.05 of the maximum fastest, and KG, which is trying to improve the maximum of the mean rather than the best observed value, is slowest by the best-observed yardstick. One run on one problem ranks nothing.
Watch the violet bars. Once the tall bump has been evaluated, the estimated distribution of collapses onto it. Thompson sampling and MES then concentrate their evaluations there; UCB keeps visiting other regions while their bands are wide.
No rule is best on every problem. Comparisons on benchmark functions favor different rules on different problems, and the regret bounds of Section 13.5.2 are proved in different settings for different rules, so they do not rank them either (inference). Table 12.2 lists the practical differences that do hold.
| Rule | Closed form for a GP? | Parameter to set | Values evaluations by | Cost per candidate |
|---|---|---|---|---|
| PI | yes, Equation (12.2) | margin , sensitive | chance of beating the incumbent | one prediction |
| EI | yes, Equation (12.5) | margin , often 0 or small | expected gain over the incumbent | one prediction |
| UCB | yes, Equation (12.6) | weight , matters | optimistic value | one prediction |
| Thompson | no; a random sample | none | chance of being the maximizer | one joint sample over all candidates |
| KG | on a finite set, Equation (12.11) | none | gain in the recommended value | a maximization per outcome |
| ES, PES | no | none | information about | expensive approximations |
| MES | given sampled maxima, Equation (12.13) | number of samples | information about | one prediction per sample |
12.8.1 In two dimensions #
One-dimensional pictures hide an important fact: the number of places to look grows exponentially with dimension, while the posterior is informative only near the data. Figure 12.4 repeats the comparison on a two-dimensional problem, the Branin function, a standard test function with three global maxima of equal height (rescaled here to the unit square and negated so that larger is better).
Compare the bottom two panels. The standard deviation is low only in small disks around the six evaluations; almost the whole square is uncertain. EI is large where a fairly high mean meets a large standard deviation, here a broad region between the evaluations in the lower half, and small both on top of the evaluations and where the mean is low, in the upper right.
Switch between rules. PI and KG choose close to the best evaluation, since an evaluation there is likely to raise the incumbent or the maximum of the mean. UCB and MES reach farther out. Thompson sampling's sample is a whole surface, with its own peaks in unexplored corners; its maximizer can land anywhere the model allows a maximum.
Run the loop. Select PI and press Evaluate the maximum ten times. The evaluations creep in small steps from the best initial point down the slope to the maximum near : the cautious behavior of Section 12.2, which here happens to work. Reset and do the same with EI or UCB. Several of their evaluations go to the edges and corners of the square, where the standard deviation stays large because no evaluation lies beyond them, and the rest land near two of the three maxima. With three maxima of equal height, which one a run finds first depends on its first few evaluations.
Imagine six dimensions. In the figure the uncertain region is most of the square, and a 31 by 31 grid of candidates covers it finely. The same grid in six dimensions would have points. The acquisition function would still be informative only near the data, now in a tiny fraction of the volume. Finding its maximum is the subject of the next section.
12.9 Optimizing the acquisition function #
Every rule in this chapter ends with "evaluate where the acquisition function is largest." The figures did that by checking every point of a grid. That is fine in one or two dimensions and impossible in ten. Maximizing the acquisition function is a global optimization problem of its own, and the loop solves one at every step.
What makes it workable is cost. One evaluation of EI or UCB needs one posterior prediction, for the mean and for the variance after the Cholesky factorization is done once per step (Section 8.4). With a few hundred observations that is microseconds, so an optimizer can afford tens of thousands of acquisition evaluations per step, while the objective, which takes hours, gets one. The acquisition function is also smooth and, for a Gaussian process, differentiable in closed form, so gradient methods apply (Frazier, 2018).
What makes it hard is shape. Acquisition functions are nonconvex and have many local maxima, one or more near each region of interest. Worse, they are nearly flat away from the data: with a stationary kernel, far from all observations the posterior returns to the prior, so its mean and standard deviation, and with them the acquisition function and its gradient, stop changing (Garnett, 2023, sec. 9.2). In high dimensions almost the whole domain is far from the data, so a gradient method started at a random point usually finds a gradient of nearly zero and goes nowhere.
The standard answer is multi-start local optimization, the approach recommended in Garnett's textbook (Garnett, 2023, sec. 9.2) and used by BoTorch (Balandat et al., 2020).
Input: acquisition function with gradient, domain , numbers .
- Screen. Evaluate at quasi-random points, for example the first points of a scrambled Sobol sequence (Section 11.4). Add points near the best observations if the acquisition function is likely to be flat elsewhere.
- Select. Choose starting points among them, favoring high values while keeping some variety.
- Climb. From each start, run a gradient-based local optimizer that respects the box, such as L-BFGS-B. (It is a quasi-Newton method: it estimates the curvature of from successive gradients instead of computing second derivatives.)
- Return the best local maximum found.
BoTorch's defaults follow this outline: the screening points come from a scrambled Sobol sequence, the starting points are drawn at random with probabilities proportional to , where is the standardized acquisition value and a temperature, and the local climbs use L-BFGS-B. The climbs are independent of one another, so they parallelize well (Garnett, 2023, sec. 9.2).
Monte Carlo versions of acquisition functions, which estimate an expectation by averaging over samples instead of using a closed form, need one more idea. Wilson et al. (2018) showed that when the samples are written as a fixed transformation of fixed random numbers, the Monte Carlo estimate is a smooth function of the input, so gradient ascent works on it too. They also identified a family of acquisition functions, including EI and UCB, whose properties justify building a batch of evaluations greedily, one point at a time, each maximized given the points already chosen. Batch selection is the subject of Section 14.3.
12.9.1 From two dimensions to twenty #
The grid in Figure 12.4 had 961 points and missed nothing. Three things change as the dimension grows to the 6 to 20 of a typical tuning problem.
Grids are out, and so is uniform screening. A grid with ten values per input has points in six dimensions and in twenty. Uniform random or Sobol screening points do not need a grid, but they share its weakness in a different form: they land mostly far from the data, where the acquisition function is flat. A useful picture: if an evaluation informs the model within a radius of about , one evaluation influences 0.033% of the six-dimensional unit cube (the computation behind Section 11.3). With 60 evaluations, at most about 2% of uniformly placed screening points land within that radius of any evaluation, and the acquisition function is essentially constant at the rest.
Figure 12.5 measures this directly on Hartmann-6, a standard six-dimensional test function, hidden among irrelevant inputs when .
Switch from to . In two dimensions the best uniform candidate is as good as the best perturbation of the data: both sets find the same peak of EI. In twenty dimensions the best of 1,000 uniform candidates has, in the default draw, an expected improvement more than a hundred times smaller than the best perturbation. The lengthscale grows with , the rate at which Hvarfner et al. (2024) scale their lengthscale prior for high dimensions, yet the typical uniform candidate is still about 1.4 lengthscales from the nearest evaluation in twenty dimensions, against about 0.4 in two (left panel). There the posterior mean is ordinary and the incumbent is several standard deviations away. EI there is tiny and nearly constant, so the screening step of Algorithm 12.1 would start its climbs from uninformative points.
Candidates come from near the data. So practical implementations put their candidates where the acquisition function has structure. One recipe mixes a quasi-random sample of the whole cube with random perturbations of the best inputs found so far, perturbing only some coordinates at a time. TuRBO, a method for high-dimensional problems that searches inside a trust region, a box around the best point found so far (Section 14.6.2), draws its Thompson samples on candidate sets of points built this way: each coordinate of a candidate takes a quasi-random value within the trust region with probability and otherwise keeps the value of the region's center (Eriksson et al., 2019). The perturbation is what keeps the candidates in the informative region as grows. The same idea, in the form of BoTorch's option to add points sampled around the best inputs, feeds step 1 of Algorithm 12.1.
Numerical flatness becomes the default. With many dimensions and many observations, the region where expected improvement is distinguishable from zero in floating point shrinks, and plain EI hands the optimizer a function that is exactly zero with zero gradient almost everywhere. This is the regime where computing instead of pays off most (Ament et al., 2023).
None of this changes the statistics of the acquisition function; it changes whether we find its maximum. That matters in practice. The guarantees of Chapter 13 assume the maximization is exact (Srinivas et al., 2010), and Ament et al. (2023) found that better maximization alone changed how EI compared with newer acquisition functions. Whether a published comparison used a good inner optimizer is worth checking before trusting it (inference). Section 14.6 discusses the surrogate side of high dimensions, where the default lengthscale priors matter as much as the acquisition function.
Sources cited in Section 12.9 8
- Frazier (2018) A Tutorial on Bayesian Optimization
- Garnett (2023) Bayesian Optimization
- Balandat et al. (2020) BoTorch: A Framework for Efficient Monte-Carlo Bayesian Optimization
- Wilson et al. (2018) Maximizing Acquisition Functions for Bayesian Optimization
- Hvarfner et al. (2024) Vanilla Bayesian Optimization Performs Great in High Dimensions
- Eriksson et al. (2019) Scalable Global Optimization via Local Bayesian Optimization
- Ament et al. (2023) Unexpected Improvements to Expected Improvement for Bayesian Optimization
- Srinivas et al. (2010) Gaussian Process Optimization in the Bandit Setting: No Regret and Experimental Design
12.10 Exercises #
Let from Equation (12.4). Show that and . Conclude that EI increases with both the mean and the standard deviation. Then compute the derivative of PI, , with respect to , and say when it is negative.
Solution
Use and write . For : and . The sum is . For , with : and . The sum is . Both and are positive, so EI increases in both arguments. For PI, , which is negative exactly when : once the mean is above the target, PI prefers less uncertainty.
Two inputs have independent posterior beliefs and , and no other input can be recommended. One exact evaluation is allowed. Use Equation (12.11) to compute the knowledge gradient of evaluating , and show that it equals the expected improvement of over the value . Why is the knowledge gradient of evaluating so small, and would that still be true if and were correlated?
Solution
Evaluating exactly reveals , so and, by independence, . The new means are for and for , so , the expected positive part of a Gaussian with and . By Equation (12.4) this is , which is EI of against the incumbent value . Evaluating moves only 's mean: has expectation with , which is , less than . So : evaluating almost never changes the recommendation, because would have to fall two standard deviations below its mean to lose to . With a positive correlation, evaluating would also move 's mean, and KG would count that; this is how KG values evaluations by their effect on the whole posterior.
Two inputs have independent beliefs and . Show that Thompson sampling chooses with probability , and check that this is the posterior probability that is the better input. What happens to this probability as both standard deviations shrink while stays fixed?
Solution
Thompson sampling draws and independently and chooses if . The difference is Gaussian with mean and variance , so . The same computation with in place of gives the posterior probability that , which is Equation (12.8) for this case. As the standard deviations shrink, the argument of grows without bound and the probability tends to 1: Thompson sampling stops exploring exactly as fast as the evidence rules it out.
Show that maximizing is the same as maximizing the -quantile of the posterior belief about , and find for , , and the value from Section 12.4. What does the last value say about how often the theory expects the true function to exceed the band?
Solution
For a Gaussian belief with mean and standard deviation , the -quantile is . So is the quantile with , the same at every input, and maximizing one maximizes the other. For , ; for , ; for , differs from 1 by about . The theory sets the band so wide that, with high probability, the function stays inside it at every one of the candidates and at every step simultaneously, which requires a tiny failure probability per candidate and per step. This is the union bound behind Equation (12.7) (the probability that any one of many events happens is at most the sum of their probabilities; Section 13.4.3 uses it), and it is why the schedule grows with and .
Further reading #
- Garnett (2023), chapters 7 and 8, derives every acquisition function in this chapter from one decision-theoretic framework and computes each for Gaussian processes, with gradients; its chapter 9 covers their optimization.
- Frazier (2018) explains expected improvement, the knowledge gradient, and entropy search side by side, including when the knowledge gradient is worth its cost.
- Jones et al. (1998) derives expected improvement in closed form and shows it at work, and Jones (2001) compares the improvement-based rules with care.
- Srinivas et al. (2010) introduces GP-UCB with its regret analysis; read it with Section 13.4.
- Hennig and Schuler (2012), Hernández-Lobato et al. (2014), and Wang and Jegelka (2017) trace the entropy search family from its first full statement to the max-value variant.
- Ament et al. (2023) is a lesson in how numerics can masquerade as statistics, and Wilson et al. (2018) is the reference for maximizing Monte Carlo acquisition functions.
References
- (2023). Unexpected Improvements to Expected Improvement for Bayesian Optimization. Advances in Neural Information Processing Systems 36 (NeurIPS 2023). Cited in §12.3 §12.9
- (2020). BoTorch: A Framework for Efficient Monte-Carlo Bayesian Optimization. Advances in Neural Information Processing Systems 33 (NeurIPS 2020). Cited in §12.6 §12.9
- (2010). A Tutorial on Bayesian Optimization of Expensive Cost Functions, with Application to Active User Modeling and Hierarchical Reinforcement Learning. arXiv preprint. preprint Cited in §12.2 §12.3
- (2017). On Kernelized Multi-armed Bandits. International Conference on Machine Learning. Cited in §12.5
- (1961). The Greatest of a Finite Set of Random Variables. Operations Research. Cited in §12.6
- (2019). Scalable Global Optimization via Local Bayesian Optimization. Advances in Neural Information Processing Systems 32 (NeurIPS 2019). Cited in §12.9
- (2018). A Tutorial on Bayesian Optimization. arXiv. preprint Cited in §12.1 §12.3 §12.6 §12.7 §12.9
- (2008). A Knowledge-Gradient Policy for Sequential Information Collection. SIAM Journal on Control and Optimization. Cited in §12.6
- (2009). The Knowledge-Gradient Policy for Correlated Normal Beliefs. INFORMS Journal on Computing. Cited in §12.6
- (2023). Bayesian Optimization. Cambridge University Press. Cited in §12.1 §12.2 §12.3 §12.7 §12.9
- (2012). Entropy Search for Information-Efficient Global Optimization. Journal of Machine Learning Research. Cited in §12.7
- (2014). Predictive Entropy Search for Efficient Global Optimization of Black-box Functions. Advances in Neural Information Processing Systems 27 (NeurIPS 2014). Cited in §12.7
- (2024). Vanilla Bayesian Optimization Performs Great in High Dimensions. International Conference on Machine Learning. Cited in §12.9
- (2001). A Taxonomy of Global Optimization Methods Based on Response Surfaces. Journal of Global Optimization. Cited in §12.2
- (1998). Efficient Global Optimization of Expensive Black-Box Functions. Journal of Global Optimization. Cited in §12.3
- (1964). A New Method of Locating the Maximum Point of an Arbitrary Multipeak Curve in the Presence of Noise. Journal of Basic Engineering. Cited in §12.1 §12.2
- (1975). On Bayesian Methods for Seeking the Extremum. Optimization Techniques IFIP Technical Conference. Cited in §12.3
- (2007). Random Features for Large-Scale Kernel Machines. Advances in Neural Information Processing Systems 20 (NeurIPS 2007). Cited in §12.5
- (2014). Learning to Optimize via Posterior Sampling. Mathematics of Operations Research. Cited in §12.5
- (2012). Practical Bayesian Optimization of Machine Learning Algorithms. Advances in Neural Information Processing Systems 25 (NeurIPS 2012). Cited in §12.3
- (2010). Gaussian Process Optimization in the Bandit Setting: No Regret and Experimental Design. ICML 2010. Cited in §12.4 §12.9
- (1933). On the Likelihood that One Unknown Probability Exceeds Another in View of the Evidence of Two Samples. Biometrika. Cited in §12.5
- (2009). An Informational Approach to the Global Optimization of Expensive-to-Evaluate Functions. Journal of Global Optimization. Cited in §12.7
- (2017). Max-value Entropy Search for Efficient Bayesian Optimization. Proceedings of the 34th International Conference on Machine Learning (ICML 2017). Cited in §12.7
- (2018). Maximizing Acquisition Functions for Bayesian Optimization. Advances in Neural Information Processing Systems 31 (NeurIPS 2018). Cited in §12.9
- (2020). Efficiently Sampling Functions from Gaussian Process Posteriors. Proceedings of the 37th International Conference on Machine Learning (ICML 2020). Cited in §12.5