{
 "id": "epqaadjk5r",
 "slug": "amortized-inference",
 "title": "Amortized inference",
 "updated": "2026-09-30",
 "topic_path": [
  {
   "id": "technology",
   "label": "Technology and the built world",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology"
  },
  {
   "id": "technology.computing",
   "label": "Computing and digital systems",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing"
  },
  {
   "id": "technology.computing.ai",
   "label": "Artificial intelligence and data",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing.ai"
  },
  {
   "id": "technology.computing.ai.ml_computation",
   "label": "Machine learning and neural computation",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing.ai.ml_computation"
  },
  {
   "id": "technology.computing.ai.ml_methods",
   "label": "Machine learning methods",
   "api_url": "https://www.edgepedia.org/api/v1/topics/technology.computing.ai.ml_methods"
  }
 ],
 "geo": [
  {
   "id": "geo.nongeo.t2001.technology.computing.ai.ml_methods",
   "label": "Non-geographic · 2001 to 2020: Machine learning methods",
   "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.technology.computing.ai.ml_methods",
   "path": [
    {
     "id": "geo.nongeo",
     "label": "Non-geographic",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo"
    },
    {
     "id": "geo.nongeo.t2001",
     "label": "Non-geographic · 2001 to 2020",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001"
    },
    {
     "id": "geo.nongeo.t2001.technology",
     "label": "Technology and the built world",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.technology"
    },
    {
     "id": "geo.nongeo.t2001.technology.computing",
     "label": "Computing and digital systems",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.technology.computing"
    },
    {
     "id": "geo.nongeo.t2001.technology.computing.ai",
     "label": "Artificial intelligence and data",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.technology.computing.ai"
    },
    {
     "id": "geo.nongeo.t2001.technology.computing.ai.ml_computation",
     "label": "Machine learning and neural computation",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.technology.computing.ai.ml_computation"
    },
    {
     "id": "geo.nongeo.t2001.technology.computing.ai.ml_methods",
     "label": "Machine learning methods",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.technology.computing.ai.ml_methods"
    }
   ]
  }
 ],
 "excerpt": "Amortized inference is a machine learning approach that trains a model once, so posterior estimates for new data come in a single forward pass instead of fresh optimization.",
 "snippet": "Amortized inference is a machine learning approach that trains a model once, so posterior estimates for new data come in a single forward pass instead of fresh optimization.",
 "node": "technology.computing.ai.ml_methods",
 "markdown": "# Amortized inference\n\nAmortized 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>\n\n| Key fact | Detail |\n|---|---|\n| 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> |\n| 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> |\n| 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> |\n| Main variants | NPE (posterior), NLE (likelihood, needs MCMC at inference), NRE (classifier-based likelihood ratio)<sup>[4](https://arxiv.org/html/2508.12939)</sup> |\n| 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> |\n| Calibration metric | Expected coverage, a necessary but not sufficient condition for conditional coverage<sup>[7](https://arxiv.org/html/2305.14275v3)</sup> |\n| 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> |\n\n## How it works\n\nThe 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\n\n\\[ \\mathcal{L}(\\phi) = \\mathbb{E}_{(\\theta, x) \\sim p(\\theta, x)} \\left[ -\\log q_{\\phi}(\\theta|x) \\right], \\]\n\nso 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>\n\nThe 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>\n\nThe 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>\n\n## How it is done\n\nA 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>\n\nCalibration 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>\n\n## Origin\n\nThe 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>\n\n## Variants\n\nNPE 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>\n\nGenerative 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,\n\n\\[ \\mathcal{L}_{\\text{FMPE}} = \\mathbb{E} \\left\\| v_{t,x}(\\theta_{t}) - u_{t}(\\theta_{t}|\\theta_{1}) \\right\\|^{2}, \\]\n\nreplacing 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>\n\nTwo 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>\n\n## Applications\n\nPublished 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>\n\n## Limitations and alternatives\n\nThe 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>\n\nMiscalibration 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>\n\n## References\n\n1. [Neural Methods for Amortized Inference](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-112723-034123)\n2. [Dax, Maximilian and colleagues (2023). Flow Matching for Scalable Simulation-Based Inference. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2305.17161)\n3. [Amortized Inference in Probabilistic Reasoning (Gershman & Goodman, 2014)](https://gershmanlab.com/pubs/GershmanGoodman14.pdf)\n4. [Simulation-Based Inference: A Practical Guide](https://arxiv.org/html/2508.12939)\n5. [JANA (arXiv 2302.09125v3)](https://export.arxiv.org/pdf/2302.09125v3.pdf)\n6. [All-in-one simulation-based inference (Simformer)](https://proceedings.mlr.press/v235/gloeckler24a.html)\n7. [Variational Inference with Coverage Guarantees in Simulation-Based Inference](https://arxiv.org/html/2305.14275v3)\n8. [Choosing an inference method, sbi documentation](https://sbi.readthedocs.io/en/latest/how_to_guide/06_choosing_inference_method.html)\n9. [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)\n10. [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)\n11. [Implemented methods, sbi documentation](https://sbi.readthedocs.io/en/latest/tutorials/16_implemented_methods.html)\n12. [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)\n13. [Conditional diffusions for amortized neural posterior estimation](https://raw.githubusercontent.com/mlresearch/v258/main/assets/chen25d/chen25d.pdf)\n14. [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)\n15. [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)\n16. [Inference Suboptimality in Variational Autoencoders](https://ar5iv.labs.arxiv.org/html/1801.03558)\n\n---\n*Topic: Encyclopedia › Technology and the built world › Computing and digital systems › Artificial intelligence and data › Machine learning and neural computation › Machine learning methods*\n\n*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*\n\n*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*\n\nLicense: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license\n",
 "same_as": [],
 "url": "https://www.edgepedia.org/amortized-inference",
 "markdown_url": "https://www.edgepedia.org/amortized-inference.md",
 "license": {
  "name": "Edgepedia Community License 1.0",
  "url": "https://www.edgepedia.org/edgepedia/license",
  "summary": "Free with credit, commercial use included. AI training is open to everyone. For other uses, organizations over USD 100M in revenue or 100M monthly users license separately.",
  "spdx": "LicenseRef-Edgepedia-Community-1.0"
 },
 "credit": "\"Amortized inference\", Edgepedia (EdgeChat), https://www.edgepedia.org/amortized-inference. Edgepedia Community License 1.0.",
 "credit_md": "\"[Amortized inference](https://www.edgepedia.org/amortized-inference)\", Edgepedia (EdgeChat), [https://www.edgepedia.org/amortized-inference](https://www.edgepedia.org/amortized-inference). [Edgepedia Community License 1.0](https://www.edgepedia.org/edgepedia/license).",
 "credit_html": "\"<a href=\"https://www.edgepedia.org/amortized-inference\">Amortized inference</a>\", Edgepedia (EdgeChat), <a href=\"https://www.edgepedia.org/amortized-inference\">https://www.edgepedia.org/amortized-inference</a>. <a href=\"https://www.edgepedia.org/edgepedia/license\">Edgepedia Community License 1.0</a>.",
 "speakable": "Amortized inference is a machine learning approach that trains a model once, so posterior estimates for new data come in a single forward pass instead of fresh optimization."
}
