TestBED: An Open-Source Toolkit for Bayesian Experimental Design
Gavin Kerrigan, Marcel Hedman, Sahel Iqbal, Tom Rainforth
stat.ML, cs.LG
2026-11-04
Oxford's TestBED modularizes Bayesian experimental design into composable components; its equal-compute benchmark shows a policy time embedding alone swings EIG by ~10 nats.
Bayesian experimental design (BED) is about spending an experiment budget well: which question to ask the next participant, when to draw a blood sample, at which substrate concentration to measure reaction velocity. Those choices determine how much information about the unknown parameters θ each unit of budget buys. The methodology has moved fast, absorbing end-to-end differentiable training, reinforcement learning, and generative models, with deployments in psychology, quantum physics, and drug discovery.
The software has not moved. Each paper ships a bespoke codebase, evaluated on its own task subset with its own horizons, architectures, and optimization settings. A domain expert who wants BED has to stitch together research repos or reimplement from scratch, with no guidance on which method fits their problem; a researcher comparing methods cannot tell an algorithmic gain from an implementation artifact. The closest thing to a general library, Pyro's experimental design module, only estimates the EIG of fixed designs and has been largely untouched since 2020. Everything else is tied to a specific algorithm, model class, or the classical non-amortised setting.
TestBED, an open-source PyTorch toolkit from Oxford's Department of Statistics, decomposes the BED pipeline into four freely composable interfaces:
Method-specific behavior goes through hooks, callbacks at fixed points of the rollout loop; ActionBED is a hook rather than a rewritten loop. Reproducibility comes from recipes that pin every hyperparameter and plug into Hydra and Weights & Biases. Composition is the point: swap one component, hold the rest fixed, and you have a controlled experiment. The team also derives REINFORCE gradient estimators extending ActionBED and JointVarPost to discrete outcomes; the original papers mentioned this was possible but gave no details and no experiments.
The main benchmark runs five method families (JointVarPost, DAD, RL-BOED, ALINE, and ActionBED trained under two losses) plus random and static baselines over eight tasks: source localization, temporal discounting, an economics utility task, pharmacokinetic sampling, enzyme kinetics, and three dynamical-system identification problems, with horizons from 10 to 50 steps. Policies share an Attention architecture wherever possible (ALINE needs its own, parameter-count matched), every method trains for 12 hours on an NVIDIA GH200 across five seeds, and EIG is evaluated with 10^9 contrastive samples, far tighter bounds than the literature usually reports. This should be the largest controlled comparison of BED methods to date.
No method dominates. JointVarPost, a 2020 variational-posterior approach rarely used as a baseline, is highly competitive with modern architectures and equal compute. A well-tuned static design comes close to learned policies on several popular tasks, which says those tasks barely discriminate between strategies. ALINE falls below a random policy on several tasks; the implementation matches its published numbers, and the diagnosis is a finite candidate pool that hurts in continuous design spaces plus a policy-gradient loss weighted by one-step rewards, which trains a myopic policy.
The architecture ablation (location finding, EIG lower bounds, five seeds):
| Configuration | DAD | ActionBED |
| DeepSets, no time embedding | 5.65 | 9.42 |
| DeepSets with time embedding | 15.42 | 15.82 |
| Attention, no time embedding | 12.05 | 9.58 |
| Attention with time embedding | 14.33 | 18.56 |
Adding a time embedding to the policy network moves DAD on DeepSets from 5.65 to 15.42 nats and ActionBED on Attention from 9.58 to 18.56. The justification is clean: finite-horizon BED is a finite-horizon MDP whose optimal policy depends on the step index, and without an explicit t the policy must infer it from history length, which pooling and layer normalization make hard. RL-BOED sits near 12 under all four combinations, untouched by architecture, plausibly because its Soft Actor-Critic per-step rewards already carry timing information. There is a subtler mechanism, too: DAD's sPCE training objective with L=2,000 is capped at log(L+1) ≈ 7.6 nats, which both architectures hit within the first hour, so the objective stops separating policies; ActionBED's loss has no ceiling and keeps improving on Attention for the full 12 hours.
A compute study on DAD with a fixed 3-hour budget shows the mirror-image trade-off: L=256 contrastive samples yields an EIG lower bound of 12.57 versus 14.62 at L=4096, while L=16384 cuts gradient steps from about 28,000 to about 10,000 with no measurable penalty. An undersized L costs about 2 nats; an oversized one cost nothing observed, so estimator accuracy should outrank update count. EIG and downstream MSE rankings also disagree, and on pharmacokinetics the ActionBED variant trained on a different loss (CMSE) beats the variant trained directly on MSE.
For BED researchers this is the first infrastructure where policy-based methods can be swapped piece by piece; the method-by-architecture table above cannot be produced from disjoint codebases. For practitioners, recipes drop the adoption cost from "read five papers and five codebases" to "install one package". The broader lesson lands outside BED: architecture, estimator accuracy, and compute allocation can matter as much as the method itself, and the paper argues these belong in a method's specification rather than its footnotes. Standardized RL implementations had exactly this effect on that field.
The authors' own list: ALINE required a finite candidate pool and RL-BOED required bounded design spaces to train stably, so both ran on modified problems, which dents strict comparability; the optimal L depends on the task and budget; and how training objectives relate to downstream utility is open. Further caveats: the architecture ablation covers one task, the compute study one method and one budget, and all eight tasks have at most four- or five-dimensional parameters, so high-dimensional design is untested here. Wall-clock normalization on a single chip favors throughput-efficient implementations, and a different budget could move the ranking. The static-design finding is as much an indictment of the field's benchmark suite as a result; whether the newer tasks discriminate better will only become clear as the community uses them.