Skip to main content

TestBED

Modular PyTorch building blocks for Bayesian experimental design.

Documentation PyPI Tests

Quickstart · Documentation · Citation


TestBED is a PyTorch library for developing, evaluating and applying Bayesian experimental design (BED) methods. Tasks, design objectives, designers and policy networks come as small, composable pieces, so you can write your own training loops on top of them instead of adopting a fixed pipeline. For fair benchmarking, TestBED also ships reproducible training recipes for established methods.

Installation

pip install torch-testbed

TestBED requires Python 3.10+ and PyTorch 2.5+, and the core library depends only on PyTorch. Two optional extras add more: train installs Hydra, which the training methods and checkpoint evaluators use, and full also adds plotting, Pyro and Weights & Biases support.

pip install "torch-testbed[train]"
pip install "torch-testbed[full]"

Quickstart

Here is how to design a source location-finding experiment, choosing each design by optimising the prior contrastive estimation (PCE) bound on the expected information gain:

from testbed.tasks import LocationFinding
from testbed.design_objectives import PCE
from testbed.designers import SequentialDesigner

task = LocationFinding(n_sources=1, dim_theta=2)
pce = PCE(task, n_outer=128, n_inner=128)
designer = SequentialDesigner(task, T=5, objective=pce, lr=5e-3, n_step_opt=200)

theta = task.sample_prior()
rollout = designer.rollout(theta)  # T designs and observations, plus a posterior estimate

The Location Finding tutorial walks through this example step by step and compares it with other designers.

What's included

Tasks. Widely used BED benchmark problems behind a shared interface, including location finding, CES, pharmacokinetics, Michaelis–Menten and temporal discounting. The interface covers continuous and discrete designs and outcomes, as well as likelihoods that depend on the full history.

Designers. PolicyDesigner, SequentialDesigner, StaticDesigner and RandomDesigner offer different strategies for choosing designs. You can customise or replace them as needed.

Design objectives and networks. Common bounds on and estimators of the expected information gain (PCE, sPCE, NMC, sNMC and Barber–Agakov), REINFORCE gradient estimators, and policy networks for amortised design.

Training methods. Reference implementations of state-of-the-art algorithms for learning amortised design policies, with Hydra recipes for most tasks. For example, training a policy with Action-BED on the temporal discounting task takes a single command:

python -m testbed.methods.actionbed --config-name experiments/temporal_discounting/actionbed

The following methods are currently available:

Method Reference
Variational posterior (Barber–Agakov) Foster et al., 2020; Phillips et al., 2026
DAD Foster et al., 2021
RL-BOED Blau et al., 2022
ALINE Huang et al., 2025
Action-BED Rossa et al., 2026

See Configuration recipes to learn how recipes are organised and how to override them.

Documentation

The full documentation lives at torch-testbed.readthedocs.io. It includes guides on using tasks, using designers and implementing custom methods, as well as a complete API reference.

Contributing

Contributions are very welcome! See CONTRIBUTING.md to set up a development install and open a pull request, and please read our Code of Conduct before taking part.

Citation

If you use TestBED in your research, please cite:

@software{testbed,
  title  = {{TestBED}: A {PyTorch} Library for {Bayesian} Experimental Design},
  author = {Kerrigan, Gavin and Hedman, Marcel and Iqbal, Sahel and Rainforth, Tom},
  year   = {2026},
  url    = {https://github.com/testbed-benchmark/testbed},
}

Metadata

Release files for torch-testbed 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-testbed 0.1.0
File Size Uploaded Provenance Actions
torch_testbed-0.1.0.tar.gz 315.3 kB With provenance Details for torch_testbed-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for torch-testbed 0.1.0
File Interpreter ABI Platform Actions
torch_testbed-0.1.0-py3-none-any.whl Python 3 none any Details for torch_testbed-0.1.0-py3-none-any.whl

Total release size: 567.3 kB

Release files / torch_testbed-0.1.0.tar.gz

Download URL torch_testbed-0.1.0.tar.gz
Size 315.3 kB
Tags Source
SHA-256 checksum
How to use checksums
318865cee26ad1ca8b3ab8a1532d850968482e7c666b6bbdff67da85f77be7b5
BLAKE2b-256 checksum
How to use checksums
2204ce8e465a2a1d46d971b7ba078a68289984fe16fd619be20b656ecaa12e0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / torch_testbed-0.1.0-py3-none-any.whl

Download URL torch_testbed-0.1.0-py3-none-any.whl
Size 252.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa373f9672370c360dbd3fa4d6156b3f5d51cff90ab0fcb741b25ae568381c3e
BLAKE2b-256 checksum
How to use checksums
36d33ba5722117f3bdb3925c81d70412e4c6a50a41ed3790baa55e22d3539c9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for torch-testbed 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for torch_testbed-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page