Whole-slide pathology classifiers usually follow a fixed recipe. A gigapixel slide is cut into thousands of small tiles. A frozen pretrained network turns each tile into a feature vector. A small learned model then pools those vectors into a slide-level diagnosis, and it is trained only from slide labels. This weakly supervised setup is called multiple instance learning (MIL): the slide is a "bag" of tile "instances," and only the bag carries a label. Real slides arrive damaged in several ways at once. Part of the tissue is out of focus, there is an air bubble in one corner, the stain has faded across the whole slide, and the sensor adds noise. Because the tile encoder is frozen, every one of these damages passes straight into the vectors the pooling model sees. The model is never told which tiles are trustworthy, so it can shift its attention onto damaged tiles.
We propose to repair the damage in the space of tile embeddings rather than in pixels. A lightweight network takes a tile's embedding and a learned code describing that tile's mixture of degradations, and maps the corrupted embedding back toward the clean one. It is trained with two signals. The first is a tile-level regression target. The second, more distinctive one, comes from MIL itself: a frozen MIL model trained on clean slides must make the same prediction and spread its attention the same way on repaired bags as on clean bags. The result is a plug-in module that works on vectors of a thousand or so numbers instead of millions of pixels. It is cheap enough for whole slides, it is optimized for preserving diagnosis rather than for looking sharp, and it can be dropped in front of any existing MIL model without retraining that model.
Core Claim
Under spatially varying, compound corruption of whole slides, a degradation-conditioned embedding restorer trained with bag-level consistency recovers most of the slide-level accuracy and attention reliability lost by clean-trained MIL models. We expect it to do this at a small fraction of the cost of pixel restoration. We also expect it to generalize to corruption combinations it never saw better than simply training MIL models on corrupted bags. The last part of the claim is the one at real risk, and the experiments are built to settle it.
Where This Sits
Three lines of work motivate the gap.
The first line shows that MIL attention is fragile. Beyond accuracy measures whether attention models such as ABMIL, CLAM, DTFD-MIL and ACMIL actually attend to lesions. It finds that high AUC often hides attention on artifacts and normal tissue, and that plain instance-level mean pooling is the most reliable. That paper treats artifacts as fixed properties of existing datasets. It never corrupts slides on purpose and never tries to repair them. We reuse its reliability metrics: mutual information, Spearman correlation and AUPRC between attention and lesion masks.
The second line characterizes corruptions without MIL. Histopath-C defines ten realistic histopathology corruptions spanning stain, contamination, blur, noise and illumination. It reports 20–30% drops for vision-language models and counters them with test-time low-rank adaptation (LATTE). It evaluates tiles only, tests corruptions one at a time, and explicitly leaves compound corruption to future work. We take its corruption families as the building blocks of our compound generator.
The third line repairs one corruption in pixels. Pathology Image Restoration via Mixture of Prompts restores defocus blur with a transformer stage followed by a diffusion stage. It raises tile classification accuracy from 82.82% to 91.91%, against 95.15% on clean tiles. It handles only defocus, never aggregates to slides, and the authors flag its inference cost as unsolved. Our proposal differs on all three counts: it handles mixtures, it is evaluated at slide level, and it is cheap enough to run on every tile.
The method draws on the all-in-one restoration literature, where a single network removes unknown or mixed corruptions. AirNet (All-In-One Image Restoration for Unknown Corruption) learns a degradation code contrastively, without corruption labels, and injects it into the restorer through feature-wise modulation. We borrow both pieces. PromptIR instead conditions a Restormer backbone on learned prompts. FIT (Bend the Basics) predicts a per-pixel severity map to bend its tokenization, at a reported 15–20% slowdown. These methods all optimize pixel fidelity measured by PSNR or SSIM, and all are too heavy for 10^4–10^5 tiles per slide. We keep their central idea, that a compact code describing the degradation should steer the repair. We move the repair from pixels into the frozen encoder's embedding space and replace the pixel loss with a diagnosis-preserving loss.
Research Program
The first component is a compound slide corruption generator. It extends Histopath-C from tiles to slides. Each slide receives a global component, such as a stain shift or illumination change, plus spatially smooth random fields that set local defocus, noise level and contamination. Bubble and dust masks cover contiguous regions. Corruption types and severities are mixed per region, and some combinations are held out entirely for testing. Because the clean slide is always available, every corrupted tile has a paired clean embedding. Lesion masks are also available for reliability scoring.
The second component is the degradation encoder. A small network reads the tile's frozen embedding together with cheap pixel statistics of the tile, such as a blur measure and color moments. Following AirNet's contrastive design, it is trained so that nearby tiles from the same corrupted slide region, which share a degradation, are pulled together, and tiles from differently corrupted regions are pushed apart. The code therefore describes how a tile is damaged and should ignore what tissue it contains. We test this by checking that the code is not predictive of tissue class.
The third component is the embedding restorer. It is a residual network that applies scale-and-shift modulation conditioned on the degradation code. Writing $h$ for a corrupted tile embedding, $c$ for its degradation code and $h^\ast$ for the clean embedding of the same tile, the restorer outputs $\hat h = h + r_\theta(h, c)$. It is trained with
$$\mathcal{L} = \lVert \hat h - h^\ast \rVert^2 + \lambda_1\, \mathrm{KL}\big(p_T(Y\mid H^\ast)\,\Vert\, p_T(Y\mid \hat H)\big) + \lambda_2\, \mathrm{KL}\big(a_T(H^\ast)\,\Vert\, a_T(\hat H)\big).$$
In this objective, $H^\ast$ and $\hat H$ are the clean and repaired bags. $p_T$ is the slide prediction of a frozen MIL teacher trained on clean slides. $a_T$ is that teacher's attention distribution over tiles. The two weights $\lambda_1$ and $\lambda_2$ balance the terms. The bag terms let MIL supply supervision that pixel restorers never receive: errors on tiles the diagnosis depends on are penalized more than errors on irrelevant tiles. To keep the restorer from overfitting one aggregator, we train it with a pool of teachers (ABMIL, CLAM, mean pooling) and test it on aggregators held out of that pool.
Baselines
The naive reference is clean-trained ABMIL and CLAM run on corrupted slides with no intervention. Its reliability counterpart is MEAN-POOL-INS, which Beyond accuracy found most reliable. These bound how much damage there is to recover.
The strongest competitor is corruption-augmented MIL. We retrain ABMIL and CLAM on bags of embeddings corrupted by the same generator, with the same encoder, the same training slides and the same hyperparameter search budget as our restorer. Augmentation is the obvious and cheap way to buy robustness, so beating it is the real test.
The second competitor is quality filtering. A tile-level corruption classifier, trained on the same synthetic data, discards tiles above a severity threshold before pooling.
The third is pixel restoration. PromptIR is fine-tuned on corrupted and clean pathology tile pairs from our generator and applied to every tile before encoding. Because full-slide pixel restoration is costly, we run it on a fixed subset of test slides and report wall-clock time per slide next to accuracy.
The fourth is test-time adaptation in the spirit of LATTE. Low-rank adapters on the tile encoder are updated on each test slide using the MIL model's pseudo-labels.
Ablations isolate the key ingredients. We remove the degradation code, which makes the restorer an unconditional denoiser. We train with the regression term only, so the restorer is not task-aware. We train with the bag terms only.
For reference, the clean-data figures are those reported by CLAM: AUC 0.953 on Camelyon16 lymph node metastasis, 0.956 on NSCLC subtyping and 0.991 on RCC subtyping. We found no reported result on Lacuna for slide-level MIL under synthetic compound corruption, so the corrupted-data baselines will be measured here. Beating the strongest competitor means two things. On held-out corruption combinations, the restorer must match or exceed augmented MIL in AUC, with non-overlapping bootstrap intervals. It must also exceed augmented MIL in attention AUPRC. On seen combinations, it must stay within one interval width of augmented MIL, while requiring no retraining of the aggregator.
Why not just…?
Why not just train the MIL model on corrupted bags? This is the most serious threat, and it may well match us on corruptions seen during training. Our bet rests on two arguments. First, augmentation teaches one aggregator to tolerate a fixed corruption distribution, whereas a degradation-conditioned repair applied tile by tile should compose to unseen mixtures. Second, augmentation must be redone for every MIL model and task, whereas the restorer is trained once. The held-out-combination split and the held-out-aggregator test settle both arguments directly. If augmentation matches us there too, we will report that the only remaining advantage is modularity, and that is a much weaker paper.
Why not just throw away the corrupted tiles? Filtering works when damage is small and sparse. It fails in two common cases. When defocus or stain fade covers most of the slide, too few tiles survive. When contamination happens to sit on the lesion, the evidence for a small metastasis on Camelyon16 is deleted along with the damage. Our generator includes both regimes, and we report results separately for low and high damaged-area fractions, so the comparison will show where filtering suffices.
Why not just restore pixels with an all-in-one model first? The mixture-of-prompts pathology result (Cai et al.) shows that pixel restoration can recover tile accuracy, but its authors flag the cost as unsolved. Pixel restorers are also optimized for perceptual fidelity, which can alter morphology. Our pixel-restoration baseline measures both accuracy and time per slide. If it wins clearly on accuracy, the embedding approach survives only as a cost trade-off, and we will say so.
Why not just adapt the encoder at test time? LATTE-style adaptation (Histopath-C) was shown to help on isolated tile corruptions. Adapting to one slide's pseudo-labels, however, applies a single update to a slide whose damage varies by region, and the update can reinforce attention on artifacts. The compound, spatially varying test set is exactly where this should break, and the comparison measures whether it does.
Proposed Experiments
The main study uses Camelyon16, where lesion masks allow reliability scoring, together with TCGA NSCLC and RCC subtyping cohorts as used by CLAM. The frozen encoder is a pathology foundation model of the kind used in the Cai et al. pipeline (UNI). Corruptions follow the five Histopath-C families, composed as described above. We report slide AUC, the three reliability metrics from Beyond accuracy and compute per slide, broken down by severity, by damaged-area fraction and by seen versus held-out corruption combinations.
Three checks are decisive. The first is compositional: train the restorer and augmented MIL on single and paired corruptions, then test on triples and on unseen pairings. The second is transfer: train the restorer with ABMIL and mean-pooling teachers and apply it unchanged in front of CLAM and DTFD-MIL. The third tests whether bag-level supervision matters: if the regression-only ablation matches the full objective, the MIL contribution is nil.
A secondary check addresses realism, since everything above is synthetic. We apply the restorer to CLAM's independent test cohorts and its cellphone-microscopy setting, where reported AUCs fall to 0.873 on NSCLC and 0.921 on RCC. If the restorer cannot narrow that real-world gap at all, the synthetic gains likely reflect the generator rather than real slide damage.
References
- Beyond accuracy: Quantifying the reliability of multiple instance learning for whole slide image classification
- Histopath-C: Towards Realistic Domain Shifts for Histopathology Vision-Language Adaptation
- Pathology Image Restoration via Mixture of Prompts
- All-In-One Image Restoration for Unknown Corruption
- PromptIR: Prompting for All-in-One Image Restoration
- Bend the Basics: Degradation-Aware Deformable Tokenization for All-in-One Image Restoration
- Data Efficient and Weakly Supervised Computational Pathology on Whole Slide Images