Authors: Simon Dirmeier, Simone Ulzega, Antonietta Mira, Carlo Albert
Introduction
In modern scientific research, complex computer simulators are indispensable tools for modeling phenomena ranging from the spread of epidemics to the formation of galaxies. However, these simulators often present a significant statistical challenge: while they can generate synthetic data, they do not provide an explicit likelihood function—the probability of observing specific data given a set of parameters. This "intractable likelihood" problem prevents the use of traditional Bayesian inference methods like Markov Chain Monte Carlo (MCMC).
To address this, the field of Simulation-Based Inference (SBI) has emerged, utilizing machine learning to learn the relationship between parameters and data. We introduce sbijax, a new JAX-native Python library designed to provide a high-performance, user-friendly interface for SBI, leveraging state-of-the-art neural density estimators and generative models.
The JAX Advantage
While existing tools like the PyTorch-based sbi package have been instrumental, the rapid evolution of the field and the need for greater computational efficiency motivated the development of sbijax. By building on the JAX ecosystem, sbijax offers several key advantages:
- Hardware Acceleration: Native support for GPUs and TPUs.
- Automatic Vectorization: Simplifies the parallelization of simulations and training.
- Ecosystem Integration:
sbijaxintegrates seamlessly withHaikufor neural network architectures,BlackJAXfor MCMC sampling, andArviZfor posterior diagnostics.
Core Methodologies
sbijax implements a comprehensive suite of inference classes, bridging the gap between deep learning and Bayesian statistics:
- Neural Likelihood Estimation (NLE): Learns a surrogate model of the likelihood function.
- Neural Posterior Estimation (NPE): Directly learns the mapping from data to the posterior distribution.
- Neural Likelihood-Ratio Estimation (NRE): Uses a classifier to estimate density ratios between real and synthetic parameter-data pairs.
- Approximate Bayesian Computation (ABC): Provides classic likelihood-free methods, such as Sequential Monte Carlo (SMC-ABC).
Beyond standard normalizing flows, sbijax incorporates cutting-edge techniques like Flow Matching (FMPE) and Consistency Models (CMPE) for posterior estimation. Additionally, it features Neural Approximate Sufficient Statistics (NASS), which automatically compresses high-dimensional data into informative summaries to streamline the inference process.
Benchmarking and Results
The library's capabilities were demonstrated using standard SBI benchmarks, including the Simple Likelihood Complex Posterior (SLCP) model. SLCP is a classic test case where the likelihood is mathematically simple, but the resulting posterior is highly multi-modal and difficult for standard algorithms to capture.
Key findings from these tests include:
- Sequential NLE: This method performed exceptionally well on the SLCP model, successfully capturing its complex multi-modal structure.
- FMPE Efficiency: Flow Matching showed impressive results in amortized settings, providing a close approximation to the true posterior without requiring multiple rounds of simulation.
- Neural vs. Traditional Methods: While SMC-ABC with NASS is functional, neural-based methods proved to be significantly more sample-efficient, particularly when dealing with multi-modality under tight computational budgets.
Conclusion and Future Directions
sbijax provides both a high-level API for rapid implementation and a low-level API for researchers requiring deep customization. As the field of generative modeling continues to advance, the authors plan to expand the library to include quantile regression for uncertainty estimation, improved diagnostic tools like discriminative calibration, and the latest emerging algorithms.
sbijax is currently available via PyPI (pip install sbijax), offering a robust platform for researchers to apply rigorous Bayesian inference to complex simulation models.
Summary updated