Ground Truth.
AI, checked against the source.

Learn · Intermediate

Bayesian optimization: how to search when every guess is expensive

Bayesian optimization is a method for finding the best setting of something when every trial is expensive. Instead of testing options one after another, it fits a cheap statistical model to the results it already has, uses that model to predict both the expected value and the uncertainty of every option it has not tried, and then picks the single next trial that best balances "this looks promising" against "I know nothing about this region." It is the standard answer whenever you can afford tens of experiments rather than millions.

That makes it the quiet engine underneath a lot of AI-for-science work, including discovery systems that refuse to trust a language model's own confidence and pair a generative proposer with a statistical surrogate scored on real measurements.

The problem it solves

Most optimization you have met assumes evaluations are cheap. Gradient descent takes millions of tiny steps because each one costs a fraction of a second and comes with a derivative telling it which way is downhill.

Now change the economics. Suppose each evaluation means training a model for three days, or synthesising a molecule and measuring it, or building a physical prototype. You get maybe forty tries, total, and there is no derivative because the process is a black box. Grid search is hopeless: with six settings and five values each you need 15,625 runs. Random search is better than people expect but still throws away everything it learned from the last thirty-nine trials.

Bayesian optimization is what you do when a single evaluation is precious enough to think hard about.

How it works

Two pieces.

The surrogate model. This is a cheap statistical stand-in for the expensive thing. Classically a Gaussian process, as laid out in Carl Rasmussen and Christopher Williams' standard textbook, though tree ensembles and Bayesian neural networks are also used. What matters is not the specific model but that it produces two outputs for any untried option: a prediction, and an honest estimate of how uncertain that prediction is. A surrogate that only predicts is useless here.

The acquisition function. This turns those two numbers into a decision. It scores every candidate by combining predicted value with uncertainty, and you test whichever scores highest. Common choices include expected improvement, which asks how much a candidate is likely to beat the current best; upper confidence bound, which adds a multiple of the uncertainty to the prediction; and knowledge gradient. Peter Frazier's tutorial is the readable modern reference.

Then loop: evaluate, update the surrogate, re-score, evaluate again.

The intuition

Imagine hiring for a role where each interview costs a full day and you have two weeks. After five interviews you have a rough sense of which backgrounds do well. A greedy strategy interviews only more candidates from the best-performing background, and will never discover that a background you have never sampled is better. A purely random strategy learns nothing from the five interviews you already did.

Bayesian optimization does the sensible human thing. It keeps interviewing strong candidates from known-good pools, but every so often deliberately interviews someone from a pool it knows nothing about, precisely because it knows nothing about it. The acquisition function is the formal version of that judgment call, and the uncertainty estimate is what makes it possible.

This is the classic exploration-exploitation tradeoff, and it is the same tension that shows up in reinforcement learning, in self-play, and in any adaptive experiment.

Where you meet it

Hyperparameter tuning was the entry point. Jasper Snoek, Hugo Larochelle and Ryan Adams' 2012 paper showed Bayesian optimization matching or beating expert hand-tuning on real machine learning problems, and modern tools like BoTorch descend directly from it.

The more interesting use now is scientific search: molecules, materials, protein sequences, reaction conditions. There the expensive evaluation is a physical experiment, and the surrogate is the only thing standing between you and testing at random. It pairs naturally with de novo protein design, where a generative model proposes candidates and a surrogate decides which few are worth synthesising.

Why an honest uncertainty estimate is the whole game

If your surrogate is confidently wrong about unexplored regions, Bayesian optimization degrades into greedy search around wherever you happened to start. This is exactly the objection that recent discovery papers raise against using a language model's own confidence as the score: model likelihoods and self-assessments are least reliable on candidates unlike anything in the training data, which is precisely where discovery happens. Our lesson on calibration explains why being frequently right and being trustworthy about your uncertainty are separate properties, and Bayesian updating covers the underlying rule for revising a belief when evidence arrives.

The limits

Bayesian optimization struggles above roughly twenty dimensions without special handling, because uncertainty estimates get thin in high-dimensional space. It assumes evaluations are noisy but consistent, which physical experiments often are not. And it carries real overhead per decision, which is only worth paying when evaluations are genuinely expensive. If a trial takes a second, run random search and go home.

Key papers
A Tutorial on Bayesian Optimization of Expensive Cost Functions (Brochu, Cora and de Freitas, 2010)
Practical Bayesian Optimization of Machine Learning Algorithms (Snoek, Larochelle and Adams, 2012)
A Tutorial on Bayesian Optimization (Frazier, 2018)
Gaussian Processes for Machine Learning (Rasmussen and Williams, 2006)
BoTorch: A Framework for Efficient Monte-Carlo Bayesian Optimization (Balandat et al., 2019)

Key questions

When should I use Bayesian optimization instead of grid or random search?

Use it when each evaluation is expensive enough that you can only afford tens or low hundreds of them, such as a training run, a lab experiment, or a physical build. When evaluations are cheap, random search is simpler and often just as good.

What is an acquisition function?

It is the rule that turns predictions and uncertainties into a decision about what to try next. It scores every untried option by combining how good the surrogate thinks it will be with how unsure the surrogate is, and you test whichever option scores highest.

How is this different from gradient descent?

Gradient descent needs a derivative and takes many cheap steps downhill. Bayesian optimization assumes you have no derivative and can afford very few evaluations, so it spends real computation deciding where each single evaluation should go.
Cite this

APA

Ground Truth. (2026, August 18). Bayesian optimization: how to search when every guess is expensive. Ground Truth. https://groundtruth.day/learn/bayesian-optimization.html

BibTeX

@misc{groundtruth:bayesian-optimization,
  title  = {Bayesian optimization: how to search when every guess is expensive},
  author = {{Ground Truth}},
  year   = {2026},
  month  = {aug},
  url    = {https://groundtruth.day/learn/bayesian-optimization.html}
}

Topics: optimization · uncertainty · hyperparameters · ai-for-science · surrogate-models · fundamentals