BayesFlow: Learning complex stochastic models with invertible neural networks
Stefan T. Radev, Ulf K. Mertens, Andreas Voss, Lynton Ardizzone, Ullrich Köthe
TL;DR
BayesFlow introduces a globally amortized Bayesian inference pipeline based on conditional invertible neural networks that map data to parameters learned from simulations. By coupling a summary network with a chain of affine coupling blocks, it achieves exact density estimation of $p(\boldsymbol{\theta}|\boldsymbol{x})$ without requiring handcrafted statistics and supports variable data sizes through learned summaries. The approach demonstrates strong accuracy, calibration, and posterior contraction across diverse forward models, including Ricker dynamics, Lévy-Flight decision making, SIR epidemiology, and Lotka–Volterra ecology, often outperforming existing amortized likelihood-free methods. With substantial speedups in inference after upfront training, BayesFlow offers a practical, scalable framework for rapid Bayesian parameter estimation in complex stochastic models. The work highlights the importance of learned summaries and invertible density estimation for robust, domain-agnostic amortized Bayesian inference on simulatable forward models.
Abstract
Estimating the parameters of mathematical models is a common problem in almost all branches of science. However, this problem can prove notably difficult when processes and model descriptions become increasingly complex and an explicit likelihood function is not available. With this work, we propose a novel method for globally amortized Bayesian inference based on invertible neural networks which we call BayesFlow. The method uses simulation to learn a global estimator for the probabilistic mapping from observed data to underlying model parameters. A neural network pre-trained in this way can then, without additional training or optimization, infer full posteriors on arbitrary many real datasets involving the same model family. In addition, our method incorporates a summary network trained to embed the observed data into maximally informative summary statistics. Learning summary statistics from data makes the method applicable to modeling scenarios where standard inference techniques with hand-crafted summary statistics fail. We demonstrate the utility of BayesFlow on challenging intractable models from population dynamics, epidemiology, cognitive science and ecology. We argue that BayesFlow provides a general framework for building amortized Bayesian parameter estimation machines for any forward model from which data can be simulated.
