Scientists often fit the same mechanistic model to data from many sites: soil samples from across a continent, recordings from many patients, measurements from many labs. They do this with a differential-equation model, a set of equations describing how a system changes over time, whose parameters such as growth rates or vessel stiffness cannot be measured directly. A natural statistical tool is the random-effects model from meta-analysis. It assumes each site has its own true parameters drawn around a population mean, and it estimates how much those parameters truly vary between sites, a quantity usually written $\tau^2$. A natural computational tool is amortized neural inference: a network trained once on simulated data that returns parameter estimates for any new dataset in milliseconds.
This note argues that the combination fails in a specific and predictable way. The simulator is always somewhat wrong. When it is, the error is largely the same at every site, but its effect on estimated parameters differs from site to site, so it shows up as fake between-site variation. Sloppy models make this worse. These are models in which many parameter combinations produce nearly the same output, and in them a tiny shared simulator error can become large, site-specific parameter bias. We propose to train a hierarchical amortized estimator on simulations that contain a single discrepancy function shared across all sites of a dataset. Because that error is common to every site while true parameters vary, the network can learn to separate the two, and it needs no real-world parameter labels and no retraining for each dataset.
Core Claim
Write the data at site $k$ as $y_k = f(\theta_k) + \delta + \epsilon_k$. Here $f$ is the simulator, $\theta_k = \mu + \eta_k$ is the site's parameter vector, $\mu$ is the population mean, $\eta_k$ is a site deviation with covariance $T$ (the multivariate $\tau^2$), $\delta$ is a systematic simulator error shared across sites, and $\epsilon_k$ is measurement noise. If $\delta$ is ignored, a linearization gives a per-site estimate of roughly $\hat\theta_k \approx \theta_k + J_k^{+}\delta$, where $J_k$ is the simulator's sensitivity matrix at $\theta_k$ and $J_k^{+}$ is its pseudoinverse. The apparent heterogeneity then becomes
$$\widehat{T} \approx T + \mathrm{Cov}_k\!\left(J_k^{+}\delta\right).$$
The second term comes purely from misspecification. It grows with how much the local sensitivity varies across sites, and it grows with the size of $J_k^{+}$. In sloppy models, Universal Sloppy Parameter Sensitivities in Systems Biology Models shows that sensitivity eigenvalues span many decades, so $J_k^{+}$ is enormous along the insensitive ("sloppy") directions. Our claim has two parts. First, standard amortized multilevel inference systematically inflates or distorts $\tau^2$ under realistic simulator error, and it does so mostly along sloppy directions. Second, a network trained with a shared-discrepancy prior removes most of this bias. The decisive test is an ablation that draws the discrepancy independently for each site instead of once per dataset.
Relation to Prior Work
Two amortized hierarchical methods supply our backbone and motivate the gap. Amortized Bayesian Multilevel Models (ML-NPE) uses local and global summary networks and normalizing flows to recover Stan-quality multilevel posteriors with sub-millisecond inference. Neural Posterior Estimation of hierarchical models in neuroscience pools observations that share global parameters to resolve parameter coupling in a neural mass model. Both assume a correct simulator. We keep the architecture of the first and change what it is trained on.
Three robust inference methods address simulator error, but each lacks something we need. Flow Matching for Robust Simulation-Based Inference under Model Misspecification (FMCPE) corrects posteriors using 10–50 real pairs of known parameters and observations, which do not exist for soil kinetics or in-vivo physiology. Learning Robust Statistics for Simulation-based Inference under Model Misspecification (NPE-RS) penalizes summary features the simulator cannot reproduce, but its penalty depends on each specific observed dataset, so amortization is lost. Simulation-based Bayesian inference under model misspecification documents that neural estimators extrapolate overconfidently while ABC's tolerance acts as an implicit error model. This last paper constrains our design: we must show that the estimator flags discrepancies it cannot explain rather than silently absorbing them.
Our discrepancy model comes from Assessing model mismatch and model selection in a Bayesian uncertainty quantification analysis of a fluid-dynamics model of pulmonary blood circulation. That paper adds a Gaussian-process discrepancy term to a single mouse's data and reports that discrepancy cannot be separated from correlated noise without informative priors. We read that negative result as a statement about single-subject data. With many sites, a shared $\delta$ becomes identifiable through its invariance across sites, and this is the structural lever we exploit. Integrating Random Effects in Deep Neural Networks puts random effects inside a supervised network loss. It is relevant as evidence that neural nets and mixed models combine well, but it has no simulator and no inverse problem.
Research Program
The method has three parts.
Simulation design. Each simulated training dataset draws a population $(\mu, T)$, then $K$ site parameters, then one discrepancy function $\delta$ from a broad prior that is shared by all $K$ sites. That prior includes Gaussian-process curves and low-order basis perturbations, and optionally a per-site scale on $\delta$.
Architecture. The ML-NPE architecture is extended with a third output head that infers $\delta$, conditioned on the global summary. The permutation-invariant pooling across sites is what lets the network attribute the common residual to $\delta$ and site-varying structure to $\eta_k$.
Reporting heterogeneity. We report $\tau^2$ separately along stiff and sloppy directions, using eigendirections of the population-averaged sensitivity matrix. Heterogeneity along sloppy directions is largely unidentifiable, and a reader should be told so instead of receiving a single shrinkage number.
On the analysis side, we will validate the inflation formula above empirically. We will measure the relationship between injected $\delta$ magnitude and $\tau^2$ bias, and between the sensitivity spectrum and that bias. We will also add an out-of-prior check that flags datasets whose shared residual is poorly explained by the discrepancy head, borrowing the ABC intuition of widening uncertainty instead of extrapolating.
Baselines
The naive reference point is ML-NPE trained on clean simulations and applied unchanged, as in Amortized Bayesian Multilevel Models. It is the strongest existing amortized hierarchical method and the one practitioners would actually reach for. The file reports its speed (under a millisecond per dataset versus about 8 seconds for Stan on the air-traffic model) but gives no reported result on Lacuna for its parameter or $\tau^2$ accuracy under misspecification. We will therefore establish that number ourselves. It is beaten if our method reduces $\tau^2$ relative bias and improves posterior coverage of $\mu$ at matched speed.
The classical two-stage competitor fits per-site neural posterior estimators and then pools their means and variances with DerSimonian-Laird random-effects meta-analysis. A robust variant uses NPE-RS per site before pooling, which sacrifices amortization. This baseline isolates whether joint hierarchical training matters at all.
As an oracle upper bound, FMCPE (Flow Matching for Robust Simulation-Based Inference under Model Misspecification) receives labeled real pairs that our method never sees. The file reports that it achieves lower 2-Wasserstein distance than NPE with 10–50 calibration samples, but no exact value is reported on Lacuna for those tasks. Matching it within a modest margin, without labels, counts as success.
On small, cheap tasks, a hierarchical Stan model with a shared Gaussian-process discrepancy, the multi-site extension of Păun et al., serves as the slow gold reference.
The key ablation trains the identical network with the same simulation count but draws $\delta$ independently per site, so it amounts to structured noise augmentation. A second ablation removes $\delta$ entirely.
All neural variants share the backbone, simulation budget, GPU hours, and a fixed hyperparameter search of equal size.
Why not just…?
Why not just let the random effects absorb the misspecification? For prediction at observed sites this may be harmless. Inflated $\tau^2$ is exactly the scientific error we target, though: it says sites differ biologically when they do not, and it shrinks site estimates too little. Our synthetic experiments, which have known ground-truth $T$, measure this directly. If inflation turns out to be negligible in practice, the core claim is falsified, and we would report that.
Why not just augment training simulations with independent noise or discrepancy per site? This is the real threat. It is cheap and it does widen posteriors. The inflation formula predicts that it cannot remove the $\mathrm{Cov}_k(J_k^{+}\delta)$ term, because it never teaches the network that the error is common to all sites. The per-site ablation settles this question. If it matches the shared-discrepancy model on $\tau^2$ bias, we abandon the shared-structure claim.
Why not just use hierarchical ABC? ABC is robust to simulator error by accident, per Simulation-based Bayesian inference under model misspecification, but it is sample-inefficient. In Benchmarking Simulation-Based Inference, neural methods reach C2ST 0.5 on Two Moons with $10^5$ simulations while rejection ABC remains less accurate, and hierarchical sampling multiplies that cost. More fundamentally, ABC widens uncertainty rather than estimating $\delta$, so it cannot tell the analyst what the simulator gets wrong. We include rejection ABC on the cheap Ricker task to quantify both its cost and its coverage.
Why not just run Stan with a Gaussian-process discrepancy? Where the likelihood is tractable and the simulator is cheap, it is the correct answer, which is why we use it as the reference. It is not amortized: Păun et al.'s single-subject analysis already relies on slow MCMC, and solver costs (117 PDE evaluations per HMC sample in Markov chain Monte Carlo with Gaussian processes…) make leave-one-site-out analyses across hundreds of sites impractical.
Proposed Experiments
Pendulum. The first testbed is a multi-site version of FMCPE's Pendulum task. Each "site" is a pendulum with its own length and initial condition, and the unmodeled friction is the shared discrepancy. We will additionally vary friction slightly across sites to test robustness when $\delta$ is only approximately shared.
Contaminated Ricker. The second testbed is the contaminated Ricker model from NPE-RS, recast as many populations with shared contamination structure.
Sloppiness stress test. The third testbed uses one sloppy model drawn from the 17 BioModels systems analyzed by Gutenkunst et al. We will remove a reaction from the fitted simulator, keep it in the data generator, and run $K \in \{5, 20, 100\}$ sites. Metrics are relative bias of $\tau^2$ along stiff and sloppy directions, coverage of 90% credible intervals for $\mu$ and $\theta_k$, posterior quality via C2ST against the Stan reference where one exists, and inference time.
Real data. The real-data test is the LUCAS soil database used by Constrained hybrid modelling to predict microbial dynamics and organic matter turnover in soil systems, treating sampling sites as groups. True parameters are unknown there, so we evaluate leave-one-site-out predictive accuracy of $\text{CO}_2$ respiration, the rate at which ecological inequality constraints are satisfied, and whether the inferred $\delta$ is stable when sites are resampled. One caveat applies: the 15-hour time series may give too little signal for $\delta$ to be distinguishable from noise, and we will report this if it occurs.
Decisive checks. Three outcomes would decide the proposal. The first is whether the clean ML-NPE baseline inflates $\tau^2$ along sloppy directions as the formula predicts. The second is whether the shared-discrepancy model removes that inflation where the per-site ablation does not. The third is whether, when the true discrepancy lies outside the training prior (a nonlinear friction law versus a Gaussian-process prior), the out-of-prior flag fires instead of producing confident wrong answers. A failure of the second check means the idea reduces to noise augmentation. A failure of the third means we have only moved synthetic-data reliance up one level, from the simulator to the discrepancy prior.
References
- Universally Sloppy Parameter Sensitivities in Systems Biology Models
- Amortized Bayesian Multilevel Models
- Neural Posterior Estimation of hierarchical models in neuroscience
- Flow Matching for Robust Simulation-Based Inference under Model Misspecification
- Learning Robust Statistics for Simulation-based Inference under Model Misspecification
- Simulation-based Bayesian inference under model misspecification
- Assessing model mismatch and model selection in a Bayesian uncertainty quantification analysis of a fluid-dynamics model of pulmonary blood circulation
- Integrating Random Effects in Deep Neural Networks
- Benchmarking Simulation-Based Inference
- <scp>Markov chain Monte Carlo</scp>with Gaussian processes for fast parameter estimation and uncertainty quantification in a<scp>1D</scp>fluid‐dynamics model of the pulmonary circulation
- Constrained hybrid modelling to predict microbial dynamics and organic matter turnover in soil systems