bayesflow-org/bayesflow

A Python library for simulation-based inference with deep learning

What it solves

BayesFlow provides a streamlined way to perform Bayesian inference using deep learning. It simplifies the process of estimating parameters from data generated by complex simulators or traditional parametric models, allowing users to avoid the slow, iterative process of traditional Bayesian methods by using "amortized" workflows.

How it works

The library uses neural networks to learn the relationship between observables (data) and parameters. It supports various neural estimators—including posterior, likelihood, ratio, and point estimators—and leverages modern generative AI, such as diffusion and consistency models, to approximate the posterior distribution. Because it is built on Keras 3, it supports multiple backends including JAX, PyTorch, and TensorFlow.

Who it’s for

Researchers and data scientists who need to perform Bayesian inference on complex simulation-based data, particularly those working with infectious disease modeling (SIR), cognitive modeling, and spatial or image data.

Highlights

  • Multi-backend support: Works seamlessly with JAX, PyTorch, and TensorFlow via Keras 3.
  • Amortized workflows: Enables fast inference once the network is trained, allowing for the same model to be used across multiple datasets.
  • Generative AI integration: Includes a rich collection of generative models, including diffusion and consistency models.
  • Crossover capabilities: Integrates with PyMC for likelihood estimation and MCMC sampling.
  • Built-in diagnostics: Provides a suite of tools for validating and understanding the results of the inference process.

Related

  • Project
  • Project
  • Project
  • Project
  • Project