Skip to content

botorch-rust v0.1.0

Choose a tag to compare

@github-actions github-actions released this 14 Oct 16:50
· 611 commits to main since this release

First release of botorch-rust: a Rust implementation of BoTorch with the same Python API (import botorch_rs instead of import botorch), tested for equivalence against BoTorch.

Install

pip install botorch-rust

Prebuilt abi3 wheels for CPython 3.11 and later (Windows x86_64, macOS arm64 and x86_64, Linux x86_64 and aarch64; no Rust toolchain needed), on PyPI and attached below. NumPy and PyTorch are optional: results come back in the array type you pass in.

What is in it

222 of BoTorch's 773 public classes and functions (coverage report):

  • Models: SingleTaskGP (multi-output, batched, fixed or inferred noise), ModelListGP, the contextual LCEMGP, PosteriorMeanModel and GenericDeterministicModel, Normalize / Standardize / InputPerturbation, conditioning and fantasies; fitting with BoTorch's L-BFGS-B setup.
  • Single-objective acquisition: analytic and Monte Carlo EI / LogEI / PI / UCB / NEI families, outcome constraints and MC objectives, optimize_acqf with linear and nonlinear constraints (SLSQP), fixed features and sequential batches.
  • Multi-objective optimization: all of botorch.acquisition.multi_objective: qLogNEHVI, qLogEHVI, qNEHVI, qEHVI, analytic EHVI, qLogNParEGO, the hypervolume knowledge gradient (also multi-fidelity), MOMF, max-value, joint and predictive entropy search, the multi-output risk measures and NSGA-II; box decompositions, hypervolumes, Pareto utilities and all 33 multi-objective test problems.
  • Pathwise sampling (draw_matheron_paths, MatheronPathModel) and torch callables as objectives, constraints, initializers and acquisition functions.

See What is not ported yet for the gaps.

Speed

Through the Python API on one CPU thread each (Intel Core Ultra 7 155H): a 30-iteration BO loop on Hartmann-6 is 47x faster than BoTorch, LogEI / qLogEI optimization 33-90x, qLogNEI and the multi-objective acquisition functions 9-14x, and model fitting from 1.4x (300 points, dominated by the Cholesky factorization) to 170x (20 points). With all cores, the multi-objective tasks reach 29-84x. See the benchmarks.

Equivalence with BoTorch

Every ported component is compared with BoTorch: Rust fixture tests generated with BoTorch, live side-by-side tests of both Python APIs against BoTorch main and the latest release, and a randomized equivalence sweep. Deterministic quantities (posteriors, likelihoods, gradients, hypervolumes) agree to 1e-9 or better; stochastic and optimization results are compared against BoTorch's own spread under rounding-level perturbations. The README lists the tolerances and worst errors per component. The comparison also turned up bugs in BoTorch itself, reported upstream.