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

Compositional Score Modeling for Simulation-Based Inference

Tomas Geffner, George Papamakarios, Andriy Mnih

TL;DR

This paper introduces Factorized Neural Posterior Score Estimation (F-NPSE), a novel Simulation-Based Inference (SBI) method that uses score-based generative modeling (diffusion models) to infer simulator parameters from multiple observations. By factorizing the posterior and learning the scores of individual observations, the method allows for highly sample-efficient training while seamlessly aggregating an arbitrary number of observations at inference time without relying on finicky MCMC samplers.

What Problem Does This Paper Address?

In many scientific fields (like physics, epidemiology, or ecology), researchers use complex mechanistic simulators to model real-world phenomena. These simulators act as black boxes: you input parameters $\theta$ and get simulated observations $x$. The goal of Simulation-Based Inference (SBI) is to go backward—given real-world observations, what is the posterior distribution of the parameters $\theta$? Because the simulator's likelihood function is intractable, standard Bayesian inference fails.

Existing neural SBI methods face a frustrating trade-off when dealing with multiple observations:

  • Neural Posterior Estimation (NPE) learns the posterior directly using normalizing flows. However, if you want to condition on $n$ observations at test time, you must train it on sets of $n$ observations, requiring $n$ expensive simulator calls per training sample.
  • Neural Likelihood Estimation (NLE) and Neural Ratio Estimation (NRE) learn the likelihood (or density ratios) from single observations, making them highly sample-efficient. However, to actually get the posterior at inference time, they rely on standard inference algorithms like Markov Chain Monte Carlo (MCMC), which often struggle to mix and fail on complex, multimodal distributions.

The authors want the best of both worlds: a method that requires only one simulator call per training sample, can aggregate an arbitrary number of observations at test time, and avoids the pitfalls of MCMC.

Methods

The authors tackle this using conditional score-based generative modeling (the math behind diffusion models).

Their core method, Factorized Neural Posterior Score Estimation (F-NPSE), relies on a simple mathematical trick: assuming observations are independent, the log-posterior of multiple observations can be factorized into a sum of the log-posteriors of individual observations (minus a prior correction term).

Because score-based models learn the gradient of the log-density (the "score"), this factorization is perfectly preserved. The training pipeline looks like this:

  1. Generate single parameter-observation pairs $(\theta, x)$ from the simulator.
  2. Diffuse the parameter $\theta$ with varying levels of Gaussian noise.
  3. Train a single neural network to predict the score of the diffused posterior for that single observation.

At inference time, if you have $n$ observations, you simply pass all of them through the network, sum their predicted scores together, and use an annealed Langevin dynamics sampler to generate samples from the true joint posterior.

To mitigate the risk of approximation errors accumulating during this summation, the authors also introduce Partially Factorized NPSE (PF-NPSE). Instead of breaking the observations down into individual pieces, PF-NPSE groups them into small subsets of size $m$. This interpolates between standard NPSE ($m=n$) and F-NPSE ($m=1$).

Key Insights and Ideas

  • Scores are wonderfully compositional: Because the score is a derivative of a logarithm, the product of independent likelihoods turns into a simple sum of scores. This makes diffusion models uniquely suited for aggregating multiple independent observations at inference time without retraining.
  • Diffusion samplers beat MCMC for SBI: By using annealed Langevin dynamics (gradually reducing noise to sample the distribution), F-NPSE naturally handles multimodal posteriors.
Posterior distributions across different methods as the number of observations increases. F-NPSE successfully captures multimodal distributions, avoiding the mode collapse seen in NRE.
  • The "Goldilocks" zone of factorization: Fully factorizing the posterior (F-NPSE) is maximally sample-efficient but can accumulate neural network inaccuracies when summing dozens of scores. Not factorizing at all (NPSE) has no summation error but requires massive simulator budgets to train. Grouping observations into small chunks (PF-NPSE) hits the sweet spot.

Key Results

  • Superior Performance: Across standard SBI benchmark tasks (Gaussian/Gaussian, Gaussian/Mixture of Gaussians, SIR, and Lotka-Volterra), F-NPSE and PF-NPSE consistently outperformed NPE, NPSE, and NRE baselines when multiple observations (e.g., 14, 22, or 30) were available at inference time.
Squared Maximum Mean Discrepancy (MMD) across various benchmarks. F-NPSE and PF-NPSE consistently achieve lower errors than baselines, especially with larger observation sets.
  • Optimal Subset Size: For PF-NPSE, using a subset size of $m=3$ or $m=6$ consistently yielded the best Maximum Mean Discrepancy (MMD) scores, proving that partial factorization effectively balances sample efficiency with error accumulation.
  • Robustness: The proposed methods proved highly robust to different neural network parameterizations (e.g., conservative vs. unconstrained vector fields) and Langevin sampler hyperparameters.

Limitations and Future Work

  • Error Accumulation: Like NLE and NRE, F-NPSE can suffer from accumulated approximation errors when the number of test-time observations $n$ becomes very large.
  • Sampling Speed: Annealed Langevin dynamics requires taking multiple gradient steps at hundreds of different noise levels, making inference computationally heavy ($\mathcal{O}(LT)$ complexity).
  • Future Work: The authors note that developing faster, hyperparameter-free sampling algorithms that don't rely on unadjusted Langevin dynamics is a highly promising direction.

Summary updated

BibTeX
@inproceedings{geffner2023compositional,
  author = {Tomas Geffner and George Papamakarios and Andriy Mnih},
  title = {{Compositional Score Modeling for Simulation-Based Inference}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=5Q5wD1sAKj},
}
Figure