Detecting Model Misspecification in Amortized Bayesian Inference with Neural Networks: An Extended Investigation

Marvin Schmitt, Paul-Christian Bürkner, Ullrich Köthe, Stefan T. RadevarXiv 2024 · DOI

Abstract

Amortized Bayesian inference using neural networks offers powerful parameter estimation for complex simulators but is vulnerable to model misspecification. We present an unsupervised method to detect such "simulation gaps" by structuring the latent summary space of a neural network. By enforcing a Gaussian distribution on simulated data summaries, we employ Maximum Mean Discrepancy (MMD) to identify real-world observations that deviate from the training domain. Our results across diverse scientific models demonstrate high sensitivity to misspecification, preventing confident but incorrect posterior estimates.

Introduction

In many scientific fields, researchers rely on complex computer simulations to understand real-world phenomena, ranging from disease outbreaks to cognitive processes. Simulation-Based Inference (SBI) leverages neural networks to "invert" these simulations, allowing for the estimation of hidden parameters from observed data. However, these networks are fundamentally limited by the quality of their training data. If a "simulation gap" exists—where the simulator inaccurately represents reality—the network may still provide a posterior distribution, but that answer might be confidently wrong. This phenomenon, known as model misspecification, often leads to "silent errors" because existing diagnostic tools frequently rely on the corrupted outputs themselves.

Methods: A Sentinel in the Summary Space

To address this, we propose a two-pronged approach integrated into the Neural Posterior Estimation (NPE) framework. The core idea is to transform the summary network—typically used to compress raw data—into a diagnostic tool.

  1. Structured Summary Statistics: We modify the training objective of the summary network ($h_\psi$) to force the resulting summary vectors to follow a unit Gaussian distribution for all well-specified simulated data.
  2. MMD-based Detection: At test time, we compare the summary statistics of real-world observations against this expected Gaussian distribution using Maximum Mean Discrepancy (MMD). MMD is a kernel-based statistical test that measures the distance between two distributions.
Conceptual framework for detecting model misspecification. Data from the generative model is mapped to a structured summary space. Misspecified data falls outside the expected distribution, triggering a detection alarm.

This approach is entirely unsupervised; it only requires knowledge of what "correct" data looks like based on the simulator. If the MMD score exceeds a predefined threshold, the system flags the result as untrustworthy, effectively acting as a "smoke detector" for scientific modeling.

Experimental Evaluation

We evaluated the robustness of this method across several challenging scenarios:

  • Gaussian Benchmarks: Used to precisely control misspecification types.
  • Biological Modeling: A spatial point process model for cancer and stromal cells with hidden necrosis factors.
  • Cognitive Psychology: The Drift-Diffusion Model (DDM) for decision-making, tested against "contaminant" data like fast guesses.
  • Epidemiology: A high-dimensional compartmental model tested against real-world COVID-19 data from Germany.
  • Computer Vision: Using EMNIST image simulators to detect domain shifts in handwriting styles and digit classes.

Key Results and Discussion

The investigation revealed that misspecified models can produce posterior distributions that appear perfectly normal and certain, even when they are wildly inaccurate. This confirms the danger of "silent errors" in automated inference.

Comparison of posterior distributions under well-specified (left) and misspecified (right) conditions. The 'silent error' is evident on the right, where the inference network provides a confident but inaccurate posterior compared to the MCMC ground truth.

Our MMD-based detector showed high sensitivity, with scores increasing monotonically with the severity of the simulation gap. In the COVID-19 experiment, the test correctly identified well-specified phases of the pandemic while flagging models that lacked critical intervention components. Furthermore, the method proved highly sample-efficient, requiring as few as five real-world observations to achieve a near-zero Type II error rate in complex scenarios.

Conclusion and Future Work

By defining what "right" looks like in a structured summary space, we can reliably detect when a model and reality have parted ways. While adding the MMD penalty introduces a training trade-off, the gain in reliability is substantial. Future research will focus on moving from detection to mitigation—automatically adjusting inference or models once a gap is identified—and managing the computational burden of MMD in extremely high-dimensional spaces.

Summary updated

BibTeX
@misc{schmitt2024detecting,
  author = {Marvin Schmitt and Paul-Christian Bürkner and Ullrich Köthe and Stefan T. Radev},
  title = {{Detecting Model Misspecification in Amortized Bayesian Inference with Neural Networks: An Extended Investigation}},
  year = {2024},
  eprint = {2406.03154},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.03154},
}
Figure