Bayesian evidence estimation from posterior samples with normalizing flows

Rahul Srinivasan, Marco Crisostomi, Roberto Trotta, Enrico Barausse, M. Breschi

TL;DR

This paper introduces floZ, a new method that uses normalizing flows to efficiently estimate the Bayesian evidence (a crucial quantity for model comparison) directly from existing posterior samples. floZ offers a robust and scalable alternative to traditional methods, particularly for complex, high-dimensional problems, and has been successfully applied to real gravitational wave data.

What Problem Does This Paper Address?

In Bayesian inference, comparing different models to explain data is fundamental. This comparison relies on the Bayesian evidence, which is the marginal likelihood of the data given a model. Calculating this evidence is notoriously difficult, often requiring computationally intensive methods like nested sampling. Existing methods that estimate evidence from pre-existing posterior samples can struggle with complex, high-dimensional distributions, especially those with sharp features. This paper aims to provide a more robust, efficient, and scalable method for evidence estimation from readily available posterior samples, making Bayesian model comparison more accessible.

Methods

The core of the floZ method lies in normalizing flows. These are a class of generative models that learn a bijective transformation between a simple base distribution (like a Gaussian) and a complex target distribution (the unnormalized posterior). By training a neural network to represent this transformation, floZ can effectively learn the structure of the posterior.

The key innovation is how floZ leverages this learned transformation to estimate the evidence. Instead of directly sampling from the posterior to compute the evidence integral, floZ uses the determinant of the Jacobian of the learned flow to relate the volume of the simple base distribution to the volume of the complex posterior. This allows for evidence estimation from the existing posterior samples.

To improve training and robustness, floZ employs a novel cyclic loss schedule that sequentially optimizes four different loss functions:

  • L1: Standard cross-entropy for density estimation.
  • L2: Encourages the estimated evidence to be close to a Dirac delta function, minimizing its variance.
  • L3a & L3b: Focus on the ratio of evidence estimates from pairs of samples, further reducing variance and improving accuracy.

Additionally, the paper introduces a pre-processing step for distributions with sharp boundaries. This involves reflecting samples across these boundaries to create a smoother distribution, which is easier for normalizing flows to model accurately.

Datasets

The paper uses several synthetic datasets for validation and benchmarking:

  • Truncated d-dimensional single Gaussian: Used to test scalability up to 200 dimensions.
  • Truncated d-dimensional mixture of five Gaussians: A more complex distribution to test robustness.
  • Truncated d-dimensional exponential function: Highlights challenges with sharp posterior boundaries.
  • Truncated d-dimensional Rosenbrock distribution: Used for cases where the evidence is analytically intractable.

These synthetic datasets are generated with varying dimensions (up to 200 for the single Gaussian) and a fixed number of posterior samples (10⁵ for higher dimensions).

The paper also applies floZ to real gravitational wave data from the GW150914 event to compute the Bayes factor for the presence of a specific signal component (the first overtone).

Key Insights and Ideas

  • Evidence from Samples: The most significant insight is that Bayesian evidence, a notoriously difficult quantity to compute, can be reliably estimated after the fact from existing posterior samples using normalizing flows. This decouples the evidence estimation from the initial sampling process.
  • Robustness to Sharp Features: The proposed pre-processing step of reflecting samples across sharp posterior boundaries dramatically improves the accuracy of evidence estimation, a common pitfall for many density estimation techniques.
  • Scalability: floZ demonstrates impressive scalability, accurately estimating evidence for a simple Gaussian up to 200 dimensions with 10⁵ samples, suggesting its potential for very large parameter spaces.
  • Cyclic Loss for Stability: The novel cyclic training regime, cycling through different loss functions, appears to be crucial for achieving stable and accurate training, especially in higher dimensions.

Key Results

  • Accuracy: floZ achieves comparable or superior accuracy to nested sampling and significantly outperforms a k-nearest-neighbors (kNN) method, especially in higher dimensions and for distributions with sharp features. For example, in 2D, floZ shows very low relative errors in log evidence across various distributions.
  • Scalability: For a single Gaussian, floZ maintains good accuracy up to 200 dimensions with 10⁵ samples.
  • Speed: floZ is significantly faster than traditional nested sampling for evidence estimation once posterior samples are available. For a 15-dimensional problem, it took less than 10 minutes on an A100 GPU, whereas nested sampling can take hours.
  • Gravitational Wave Application: floZ successfully computed the Bayes factor for the presence of a signal overtone in GW150914 data, yielding results consistent with nested sampling.

Limitations and Future Work

  • High Dimensionality Challenges: While floZ scales well, the accuracy of normalizing flows can degrade in very high dimensions. This is partly due to the difficulty of obtaining accurate densities in the tails of the distribution, which is less critical for evidence estimation where the peak density is more important.
  • Importance Sampling for Improvement: The authors suggest that importance sampling could be used to further correct the estimated evidence and improve precision, especially in challenging scenarios.
  • Training Data Requirements: For more complex posteriors in high dimensions, a larger number of training examples might be necessary.
  • Future Applications: The authors envision floZ being widely applicable in cosmology, astrophysics, and other fields where Bayesian model comparison is used, particularly when dealing with computationally expensive likelihoods or large datasets. They also mention exploring its use with other simulation-based inference techniques.

Summary updated

BibTeX
@inproceedings{srinivasan2024bayesian,
  author = {Rahul Srinivasan and Marco Crisostomi and Roberto Trotta and Enrico Barausse and M. Breschi},
  title = {{Bayesian evidence estimation from posterior samples with normalizing flows}},
  booktitle = {Physical},
  year = {2024},
  doi = {10.1103/physrevd.110.123007},
}
Figure