Conditional diffusions for neural posterior estimation

Tianyu Chen, Vansh Bansal, James G. Scott · DOI

Introduction

In scientific disciplines ranging from epidemiology to cosmology, researchers frequently rely on complex simulators to model real-world phenomena. Performing Bayesian inference in these contexts requires estimating the posterior distribution $p(\theta | X)$—the probability of parameters $\theta$ given observed data $X$. However, because these simulators often lack a tractable likelihood function, traditional Markov Chain Monte Carlo (MCMC) methods are often inapplicable.

Neural Posterior Estimation (NPE) has emerged as a powerful solution, using neural networks to learn an amortized approximation of the posterior. While Normalizing Flows (NFs) have long been the standard architecture for NPE, they face significant challenges regarding training stability and their ability to represent complex, multimodal, or sharply bounded distributions. This paper introduces cDiff, a framework that replaces flows with conditional diffusion models, offering a more robust and accurate approach to simulation-based inference.

The cDiff Framework

The authors propose a joint architecture consisting of a conditional diffusion decoder and a summary network.

1. Conditional Diffusion Models

Unlike normalizing flows, which attempt to transform a simple base distribution into a complex one through a series of invertible mappings, diffusion models learn to reverse a gradual noising process. This "denoising" approach is inherently more stable. The paper provides theoretical grounding by proving that minimizing the diffusion loss function effectively minimizes an upper bound on the Kullback-Leibler (KL) divergence between the true and estimated posterior.

2. Amortization via Summary Networks

To ensure the model is "amortized"—meaning it can be applied to new observations without retraining—the diffusion process is conditioned on a summary network (such as DeepSets or LSTMs). This network compresses datasets of arbitrary size into a fixed-length context vector, allowing the diffusion decoder to generate posterior samples tailored to specific observations efficiently.

Experimental Evaluation

The researchers evaluated cDiff against state-of-the-art conditional normalizing flows (cNF) across 13 benchmark problems. These included:

  • Toy Problems: Testing pure decoder performance on challenging geometries like the "Sum of Cosines" and the "Witch’s Hat."
  • Statistical Models: Standard IID problems such as Normal-gamma distributions.
  • Sequential Data: Complex time-series models, including Lotka-Volterra predator-prey dynamics.

A critical advantage of this study was the use of "white-box" problems where the ground-truth posterior is known, allowing for precise measurement of approximation error using metrics like Wasserstein distance.

Key Findings

Stability and Expressivity

One of the most significant findings is the superior stability of diffusion models. Normalizing flows often "diverge" or crash during training when faced with high-dimensional or complex distributions. In contrast, cDiff demonstrated consistent convergence across all benchmarks.

Furthermore, cDiff excels at capturing "hard" boundaries. In the "Witch’s Hat" benchmark—a distribution with sharp edges and regions of zero probability—normalizing flows struggled to respect the boundaries, often leaking probability mass into impossible regions. Diffusion models captured these transitions with high fidelity without requiring explicit boundary constraints.

Computational Efficiency

A common critique of diffusion models is their perceived computational cost. However, the authors found that cDiff was 35% faster to train than normalizing flows (1.752s vs. 2.674s per batch) on their hardware. While generating samples during inference is slightly slower for diffusions (30.25ms vs. 22.47ms), this is a minor trade-off in an amortized setting where the model is trained once and deployed many times.

Scaling and Accuracy

Across nearly all benchmarks, cDiff achieved lower Wasserstein distances compared to cNFs, indicating a closer fit to the true posterior. Theoretical analysis also suggests that diffusions scale more effectively as the dimensionality of the parameter space $\theta$ increases, avoiding the exponential complexity growth often seen in deep flow architectures.

Conclusion and Future Work

The cDiff framework represents a significant step forward for simulation-based inference. By providing a more stable and expressive alternative to normalizing flows, it allows researchers to perform Bayesian inference on more complex models with greater confidence.

Future research directions identified by the authors include investigating robustness to model misspecification, optimizing the interaction between summary networks and diffusion decoders, and developing more computationally efficient ways to validate high-dimensional joint posteriors.

Code Availability: The authors have released their implementation at github.com/TianyuCodings/cDiff.

Summary updated

BibTeX
@inproceedings{chen2025conditional,
  author = {Tianyu Chen and Vansh Bansal and James G. Scott},
  title = {{Conditional diffusions for neural posterior estimation}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2025},
  url = {https://openreview.net/forum?id=u2hlwh88vd},
}
Figure