Tech Blog · Algorithms Explained
[Prescription Methods 4] When every experiment is expensive — Bayesian optimization
If one experiment takes half a day, you need to find good conditions within a few dozen tries. We explain how Bayesian optimization picks the next experiment, and what to check when applying it to a process: number of variables, noise, constraints, and batch experiments.
Jul 16, 2026 · OPTI-X
Series “Prescription Methods” · Part 4
If testing a single recipe takes half a day, methods that need hundreds of tries are not an option. Often there is also no time to build an accurate process model first, as MPC in the previous part requires. Bayesian optimization was built for exactly this situation: "when each evaluation is expensive."
How it works: draw a map, then pick where to try next
Bayesian optimization runs on two components.
- Surrogate model: Uses the experimental results so far to estimate a "conditions → outcome" map. It usually uses a Gaussian process, which gives not only a predicted value but also how uncertain that prediction is.
- Acquisition function: Looks at the map and picks the next experimental conditions. It strikes a balance between places where results look likely to be good (exploitation) and places that are still unknown (exploration).
A Gaussian process starts from one assumption: nearby conditions produce similar results. It estimates from the data how far each variable has to move before the result changes, and uses that sense of distance to predict conditions that have not been tested.
Uncertainty is therefore small near tested points and grows the farther you move from them. In a noise-free computer experiment, uncertainty at a tested point is zero. The method shares its roots with kriging, which geologists used to estimate mineral distribution from core samples, and Jones et al. (1998) explain that it approximates well the nonlinear, multimodal functions common in engineering.
One round of Bayesian optimization
The map is revised each time a new experimental result comes in
- 1Update the surrogate modelEstimate the outcome map and its uncertainty from the experiments so farNext
- 2Choose the next experimental conditionsUse the acquisition function to pick conditions that 'look good or are still unknown'Within allowed range → experimentOut of range → candidate excluded
- 3Run the experiment and add the resultAdd the result to the data and repeat; stop when the target is reached or the budget runs outReport the best conditions
Acquisition functions: expected improvement and upper confidence bound
The most widely used acquisition function is expected improvement (EI). It takes the best result so far as a baseline and calculates how much, on average, an experiment at a given condition would beat that baseline. The value grows as the prediction gets better and as the uncertainty gets larger. Without noise, it is zero at points already tested, because there is nothing more to learn there.
Another standard approach is the upper confidence bound (UCB). It scores each condition as "prediction + uncertainty × coefficient," taking an optimistic view of the unknown. A larger coefficient tilts toward exploration; a smaller one toward exploitation.
The acquisition function itself has many peaks, so finding its maximum takes a separate optimization. Still, it is far cheaper to compute than a real experiment, so it is a small part of the total cost. Shahriari et al. (2016) note that how you build the surrogate model often matters far more than which acquisition function you choose.
Balancing exploration and exploitation
What the acquisition function weighs every time
Worked example: reactor temperature and residence time
Suppose you are looking for a recipe that raises yield using two variables: reactor temperature and residence time. You start with initial experiments that evenly cover the range of both variables. Jones et al. (1998), who proposed efficient global optimization (EGO), used about 10 times the number of variables as initial points (21 points for 2 variables, 65 for 6).
From there, you proceed one experiment at a time. Refit the Gaussian process to the results, then run the next experiment at the temperature and residence time combination with the highest expected improvement.
Jones et al. stopped when expected improvement fell below 1% of the current best value. It is a way to put a number on the judgment "further experiments will gain little." Because expected improvement tends to understate the remaining room for improvement, they also suggested setting a lower threshold or stopping only when the criterion is met twice in a row.
EGO evaluations by test function
Evaluations needed to reach the stopping criterion on problems with 2–6 variables
Going from 2 to 6 variables tripled the evaluations needed. These results, however, come from noise-free mathematical test functions. A real process with measurement error and raw material variation may need more experiments.
The automotive materials case in the same paper was also a problem of adjusting the amounts of two ingredients. From a 21-point experiment, the authors built separate maps for viscosity and yield stress, then minimized viscosity while varying a lower limit on yield stress to trace the tradeoff between the two properties. According to the authors, this analysis found a previously unknown composition region and produced a material that beat the previous best on both properties.
What to check when applying it to a process
When moving to a real process, look at the problem conditions before the algorithm. The setup changes with how many variables there are, how much measurements fluctuate, which lines must not be crossed, and how many experiments can run at once.
Items to check before applying
Four conditions change how the search is set up
| Item | Question to check | Approach in the literature |
|---|---|---|
| Number of variables | How many variables are adjusted? | Narrow down key variables first with screening experiments |
| Noise | How much do results differ when the same condition is repeated? | Include observation noise in the model |
| Constraints | Do you know in advance which conditions must not be crossed? | Known constraints go into the search range; unknown ones are reflected as a probability of satisfaction |
| Batch experiments | How many experiments can run at once? | Fill in pending results with predicted values, then choose the next candidate |
Number of variables. Shahriari et al. note that Bayesian optimization is restricted to problems of moderate dimension. As dimensions increase, the number of evaluations needed to cover the space grows exponentially. In the integrated-circuit case in Jones et al., only about 5 of 36 input variables were important. This is why the screening experiments from Part 2 are used to reduce variables first.
Noise and constraints. EGO assumed noise-free computer experiments and left the extension to noisy cases as future work. An observation noise term can be added to a Gaussian process, but the standard form assumes the noise level is the same under every condition. Constraints known in advance, such as a temperature upper limit, are removed from the candidate range. For constraints you only learn by experimenting, such as byproduct concentration, methods that multiply expected improvement by the probability of satisfying the constraint have been proposed.
Batch experiments. The basic procedure decides the next experiment only after one finishes. If several reactors or specimens can run at the same time, one approach temporarily fills in the results of pending experiments with model predictions and then chooses the next candidate. Even if the number of experiments stays the same, the overall duration can shrink.
Strengths and limits
Its strengths are that it works from results alone without a process model, and that prediction and uncertainty let it judge when to stop. Its limits are dimension and data size. The computation of an exact Gaussian process grows with the cube of the number of data points, which becomes a burden with a large evaluation budget or a lot of data. With little data, the kernel settings (hyperparameters) can also overfit.
Bayesian optimization at a glance
Strong with few trials, weak with high dimensions and real time
How it relates to other methods
Design of experiments (DoE), covered in Part 2, designs the whole set of experiments in advance and then analyzes the results. Bayesian optimization decides the next experiment one at a time while watching the results. The two are used in sequence: EGO itself starts with an experimental design that evenly covers the space.
It shares its roots with surrogate-based optimization, which Part 7 covers. Bayesian optimization is the form that uses the surrogate's uncertainty directly to choose the next experiment. Using uncertainty only as a reason to explore, however, can be risky in a process.
Sui et al. (2015) point out that standard upper-confidence-bound methods accept poor immediate results for the sake of long-term performance, which makes them unsuitable for safety-critical targets. Their SafeOpt starts from conditions known to be safe and expands the range by trying only conditions it can be confident, with high probability, will not cross the safety threshold. The price is that it may miss an optimum outside the range safely reachable from the starting point.
Bayesian optimization picks the next experiment using uncertainty, and when applied to a process, the same uncertainty must also limit the range of trials. In the next part, we look at reinforcement learning, which learns by trial and error.
References
- Journal of Global Optimization 1998 (Jones et al.), "Efficient Global Optimization of Expensive Black-Box Functions" ↗
- Proceedings of the IEEE 2016 (Shahriari et al.), "Taking the Human Out of the Loop: A Review of Bayesian Optimization" ↗
- ICML 2015 (Sui et al.), "Safe Exploration for Optimization with Gaussian Processes" ↗
Could this work for your process?
Talk to us