Christoph Weniger — University of Amsterdam (GRAPPA)
A taxonomy of epistemic uncertainties in SBI: three failure modes, each with its own diagnostic strategy.
| Category | Type | Description |
|---|---|---|
| Epistemic | Type A | Misspecified model "I'm simulating the wrong world" |
| Type B | Lossy summary "I'm discarding relevant information" |
|
| Type C | Inexact inference "I can't compute the posterior exactly" |
|
| Aleatoric | — | Irreducible randomness in the data |
When the embedding network fails to extract all relevant information from the data.
Approximate posteriors $q_\phi(\theta \mid x)$ are overdispered (underdispersed) when they overestimate (underestimate) their coverage of the data generating parameters.
Posteriors that are exact but based on lossy summaries, $q_\phi(\theta \mid x) = p(\theta \mid T(x))$, are wider but not overdispersed. Their width correctly represents information loss and additional scatter in the posterior position.
| Entropy | \[ H(X) = -\sum_x p(x)\log p(x) \] Average uncertainty in \(X\). How many bits does it take to describe a draw from \(p(x)\)? |
| Conditional Entropy | \[ H(X\mid Y) = -\sum_{x,y} p(x,y)\log p(x\mid y) \] Remaining uncertainty in \(X\) after observing \(Y\). |
| Mutual Information | \[ I(X;Y) = H(X) - H(X\mid Y) = \sum_{x,y} p(x,y)\log\frac{p(x,y)}{p(x)p(y)} \] How much knowing \(Y\) reduces uncertainty about \(X\). Zero iff \(X \perp Y\). |
Any deterministic function \(T(x)\) can only destroy — never create — information about \(\theta\).
\[ T(x)\ \text{sufficient} \;\Leftrightarrow\; I(\theta;\,T(x)) = I(\theta;\,x) \]
Equality holds iff \(\theta \perp x \mid T(x)\): the statistic captures everything about \(\theta\).
Compressing \(x \to T(x)\) before SBI can only widen posteriors. The ideal learned summary is a sufficient statistic.
Maximize \(\log q_\phi(\theta\mid x)\) on the training set:
\[ \mathcal{L}_\text{NPE} = -\frac{1}{|\mathcal{D}|}\sum_{(\theta,x)\in\mathcal{D}} \log q_\phi(\theta\mid x) \]As \(N\to\infty\), the empirical loss becomes an expectation over the joint:
\[ \mathcal{L}_\text{NPE} \longrightarrow \mathbb{E}_{x\sim p(x)}\!\Big[ D_\text{KL}\big(p(\theta\mid x)\,\|\,q_\phi(\theta\mid x)\big) + H\big(p(\theta\mid x)\big) \Big] \]where the KL divergence measures the (non-symmetric) "distance" between distributions, with \(D_\text{KL}\ge 0\) and equality iff \(p=q\):
\[ D_\text{KL}(p\,\|\,q) = \mathbb{E}_{p}\!\left[\log\frac{p(\theta)}{q(\theta)}\right] = \sum_\theta p(\theta)\log\frac{p(\theta)}{q(\theta)} \]So the loss is minimized exactly when \(q_\phi(\theta\mid x) = p(\theta\mid x)\) for all \(x\). Requires a normalized density estimator (e.g. a normalizing flow).
Add a summary network \(q_\phi(\theta\mid x)\to q_\phi(\theta\mid T_\phi(x))\). Then
Tight when the estimator is exact. Training \(T_\phi\) end-to-end pushes summaries toward minimal posterior entropy.
Using the identity
\[ \mathbb{E}_{p(x)} H\big(p(\theta\mid T_\phi(x))\big) = H\big(p(\theta)\big) - I\big(\theta; T_\phi(x)\big) \]we find that
minimizing posterior entropy \(\;\Leftrightarrow\;\) maximizing \(I(\theta; T_\phi(x))\).
Summaries learned in the context of NPE (but also NRE, score matching, ..., not NLE) are information-maximizing — a key strength. But it brings the challenge of knowing when they are sufficient.
Letting the inference "walk on its own": forward vs backward, judged by ranks.
Compare samples from two joint distributions on \((\theta, x)\), derived from the forward model and the backward model, respectively.
Key observation: If \(q_\phi(\theta\mid x) = p(\theta\mid x)\), the two distributions coincide. Vice versa, any discrepancy flags inference error.
Simulation-based calibration (SBC). Given an observation \(x\sim p(x)\) drawn from the generative model, draw one parameter from the true posterior, \(\theta^* \sim p(\theta\mid x)\), and \(L\) further draws from the learned posterior, \(\theta_{1:L} \sim q_\phi(\theta\mid x)\).
For each of \(N\) simulated experiments we get one rank between \(0\) and \(L\). Aggregate them into a histogram.
Under \(q_\phi=p\), the histogram is flat; any structure is a calibration signature.
Top: one trial — the true value (red ×) among the approx-posterior samples (orange). Bottom: the trial's rank drops into the histogram.
Now, given rank test samples
\[ \theta^* \sim p(\theta),\quad x \sim p(x\mid\theta^*),\quad \theta_{1:L} \sim q_\phi(\theta\mid x) \]we can use some rank statistics arguments to construct a test.
The position (rank) of the true posterior sample \(\theta^*\) among the approximate posterior samples \(\theta_{1:L}\), is given by
\(F(\theta^*) = \tfrac{1}{L}\sum_i \mathbb{1}(\theta_i \le \theta^*)\).
Assuming that \(q_\phi = p\), all \(L+1\) positions are equally likely, and hence we expect:
\[ F(\theta^*) \;\sim\; \text{Uniform}\bigl(\{0, \tfrac{1}{L}, \ldots, 1\}\bigr) \]
Simulator: \(\theta\sim\mathcal{U}(-1,1)\), \(x\mid\theta\sim\mathcal{N}(\theta, \sigma^2)\) with \(\sigma=0.1\).
Learned posterior:
Each trial draws \(\theta^*\) and \(x\) afresh, so both posteriors recentre on \(x\). Red × is \(\theta^*\); orange dots are the \(q\)-samples whose rank we record.
The highest posterior density region at level \(1-\alpha\):
If \(q_\phi = p\), a fraction \(1-\alpha\) of true parameters \(\theta^*\) should fall inside. Plot empirical vs nominal coverage: the pp-plot.
Equivalently, this is a rank test with ordering function \(q_\phi(\theta\mid x)\):
Same simulator and learned posterior as before — only the ordering changes.
Now we rank by density \(q_\phi(\theta\mid x)\):
The dots now sit on the orange curve at their density height; the red line marks \(q_\phi(\theta^*\mid x)\). The rank counts the orange dots above the red line.
Horizontal lines carry each density to the axis. Orange lines above the red one are the samples ranked higher than \(\theta^*\).
Same Gaussian setup as before; now we look at both diagnostics at once.
Where rank tests stay blind, and the framework that ties them together.
SBC averages over \(x \sim p(x)\). A bias whose sign changes across data space partially cancels.
Global rank histogram (dashed black) looks nearly flat. Stratify by sign of \(x\) and the opposite biases appear at once.
Lesson: stratify whenever miscalibration could depend on \(x\). The cost is statistical power per stratum.
Two observations \(x_1, x_2 \sim \mathcal{N}(\theta, \sigma^2)\). The Bayes-optimal posterior uses both:
Compare two flawed posteriors, both wider than optimal:
If we can evaluate the simulator's likelihood \(p(x\mid\theta)\) or score \(\nabla_\theta \log p(x\mid\theta)\), use those as ordering functions instead.
Same rank machinery, ordering function changed. In the lossy-summary case above, the likelihood-rank histogram would no longer be flat.
Requires a tractable model. When you have one, use it — it is the only rank test that sees information loss.
HPDR tests check only the mass inside super-level sets. Distorted shapes that preserve mass-vs-level go undetected.
Construct \(q(\theta) = g(|\theta - \theta_0|)\) so every symmetric interval matches the true posterior mass. The pp-plot stays perfectly diagonal, even when the shape is bimodal.
Left: true posterior (dashed) vs distorted \(q\). Right: pp-plot stays on the diagonal regardless of distortion.
SBC applied separately to each component \(\theta_i\) tests only the marginals. It can pass while the joint posterior is wrong (correlations distorted).
All forward–backward tests share a structure: choose an ordering function \(f(\boldsymbol\theta, x)\) and rank \(\theta^*\) among the \(\theta_{1:L}\) under that ordering.
| Method | Ranks by | Type B | Ordering \(f(\boldsymbol\theta, x)\) |
|---|---|---|---|
| SBC | parameter (\(d\) tests) | No | \(\theta_i\) for \(i=1,\ldots,d\) |
| HPDR coverage | learned posterior | No | \(q_\phi(\boldsymbol\theta\mid x)\) |
| TARP | distance to reference | Maybe | \(\|\boldsymbol\theta - \boldsymbol\theta'\|^2\), \(\boldsymbol\theta' \sim p(\boldsymbol\theta)\) |
| True HPDR | true posterior | Yes | \(\pi(\boldsymbol\theta\mid x) \propto p(x\mid\boldsymbol\theta)p(\boldsymbol\theta)\) |
| Likelihood ranks | likelihood | Yes | \(p(x\mid\boldsymbol\theta)\) |
| Score ranks | score (\(d\) tests) | Yes | \(\nabla_{\theta_i} \log p(x\mid\boldsymbol\theta)\) |
Any complex system, really.
A clockmaker does not assemble every gear and escapement at once and expect it to tick. Start with the gear train — verify it rotates. Add the escapement, check regulation. Add the pendulum, verify synchronization. At each step, the mechanism works.
SBI pipelines (and anything deep learning related) obey the same law. The diagnostics ahead are designed to pinpoint failures in nearly-working systems. Applied to a completely broken pipeline they generate noise; applied to an incrementally refined system they can tell you exactly what broke.