botorch
Bayesian Optimization in PyTorch
What it is and what it does
BoTorch is a Bayesian optimization library built on PyTorch that lets researchers and practitioners compose optimization algorithms from modular components: probabilistic models (especially Gaussian Processes via gpytorch), acquisition functions, and optimizers. It leverages PyTorch's autodifferentiation and GPU support to enable efficient Monte Carlo-based acquisition function optimization without restrictive modeling assumptions.
The library targets researchers and sophisticated practitioners doing active research on Bayesian optimization algorithms. BoTorch supports advanced probabilistic models including multi-task Gaussian Processes, deep kernel learning, and deep GPs, making it suitable for complex optimization problems that integrate with deep learning architectures.
Use it for:
- Compose custom Bayesian optimization algorithms from probabilistic models, acquisition functions, and optimizers for research.
- Optimize expensive black-box functions using Gaussian Process models with GPU acceleration for large-scale optimization.
- Integrate Bayesian optimization into deep learning pipelines using PyTorch's autodifferentiation and GPU support.
- Experiment with advanced probabilistic models like multi-task GPs or deep GPs for structured optimization problems.
- Build acquisition function variants using the reparameterization trick without restrictive modeling assumptions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
BoTorch provides a modular, PyTorch-based framework for building Bayesian optimization algorithms with probabilistic models, acquisition functions, and optimizers.
Yes, if you are a researcher or sophisticated practitioner actively developing Bayesian optimization algorithms. The library is actively maintained, has low install friction, and offers a modular, extensible interface backed by PyTorch's performance and GPU support. No if you are an end-user seeking a simple optimization tool. The beta status and requirement for Python >= 3.11 and PyTorch >= 2.0.1 reflect active development.
Install
botorch on PyPI
pip
pip install botorchuv
uv add botorchpoetry
poetry add botorchInstalling botorch
Before you install
Low friction install with a pure-Python wheel. Requires PyTorch >= 2.0.1 and gpytorch >= 1.14 as core dependencies. Actively maintained with recent releases; last commit 2026-08-14 and 3584 repository stars indicate ongoing development.
License in practice
MIT licensed under permissive terms, allowing use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install botorch
import torch
from botorch.models import SingleTaskGP
from botorch.fit import fit_gpytorch_mll
from gpytorch.mlls import ExactMarginalLogLikelihood
train_X = torch.rand(10, 2, dtype=torch.double)
train_Y = torch.rand(10, 1, dtype=torch.double)
gp = SingleTaskGP(train_X=train_X, train_Y=train_Y)
mll = ExactMarginalLogLikelihood(gp.likelihood, gp)
fit_gpytorch_mll(mll)
Requires Python >= 3.11, PyTorch >= 2.0.1, and gpytorch >= 1.14. Double precision (torch.double) is highly recommended for Gaussian Process models.
Verify before relying
- Whether the package's beta status (Development Status :: 4 - Beta) indicates API stability concerns for production use.
- Performance characteristics when scaling to large datasets or high-dimensional optimization problems.
- Integration patterns and whether direct use versus higher-level tools is appropriate for your use case.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 9 — typing_extensions, pyre_extensions, gpytorch, linear_operator, torch, scipy, multipledispatch, threadpoolctl, ninja |
| Maintenance | actively maintained — 67 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 827,975/month — #4,955 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: botorch-0.18.1-py3-none-any.whl
Keywords: Bayesian optimization, PyTorch
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
ax-platformAx is a platform for adaptive experimentation…
permissive · top 15,000 on PyPI
bayesian-optimizationBayesian optimization using Gaussian processes…
permissive · top 15,000 on PyPI
gpytorchGPyTorch is a PyTorch-based Gaussian process…
permissive · top 5,000 on PyPI
pyro-pplPyro is a deep probabilistic programming…
permissive · top 5,000 on PyPI
hyperoptHyperopt performs serial and parallel…
permissive · top 5,000 on PyPI
pymc3PyMC3 is a Python package for Bayesian…
permissive · top 15,000 on PyPI
pyro-apiProvides a generic dispatch API for…
permissive · top 5,000 on PyPI
optuna-integrationProvides integration modules connecting Optuna…
permissive · top 5,000 on PyPI
tensorflow-probabilityTensorFlow Probability provides probabilistic…
permissive · top 5,000 on PyPI
scikit-optimizeScikit-Optimize is a library for optimizing…
permissive · top 15,000 on PyPI