TL;DR
Trieste is a highly modular, open-source Python library that brings robust Bayesian optimization (BO) and active learning to the TensorFlow 2 ecosystem. By carefully navigating TensorFlow's computational graph mechanics to avoid expensive retracing overhead, Trieste allows researchers and engineers to seamlessly plug in popular probabilistic models (like GPflow and Keras neural networks) to efficiently optimize expensive, black-box functions.
What Problem Does This Paper Address?
Bayesian optimization (BO) is the gold standard for optimizing expensive black-box functions where data collection is heavily constrained by time or cost—such as physical laboratory experiments or tuning massive machine learning models. While PyTorch users have long enjoyed native BO libraries like BoTorch, the TensorFlow 2 ecosystem lacked an actively maintained, dedicated equivalent.
Developing a BO library in TensorFlow 2 is notoriously tricky. BO loops are inherently sequential and dynamic, frequently updating models and acquisition functions as new data arrives. In TensorFlow, this constant shifting easily triggers "graph retracing"—an expensive process where the framework recalculates the underlying computational graph, severely bottlenecking performance. Trieste addresses this gap by providing a framework designed from the ground up to prevent unnecessary retracing while fully leveraging TensorFlow's automatic differentiation and GPU acceleration.
Methods
Trieste achieves its flexibility and efficiency through a clean, modular architecture consisting of four core building blocks:
- High-Level Interfaces: Trieste offers two distinct ways to run optimization loops:
BayesianOptimizer: A standard loop that directly queries a Python-accessible objective function.AskTellOptimizer: A decoupled interface where the optimizer recommends a point (the ask) and pauses, waiting for the user to evaluate it externally and return the result (the tell).
- Probabilistic Models (
ProbabilisticModel): Rather than reinventing the wheel, Trieste provides direct interfaces to well-established TensorFlow modeling libraries. Users can deploy standard Gaussian Processes (GPs) via GPflow, Deep GPs via GPflux, or Deep Ensembles via Keras. - Acquisition Functions and Rules: The library separates the AcquisitionFunction (the mathematical metric evaluating a point's potential, like Expected Improvement) from the AcquisitionRule (the logic dictating how points are chosen, such as trust-region methods or batch selection).
To optimize these acquisition functions, Trieste utilizes TensorFlow's automatic differentiation to calculate exact gradients, feeding them into an efficient, parallelized multi-start L-BFGS-B optimizer.
Datasets
As a software architecture paper, Trieste does not introduce new datasets or benchmarks. Instead, its utility is demonstrated through its integration with synthetic optimization problems and real-world engineering deployments cited throughout recent literature.
Key Insights and Ideas
- The Power of the Ask-Tell Pattern: In real-world engineering (e.g., automated wet labs or distributed computing clusters), you rarely have a clean Python function handle to pass into an optimization loop. The
AskTellOptimizertreats the objective function as an external entity, making Trieste uniquely suited for asynchronous, human-in-the-loop, or hardware-constrained optimization. - Solving the Retracing Bottleneck: By isolating the internal dynamics of the decision-making loop and ensuring that acquisition functions can be updated without altering the underlying graph structure, Trieste unlocks the full speed of TensorFlow's GPU acceleration without the typical graph-recompilation penalties.
- Native Multi-Quantity Support: Trieste’s architecture natively supports modeling multiple quantities simultaneously. This makes complex extensions—like multi-objective optimization, optimization with safety constraints, and multi-fidelity optimization—straightforward to implement.
Key Results
- Robustness: Trieste is production-ready, backed by a comprehensive continuous integration pipeline and boasting 97% unit test coverage.
- Real-World Impact: The library has already been adopted by researchers to develop new BO methodologies and has been successfully deployed in practical applications, including the design of physical heat exchangers and the optimization of plasma-assisted surface treatments for adhesive bonding.
Limitations and Future Work
While Trieste excels at standard BO workflows, the authors note a few frontiers currently on their roadmap:
- High-Dimensional Spaces: Standard BO struggles as the number of input dimensions grows; the team plans to integrate specialized methods for high-dimensional objective functions.
- Non-Euclidean Search Spaces: Future versions aim to expand support for optimizing over non-traditional domains, such as categorical inputs, graphs, and string spaces.
Summary updated