[Paper Review] Learned harmonic mean estimation of the Bayesian evidence with normalizing flows
The paper introduces a robust learned harmonic mean estimator that uses normalizing flows as the internal target distribution to estimate Bayesian evidence from posterior samples, demonstrating accuracy against ground truth and nested sampling, and providing an open-source implementation.
We present the learned harmonic mean estimator with normalizing flows - a robust, scalable and flexible estimator of the Bayesian evidence for model comparison. Since the estimator is agnostic to sampling strategy and simply requires posterior samples, it can be applied to compute the evidence using any Markov chain Monte Carlo (MCMC) sampling technique, including saved down MCMC chains, or any variational inference approach. The learned harmonic mean estimator was recently introduced, where machine learning techniques were developed to learn a suitable internal importance sampling target distribution to solve the issue of exploding variance of the original harmonic mean estimator. In this article we present the use of normalizing flows as the internal machine learning technique within the learned harmonic mean estimator. Normalizing flows can be elegantly coupled with the learned harmonic mean to provide an approach that is more robust, flexible and scalable than the machine learning models considered previously. We perform a series of numerical experiments, applying our method to benchmark problems and to a cosmological example in up to 21 dimensions. We find the learned harmonic mean estimator is in agreement with ground truth values and nested sampling estimates. The open-source harmonic Python package implementing the learned harmonic mean, now with normalizing flows included, is publicly available.
Motivation & Objective
- Motivate Bayesian model comparison in cosmology and the need for flexible evidence estimation.
- Extend the learned harmonic mean estimator by incorporating normalizing flows to improve robustness and scalability.
- Showcase accuracy and robustness through benchmark problems and a DES-like cosmological example.
- Provide an open-source implementation for easy adoption with various sampling techniques.
Proposed method
- Use normalizing flows (real NVP and rational quadratic spline flows) as the internal target distribution for importance sampling in the learned harmonic mean estimator.
- Train the flow on posterior samples by minimizing forward KL divergence (maximum likelihood).
- Concentrate the learned density by reducing the base distribution variance (temperature) to ensure the target remains within the posterior.
- Compute the Bayesian evidence via the learned harmonic mean estimator with the concentrated flow and provide an error estimate in log-space.
- Standardize data prior to flow training and inference; adjust density with the Jacobian for standardized spaces.
- Offer an implementation in the harmonic Python package using JAX and auxiliary libraries for scalable computation.

Experimental results
Research questions
- RQ1Does the normalizing-flow-enhanced learned harmonic mean estimator yield Bayesian evidence values in agreement with ground truth and nested sampling?
- RQ2How does the estimator perform in higher-dimensional settings (up to 21 dimensions) and across different sampling strategies?
- RQ3Is the method robust to variations in flow architecture and temperature concentration?
- RQ4Can the approach be effectively integrated with cosmological analyses and simulation-based inference workflows?
- RQ5What is the practical performance and reliability of the accompanying open-source implementation?
Key findings
- The learned harmonic mean estimator with normalizing flows agrees with ground truth values and nested sampling estimates.
- Normalizing flows provide a more robust, flexible, and scalable internal target distribution than prior simple ML models.
- The method remains effective across benchmark problems and a DES-like cosmological example up to 21 dimensions.
- The approach is agnostic to the sampling strategy, working with any MCMC or variational inference output.
- An open-source harmonic Python package implements the method, with flow-based variants and GPU-accelerated computation.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.