NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Efficient Bayesian Sampling Using Normalizing Flows to Assist Markov Chain Monte Carlo Methods

Marylou Gabrié, Grant M. Rotskoff, Eric Vanden-Eijnden

TL;DR

Sampling multimodal Bayesian posterior distributions is notoriously difficult: standard MCMC gets trapped in local modes, while normalizing flows trained via standard variational inference suffer from mode collapse. This paper introduces a concurrent sampling and training framework where local MCMC steps provide training data to fit a normalizing flow via the forward KL divergence, while the flow simultaneously proposes non-local Metropolis–Hastings jumps that allow MCMC chains to effortlessly hop between modes.

What Problem Does This Paper Address?

In Bayesian inference, evaluating complex, multimodal posterior distributions poses two major challenges:

  1. Slow MCMC mixing: Local Markov Chain Monte Carlo algorithms (such as Metropolis-Adjusted Langevin Algorithm, or MALA) struggle to cross low-probability barriers between modes, while uninformed global proposals result in vanishingly low acceptance rates.
  2. Failure of standalone Normalizing Flows (NFs): Normalizing flows can map simple base distributions to complex target densities, but without existing training data, they are conventionally trained using the reverse Kullback–Leibler (KL) divergence (the variational inference approach). When the target is multimodal and the untrained flow starts far from it, this objective frequently leads to mode collapse, where the flow captures only a subset of the modes.
  3. Evidence calculation: MCMC cannot easily compute the normalization constant (the marginal likelihood or Bayesian evidence $Z_*$), which is essential for model comparison and hypothesis testing.

Methods

The authors propose an iterative, alternating framework (Algorithm 1) that compounds local MCMC exploration with generative flow proposals:

  • Concurrent Sampling and Training: Multiple walkers run in parallel. The algorithm alternates between local Langevin steps (exploring the local neighborhood around each mode) and non-local proposals generated by the normalizing flow $T$.
  • Metropolis–Hastings Resampling: The normalizing flow pushes samples from a base distribution $\rho_B$ through map $T$ to propose new states $\theta'$. These non-local jumps are accepted or rejected via an exact Metropolis–Hastings ratio targeting the posterior $\rho_*$, preserving ergodicity and avoiding bias.
  • Direct (Forward) KL Training: Rather than using the reverse KL divergence, the normalizing flow is trained on the walker positions using the forward KL divergence (maximizing the log-likelihood of current MCMC states under the flow: $\mathcal{L}[T] = -\frac{1}{n} \sum_{i=1}^n \log \hat{\rho}(\theta_i)$). As MCMC chains explore, the flow improves; as the flow improves, it proposes higher-acceptance jumps across modes.
  • Architecture: Invertible affine coupling layers (RealNVP) parameterized by standard feedforward neural networks.
  • Evidence Estimation: Once the flow approximates the posterior distribution $\hat{\rho} \approx \rho_*$, importance sampling with weights $\hat{w}(\theta) = L(\theta)\rho_0(\theta)/\hat{\rho}(\theta)$ provides estimates of the Bayesian evidence and relative mode weights.

Datasets

The authors evaluate their method on synthetic and semi-realistic scientific benchmarks:

  • 10D Gaussian Mixture: A synthetic 10-dimensional target with two Gaussian components of unequal weights ($w_A = 2/3, w_B = 1/3$) separated in parameter space.
  • Exoplanet Radial Velocity Model: A 4-dimensional astrophysical parameter estimation problem ($v_0, K, \phi_0, \ln P$) using synthetic noisy radial velocity observations generated from a ground-truth orbit, closely following the problem setup used by The Joker algorithm (Price-Whelan et al., 2017).

Key Insights and Ideas

  • A Symbiotic Feedback Loop: Local MCMC acts as a local explorer that provides training points for the flow. The flow serves as a global transport vehicle, learning the global geometry and proposing valid jumps across distant energy barriers.
  • Forward KL Avoids Mode Collapse: While reverse KL penalizes placing mass where the target is zero (encouraging mode-dropping), forward KL penalizes failing to cover where target mass exists. By seeding walkers across modes, forward KL forces the flow to capture all discovered modes.
  • Theoretical Guarantees in Continuous Time: In Appendix B, the authors derive the continuous-time limit (Chapman–Kolmogorov / Fokker–Planck formulations) and prove convergence bounds in terms of the Pearson $\chi^2$-divergence, demonstrating asymptotic exponential convergence when the flow is continually updated.

Key Results

  • 10D Gaussian Mixture:
  • The acceptance rate for non-local proposals proposed by the flow increased from near 0% to approximately 80% over training.
  • The relative log-evidence difference $\log Z_A - \log Z_B$ converged accurately to the true value ($\ln(2) \approx 0.693$) within small statistical error.
  • Exoplanet Radial Velocity Inference:
  • Starting from coarse initialization points (obtained via 11 accepted samples from a prior rejection sampler), the algorithm achieved an acceptance rate exceeding 60% for non-local flow jumps after $10^4$ iterations.
  • Walkers frequently jumped between multiple modes of the marginal posterior along period $\ln P$ and phase $\phi_0$, while correctly sampling the full joint posterior over linear parameters ($K, v_0$) where standard rejection sampling fails.

Limitations and Future Work

  • Requires Mode Initialization: The algorithm relies on having at least one walker initialized in each major mode. If an important mode is omitted at initialization (as demonstrated in the exoplanet test with a small mode near $v_0 = 0, \phi_0 = 0$), the flow will never learn it, and MCMC will fail to discover it.
  • Initial Optimization Overhead: In early iterations, non-local moves have high rejection rates until the flow receives sufficient data to model the target geometry.
  • Future Directions: Comparing the efficiency and scaling behavior against modern variational inference techniques on higher-dimensional parameter spaces.

Summary updated

BibTeX
@inproceedings{gabrie2021efficient,
  author = {Marylou Gabrié and Grant M. Rotskoff and Eric Vanden-Eijnden},
  title = {{Efficient Bayesian Sampling Using Normalizing Flows to Assist Markov Chain Monte Carlo Methods}},
  booktitle = {INNF @ ICML},
  year = {2021},
  url = {https://openreview.net/forum?id=mvtooHbjOwx},
}
Figure