Skip to content

Simulation-based inference for rapid Bayesian parameter estimation in epidemiological models: a comparison with MCMC

Source: arXiv:2606.27286 · Published 2026-06-25 · By Alina Bazarova, Johann Fredrik Jadebeck, Henrik Zunker, Carolina J. Klett-Tammen, Torben Heinsohn, Wolfgang Wiechert et al.

TL;DR

This paper addresses the computational challenges of Bayesian calibration of mechanistic epidemiological models, which are crucial for real-time public health forecasting during infectious disease outbreaks. Traditional Bayesian inference using Markov chain Monte Carlo (MCMC) is computationally expensive for nonlinear, high-dimensional models like the SECIR compartmental model of COVID-19 ICU occupancy in Germany. The authors explore simulation-based inference (SBI) using neural posterior estimation (NPE) as an alternative. SBI amortizes inference by training a neural density estimator on simulated parameter-trajectory data pairs, enabling rapid posterior estimation on new data without repeated costly likelihood evaluations.

They compare SBI and MCMC across multiple epidemic phases using both short 31-day inference windows and a challenging 201-day reconstruction window with multiple transmission change points. Using quantitative metrics (Wasserstein distances, KL divergences) and posterior predictive checks, they find SBI recovers posterior distributions in strong agreement with MCMC for 31-day windows and preserves dominant posterior features despite greater uncertainty for the longer window. Importantly, SBI achieves comparable inference accuracy while drastically reducing computation time: from about 1000 seconds per 31-day run with MCMC to about 60–70 seconds on a single GPU with SBI, and from over 19,000 seconds to 157 seconds for the 201-day problem. This demonstrates SBI as a rapid, scalable, and computationally efficient approach for Bayesian epidemiological model calibration suited to repeated near-real-time inference in fast-moving epidemics.

Key findings

  • SBI recovers posterior distributions closely matching MCMC for 31-day COVID-19 ICU data inference windows, confirmed by low Wasserstein distances and symmetric KL divergences across multiple epidemic phases.
  • For a challenging 201-day reconstruction with multiple transmission change points, SBI preserves the dominant posterior structure despite wider uncertainty bounds compared to MCMC.
  • SBI reduces inference runtime from ~1000 seconds (MCMC on CPU) to 60–70 seconds on a single NVIDIA A100 GPU for 31-day windows, a >14x speedup.
  • For the 201-day inference, SBI runtime averages 157 seconds compared to over 19,000 seconds for MCMC, a >120x speedup.
  • Posterior predictive checks show SBI accurately reproduces observed ICU trajectories across both short and long time windows with root mean squared errors comparable to MCMC.
  • Tighter prior bounds on transmission change-point parameters improve epidemiological plausibility of simulations and training efficiency for SBI.
  • Neural posterior estimation using a convolutional neural network embedding plus Masked Autoregressive Flow density estimator effectively models the posterior given time-series ICU data.
  • Batch size, simulation budget, and CNN architecture hyperparameters affect SBI training but 50,000–100,000 simulations with mid-sized batch sizes offer a good trade-off.

Threat model

n/a — This is not a security-focused paper. The focus is on scalable Bayesian inference performance rather than adversarial threat analysis.

Methodology — deep read

  1. Threat model and assumptions: The study assumes a data-driven Bayesian inference setting without an explicit adversarial model; the focus is on accurate, scalable posterior estimation in a mechanistic SECIR epidemiological model. The 'adversary' is essentially the computational complexity barrier to near-real-time inference using traditional MCMC.

  2. Data: Empirical data consists of COVID-19 ICU occupancy time series for Germany from April 24 to December 10, 2020 (231 days). They conduct experiments on three separate 31-day windows representing different epidemic phases and one extended 201-day time window capturing multiple transmission change points. Data preprocessing includes filtering to ICU occupancy to reduce noise present in case counts. The data is implicitly labeled with time stamps; the target is to infer epidemiological parameters explaining observed occupancy trajectories.

  3. Architecture and algorithm: The epidemiological model is a mechanistic compartmental SECIR model partitioning the population into Susceptible, Exposed, Infectious (symptomatic and asymptomatic), Severe, Critical, Recovered, and Dead compartments. It includes 15 parameters—transition times and probabilities, infectiousness factors, and piecewise-constant time-varying contact rate reduction factors (change points). For SBI, the authors use Neural Posterior Estimation with amortized inference. Parameter samples are drawn from prior parameter distributions; simulated ICU trajectories are generated by forwarding these through the SECIR ODE simulator (MEmilio framework). A convolutional neural network (CNN) encodes the ICU trajectory time series into a learned low-dimensional embedding, which conditions a Masked Autoregressive Flow (MAF) normalizing flow that estimates the conditional posterior density over parameters. The MAF models the posterior autoregressively.

  4. Training regime: The neural density estimator is trained with the SNPE-C loss combining likelihood maximization and atomic contrastive terms to regularize density support. Training datasets vary between 20,000 and 100,000 simulated pairs. Batch sizes range from 450 to 90,000 in hyperparameter sweeps; typical selected configuration uses 50,000 simulations and batch size 14,400 for 31-day problems, and 100,000 simulations with batch size 1800 for 201-day inference. Training uses GPU acceleration, a custom PyTorch dataloader for efficient batch processing, and repeats each experimental condition 16 times to estimate variability.

  5. Evaluation protocol: Posterior distributions from SBI and MCMC are compared using marginal distribution similarity metrics—1-Wasserstein distance, Kullback-Leibler (KL) divergence, and symmetric KL divergence. Posterior predictive checks evaluate the root mean squared error (RMSE) between observed and predicted ICU occupancy trajectories. Convergence diagnostics are applied to MCMC (rank-normalized R-hat near 1). Multiple epidemic phases serve as independent test cases to check robustness. Prior and posterior predictive simulations assess model and prior plausibility. Runtime comparisons are made between SBI (using CPU+GPU) and MCMC (CPU only).

  6. Reproducibility: The SBI pipeline is implemented using the open-source sbi Python package and the publicly available MEmilio simulator. Detailed prior specifications and neural architectures are documented. However, the COVID ICU occupancy dataset is publicly available but specific simulation seeds and full trained neural weights are not explicitly stated to be released, which may limit exact reproducibility.

A concrete example: For the 31-day window starting at epidemic offset zero, 50,000 parameter sets are sampled from priors and simulated with SECIR to generate ICU occupancy traces. These paired data train a CNN+MAF network that learns to approximate the posterior over parameters conditioned on ICU trajectories. The trained network then efficiently samples parameters given the observed ICU data for that period, producing an approximate posterior, which is compared to a full MCMC posterior obtained by thousands of differential evolution Metropolis-Z MCMC samples with explicit Student's t- likelihood. The close agreement in posterior distributions and predictive ICU fits, combined with reduced inference time from ~1000 to ~60 seconds, exemplifies the end-to-end advantage.

Technical innovations

  • Application of amortized Neural Posterior Estimation (NPE) with Masked Autoregressive Flow density estimators and CNN embeddings for fast Bayesian calibration of large-scale epidemiological models.
  • Adaptation of the SECIR mechanistic compartmental model parameter inference to include time-varying contact rate change points treated as piecewise-constant latent variables in the posterior.
  • Use of prior predictive checks to inform tighter, epidemiologically plausible prior bounds for transmission reduction change points, improving SBI training stability and efficiency.
  • Systematic benchmarking of SBI against MCMC with multiple quantitative posterior similarity metrics (Wasserstein and symmetric KL divergences) over varying time horizons and epidemic phases.

Datasets

  • COVID-19 ICU occupancy time series Germany 2020 — ~231 days daily records — sourced from DIVI intensive care registry (public health data)

Baselines vs proposed

  • MCMC (DE-MZ) 31-day inference: runtime ~1000 s CPU, RMSE and posterior metrics serve as baseline; SBI achieves similar RMSE and posterior quality in 60–70 s GPU.
  • MCMC (DE-MZ) 201-day inference: runtime >19,000 s CPU; SBI produces comparable posterior structure in 157 s GPU with increased but acceptable uncertainty.
  • SBI with 50,000 simulations and batch 14,400: Wasserstein distance ~0.63–0.75 vs MCMC, symmetric KL ~9.3 (units context dependent) on 31-day windows.
  • SBI durations scale approximately linearly with simulation budget; trade-offs in posterior accuracy seen with smaller simulation budgets.

Figures from the paper

Figures are reproduced from the source paper for academic discussion. Original copyright: the paper authors. See arXiv:2606.27286.

Fig 2

Fig 2: Workflow of amortized neural posterior estimation (NPE). Parameters θ are

Fig 4

Fig 4: Comparison of marginal posterior distributions inferred using

Fig 3

Fig 3 (page 16).

Fig 4

Fig 4 (page 16).

Fig 5

Fig 5 (page 28).

Fig 6

Fig 6 (page 28).

Fig 7

Fig 7 (page 29).

Limitations

  • SBI accuracy depends on prior selection and simulation design; poorly specified priors lead to implausible epidemic trajectories and hamper training.
  • The study is limited to one mechanistic SECIR model and one data modality (ICU occupancy) from a single country, limiting generalizability.
  • MCMC was restricted to CPU runs, possibly exaggerating SBI GPU runtime advantage; a GPU-accelerated MCMC baseline was not tested.
  • No adversarial or distribution-shift robustness tests were performed to evaluate SBI stability under data perturbations or misspecification.
  • The amortized posterior estimator is conditioned on a fixed prior and simulator; significant model changes may require retraining.
  • Details on exact reproducibility such as code release or trained model weights are not fully detailed.

Open questions / follow-ons

  • How does SBI compare with advanced MCMC variants or other likelihood-free inference methods like ABC on epidemiological models?
  • Can SBI methods maintain accuracy under real-world data issues such as missing data, noise, or non-stationary reporting biases?
  • How robust is SBI to model misspecification or to epidemics with different dynamics, e.g., multi-strain diseases or vaccination effects?
  • Can amortized SBI formulations be extended to adaptively handle changing priors or evolving epidemiological models without retraining from scratch?

Why it matters for bot defense

While primarily focused on epidemiological model calibration, the methodological insights apply broadly to Bayesian inference for complex nonlinear dynamical systems under time constraints. For bot-defense and CAPTCHA practitioners, the demonstration that simulation-based inference using learned density estimators can rapidly approximate costly Bayesian posteriors suggests similar SBI approaches may accelerate parameter estimation in security-related sequential decision models or behavioral simulations. The emphasis on amortized inference could enable scalable repeated posterior updates as online data streams in, analogous to bot activity monitoring across time. However, challenges around prior design, simulator fidelity, and uncertainty quantification remain critical to ensure SBI methods provide reliable approximations suitable for real-time defensive actions. This work encourages exploring neural posterior estimation in security contexts where traditional MCMC or likelihood-based calibration is too slow for operational deployment.

Cite

bibtex
@article{arxiv2606_27286,
  title={ Simulation-based inference for rapid Bayesian parameter estimation in epidemiological models: a comparison with MCMC },
  author={ Alina Bazarova and Johann Fredrik Jadebeck and Henrik Zunker and Carolina J. Klett-Tammen and Torben Heinsohn and Wolfgang Wiechert and Katharina Noeh and Stefan Kesselheim },
  journal={arXiv preprint arXiv:2606.27286},
  year={ 2026 },
  url={https://arxiv.org/abs/2606.27286}
}

Read the full paper

Articles are CC BY 4.0 — feel free to quote with attribution