The Leakage Gap as a Single-Site Warning Sign for Cross-Hospital Failure

Medical imaging models that look excellent in the lab often fail at the next hospital. Two separate literatures explain parts of this. One shows that splitting data carelessly, so that frames or slices from the same patient land in both training and test sets, inflates scores because the model recognizes the patient instead of the disease. The other shows that models trained at one hospital pick up scanner- and population-specific cues and degrade elsewhere. We propose that these are largely the same failure seen from two angles. A model that gains a lot from seeing neighbouring slices of a test patient during training is a model that relies on patient- and acquisition-specific signal. That same reliance should make it fragile when the scanner or population changes. If so, the size of the "leakage gap" is useful information rather than just a reporting error to fix. The leakage gap is the score on a careless slice-shuffled split minus the score on a patient-disjoint split, for the same model and data. It can be measured at a single site, and it could help rank design choices by how well they will transfer before any external data exists.

We test this on 3D abdominal CT and MRI segmentation. The design choices we vary are the two levers the literature argues about most. The first is how tightly the model is restricted to a region of interest, meaning an anatomical mask that hides everything outside the relevant organ. The second is how much through-plane (volumetric) context it sees: single 2D slices, a few stacked slices, or full 3D patches. The contribution is a controlled study with a falsifiable predictive claim, plus a mechanistic test of where the patient-specific signal lives. It is not a new architecture.

Core Claim

Across a family of pipeline variants trained on one source, the single-site leakage gap will rank-predict the drop in performance on unseen external datasets. It will do so beyond what patient-disjoint in-distribution accuracy already predicts. Region-of-interest restriction will shrink both the leakage gap and the external drop, but only up to a context margin, beyond which stripping context hurts. We also expect the effect of volumetric context to split. Adding depth should increase the leakage gap when the extra slices carry patient-identifying texture, and decrease it when the model is restricted to the anatomical region. The claim fails if the leakage gap adds no predictive value once in-distribution patient-disjoint Dice is controlled for. We will report that outcome as a negative result.

Why This Is Not Already Done

Leakage inflation has been quantified mostly in video. A pig-behaviour detector fell from 96.8% to 76.6% accuracy under blocked validation (Han et al.). A lung-ultrasound classifier went from 87.8% on leaked retrospective data to 65% on a prospective patient-level cohort (COVID-BLUeS). Video-disjoint colonoscopy splits exposed inflated Dice (FCB-SwinV2). A meta-analysis of 188 surgical AI studies found nearly 30% split at frame level (Carstens et al.). All of these papers treat the gap as a bias to eliminate. None uses it as a measurement that predicts transfer, and none studies the volumetric slice analogue.

On the domain-shift side, AMOS reports a drop of more than 20% mDice on unseen MRI vendors, and A-Eval documents large cross-dataset gaps for single-dataset training. Neither relates those drops to within-site diagnostics.

Region-of-interest work motivates the masking hypothesis. Masking subcutaneous fat raised lung-ultrasound AUC from 0.6553 to 0.7742 because the unmasked model read body habitus (The Role of Pleura and Adipose in Lung Ultrasound AI). Lung-mask-weighted pooling improved CT triage specificity (Bai et al.). However, neither paper tests external sites or leakage.

On volumetric context, 3D smoothing lifted pancreas Dice from 56% to 68% (Roth et al.), and OmniCT adds slice-grouping and 3D positional codes. Both treat depth purely as accuracy-enhancing, never as a possible carrier of patient-specific shortcuts.

The closest methodological cousin is Domain Game. It separates anatomy from scanner style in 2D using the observation that anatomy features change under rotation while style features do not. It is an intervention; we build a diagnostic and use Domain Game as a comparison intervention.

Research Program

The task is a two-stage cascade for small, low-contrast abdominal organs: pancreas, adrenal glands and duodenum. In the first stage, a coarse segmenter proposes an abdominal region. In the second stage, a fine segmenter works inside that region. We build a grid of about 30 second-stage variants, each trained with three seeds, along three axes.

The first axis is spatial restriction. The options are whole field of view, a bounding crop with margin $m \in \{0, 10, 25, 50\}$ mm, a hard binary mask, and soft mask-weighted pooling in the style of Bai et al. The margin sweep directly probes the context-stripping concern raised against hard masks.

The second axis is through-plane context. The options are 2D, 2.5D with $k \in \{3, 7\}$ adjacent slices as channels, and 3D patches.

The third axis is augmentation strength, either standard or heavy intensity and bias-field augmentation.

Every variant is trained on one source: AMOS CT, restricted to one center, where the per-scan metadata allows this. Each variant is evaluated in three ways. First, on a slice-level random split of that source. Second, on a patient-disjoint split of the same source with an identical number of training slices. Third, zero-shot on the external A-Eval datasets (FLARE22, WORD, TotalSegmentator, BTCV) and on the AMOS second center.

For 3D variants, slice shuffling is undefined, so the leakage condition assigns non-overlapping z-blocks of $b$ slices from each patient randomly to train or test. The 2.5D variants get the same z-block condition, which lets us check that the two leakage definitions agree. We define

$$\Delta_{\text{leak}} = D_{\text{shuffled}} - D_{\text{patient}}, \qquad \Delta_{\text{ext}} = D_{\text{patient}} - D_{\text{external}},$$

where $D$ is Dice averaged per volume. We average per volume rather than pooling voxels, following the "averaging trap" warning in FCB-SwinV2, so that small organs are not swamped.

To locate the patient-specific signal, we add two analyses. The first is a patient-identity probe: a linear classifier on frozen penultimate features that tries to name which training patient a slice came from. The second is a background-swap test. At inference we replace everything outside the region of interest with the corresponding region from another patient or site. The change in Dice then measures how much the prediction depends on outside-region content. If masking works through the proposed mechanism, it should reduce identity decodability and background-swap sensitivity together with both gaps.

Baselines

The naive reference point is the slice-shuffled score itself. It is what roughly a third of surveyed surgical AI studies would report (Carstens et al.), and its distance from external performance is the quantity we try to explain.

The strongest existing method for this segmentation question is the plain whole-volume 3D U-Net. AMOS reports 89.04% mDice on its CT test set, ahead of Swin-UNetr at 86.32%. For the external reference we use A-Eval, which reports 88.90% mean DSC on unseen BTCV with joint multi-dataset training. That is an upper bound our single-source variants are not expected to reach, but it calibrates the size of the gap. We will run the 3D U-Net ourselves with identical preprocessing, source data, epochs and a matched tuning budget, and report its per-organ scores rather than borrowing the published aggregate. A masking or context variant "beats" it if it achieves higher external per-volume Dice on the small organs, averaged over seeds, with a confidence interval excluding zero.

The strongest intervention baseline is Domain Game. It reports an 11.8% cross-site prostate gain and limits target drop to 4.7% versus 9–15% for competitors. We apply it to the 2D and 2.5D variants under the same budget. Its role is to check whether the leakage gap still tracks external drop for a model explicitly trained to discard style.

For the predictive claim, the baseline predictor is patient-disjoint in-distribution Dice alone. The leakage gap is useful only if it adds significant rank correlation with external drop beyond this predictor.

The key-ingredient ablation holds everything fixed except whether the region mask is applied. By sweeping margin $m$, this ablation isolates whether restriction itself, rather than resolution or input size, moves both gaps.

Why not just…?

Why not just always use patient-disjoint splits and stop worrying about the gap? Everyone should use patient-disjoint splits for reporting, and we do. The question is different: whether the gap carries information about transfer that the patient-disjoint score lacks. This is the most serious threat to the proposal. In-distribution patient-disjoint Dice may already rank variants by external performance as well as the gap does. The partial-correlation test is designed to settle exactly this, and a null result would be reported as the finding.

Why not just use a native 3D model, where slice leakage cannot happen? AMOS shows 3D U-Nets are strong. Yet the same benchmark's more-than-20% drop on unseen MRI vendors shows that 3D context does not remove acquisition-specific reliance. Our z-block leakage condition lets 3D models be measured on the same scale. If 3D variants show uniformly small gaps and small external drops, that answers the volumetric question directly: depth fixes the problem, and masking is unnecessary.

Why not just augment heavily or pool more sites? Heavy augmentation is one axis of the grid, so its effect is measured, not assumed. Domain Game reports that augmentation-based baselines such as RandConv still drop 9–15% across sites. Multi-site pooling is the A-Eval upper bound. It is often unavailable under single-institution constraints, which is precisely the setting where a single-site diagnostic is needed.

Why not just probe features for scanner or site identity instead? A site probe needs multiple sites at training time. A patient-identity probe does not, and we include it as a competing single-site diagnostic. If the probe predicts external drop as well as the leakage gap does, we will recommend the probe, because it is cheaper.

Proposed Experiments

The first decisive check is Spearman correlation between $\Delta_{\text{leak}}$ and $\Delta_{\text{ext}}$ across all variants and seeds, with a partial correlation controlling for $D_{\text{patient}}$. Confidence intervals come from bootstrapping over patients. We consider the claim supported if the partial correlation is positive with an interval excluding zero on at least three of the five external datasets.

The second is a prospective selection test. From the grid, we pick the variant minimizing $\Delta_{\text{leak}}$ among those within one standard error of the best $D_{\text{patient}}$. We compare its held-out external Dice against the variant chosen by $D_{\text{patient}}$ alone. The comparison is run on AMOS MRI, which is kept untouched until this step, and on its unseen-vendor subset.

The third is the mechanism check. Masking variants should show lower identity-probe accuracy and lower background-swap sensitivity, and the margin sweep should show a U-shape in external Dice.

The fourth tests the split hypothesis for depth: the interaction between context depth and masking on $\Delta_{\text{leak}}$.

For whole-volume versions of the reported baselines, the published numbers above anchor the comparison. For small-organ external Dice of single-source cascades and for leakage-gap predictiveness, we found no reported result on Lacuna, so all such numbers will come from our own matched runs.