wikillm

Concept · 1 paper · updated 2026-11-05

Simulation-based inference

Simulation-based inference estimates the posterior over a black-box simulator's parameters from simulated runs, without a computable likelihood. Three neural families: posterior, likelihood and ratio estimation. One toolkit card, no benchmark numbers, so no variant is shown to be more accurate.

likelihood-free-inferencedensity-estimationbayesian-inferencesoftware

Markdown3 min read

AI-compiled overview, updated 2026-11-05, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

Overview

A simulator maps settings to outputs, but its likelihood, the probability of an output given the settings, cannot be written down. Simulation-based inference (SBI) draws settings from a prior, runs the simulator on them, and learns from the pairs which settings are consistent with an observed output. The answer is a posterior distribution over the settings, not one best guess 2007.09114 §1. The classic alternative named there is approximate Bayesian computation, which uses Monte-Carlo rejection 2007.09114 §1.

The shared idea of the neural variants: the learned estimator is trained on simulated pairs, instead of a likelihood that is written down 2007.09114 §1 2007.09114 §2.

Variants

Only one card covers this concept. It describes the sbi toolkit, which implements three families 2007.09114 §2.

Sequential neural posterior estimation (SNPE)

Trains a density estimator that gives the posterior directly. The paper names SNPE-C as the implemented variant 2007.09114 §2. Card: SBI -- A toolkit for simulation-based inference.

Sequential neural likelihood estimation (SNLE)

Trains a density estimator of the likelihood, then samples the posterior with a method such as MCMC 2007.09114 §2. Same card.

Sequential neural ratio estimation (SNRE)

Trains a classifier that estimates density ratios, which are then used to sample the posterior, for example with MCMC 2007.09114 §2. Same card.

All three return a posterior object with one sampling interface. It can be evaluated where the method allows 2007.09114 §2.

When to use which

The paper reports no benchmark results, so no table below ranks the variants on accuracy 2007.09114 §1 2007.09114 §2. Choose on the constraints the paper does state.

SituationUseWhy
A ready PyTorch package, defaults acceptable, one call wantedSimple interfaceOne function call with reasonable defaults 2007.09114 §2
Custom networks or hyperparameters neededFlexible interfaceThe flexible interface allows both 2007.09114 §2
The posterior itself should be the trained objectSNPETrains the posterior directly 2007.09114 §2
A learned likelihood is wanted, and MCMC sampling at inference is acceptableSNLESamples the posterior with MCMC after training the likelihood 2007.09114 §2
A classifier is preferred to a density modelSNRETrains a ratio classifier, then samples with MCMC 2007.09114 §2
Accuracy of one variant over another must be justifiedNone from this conceptNo benchmark numbers in the paper 2007.09114 §1 2007.09114 §2

Two caveats from the card's review of the code the card:

  • The simple interface returns a posterior that is amortized: one training run serves any observed output. The paper does not explain what this means for accuracy 2007.09114 §2.
  • The code is much newer than the 2020 paper. Method names and defaults have changed, so pin a commit before copying any value.

Implementation sketch

Language-agnostic pseudocode of the common core. It follows the paper's description; the round-by-round procedure of the sequential variants is not reproduced here.

Pseudocode
# Common core of neural SBI  [arxiv:2007.09114 §2]
# Input:  simulator (theta -> x), prior with sample() and log_prob()
# Output: posterior p(theta | x_obs), sampled for an observed x_obs

# 1. Draw parameters from the prior and run the simulator on each
theta = prior.sample(N)
x = simulator(theta)

# 2. Drop failed simulations (NaN or Inf) when the method excludes them
theta, x = keep_valid(theta, x)

# 3. Train one neural estimator on the simulated pairs
#    SNPE: posterior density   SNLE: likelihood density
#    SNRE: density ratio (classifier)
estimator = train(theta, x, kind)

# 4. Wrap the estimator as a posterior and sample for the observation
posterior = build_posterior(estimator, prior)
samples = posterior.sample(x_obs)

Contradictions

  • Licence. The paper's footnote states AGPLv3 2007.09114 p. 1. The card records Apache-2.0 for the code it cites, and does not check the licence of the 2020 release the card. Not resolved here.
  • Names. The paper names SNPE-C, SNLE and SNRE 2007.09114 §2. The code's trainer names differ, and the card's mapping between them is inferred from names the card.

Papers

Source and license

Compiled from the papers listed on this page, all published under CC BY, CC BY-SA or CC0, with citations. See each paper's page for its authors and license.