TL;DR
Multiple Instance Learning (MIL) models often struggle when applied to medical images from new, unseen hospitals due to distribution shifts. This paper introduces Retrieval-Augmented MIL (RAM-MIL), a framework that uses Optimal Transport to retrieve and merge similar examples from a database. This approach effectively reduces the data's intrinsic dimensionality and significantly boosts both in-domain and out-of-domain performance.
The Challenge of Domain Shift in Computational Pathology
In computational pathology, Whole Slide Images (WSIs) are gigapixel-sized images that are too large to process at once. They are typically analyzed using Multiple Instance Learning (MIL): the image is chopped into thousands of smaller patches (or "instances") to form a "bag." The model then predicts a single label for the entire bag (e.g., "cancerous" or "normal") without needing patch-level annotations.
While state-of-the-art MIL models perform exceptionally well on test data from the same distribution as the training data (e.g., the same hospital), their performance degrades sharply on out-of-domain (OOD) data. A model trained on slides from Hospital A might fail on slides from Hospital B due to differences in tissue staining, scanners, or preparation protocols. This paper tackles this distribution shift, aiming to build a more robust MIL framework capable of unsupervised domain adaptation.
Methods: Retrieval-Augmented MIL (RAM-MIL)
To address these generalization issues, the authors propose Retrieval-Augmented MIL (RAM-MIL). This framework enhances a standard attention-based MIL model (like CLAM) by augmenting its features with data retrieved from a reference database.
The RAM-MIL pipeline operates through the following key steps:
- Pre-training: A standard MIL model is trained to extract patch-level features and assign an "attention score" to each patch, indicating its importance to the final diagnosis.
- Bags as Distributions: Instead of treating a WSI as a simple average of its patches, RAM-MIL treats it as a discrete probability distribution. The patches are the data points, and their pre-calculated attention scores act as their "probability mass."
- Optimal Transport (OT) Retrieval: To find the most similar WSI in a retrieval dataset, RAM-MIL uses Optimal Transport (solved via Sinkhorn's algorithm). OT calculates the "cheapest" way to move the attention mass from the patches of one WSI to the patches of another. This provides a highly accurate, structure-aware distance metric between two bags.
- Feature Merging: Once the nearest neighbor bag is retrieved, its representation is merged with the query bag's representation (e.g., via a convex combination).
- Classification: A final classifier makes the prediction based on this merged, context-rich feature vector.
Key Insights and Ideas
- Dimensionality is the enemy of generalization: The authors provide a mathematical proof showing that the approximation error of an attention-based MIL model is bounded by the intrinsic dimensionality of the input data.
- Retrieval shrinks the space: By retrieving and merging nearest neighbors, RAM-MIL actively reduces the intrinsic dimension of the feature space. This theoretical insight perfectly explains why retrieval improves the model's ability to generalize to new domains.
- Attention as Mass: Using pre-trained attention weights as the "mass" for Optimal Transport is a clever design choice. It forces the distance metric to prioritize matching the most diagnostically relevant patches (like tumor cells) rather than wasting effort matching background tissue.
- Free Interpretability: The OT transport matrix inherently maps connections between instances. If you know which patches are cancerous in a retrieved reference slide, you can use the transport matrix to trace them back and highlight the likely cancerous patches in your query slide—all without extra training.
Datasets and Key Results
The models were evaluated primarily on medical WSI datasets, including Camelyon16 & Camelyon17 (breast cancer metastasis), as well as TCGA-NSCLC, CPTAC-UCEC, and CPTAC-LSCC for subtyping and domain adaptation tasks. General MIL benchmarks (MUSK1, MUSK2, FOX, TIGER, ELEPHANT) were also used to prove the method's versatility outside of medical imaging.
- In-domain Performance: On Camelyon16, RAM-MIL achieved an AUC of 0.9451, outperforming the strong CLAM baseline (0.9177) and other state-of-the-art methods like TransMIL and Bayes-MIL.
- Out-of-domain (OOD) Generalization: When trained on Camelyon16 and tested on Camelyon17, RAM-MIL boosted the AUC to 0.7974 compared to CLAM's 0.7613.
- Unsupervised Domain Adaptation: In a challenging adaptation task (CPTAC-LSCC to CPTAC-UCEC), RAM-MIL improved the AUC by over 10 points (0.6056 vs. CLAM's 0.4986).
- Ablation: The Optimal Transport distance metric was crucial. It significantly outperformed simpler retrieval methods based on Euclidean ($l_2$) or Hausdorff distances.
Limitations and Future Work
The primary limitation acknowledged by the authors is computational cost. A single WSI can contain over 100,000 patches, making the Optimal Transport calculation incredibly slow. To mitigate this in the current paper, the authors only computed OT on the top 10% to 20% of patches with the highest attention scores. While this heuristic worked well empirically, developing a more principled and efficient method for scaling OT solvers to massive bags of instances remains a necessary direction for future work.
Summary updated