ML0072 Bayesian Optimization

How does Bayesian optimization (e.g., Gaussian processes) work for hyperparameter tuning, and when is it worth it?

Answer

Bayesian optimization tunes an expensive black-box objective by maintaining a probabilistic surrogate model of it, usually a Gaussian process that predicts both the mean performance and the uncertainty at every untried configuration. An acquisition function (expected improvement is the common default) scores each candidate by trading off exploitation (likely to be good) against exploration (highly uncertain), and the configuration maximizing it is evaluated next; the result updates the surrogate and the loop repeats. It needs far fewer trials than grid or random search when each evaluation costs minutes to hours, but the Gaussian process costs O(n^3) to fit in the number of trials and struggles in high-dimensional or heavily categorical spaces.

(1) Surrogate: the GP posterior gives a predictive mean \mu(x) and uncertainty \sigma(x) from a handful of noisy trials, and it is cheap to query, unlike the real objective.
(2) Acquisition: expected improvement picks the point with the largest expected gain over the incumbent, automatically balancing exploration and exploitation without hand-tuned schedules.
(3) When It Is Worth It: when trials dwarf surrogate cost (minutes or more per trial, tens of dimensions at most). Meta’s Ax platform (built on BoTorch) runs exactly this loop to tune recommender systems and AR/VR hardware designs, while Google’s Vizier has tuned over 70 million objectives and swaps in more scalable algorithms once the trial count outgrows GP fitting costs.

Top panel: Gaussian process posterior mean with a shaded uncertainty band fitted to a few observed points; bottom panel: expected improvement curve peaking at the next point to evaluate

Figure 1: One iteration of the loop: the GP posterior (mean with uncertainty band, top) is fitted to the evaluated points, and the expected-improvement acquisition (bottom) peaks where a high predicted mean and high uncertainty combine. That peak becomes the next expensive evaluation.

Mathematical Formulation:
\mathrm{EI}(x) = \mathbb{E}\big[\max(f(x) - f^{*}, 0)\big]
x_{t+1} = \arg\max_{x}\ \mathrm{EI}(x)

Where:

  • f(x) is the expensive black-box objective (for example validation accuracy) and f^{*} the best value observed so far.
  • The expectation is taken under the GP posterior, so \mathrm{EI}(x) grows both with predicted quality \mu(x) and with uncertainty \sigma(x).
  • x_{t+1} is the next configuration to evaluate; the acquisition maximization is cheap because it queries only the surrogate.
FeatureBayesian OptimizationGrid / Random Search
How Points Are ChosenSurrogate model plus acquisition functionFixed lattice / uniform sampling
Trials to a Good RegionFewest, for smooth low-dimensional objectivesGrows exponentially (grid) or slowly (random)
Per-Step OverheadGP fit O(n^3) plus acquisition searchNone
ParallelismNeeds batch acquisition (qEI)Trivially parallel
Worth It WhenTrials cost minutes or more, up to tens of dimensionsCheap trials, high dimensions, quick baseline
Best value found so far versus number of evaluations: Bayesian optimization curve rises fastest, random search in the middle, grid search slowest

Figure 2: Best value found so far against evaluations spent. Bayesian optimization’s surrogate-guided choices reach a good region in far fewer trials than random or grid search, which is exactly why it pays off only when each trial is expensive.


Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *