Beyond Attention Heatmaps: How to Get Better Explanations for Multiple Instance Learning Models in Histopathology

Mina Jamshidi Idaji, Julius Hense, Tom Neuhauser, Augustin Krause, Yanqing Luo, Oliver Eberle, Thomas Schnake, Laure Ciernik, Farnoush Rezaei Jafari, Reza Vahidimajd, Jonas Dippel, Christoph Walz, Frederick Klauschen, Andreas Mock, Klaus-Robert Müller

Abstract

Multiple instance learning (MIL) has enabled substantial progress in computational histopathology, where a large amount of patches from gigapixel whole slide images are aggregated into slide-level predictions. Heatmaps are widely used to validate MIL models and to discover tissue biomarkers. Yet, the validity of these heatmaps has barely been investigated. In this work, we introduce a general framework for evaluating the quality of MIL heatmaps without requiring additional labels. We conduct a large-scale benchmark experiment to assess six explanation methods across histopathology task types (classification, regression, survival), MIL model architectures (Attention-, Transformer-, Mamba-based), and patch encoder backbones (UNI2, Virchow2). Our results show that explanation quality mostly depends on MIL model architecture and task type, with perturbation ("Single"), layer-wise relevance propagation (LRP), and integrated gradients (IG) consistently outperforming attention-based and gradient-based saliency heatmaps, which often fail to reflect model decision mechanisms. We further demonstrate the advanced capabilities of the best-performing explanation methods: (i) We provide a proof-of-concept that MIL heatmaps of a bulk gene expression prediction model can be correlated with spatial transcriptomics for biological validation, and (ii) showcase the discovery of distinct model strategies for predicting human papillomavirus (HPV) infection from head and neck cancer slides. Our work highlights the importance of validating MIL heatmaps and establishes that improved explainability can enable more reliable model validation and yield biological insights, making a case for a broader adoption of explainable AI in digital pathology. Our code is provided in a public GitHub repository: https://github.com/bifold-pathomics/xMIL/tree/xmil-journal

Introduction: The Problem with Attention

In computational pathology, Whole Slide Images (WSIs) are gigapixel-sized files too large for standard neural networks. Researchers use Multiple Instance Learning (MIL), where an image is broken into thousands of small patches. A model looks at these patches and aggregates them into a single slide-level prediction, such as cancer detection or survival risk.

To understand why a model made a prediction, researchers generate heatmaps to see which patches were most influential. Usually, they rely on the model's internal "attention weights." However, there is a growing concern that these heatmaps are often "pathologist-pleasing" rather than "model-faithful" — meaning they might highlight what a human expects to see rather than what the model actually used to arrive at its decision. This paper addresses the lack of systematic, label-free evaluation for these explanations.

Methods: A Framework for Faithfulness

The authors propose a framework called patch flipping to measure faithfulness. The logic is simple: if a heatmap correctly identifies the most important patches, removing those patches should cause the model's prediction to change drastically. Conversely, removing "unimportant" patches should have little effect. By measuring the area between these two perturbation curves, they calculate a Symmetric Relevance Gain (SRG) score.

Overview of the MIL explanation framework (a) and task-specific heads (b).

The study benchmarked six explanation methods across three MIL architectures (Attention-MIL, TransMIL, MambaMIL) and two state-of-the-art foundation model backbones (UNI2, Virchow2):

  1. Attention (Attn): The standard internal weights.
  2. Single: A perturbation method that passes each patch through the model individually.
  3. Integrated Gradients (IG): A gradient-based method that integrates path-wise gradients.
  4. Layer-wise Relevance Propagation (LRP): A method that "redistributes" the output score back through the layers.
  5. Gradient × Input (G×I) & Saliency (Grad2): Simpler gradient-based baselines.

These methods were evaluated across classification, regression, and survival tasks, as shown in the task head diagrams above.

Key Insights and Results

The benchmark revealed several critical findings:

  • Attention is not Explanation: In many cases, attention heatmaps performed no better than a random baseline in terms of faithfulness. They often highlight features necessary for the model but not sufficient to drive the final prediction.
  • Architecture Matters: The "best" explanation method depends on the model. For Transformer-based models (like TransMIL), LRP is the clear winner. For simpler Attention-MIL or the newer Mamba-based models, the Single perturbation method is often most faithful.
  • Faithfulness Ranking: Across 60 experimental settings, Single, LRP, and IG consistently outperformed Attention and other gradient-based methods. "Single" achieved the best average rank (1.8), followed closely by LRP (2.1), while Attention trailed significantly at 5.3 (where 7 is the worst).

Biological Validation and Discovery

The authors demonstrated that faithful heatmaps lead to more valid biological insights. Using the HEST-1k dataset, which pairs H&E slides with spatial transcriptomics, they proved that faithful heatmaps (like LRP) correlate significantly better with ground-truth gene expression patterns than attention heatmaps (Pearson correlations of 0.54–0.78 vs. noisy results).

Furthermore, by analyzing LRP heatmaps, the authors discovered that models use different "strategies" for the same task. For example, in HPV prediction, some models focused on the tumor itself, while others looked at the surrounding immune cell infiltration. This highlights how improved explainability can uncover distinct biological patterns and model behaviors.

Conclusion

This work establishes a rigorous framework for validating MIL heatmaps and demonstrates that commonly used attention weights are often unreliable. By adopting more faithful methods like LRP or Single, researchers can ensure that their models are validated correctly and can discover more robust biological biomarkers. The authors suggest that future work should extend these metrics to capture complex feature interactions and multimodal data.

Summary updated

Abstract

Multiple instance learning (MIL) has enabled substantial progress in computational histopathology, where a large amount of patches from gigapixel whole slide images are aggregated into slide-level predictions. Heatmaps are widely used to validate MIL models and to discover tissue biomarkers. Yet, the validity of these heatmaps has barely been investigated. In this work, we introduce a general framework for evaluating the quality of MIL heatmaps without requiring additional labels. We conduct a large-scale benchmark experiment to assess six explanation methods across histopathology task types (classification, regression, survival), MIL model architectures (Attention-, Transformer-, Mamba-based), and patch encoder backbones (UNI2, Virchow2). Our results show that explanation quality mostly depends on MIL model architecture and task type, with perturbation ("Single"), layer-wise relevance propagation (LRP), and integrated gradients (IG) consistently outperforming attention-based and gradient-based saliency heatmaps, which often fail to reflect model decision mechanisms. We further demonstrate the advanced capabilities of the best-performing explanation methods: (i) We provide a proof-of-concept that MIL heatmaps of a bulk gene expression prediction model can be correlated with spatial transcriptomics for biological validation, and (ii) showcase the discovery of distinct model strategies for predicting human papillomavirus (HPV) infection from head and neck cancer slides. Our work highlights the importance of validating MIL heatmaps and establishes that improved explainability can enable more reliable model validation and yield biological insights, making a case for a broader adoption of explainable AI in digital pathology. Our code is provided in a public GitHub repository: https://github.com/bifold-pathomics/xMIL/tree/xmil-journal
BibTeX
@article{idaji2026beyond,
  author = {Mina Jamshidi Idaji and Julius Hense and Tom Neuhauser and Augustin Krause and Yanqing Luo and Oliver Eberle and Thomas Schnake and Laure Ciernik and Farnoush Rezaei Jafari and Reza Vahidimajd and Jonas Dippel and Christoph Walz and Frederick Klauschen and Andreas Mock and Klaus-Robert Müller},
  title = {{Beyond Attention Heatmaps: How to Get Better Explanations for Multiple Instance Learning Models in Histopathology}},
  journal = {Medical Image Analysis},
  year = {2026},
  doi = {10.1016/j.media.2026.104148},
}
Figure