sbi reloaded: a toolkit for simulation-based inference workflows

Jan Boelts, Michael Deistler, Manuel Glöckler, Álvaro Tejero-Cantero, Jan-Matthis Lueckmann, Guy Moss 0001, Peter Steinbach, Thomas Moreau, Fabio Muratore, Julia Linhart, Conor Durkan, Julius Vetter, Benjamin Kurt Miller, Maternus Herold, Abolfazl Ziaeemehr, Matthijs Pals, Theo Gruner, Sebastian Bischoff, Nastya Krouglova, Richard Gao, Janne K. Lappalainen, Bálint Mucsányi, Felix Pei, Auguste Schulz, Zinovia Stefanidi, Pedro Rodrigues 0002, Cornelius Schröder, Faried Abu Zaid, Jonas Beck, Jaivardhan Kapoor, David S. Greenberg, Pedro J. Goncalves, Jakob H. Macke, Manuel Gloeckler, Miriam Herold, Sebastian Bischoff 0001, Pedro Luiz Coelho Rodrigues, Guy MossJ. Open Source Softw 2025 · DOI · DBLP

Abstract

The sbi package is a flexible, PyTorch-based toolkit designed to perform Bayesian inference on complex, "black-box" simulators where traditional likelihood evaluations are impossible. By leveraging state-of-the-art neural networks, it allows scientists and engineers to align their simulation models with real-world empirical data efficiently, without needing gradients or explicit likelihood functions.

Introduction

In many scientific and engineering fields, researchers use complex stochastic simulators to model real-world phenomena. To make these models useful, their underlying parameters must be tuned so that the simulator's output matches actual empirical observations—a classic use case for Bayesian inference. However, traditional Bayesian methods, such as Markov-Chain Monte Carlo (MCMC), rely on evaluating a "likelihood function" to determine how probable an observation is given a set of parameters. For many modern simulators, this likelihood function is mathematically intractable; while one can generate simulated samples, calculating their exact probabilities is impossible. Furthermore, simulators are often slow to run and non-differentiable, precluding gradient-based inference methods.

Simulation-based inference (SBI) addresses these challenges by using machine learning to deduce the relationship between parameters and outputs directly from simulated data. This paper introduces the updated sbi toolkit, a comprehensive, user-friendly software ecosystem for applying advanced neural network-based SBI algorithms.

Simulation-Based Inference Methods

The sbi toolkit implements a wide array of neural network-based SBI algorithms, treating the user's simulator entirely as a "black box." The core methods include:

  • Neural Posterior Estimation (NPE): Directly estimates the posterior distribution of the parameters.
  • Neural Likelihood Estimation (NLE): Learns a surrogate model of the intractable likelihood function.
  • Neural Ratio Estimation (NRE): Estimates the likelihood-to-evidence ratio to perform inference.

These methods support both amortized inference—where a network is trained once on a large dataset to perform instant inference on any new observation—and sequential inference, which focuses simulations actively on a single specific observation to optimize computational resource usage.

The sbi Toolkit Ecosystem

The sbi package is designed to be both flexible for researchers and accessible for domain scientists. It supports cutting-edge density estimators, including normalizing flows, diffusion models, mixture density networks, and flow matching. Additionally, it provides embedding networks (such as CNNs) to automatically extract summary statistics from high-dimensional simulation outputs.

Overview of the sbi toolkit components, covering the full inference workflow from simulation to diagnostic analysis.

As shown in the workflow above, the toolkit covers the entire pipeline from simulator integration to final analysis. Key technical features include:

  • Decoupling the Simulator: Unlike probabilistic programming languages that require simulators to be written in specific differentiable frameworks, sbi only requires inputs (parameters) and outputs (simulated data). This allows for the use of legacy simulators written in C++, Fortran, or other languages.
  • Sampling and Diagnostics: Once trained, models can be sampled using MCMC, variational inference, or rejection sampling. The toolkit includes robust diagnostic tools like Simulation-Based Calibration (SBC) and expected coverage to ensure inference results are trustworthy.
  • Balancing Flexibility and Usability: sbi provides highly optimized, pre-configured defaults for all inference methods while exposing low-level APIs to customize training loops, neural architectures, and sampling strategies.

Impact and Conclusion

Since its initial release, the sbi package has become a staple in the machine learning research community, fostering the application of SBI across diverse fields such as neuroscience, astrophysics, and computational biology. The recent expansion of the toolkit includes support for diffusion models, flow-matching, truncated priors, and advanced posterior diagnostics. By lowering the barrier to entry for Bayesian inference, sbi encourages collaboration between machine learning researchers and applied scientists dealing with complex, intractable models.

Summary updated

BibTeX
@article{boelts2025sbi,
  author = {Jan Boelts and Michael Deistler and Manuel Glöckler and Álvaro Tejero-Cantero and Jan-Matthis Lueckmann and Guy Moss and Peter Steinbach and Thomas Moreau and Fabio Muratore and Julia Linhart and Conor Durkan and Julius Vetter and Benjamin Kurt Miller and Maternus Herold and Abolfazl Ziaeemehr and Matthijs Pals and Theo Gruner and Sebastian Bischoff and Nastya Krouglova and Richard Gao and Janne K. Lappalainen and Bálint Mucsányi and Felix Pei and Auguste Schulz and Zinovia Stefanidi and Pedro Rodrigues and Cornelius Schröder and Faried Abu Zaid and Jonas Beck and Jaivardhan Kapoor and David S. Greenberg and Pedro J. Goncalves and Jakob H. Macke and Manuel Gloeckler and Miriam Herold and Sebastian Bischoff and Felix Pei and Pedro Luiz Coelho Rodrigues and David Greenberg and Guy Moss},
  title = {{sbi reloaded: a toolkit for simulation-based inference workflows}},
  journal = {J. Open Source Softw.},
  year = {2025},
  doi = {10.21105/joss.07754},
}
Figure