Medical image classifiers are often deployed with a referral rule: the model handles cases it is confident about and sends the rest to a clinician. This rule fails worst when the model moves to a new scanner or a new patient population, because its mistakes there tend to be confident mistakes. Those errors sit in the high-confidence region that the rule never refers. Prior work has shown this "catastrophic referral failure" when moving from US to Indian fundus clinics. Separately, chest X-ray foundation models underdiagnose Black, female, and young patients. No one, however, has a reliable way to estimate how many confident errors a model makes for a specific scanner and patient-group combination. Most such combinations have only a few dozen labeled cases. Confident errors are rare by construction, so an empirical count from those cases is close to useless.
We propose to estimate these rare errors with extreme value theory (EVT), the branch of statistics that describes the far tail of a distribution from a modest number of large observations. Concretely, we fit a tail model to how strongly the model believes its wrong answers, separately for each scanner-by-group cell. The cells share statistical strength through a hierarchical model, so a cell with 50 labels borrows from cells with thousands. The fitted tails give two products. The first is an extrapolated estimate, with an upper bound, of the residual error rate among auto-accepted cases in each cell. The second is a per-cell referral threshold chosen to keep that rate below a target. The same decomposition lets us ask a question the literature leaves open: is the dangerous tail shaped mainly by the hardware or by the patient population?
Core Claim
The claim has two parts, and each could fail. The first is methodological. In the regime that matters, where cells are small and accepted cases are high-confidence, a hierarchical generalized Pareto model of confident-error margins estimates the per-cell residual error more accurately than three simpler options: empirical per-cell rates, per-cell recalibration, and shrinkage of empirical rates. Its upper bounds also achieve their nominal coverage where t-test and empirical bounds do not. The second is scientific. Once scanner and population are crossed in a controlled way, the tail shape parameter is governed mostly by the acquisition device, while demographic group mainly shifts the tail's scale. If this holds, it gives a concrete way to separate hardware failure from population failure in the tails. If it fails, that is informative too.
Grounding in Prior Work
Two papers motivate the proposal by documenting the failure. Avoiding Catastrophic Referral Failures In Medical Images Under Domain Shift shows that under geographic and camera shift (EyePACS to APTOS for diabetic retinopathy; pediatric to adult chest X-rays), even Bayesian networks become confidently wrong. Their out-of-domain false positives have low entropy. The paper repairs referral with post-hoc class-wise rules: Split Referral, a shifted variant, and Split Platt Scaling, all tuned by grid search on an out-of-domain validation slice. Rescuing referral failures during automated diagnosis of domain-shifted medical images shows that referral accuracy can fall as more cases are referred. It rescues this with domain-adversarial training on self-supervised features (REMEDIS/DAN), and it finds that plain contrastive pretraining widens the in-domain versus out-of-domain gap. Both papers report average referral curves over a whole target dataset. Neither reports per-subgroup tail error, and both entangle population and camera. We keep their failure mode and their benchmarks. We change the target quantity from an average referral curve to a per-cell tail error with a statistical model behind it.
Three papers supply EVT machinery in neighbouring settings, and each falls short in a specific way. Open Set Domain Adaptation by Extreme Value Theory fits a generalized extreme value distribution to source entropies and flags target samples in the high-entropy tail as unknown classes. That design is precisely wrong for our failure. Confident clinical errors have low entropy, so a source-entropy tail never sees them. We instead model the tail of the confidence margin among labeled errors in the target cell. Fairness Testing through Extreme Value Theory fits extreme value distributions to counterfactual discrimination on tabular data. It finds a "mitigation paradox": a standard mean-fairness mitigator worsened tail discrimination in 35% of tested cases. We borrow the audit logic but apply it to image models under device shift. We also need no counterfactual attribute flipping, which is ill-defined for images. In reinforcement learning, Extreme Risk Mitigation in Reinforcement Learning using Extreme Value Theory splits a distribution into a quantile-fitted body and a generalized Pareto tail. We reuse that body-plus-tail split.
Fairness Guarantees under Demographic Shift constrains the design. Its Shifty method gives high-confidence fairness bounds under shifts in group proportions, using Student's t bounds. It assumes the inputs given the group do not change, which is exactly what scanner shift breaks. Its t bounds are also the thin-tailed tool we expect to under-cover. On the population side, Demographic bias of expert-level vision-language foundation models in medical imaging supplies the evidence of underdiagnosis disparities across five chest X-ray archives, but it explicitly does not separate site and scanner from demographics. That separation is our second question.
Research Program
The core object is the logit margin $m$, meaning the gap between the predicted class's logit and the runner-up's. We use the margin rather than softmax confidence because it is unbounded, and EVT tail families need room to extend. For each device $d$ and patient group $g$, take the labeled target cases the model gets wrong. Above a cell threshold $u$ (chosen as a high percentile of the pooled margins), the exceedances $m-u$ of these errors are modeled as generalized Pareto, the distribution that the Pickands-Balkema-de Haan theorem gives as the limit for excesses over a high threshold. We do the same for all cases. The residual error rate among cases auto-accepted at margin threshold $t > u$ is then
$$ r_{d,g}(t) = \frac{n^{e}_{d,g}\,\bar H_{\xi^{e}_{d,g},\sigma^{e}_{d,g}}(t-u)}{n^{a}_{d,g}\,\bar H_{\xi^{a}_{d,g},\sigma^{a}_{d,g}}(t-u)}, $$
where $n^{e}_{d,g}$ and $n^{a}_{d,g}$ count error and all cases exceeding $u$ in the cell. Here $\bar H_{\xi,\sigma}(y) = (1+\xi y/\sigma)^{-1/\xi}$ is the generalized Pareto survival function, with shape $\xi$ and scale $\sigma$. The point of the formula is extrapolation: $r$ can be evaluated at margins where the cell has seen one error or none.
Parameters are tied across cells by an additive hierarchical model. We set $\xi^{e}_{d,g} = \xi_0 + \delta_d + \eta_g$ and $\log \sigma^{e}_{d,g} = \alpha + \beta_d + \gamma_g$, with shrinkage priors on the device effects ($\delta, \beta$) and the group effects ($\eta, \gamma$), plus a small interaction term. We fit by Hamiltonian Monte Carlo. Posterior upper quantiles of $r_{d,g}(t)$ serve as audit bounds. The referral threshold for each cell is the smallest $t$ whose posterior 95% upper bound on residual error sits below a clinician-specified target. Threshold choice is the classical weak point of EVT, so every result will be reported across a sweep of $u$ from the 80th to the 95th percentile, together with mean-excess diagnostics.
The disentangling analysis compares the posterior variance of the device effects with that of the group effects. We do this first on a controlled construction, where we know the truth, and then on natural data. For the controlled construction, we take source images within each demographic group and apply physically motivated acquisition corruptions to them. These are gain and speckle-like noise, blur, and contrast and resolution changes, and they act as synthetic "devices." This yields a fully crossed device-by-group grid in which the hardware effect is known. For natural crossing, we use acquisition metadata recorded within a single archive, such as portable versus fixed chest X-ray units in the same hospital, wherever the archive provides it. Where it does not, device falls back to dataset identity and is confounded with site, and we will say so.
Baselines
The naive reference is a single global softmax-entropy threshold fitted on source validation data and applied unchanged to every target cell. This is what a deployed system does by default, and the referral-failure papers show that it breaks. The method has to beat it everywhere, or the problem is not real for that model.
The strongest existing referral method is REMEDIS/DAN from Rescuing referral failures during automated diagnosis of domain-shifted medical images, together with Split Platt Scaling from Avoiding Catastrophic Referral Failures In Medical Images Under Domain Shift. For EyePACS to APTOS, the Rescuing paper reports that REMEDIS/DAN reached an AURC-AUROC of 0.98, a 12.8% gain over ViT-Base. On the same shift, the RETFound paper A foundation model for generalizable disease detection from retinal images reports external diabetic retinopathy AUROCs of 0.943, 0.822 and 0.884 across three datasets that include APTOS-2019. For per-subgroup residual error at a fixed automation rate, no reported result was found on Lacuna for any of these methods. That missing number is the quantity we measure.
We run REMEDIS/DAN and Split Platt Scaling on the same backbones and give them the same labeled target calibration cases we give our method. Split Platt Scaling is fitted per cell as well as globally. All methods get the same hyperparameter search budget. Our tail model is applied on top of each backbone, including the REMEDIS/DAN one, so the comparison isolates the threshold-setting step from representation quality. Beating it means three things at once. Worst-cell residual error must be lower at an equal overall automation rate. Our tail-error estimates must have lower mean absolute error than theirs. And neither average AURC nor average AUROC may fall.
Three statistical competitors target the estimation question directly. The first is empirical per-cell rates with Clopper-Pearson bounds, which is equivalent to a split-conformal style threshold. The second is a beta-binomial model that shrinks empirical rates across cells, using the same additive device-plus-group structure. The third is Shifty-style t-test upper bounds from Fairness Guarantees under Demographic Shift. We also run an ADAGEV-style source-entropy tail from Open Set Domain Adaptation by Extreme Value Theory, because it is the closest prior EVT design.
Two ablations isolate the key ingredients. The first fits independent generalized Pareto models per cell with no sharing, which tests the value of the hierarchy. The second keeps the hierarchy but swaps the generalized Pareto tail for an exponential tail (shape fixed at zero) or a log-normal fit to the whole margin distribution. This tests whether the EVT tail form itself matters or whether any smooth parametric pooling would do.
Why not just…?
Why not just use empirical per-cell error rates or a conformal threshold on a target calibration set? In large cells this will work, and we expect it to tie with or beat EVT. Its weakness is the small-cell, high-confidence corner. With 50 labels and a true residual error of 2%, the most likely observed count above a strict threshold is zero, and an exact binomial bound is then too wide to choose a threshold from. The subsampling experiment below measures the cell size at which the empirical method catches up. If that crossover sits below roughly 100 labeled cases per cell, the method has little practical value and we will report that.
Why not just shrink empirical rates across cells with a beta-binomial model? This is the most serious threat, because it captures much of the pooling benefit with no tail theory. Its limitation is that it shrinks rates at a fixed threshold. It cannot say how the rate falls as the threshold rises past the observed errors, and that is the information needed to set a threshold. The exponential-tail and log-normal ablations sit between the two approaches. If the beta-binomial model matches the hierarchical Pareto model on held-out tail error at every cell size, the EVT component is unnecessary, and we would reframe the contribution around the device-versus-group decomposition alone.
Why not just recalibrate each cell with Split Platt Scaling? Per-cell Platt scaling fits a logistic link across the whole confidence range. The large mass of easy correct cases therefore dominates the fit, and the fit is not driven by the few confident errors. The Avoiding paper tunes its shift parameters by grid search on out-of-domain validation slices and does not report per-subgroup residual error. Running it per cell under the same label budget tests directly whether a logistic link mis-describes the tail.
Why not just fix the representation with domain-adversarial training or more diverse data? Training-side remedies change the model, but they do not tell the deployer how often the changed model is still confidently wrong for a given cell. The audit is needed in either case. The mitigation-paradox evidence in Fairness Testing through Extreme Value Theory also suggests that average improvements can hide tail regressions. We test this directly by comparing tail error with and without REMEDIS/DAN.
Proposed Experiments
The first benchmark is diabetic retinopathy, trained on EyePACS and deployed to APTOS 2019, with labels binarized as in the referral papers. Here the population and camera shift are entangled. The second is chest X-ray, trained on CheXpert and evaluated on MIMIC, NIH, PadChest and VinDr, with groups defined by the recorded sex, age band and race. The third is the controlled crossed grid built from synthetic acquisition corruptions applied within demographic groups of the source data. Backbones are a ViT-Base, REMEDIS/DAN, and frozen RETFound features for fundus images.
The first decisive check concerns estimation accuracy. For cells large enough to have a reliable empirical tail error, which serves as ground truth, we repeatedly subsample 25 to 500 labeled cases, re-estimate, and measure absolute error and 95% upper-bound coverage of residual error at automation rates of 70 to 95%. The hierarchical Pareto model should show lower error and near-nominal coverage below the crossover cell size. The t-bound and empirical baselines should under-cover there.
The second decisive check concerns deployment. With per-cell thresholds set by each method under a common overall automation rate, we compare worst-cell residual error and the number of cells that exceed the target error.
The third decisive check is the mitigation paradox. It counts how often REMEDIS/DAN or Split Referral improves average AURC while raising the estimated tail error of some cell. Each such case is confirmed on held-out data.
The fourth check is disentanglement. On the synthetic grid, the method should recover the planted dominance of device effects in tail shape. If it does not recover a known structure, its natural-data decomposition will not be interpreted.
Every result is reported across the threshold sweep. A conclusion that flips between the 80th and 95th percentile thresholds will be reported as unstable.
References
- Avoiding Catastrophic Referral Failures In Medical Images Under Domain Shift
- Rescuing referral failures during automated diagnosis of domain-shifted medical images
- Open Set Domain Adaptation by Extreme Value Theory
- Fairness Testing Through Extreme Value Theory
- Extreme Risk Mitigation in Reinforcement Learning using Extreme Value Theory
- Fairness Guarantees under Demographic Shift
- Demographic bias of expert-level vision-language foundation models in medical imaging
- A foundation model for generalizable disease detection from retinal images