Manuscript Offprint

arXiv:2609.08419

CAR-MIL: Counterfactual Attention Regularization for Multiple Instance Learning

Imane Chraki, Pierre Marza, Stergios Christodoulidis, Maria Vakalopoulou

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Imane Chraki¹,², Pierre Marza¹,², Stergios Christodoulidis¹,², and Maria Vakalopoulou¹,²

¹ Université Paris-Saclay, CentraleSupélec, Gustave Roussy, INSERM, IHU PRISM, Cancer Data Science Unit, France

² Université Paris-Saclay, CentraleSupélec, MICS Laboratory, France

Abstract. Multiple Instance Learning (MIL) is widely used for weakly supervised learning, particularly in digital pathology, where fine-grained annotations are costly. Most MIL methods aggregate instance features via attention mechanisms. However, attention weights do not always faithfully reflect instance importance and may focus on spuriously correlated regions. In this work, we propose CAR-MIL, a framework that explicitly guides attention learning through a counterfactual attention regularization objective inspired by counterfactual explanations. Built on a standard attention-based MIL architecture, our approach introduces a lightweight counterfactual attention branch trained to produce an alternative prediction while remaining close to the factual attention distribution. This encourages prediction changes to arise from minimal, structured redistributions of attention, leading to more informative evidence allocation. The resulting factual and counterfactual attention maps capture complementary evidence: the former highlights regions supporting the prediction, while the latter reveals regions whose reweighting would challenge it. We evaluate our method on synthetic MIL benchmarks with instance-level ground truth enabling controlled analysis of attention behavior and on five digital pathology datasets across four tasks. CAR-MIL maintains competitive classification performance, with the largest gains observed on more challenging tasks, while improving attention reliability, demonstrating the benefits of integrating counterfactual explainability reasoning into attention learning. Code is available at: https://github.com/ImaneCR/CAR-MIL/.

1 Introduction

Multiple Instance Learning (MIL) addresses learning from weakly-annotated data, where samples are organized into bags of instances, and labels are assigned only at the bag level [12, 26].

Attention-based MIL methods [17, 23, 38] address this challenge by learning a weighted aggregation of instance features into a bag representation, and achieve high predictive performance. Despite recent progress, two major limitations remain. First, as shown in recent studies [13, 16, 19, 41], MIL attention

I. Chraki et al.

(a) Dropping highly-attended instances (BRCA)

Figure

(b) Qualitative visualisation of attention maps (BRACS)

Fig. 1: CAR-MIL is a multiple instance learning method to model complex interactions between relevant regions using counterfactual explanation. (a) Dropping highly-attended instances for CAR-MIL leads to a higher performance drop than ABMIL on the TCGA-BRCA dataset. (b) Qualitative example from the BRACS dataset: the factual attention correctly focuses on the Ductal Carcinoma In Situ (DCIS) areas and predicts the correct slide-level label, whereas the counterfactual attention reallocates evidence and predicts the Benign class.

may highlight irrelevant or spuriously-correlated regions, both degrading performance and interpretability. Such an issue can arise from training instability, with the attention collapsing and highlighting only a small set of regions [34,42]. Secondly, current methods only emphasize evidence supporting the predicted class while providing little insight into evidence that contradicts the decision, limiting both their reliability and their explanatory capacity. This is for example problematic in medical applications, where attention maps are often used to justify automated decisions. These observations suggest that attention should not be treated merely as a by-product of optimization but its training should be guided to reflect how evidence supporting or contradicting a prediction is allocated across instances.

A natural framework for reasoning about such evidence is provided by counterfactual explanations (CE) [37], which characterize predictions through minimal changes to the input of a model that would alter its output. This counterfactual perspective distinguishes evidence supporting a decision from evidence that challenges it. Importantly, existing CE methods provide post-hoc interpretability, as they are applied to a trained model to better understand its decision-making process. However, as showcased earlier, in the case of MIL, evidence reasoning should be performed at training time. We thus propose two main adaptations to this framework: (i) integrating CE at training time to guide the learning of attention, (ii) performing perturbations in attention instead of input space as it is more adapted to MIL. To the best of our knowledge, such an adaptation of CE to MIL training has not been studied in previous work. Recent methods begin to incorporate counterfactual interventions into the training of attention [9,31] but this is different from what we propose. Indeed, the latter rely on random attention perturbations while we believe learning such perturbations is beneficial.

In this work, we introduce CAR-MIL (Figure 1), a method trained to provide a factual and counterfactual attentions following CE principles. The coun-terfactual attention is constrained to remain close to the factual attention while producing a different prediction, encouraging changes to arise from selective redistributions of attention across instances. We propose a double-branch design yielding complementary attention maps: the factual attention highlights regions supporting the prediction, while the counterfactual attention reveals regions refuting it. Our framework introduces a new learning paradigm where the model learns how reallocating attention across instances affects the predicted outcome and therefore providing a contrastive training signal that guides attention learning dynamics. The counterfactual branch is implemented as a lightweight attention module sharing the encoder and classifier with the factual branch, therefore introducing minimal computational overhead and requiring no additional supervision. We evaluate CAR-MIL on synthetic MIL benchmarks designed to assess interaction modelling [16], as well as on five digital pathology datasets across four tasks. Across all settings, our method consistently maintains a competitive classification performance, with the largest performance gains observed on the more challenging tasks, while producing more reliable attention distributions, as confirmed by both quantitative metrics and qualitative analysis.

Our contributions can be summarized as follows: (i) We introduce for the first time counterfactual attention regularization for MIL, enforcing prediction divergence under minimal attention perturbations. (ii) We learn complementary factual and counterfactual attention distributions that reveal supporting and refuting evidence within attention maps. (iii) We demonstrate that explicitly guiding attention during training maintains or improves both predictive accuracy and interpretability in attention-based MIL models.

References (42)

  • Sanity checks for saliency maps
  • investigate neural networks! Journal of machine learning research **20**(93), 1–8
  • On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation
  • How to explain individual classification decisions
  • Diagnostic assessment of deep learning algorithms for detection of lymph node metastases in women with breast cancer
  • Bracs: A dataset for breast carcinoma subtyping in h&e histology images
  • On the tractability of shap explanations
  • Towards a general-purpose foundation model for computational pathology
  • Counterfactual intervention in attention multiple instance learning for digital pathology
  • Imagenet: A large-scale hierarchical image database
  • The mnist database of handwritten digit images for machine learning research [best of the web]
  • Solving the multiple instance problem with axis-parallel rectangles
  • Inherently interpretable time series classification via multiple instance learning (opens arXiv in a new tab)
  • Model agnostic interpretability for multiple instance learning (opens arXiv in a new tab)
  • Deep residual learning for image recognition
  • Xmil: Insightful explanations for multiple instance learning in histopathology
  • Attention-based deep multiple instance learning
  • Towards Faithfully Interpretable NLP Systems: How Should We Define and Evaluate Faithfulness?
  • Additive mil: Intrinsically interpretable multiple instance learning for pathology
  • The (un) reliability of saliency methods
  • Adam: A Method for Stochastic Optimization
  • Dual-stream multiple instance learning network for whole slide image classification with self-supervised contrastive learning
  • Ai-based pathology predicts origins for cancers of unknown primary
  • Data-efficient and weakly supervised computational pathology on whole-slide images
  • Torchvision: Pytorch's computer vision library
  • A framework for multiple-instance learning
  • General pitfalls of model-agnostic interpretation methods for machine learning models
  • Layer-wise relevance propagation: an overview
  • Improving interpretability for computer-aided diagnosis tools on whole slide imaging with multiple instance learning and gradient-based explanations
  • Bi-directional weakly supervised knowledge distillation for whole slide image classification
  • Counterfactual attention learning for fine-grained visual categorization and re-identification
  • Transmil: Transformer based correlated multiple instance learning for whole slide image classification
  • Learning important features through propagating activation differences
  • Multiple instance learning framework with masked hard instance mining for whole slide image classification
  • Feature re-embedding: Towards foundation model-level performance in computational pathology
  • Review the cancer genome atlas (tcga): an immeasurable source of knowledge
  • Counterfactual explanations without opening the black box: Automated decisions and the gdpr
  • Transformer-based biomarker prediction from colorectal cancer histology: A large-scale multicentric study
  • Machine learning models for multiparametric glioma grading with quantitative result interpretations
  • Nystromformer: A nystrom-based algorithm for approximating self-attention
  • Dtfd-mil: Double-tier feature distillation multiple instance learning for histopathology whole slide image classification
  • Attention-challenging multiple instance learning for whole slide image classification