# Amortized inference

Amortized inference is a machine learning approach in which a model is trained once to perform statistical inference, so that posterior estimates for new data are produced in a single forward pass rather than by running a fresh optimization such as MCMC or variational inference for each dataset.<sup>[1](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)</sup> In simulation-based inference (SBI), the trained network approximates a posterior, a likelihood, or a likelihood ratio for a simulator whose likelihood is intractable, and the cost of simulation and training is paid once and reused across all subsequent observations.<sup>[2](https://doi.org/10.48550/arxiv.2305.17161)</sup> The term originates in probabilistic reasoning in cognitive science, where Gershman and Goodman described reusing demanding past inferences for quick decisions, and it now labels a family of neural methods for [Bayesian inference](https://www.edgepedia.org/bayesian-inference).<sup>[3](https://gershmanlab.com/pubs/GershmanGoodman14.pdf)</sup>

| Key fact | Detail |
|---|---|
| What is produced | A trained conditional density estimator that returns a posterior estimate for any new observation without retraining or further simulation<sup>[2](https://doi.org/10.48550/arxiv.2305.17161)</sup> |
| Speed at query time | NPE posterior samples are often generated in milliseconds via a single forward pass; one benchmark MCMC run took about one minute for 24,000 samples<sup>[4](https://arxiv.org/html/2508.12939)</sup><sup> • </sup><sup>[1](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)</sup> |
| Training loss (NPE) | \( \mathcal{L}_{\text{NPE}} = -\mathbb{E}_{p(\theta)p(x|\theta)} \log q(\theta|x) \) on simulated pairs<sup>[2](https://doi.org/10.48550/arxiv.2305.17161)</sup> |
| Main variants | NPE (posterior), NLE (likelihood, needs MCMC at inference), NRE (classifier-based likelihood ratio)<sup>[4](https://arxiv.org/html/2508.12939)</sup> |
| Simulation cost | Amortized methods need larger simulation budgets than sequential ones; Simformer needed about 10 times fewer simulations than NPE on benchmarks<sup>[5](https://export.arxiv.org/pdf/2302.09125v3.pdf)</sup><sup> • </sup><sup>[6](https://proceedings.mlr.press/v235/gloeckler24a.html)</sup> |
| Calibration metric | Expected coverage, a necessary but not sufficient condition for conditional coverage<sup>[7](https://arxiv.org/html/2305.14275v3)</sup> |
| Main failure modes | Amortization gap, miscalibration, and model misspecification<sup>[1](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)</sup><sup> • </sup><sup>[7](https://arxiv.org/html/2305.14275v3)</sup> |

## How it works

The method trains a conditional density estimator \( q_{\phi}(\theta|x) \) on simulated pairs \( (\theta, x) \) drawn from the prior and the simulator. Neural SBI minimizes the negative log-likelihood loss

\[ \mathcal{L}(\phi) = \mathbb{E}_{(\theta, x) \sim p(\theta, x)} \left[ -\log q_{\phi}(\theta|x) \right], \]

so the network learns to map data to the posterior distribution that generated them.<sup>[4](https://arxiv.org/html/2508.12939)</sup> Because the expectation is taken under \( p(\theta)p(x|\theta) \), no likelihood evaluation is needed, only simulations. Once trained, inference for every new observation uses \( q(\theta|x) \) directly, amortizing the computational cost of simulation and training across all observations.<sup>[2](https://doi.org/10.48550/arxiv.2305.17161)</sup>

The three main targets differ in what is estimated. NPE directly approximates the posterior. NLE trains a conditional generative model of the likelihood \( p(x|\theta) \) and then requires MCMC or variational inference at inference time, typically taking minutes for 1,000 posterior samples given 200 trials. NRE learns the likelihood ratio \( p(x|\theta)/p(x) \) by training a classifier to distinguish joint samples \( p(x,\theta) \) from marginals \( p(x)p(\theta) \), which can be computationally cheaper than generative models.<sup>[4](https://arxiv.org/html/2508.12939)</sup>

The speed advantage is large at query time. In one benchmark, a single MCMC run required about one minute of compute to generate 24,000 samples (thinned to 1,000), while neural methods required only a few dozen milliseconds each for approximate posterior inference.<sup>[1](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)</sup>

## How it is done

A practitioner defines a simulator and a prior, generates simulations, trains the estimator, chooses between amortized and sequential modes, validates calibration, and applies the network to observed data. Amortized methods return a posterior applicable to many observations without retraining, whereas sequential methods focus inference on one particular observation to be more simulation-efficient; the sbi documentation recommends amortized methods when inference is needed for more than about 10 observations.<sup>[8](https://sbi.readthedocs.io/en/latest/how_to_guide/06_choosing_inference_method.html)</sup>

Calibration is checked with expected coverage, the most common metric for assessing calibration of amortized inference algorithms; it is necessary but not sufficient for conditional coverage.<sup>[7](https://arxiv.org/html/2305.14275v3)</sup> A meta-study of likelihood-free inference algorithms highlighted that a lack of such calibration limits the capacity to reach downstream scientific conclusions.<sup>[7](https://arxiv.org/html/2305.14275v3)</sup>

## Origin

The term was introduced by [Samuel J. Gershman](https://www.edgepedia.org/samuel-gershman) and Noah D. Goodman in "Amortized Inference in Probabilistic Reasoning", published in 2014 in eScholarship, which framed the reuse of past inferences in human probabilistic reasoning.<sup>[3](https://gershmanlab.com/pubs/GershmanGoodman14.pdf)</sup> The neural SBI framework traces to Papamakarios and Murray (2016), who proposed learning a parametric approximation to the exact posterior with [conditional density estimation](https://www.edgepedia.org/conditional-density-estimation) using Bayesian neural networks, instead of returning samples from an \( \epsilon \)-approximation as in conventional ABC; their approach used preliminary posterior fits to guide future simulations, reducing the number of simulations required by orders of magnitude.<sup>[9](https://doi.org/10.48550/arxiv.1605.06376)</sup> Greenberg, Nonnenmacher, and Macke (2019) proposed NPE with [normalizing flows](https://www.edgepedia.org/normalizing-flow) (neural networks transforming simple distributions into complex ones) under the name Automatic Posterior Transformation, which is the default in the sbi package.<sup>[10](https://doi.org/10.48550/arxiv.1905.07488)</sup><sup> • </sup><sup>[11](https://sbi.readthedocs.io/en/latest/tutorials/16_implemented_methods.html)</sup> Earlier work the field built on includes approximate Bayesian computation, formalized for population genetics by Beaumont, Zhang, and Balding in 2002.<sup>[12](https://doi.org/10.1093/genetics/162.4.2025)</sup>

## Variants

NPE targets the posterior directly, NLE targets the likelihood and then requires MCMC or variational inference to draw posterior samples, and NRE targets a classifier-based likelihood ratio, with the sbi default using a modified loss function.<sup>[11](https://sbi.readthedocs.io/en/latest/tutorials/16_implemented_methods.html)</sup> All SNPE methods use the same loss function in the first round, so NPE is equivalent to single-round SNPE.<sup>[11](https://sbi.readthedocs.io/en/latest/tutorials/16_implemented_methods.html)</sup>

Generative backbones beyond normalizing flows now anchor the field. [Flow matching](https://www.edgepedia.org/flow-matching) posterior estimation (FMPE), reported by Dax and colleagues in 2023, learns conditional vector fields via a flow matching objective,

\[ \mathcal{L}_{\text{FMPE}} = \mathbb{E} \left\| v_{t,x}(\theta_{t}) - u_{t}(\theta_{t}|\theta_{1}) \right\|^{2}, \]

replacing the NPE log-likelihood objective while retaining exact density evaluations of \( q(\theta|x) \), which the authors state is crucial for their physics application.<sup>[2](https://doi.org/10.48550/arxiv.2305.17161)</sup> In 2024, Gloeckler and colleagues introduced the Simformer, a diffusion-transformer method for amortized Bayesian inference that outperforms state-of-the-art amortized approaches on benchmark tasks, handles function-valued parameters and missing or unstructured data, and can sample arbitrary conditionals of the joint parameter-data distribution, including the posterior and the likelihood.<sup>[6](https://proceedings.mlr.press/v235/gloeckler24a.html)</sup> Conditional diffusion models for NPE train faster than normalizing flows, at a small cost in inference time.<sup>[13](https://raw.githubusercontent.com/mlresearch/v258/main/assets/chen25d/chen25d.pdf)</sup>

Two open-source platforms dominate practice. The sbi Python package, built on PyTorch, implements amortized and sequential methods targeting the posterior, likelihood, or likelihood-to-evidence ratio.<sup>[1](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)</sup> BayesFlow, built on [TensorFlow](https://www.edgepedia.org/tensorflow) with GPU and TPU acceleration, supports amortized Bayesian workflows and includes model misspecification detection to help keep posteriors faithful when simulations do not perfectly represent reality.<sup>[14](https://doi.org/10.21105/joss.05702)</sup> The swyft package implements truncated marginal neural ratio estimation for the physical sciences.<sup>[15](https://doi.org/10.21105/joss.04205)</sup>

## Applications

Published applications span neuroscience (ion-channel conductances, plasticity, whole-brain dynamics), cognitive science (perceptual decision making), biology, the social sciences, and physics including gravitational waves, cosmology, and exoplanets.<sup>[4](https://arxiv.org/html/2508.12939)</sup> BayesFlow alone has been applied in epidemiology, cognitive modeling, computational psychiatry, neuroscience, particle physics, econometrics, seismic imaging, aerospace, and [wind turbine design](https://www.edgepedia.org/wind-turbine-design).<sup>[14](https://doi.org/10.21105/joss.05702)</sup> The Simformer was showcased on simulators from ecology, epidemiology, and neuroscience.<sup>[6](https://proceedings.mlr.press/v235/gloeckler24a.html)</sup>

## Limitations and alternatives

The amortization gap is the extra bias or variance that makes a trained estimator suboptimal relative to the KL-optimal Bayes estimator.<sup>[1](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)</sup> In one benchmark, all neural methods performed slightly worse than MCMC overall, due to the amortization gap, the use of an inflexible posterior approximation, or both.<sup>[1](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)</sup> Related work in variational autoencoders formally defines the gap between the ELBO evaluated with an amortized distribution and the optimal per-dataset variational distribution.<sup>[16](https://ar5iv.labs.arxiv.org/html/1801.03558)</sup>

Miscalibration is a documented failure mode: amortized variational approximations fail to achieve even expected coverage despite significant remediation work.<sup>[7](https://arxiv.org/html/2305.14275v3)</sup> Model misspecification, where simulations do not represent reality, threatens posterior validity, and detection methods are built into BayesFlow.<sup>[14](https://doi.org/10.21105/joss.05702)</sup> Simulation cost runs the other way: amortized inference requires much larger simulation budgets than sequential inference to compensate for its larger prediction task.<sup>[5](https://export.arxiv.org/pdf/2302.09125v3.pdf)</sup> Architectural improvements reduce this cost: averaged across benchmark tasks and observations, the Simformer required about 10 times fewer simulations than NPE.<sup>[6](https://proceedings.mlr.press/v235/gloeckler24a.html)</sup> Sequential (multi-round) methods trade amortization for simulation efficiency, but the resulting posterior is accurate only for the specific observation \( x_o \), not for any \( x \).<sup>[8](https://sbi.readthedocs.io/en/latest/how_to_guide/06_choosing_inference_method.html)</sup> Compared with MCMC, amortized methods are orders of magnitude faster per dataset but slightly less accurate in benchmarks; compared with conventional ABC, they avoid the \( \epsilon \)-approximation and return a density rather than samples.<sup>[1](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)</sup><sup> • </sup><sup>[9](https://doi.org/10.48550/arxiv.1605.06376)</sup>

## References

1. [Neural Methods for Amortized Inference](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)
2. [Dax, Maximilian and colleagues (2023). Flow Matching for Scalable Simulation-Based Inference. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2305.17161)
3. [Amortized Inference in Probabilistic Reasoning (Gershman & Goodman, 2014)](https://gershmanlab.com/pubs/GershmanGoodman14.pdf)
4. [Simulation-Based Inference: A Practical Guide](https://arxiv.org/html/2508.12939)
5. [JANA (arXiv 2302.09125v3)](https://export.arxiv.org/pdf/2302.09125v3.pdf)
6. [All-in-one simulation-based inference (Simformer)](https://proceedings.mlr.press/v235/gloeckler24a.html)
7. [Variational Inference with Coverage Guarantees in Simulation-Based Inference](https://arxiv.org/html/2305.14275v3)
8. [Choosing an inference method, sbi documentation](https://sbi.readthedocs.io/en/latest/how_to_guide/06_choosing_inference_method.html)
9. [Papamakarios, George, Murray, Iain (2016). Fast $ε$-free Inference of Simulation Models with Bayesian Conditional Density Estimation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1605.06376)
10. [Greenberg, David S., Nonnenmacher, Marcel, Macke, Jakob H. (2019). Automatic Posterior Transformation for Likelihood-Free Inference. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1905.07488)
11. [Implemented methods, sbi documentation](https://sbi.readthedocs.io/en/latest/tutorials/16_implemented_methods.html)
12. [Mark A Beaumont, Wenyang Zhang, David J Balding (2002). Approximate Bayesian Computation in Population Genetics. Genetics.](https://doi.org/10.1093/genetics/162.4.2025)
13. [Conditional diffusions for amortized neural posterior estimation](https://raw.githubusercontent.com/mlresearch/v258/main/assets/chen25d/chen25d.pdf)
14. [Stefan T. Radev and colleagues (2023). BayesFlow: Amortized Bayesian Workflows With Neural Networks. The Journal of Open Source Software.](https://doi.org/10.21105/joss.05702)
15. [Benjamin Kurt Miller and colleagues (2022). swyft: Truncated Marginal Neural Ratio Estimation in Python. The Journal of Open Source Software.](https://doi.org/10.21105/joss.04205)
16. [Inference Suboptimality in Variational Autoencoders](https://ar5iv.labs.arxiv.org/html/1801.03558)

---
*Topic: Encyclopedia › Technology and the built world › Computing and digital systems › Artificial intelligence and data › Machine learning and neural computation › Machine learning methods*

*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
