In many scientific and engineering fields, the forward process—moving from a set of parameters to an observed outcome—is well understood and captured by high-fidelity computer simulators. Whether modeling the collision of galaxies, the propagation of a brain tumor, or the contact dynamics of a robot arm, these simulators act as mechanistic engines: you input parameters $\theta$, run the simulation, and receive synthetic data $x$.
However, the inverse problem—determining which parameters $\theta$ explain a real-world observation $x_{\text{obs}}$—presents a fundamental mathematical challenge. Traditional Bayesian inference relies on Bayes' theorem:
$$p(\theta|x_{\text{obs}}) = \frac{p(x_{\text{obs}}|\theta)p(\theta)}{p(x_{\text{obs}})}$$
To compute the posterior distribution $p(\theta|x_{\text{obs}})$, we must evaluate the likelihood function $p(x_{\text{obs}}|\theta)$, which measures the probability of observing the data given a specific parameter set. But for complex, stochastic simulators, this likelihood function is analytically intractable. The simulator might involve thousands of internal random variables, chaotic differential equations, or non-differentiable logic. We can easily sample from the simulator ($x \sim p(x|\theta)$), but we cannot write down or evaluate the mathematical formula for its density.
As reviewed by Carleo et al. in Machine learning and the physical sciences, this bottleneck has driven the development of likelihood-free inference (LFI)—also known as simulation-based inference (SBI).
The Classical Approach: Approximate Bayesian Computation
Before the widespread adoption of deep learning, the primary tool for likelihood-free inference was Approximate Bayesian Computation (ABC). The core intuition behind ABC is straightforward: if we cannot evaluate the likelihood of $x_{\text{obs}}$, we can instead generate millions of synthetic datasets $x$ from different candidate parameters $\theta$ and keep only those parameters that produce data close to our real-world observation.
In its simplest form, rejection-ABC samples a candidate parameter $\theta^*$ from the prior, runs the simulator to get $x^*$, and accepts $\theta^*$ if the distance between $x^*$ and $x_{\text{obs}}$ falls below a small threshold $\epsilon$. As Dimitrakakis et al. demonstrate in ABC Reinforcement Learning and Barthelmé shows in ABC-EP: Expectation Propagation for Likelihoodfree Bayesian Computation, this basic mechanism allows agents and state-space models to perform Bayesian updates using black-box simulators.
However, ABC suffers from a severe curse of dimensionality. If the data $x$ is high-dimensional (such as an image or a time series), the probability that a random simulation will exactly match $x_{\text{obs}}$ is virtually zero. To make comparison feasible, researchers traditionally rely on hand-crafted summary statistics $S(x)$ to reduce the data's dimensionality.
This introduces a difficult trade-off: if the summary statistics are not sufficient, the inferred posterior will be biased; if the tolerance threshold $\epsilon$ is too small, the acceptance rate drops exponentially, requiring an impractical number of simulator runs. While authors like Jiang in Approximate Bayesian Computation with Kullback-Leibler Divergence as Data Discrepancy and Meeds et al. in Hamiltonian ABC have proposed advanced metrics and stochastic gradient sampling to optimize this process, classical ABC fundamentally wastes data by discarding any simulation that fails the rejection test.
The Modern Shift: Neural Density Estimation
Modern simulation-based inference shifts the paradigm from rejecting simulations to learning from them. Instead of throwing away simulations that do not perfectly match $x_{\text{obs}}$, modern methods use every single simulated pair $(\theta, x)$ to train deep neural networks as conditional density estimators.
By framing inference as a supervised learning problem, these methods extract maximum information from a limited budget of simulator calls. Three dominant strategies have emerged based on what part of the Bayesian equation the neural network approximates.
1. Neural Likelihood Estimation (NLE)
Instead of trying to evaluate the intractable true likelihood, NLE trains a neural network to learn a smooth surrogate likelihood function, $\hat{p}(x|\theta)$.
In Sequential Neural Likelihood: Fast Likelihood-free Inference with Autoregressive Flows, Papamakarios et al. utilize conditional autoregressive flows to model the distribution of the simulator's output given its parameters. Because normalizing flows can model highly complex, multi-modal data distributions, the surrogate model $\hat{p}(x|\theta)$ becomes a highly accurate, differentiable proxy for the simulator. Once this surrogate is trained, researchers can plug it into standard Markov Chain Monte Carlo (MCMC) or Hamiltonian Monte Carlo samplers to evaluate the posterior surface at $x_{\text{obs}}$ without ever running the simulator again.
2. Neural Posterior Estimation (NPE)
If the ultimate goal is to find the posterior distribution, why not learn it directly? NPE trains a conditional density estimator to map directly from an observed data point $x$ to a distribution over parameters, $\hat{p}(\theta|x)$.
Sequential Neural Posterior Estimation (SNPE) Loop:
┌────────────────────────────────────────────────────────┐
│ │
│ 1. Sample parameters θ ~ current proposal │
│ 2. Run black-box simulator to generate data x │
│ 3. Train Neural Density Estimator on pairs (θ, x) │
│ 4. Evaluate network at x_obs to get updated posterior │
│ │
└───────────────────────────┬────────────────────────────┘
│
▼ Iterates over multiple rounds
Lueckmann et al. pioneered this in Flexible statistical inference for mechanistic models of neural dynamics, training networks to output the parameters of a mixture density network or a normalizing flow. To make this process highly sample-efficient, Greenberg et al. introduced Automatic Posterior Transformation for Likelihood-Free Inference (APT). Rather than sampling parameters uniformly across the entire prior space, APT adaptively refines the proposal distribution over multiple rounds, forcing the simulator to focus exclusively on generating data in the immediate neighborhood of $x_{\text{obs}}$.
3. Neural Ratio Estimation (NRE)
A third approach avoids estimating probability densities altogether by recognizing that we only need the density ratio to perform inference:
$$r(x, \theta) = \frac{p(x, \theta)}{p(x)p(\theta)} = \frac{p(\theta|x)}{p(\theta)}$$
Durkan et al. formalized this connection in On Contrastive Learning for Likelihood-free Inference, demonstrating that estimating this ratio is mathematically equivalent to contrastive learning. A neural classifier is trained on a binary classification task: distinguish between "true" pairs $(\theta, x)$ sampled jointly from the simulator, and "fake" pairs where $\theta$ and $x$ are randomly shuffled from their marginal distributions.
The optimal classifier's decision boundary converges exactly to the log-ratio of the densities. To refine this approach for rigorous scientific applications, Miller introduced Contrastive Neural Ratio Estimation (NRE-C), which introduces a null class to eliminate mathematical biases that previously compromised model diagnostics.
Real-World Applications: Bridging the Reality Gap
The capacity to perform rigorous Bayesian inference over black-box models has unlocked solutions to long-standing problems where physical systems are too complex for analytical formulas.
Robotics and the Sim2Real Challenge
In robotics, policies trained in simulation often fail in the real world due to the "reality gap"—the simulator's physics parameters (such as joint friction, link mass, or surface restitution) do not perfectly match physical reality.
Ramos et al. introduced BayesSim in BayesSim: Adaptive Domain Randomization Via Probabilistic Inference for Robotics Simulators, demonstrating how likelihood-free inference can ingest a handful of real-world robotic trajectories to estimate the true posterior distribution of physical properties. Similarly, Matl et al. applied this framework in Inferring the Material Properties of Granular Media for Robotic Tasks to identify the microscopic particle properties of granular materials solely from macroscopic depth images, allowing robots to accurately predict and manipulate complex media like grains and gravel.
Physical Sciences and Cosmology
In astrophysics, running physical experiments is impossible, forcing researchers to rely entirely on observational data and massive cosmological simulations.
In Sum of the masses of the Milky Way and M31: A likelihood-free inference approach, Jeffrey et al. bypassed traditional, oversimplified kinematic equations by training neural density estimators on millions of simulated galaxy pairs, yielding a highly accurate joint mass estimate for our galaxy and Andromeda. Furthermore, Montel et al. utilized Truncated Marginal Neural Ratio Estimation (TMNRE) in The effect of the perturber population on subhalo measurements in strong gravitational lenses to map dark matter substructures within strong gravitational lensing images. This method successfully isolated local parameters of interest while seamlessly marginalizing over thousands of high-dimensional nuisance variables—a feat that remains computationally intractable for traditional likelihood-based sampling methods.