Every new DFT label costs hours of computer time; every synthesis and test costs a day or more. We can afford only a few. Which structure, composition or recipe should we try next?
The Gaussian process of lecture 4 gives a prediction and an error bar. Today we use the error bar to decide where to look.
This week: PS4 (weeks 11–12) is due. PS5 covers weeks 13–14.
Why would a smart optimizer choose to make an alloy that it predicts to be softer than the best one so far?
Why does "always make the alloy with the best prediction" often get stuck on a second-rate material?
Why is the best hydrogen-evolution catalyst not the one that binds hydrogen most strongly, and how should a search use that?
A robot can run four syntheses at once. Why not simply run the four candidates with the highest scores?
Goal: a good model everywhere. Measure where the model is least sure (largest σ).
Goal: the best material. Balance a high prediction μ against a large σ.
Simulated alloy A₁₋ₓBₓ, hardness in GPa, three alloys already tested (x = 0.1, 0.4, 0.9). Kernel σf = 1 GPa, length scale l = 0.08, noise σ = 0.1 GPa.
μ is the best guess, σ says how much we still do not know. Neither alone tells us where to measure: we need both.
| z | φ(z) | Φ(z) |
|---|---|---|
| 0 | 0.399 | 0.500 |
| 1 | 0.242 | 0.841 |
| 1.96 | 0.058 | 0.975 |
At every candidate the GP says \(f \sim \mathcal N(\mu_*,\sigma_*^2)\). Every score today is an integral over this Gaussian.
Sanity check: if \(\mu_* = y_{\text{best}}\), PI = 0.5 whatever σ*. PI asks only whether we improve, not by how much, so a tiny but sure gain wins: PI is greedy.
No uncertainty, σ* → 0: EI → max(0, μ* − ybest), the sure gain.
Prediction equals the best: EI = σ* φ(0) = 0.399 σ*.
Units: GPa, like y. EI is never negative.
| μ* − ybest | σ* (GPa) | EI (GPa) |
|---|---|---|
| −0.5 | 0.5 | 0.04 |
| −0.5 | 1.0 | 0.20 |
| −0.5 | 2.0 | 0.57 |
First term: exploitation, a high mean. Second term: exploration, a large σ. One formula, no tuning knob.
κ = 0: pure exploitation, measure the best mean.
κ large: pure exploration, measure the largest σ.
κ ≈ 2: the top of the 95 % band of lecture 4: "optimism in the face of uncertainty".
Minimizing (Ehull, cost)? Use μ* − κσ*, or maximize −y.
All three use only μ and σ of the GP. They differ in how much they value σ.
Given: best hardness so far ybest = 10.0 GPa. The GP predicts
A: μ = 10.5, σ = 0.25 GPa (close to tested alloys)
B: μ = 9.5, σ = 2.0 GPa (an untested region)
| z | φ(z) | Φ(z) |
|---|---|---|
| 2 | 0.0540 | 0.9772 |
| −0.25 | 0.3867 | 0.4013 |
What if B were less uncertain? EI of B = 0.20 for σ = 1.0 and 0.38 for σ = 1.5 GPa: then the safe bet A (0.50) wins.
PI picks the safe bet A; EI and UCB pick the long shot B, because a possible gain of several GPa outweighs a sure gain of 0.5 GPa.
Given (lecture 4, worked problem 3): σf = 1, l = 1, σ = 0.1; two centred measurements (m = 0), y = 1 at x = 0 and y = 0.5 at x = 1; \(\boldsymbol\alpha = (K+\sigma^2I)^{-1}\mathbf y = (1.084,\ -0.156)\). So ybest = 1.
| x* | μ* | σ* | Z | EI |
|---|---|---|---|---|
| −1 | 0.636 | 0.745 | −0.49 | 0.150 |
| 0.5 (midway) | 0.819 | 0.191 | −0.95 | 0.018 |
| 3 (far) | −0.009 | 0.987 | −1.02 | 0.079 |
Midway is already well known and below the best. Far away is uncertain but predicted low. Next to the best point, on the unexplored side, we are both uncertain and hopeful.
Simulated: hidden true hardness (dashed) has a small peak near x = 0.25 and the real peak, 5.1 GPa, at x = 0.72. Each test has 0.1 GPa noise. Shaded: 95 % band. Gold: EI (scaled). ▲ next alloy.
With 5 alloys it found the real peak (measured 5.18 GPa at x = 0.71). Once the peak is pinned down, EI there drops and the loop turns to the unexplored small peak near 0.25. 5.18 is above the true 5.12 GPa because each test carries 0.1 GPa noise: the best measured value is optimistic, so we repeat the best point.
| strategy (3 random starts + 9 chosen) | found the real peak |
|---|---|
| random search (baseline) | 50 % |
| greedy: best mean (κ = 0) | 56 % |
| pure exploration: largest σ | 53 % |
| probability of improvement | 82 % |
| expected improvement | 100 % |
| UCB, κ = 2 | 100 % |
| UCB, κ = 5 | 94 % |
"Found" = best alloy tested within 0.3 GPa of the true maximum after 12 tests. Same simulated alloy and GP as before.
Too greedy: stays on the first good hill. Too curious: spends tests on places that cannot win. Balance wins, and both extremes are barely better than random.
Simulated hardness on 26 × 26 = 676 candidate (composition, ageing temperature) pairs; only 3 lie within 0.3 GPa of the best. 100 campaigns of 30 tests, 5 random starts. Lines: median; band: middle 50 %.
BO: within 0.3 GPa of the best after a median of 12 tests, in all 100 campaigns. Random: reached it in only 14 % of campaigns within 30 tests.
| batch of 4 (after the 3 starting alloys) | compositions x |
|---|---|
| naive: top-4 EI values | 0.76, 0.77, 0.78, 0.79 |
| kriging believer | 0.78, 1.00, 0.59, 0.26 |
A batch of 4 takes one round instead of four. Per test it is a little less efficient than one-at-a-time, but much faster in days.
Stopping rules: the budget is spent · max EI below a threshold (here 0.01 GPa, a tenth of the noise) · no improvement for several rounds · the target property is reached.
Same alloy, goal: an accurate GP everywhere. RMSE of the GP over all compositions, median of 200 simulated campaigns:
| alloys tested | random choice | largest σ |
|---|---|---|
| 3 | 0.71 GPa | 0.72 GPa |
| 8 | 0.48 GPa | 0.33 GPa |
| 15 | 0.25 GPa | 0.11 GPa |
On-the-fly training of interatomic potentials works this way: run MD, and call DFT only when the model's uncertainty for a new structure is large.
Too weak: hydrogen does not stick. Too strong: it does not leave. The best catalyst binds "just right", ΔGH* ≈ 0. Nickel, 0.3 eV too strong, sits about 2.2 decades below the top.

Simulated: 231 compositions of an A–B–C surface alloy; an illustrative smooth ΔGH*; "DFT" noise 0.02 eV. Only 8 candidates have |ΔGH*| < 0.03 eV (gold rings). 200 campaigns, 3 random starts.
| strategy | DFT calcs to first hit (median) | hit within 10 |
|---|---|---|
| random | 19 | 34 % |
| GP on activity + EI | 8 | 68 % |
| GP on ΔG + window probability | 7 | 72 % |
Model the smooth descriptor, then apply the known physics (the volcano) in the score. ΔG is only a descriptor: stability, cost and real surfaces still need checking.
Reported: 41 of 58 target compounds made in 17 days (Szymanski et al., Nature 2023). A mobile robot chemist ran about 700 experiments in about 8 days with BO over 10 variables (Burger et al., Nature 2020).
Careful: later analyses questioned how many products were truly new and correctly identified. Automation speeds up the loop; it does not replace careful characterization (Leeman et al., 2024).
| problem | symptom | what to do |
|---|---|---|
| Search space too narrow | best point sits on the boundary | widen the ranges; humans still choose the space |
| Wrong length scale | σ too small, loop stops exploring | refit by marginal likelihood every round (lecture 4) |
| Noisy, drifting measurements | "best" alloy does not reproduce | repeat the best points; keep the noise term σ honest |
| Wrong objective | harder, but brittle or too costly | constraints, or several objectives (Pareto front) |
| Too many variables | no better than random above ~10–20 knobs | fewer, physical descriptors; PCA (lecture 7) |
| No baseline | "BO found it" with nothing to compare | always report random search alongside |
import numpy as np from scipy.stats import norm def kern(a, b, sf=1.0, l=0.08): # lecture 4 return sf**2*np.exp(-(a[:,None]-b[None,:])**2/(2*l**2)) def gp(X, y, xs, sn=0.1): m = y.mean(); K = kern(X, X) + sn**2*np.eye(len(X)) ks = kern(xs, X); mu = m + ks @ np.linalg.solve(K, y - m) var = 1.0 - np.sum(ks*np.linalg.solve(K, ks.T).T, axis=1) return mu, np.sqrt(np.maximum(var, 1e-12)) def ei(mu, sd, best): z = (mu - best)/sd return (mu - best)*norm.cdf(z) + sd*norm.pdf(z) xs = np.linspace(0, 1, 101) X = np.array([0.1, 0.4, 0.9]); y = measure(X) # simulated for it in range(9): mu, sd = gp(X, y, xs) xn = xs[np.argmax(ei(mu, sd, y.max()))] X, y = np.append(X, xn), np.append(y, measure(xn))
ei.Runs in Google Colab; no GPU needed. measure() simulates the alloy with 0.1 GPa noise.
Because it might be much harder. B (μ = 9.5, σ = 2 GPa) has EI 0.57 vs 0.50 for the safe A (μ = 10.5, σ = 0.25). Uncertainty has value.
It ignores σ, so it keeps testing next to its current best. It found the real peak in 56 % of campaigns; EI and UCB (κ = 2) in 100 %.
Sabatier: H must stick and leave, so activity peaks at ΔGH* ≈ 0 (Ni, 0.3 eV too strong: 2.2 decades lower). Search for a window: median 7 calculations vs 19 at random.
The top-4 EI points sit at x = 0.76–0.79: one experiment, four times. The kriging believer spreads them to 0.78, 1.00, 0.59 and 0.26.
Lab 13: a BO loop in numpy. PS4 due; PS5 (weeks 13–14) due in week 15. Posters and 6-page reports in week 15.
Instead of scoring candidates we list, can a model invent them? Screening funnels, variational autoencoders and their latent space, diffusion models, and how many generated crystals survive a DFT stability check.
All plots were computed for this course (numpy). The alloy hardness landscapes and the ternary catalyst are simulated; the volcano uses the one-parameter model of Electrochemistry lecture 13 with typical ΔGH* values for Pt, MoS₂ edges and Ni.