Manuscript Offprint

arXiv:2610.28007

AdaptMIL: Domain Adaptation for Multiple Instance Learning in Digital Pathology

Ben Vardi, Dana Schonberger, Yuval Friedmann, Zohar Yakhini, Iris Barshack, Alexander Loebel, Ariel Shamir

ABSTRACT

Pathology foundation models (PFMs) support a wide range of histopathology tasks on whole-slide images through multiple instance learning (MIL). Despite recent progress, these models remain sensitive to cross-hospital distribution shifts: performance often degrades when a task head (e.g., classification) is trained on data from one hospital and then used on data from another hospital. To address this challenge, we propose AdaptMIL, a training strategy for integrating domain adaptation into MIL training. AdaptMIL is motivated by our finding that directly applying domain adaptation objectives during MIL training can interfere with MIL aggregation learning, often resulting in performance degradation over standard training. AdaptMIL resolves this by decoupling representation-level domain alignment learning from MIL aggregation learning through a two-stage training procedure. We show that AdaptMIL improves cross-hospital performance and outperforms alternative adaptation methods across experiments spanning multiple WSI datasets, tasks, PFMs, MIL architectures, and domain adaptation objectives. AdaptMIL's code will be released upon publication.

1 INTRODUCTION

The emergence of modern pathology foundation models (PFMs) has driven substantial progress in digital pathology in recent years (Chen et al., 2024; Lu et al., 2024; Filiot et al., 2025). These models take digitized tissue images as input and produce general-purpose representations that can support a wide range of downstream histopathology tasks, including cancer detection, tumor subtyping, biomarker prediction, and survival analysis (Neidlinger et al., 2026).

Unlike conventional image encoders that process standard-sized images, PFMs are used to process extremely large images, commonly referred to as whole-slide images (WSIs), which can contain billions of pixels. This requires a specialized processing pipeline: a WSI is first divided into smaller patches, each patch is independently encoded by a PFM into a patch-level representation, and finally, the patch representations are aggregated into a single slide-level embedding using a weakly supervised multiple instance learning (MIL) module, most commonly trained from scratch per task (Wang et al., 2024; Shao et al., 2025).

Despite their progress, PFM-based MIL pipelines may still struggle in real-world deployment conditions. A major challenge is their limited robustness to variability across hospitals from which tissue samples were collected, arising from differences in tissue processing protocols (Kömen et al., 2026). As a result, the performance of task heads (e.g., classifiers) built on PFM representations degrades when the MIL module and task head are trained on data from one hospital and used on data from another (Fernandez-Romero et al., 2026; Umer et al., 2026). This poses a practical limitation, since labeled data from a specific target hospital is often unavailable due to costly and time-consuming expert annotation, whereas unlabeled data from that hospital may be readily available. Meanwhile, labeled data from other source hospitals may already be available, a setting known as unsupervised domain adaptation (UDA) (Wilson & Cook, 2020).

A direct approach is to fine-tune the pretrained PFM toward the target hospital domain. This can be done using domain adaptation objectives in the UDA setting, and requires labels for individual image patches from source-domain WSIs. Although this approach has been explored before (Vardi et al., 2026), its applicability is limited by the scarcity of patch-level annotations in pathology. By contrast, slide-level annotations are more readily available and can be used for end-to-end PFM fine-tuning. However, this requires propagating gradients from the slide-level objective through the MIL module and back through the PFM across hundreds or thousands of patches per slide, substantially increasing the computational cost compared with training the MIL module alone (Campanella et al., 2025; Kumar & Vanderbilt, 2026).

In this work, we pursue a simpler alternative: we keep the pretrained PFM frozen and perform adaptation within the MIL training pipeline, using only slide-level supervision. We find that a standard approach to unsupervised domain adaptation, which combines a task loss on the labeled source domain and a domain alignment objective to align the source and target domains, can fail when applied to MIL pipelines. In particular, we find that domain alignment and learned MIL aggregation can interfere with one another: rather than learning more domain-invariant representations, the MIL module reduces the domain discrepancy by altering its aggregation pattern. This can result in performance below source-only training.

To address this, we propose AdaptMIL, a two-stage MIL training strategy for domain adaptation that decouples domain alignment from aggregation learning. The first stage trains a patch-level projection layer to make representations more domain-aligned and uses fixed mean pooling to aggregate them into slide-level rep-

Figure

Figure 1: AdaptMIL improves cross-hospital performance across PFMs such as UNI and H0-mini and across domain adaptation objectives. It is motivated by the observation that directly applying standard UDA during MIL training often degrades performance.

representations. Source–target domain alignment is performed on these slide-level representations together with a source task objective that preserves task-discriminative information. In the second stage, the MIL aggregation is trained using the source task objective on top of the adapted projection layer learned in the first stage. By performing domain alignment before learning the aggregation mechanism, AdaptMIL prevents the MIL module from altering its aggregation pattern to satisfy the alignment objective, resulting in gains over source-only training (Fig. 1).

Across experiments on multi-hospital datasets, we show that AdaptMIL outperforms source-only MIL training and alternative adaptation methods. We demonstrate these gains across multiple PFMs, slide-level tasks, domain alignment objectives, and MIL aggregation methods. Our code will be released upon publication.

Our contributions are:

• We explore UDA in slide-level pathology MIL pipelines and identify a failure mode for jointly learning domain alignment and MIL aggregation.

• We introduce AdaptMIL, a two-stage training strategy for MIL that decouples domain alignment from aggregation learning and can be applied across different MIL architectures.

• We evaluate AdaptMIL across multiple pathology tasks, WSI datasets, PFMs, MIL architectures, and domain alignment objectives, and demonstrate improved cross-hospital performance over source-only training and other adaptation approaches.

2 RELATED WORK

References (45)

  • the CAMELYON17 challenge
  • Eidoslab/torchstain: v1.2.0-stable, August 2022
  • Clinical-grade computational pathology using weakly supervised deep learning on whole slide images
  • Nature Medicine, 31(9):3002–3010, 2025
  • Nature medicine, 30(3):850–862, 2024
  • Not-so-supervised: A survey of semi-supervised, multi-instance, and transfer learning in medical image analysis
  • Solving the multiple instance problem with axis-parallel rectangles
  • Nature medicine, 31(11):3749–3761, 2025
  • Domain generalisation challenges in breast cancer molecular classification using foundation models: a cross-cohort exploratory study
  • Domain-adversarial training of neural networks
  • Nature communications, 12(1):4423, 2021
  • Knowledge-guided adaptation of pathology foundation models effectively improves cross-domain generalization and demographic fairness
  • Attention-based deep multiple instance learning
  • Transfer learning library
  • Nature Communications, 17(1):5218, 2026
  • Universal encoding of pan-cancer histology by deep texture representations
  • Single GPU task adaptation of pathology foundation models for whole slide image analysis
  • Dual-stream multiple instance learning network for whole slide image classification with self-supervised contrastive learning
  • Unveiling institution-specific bias in pathology foundation models: Detriments, causes, and potential solutions, 2025
  • HASD: Hierarchical adaptation for pathology slide-level domain-shift
  • Learning transferable features with deep adaptation networks
  • SGDR: Stochastic Gradient Descent with Warm Restarts
  • Decoupled Weight Decay Regularization
  • Data-efficient and weakly supervised computational pathology on whole-slide images
  • Nature medicine, 30(3):863–874, 2024
  • A method for normalizing histology slides for quantitative analysis
  • Nature biomedical engineering, pp. 1113–1123, 2026
  • Nature Biomedical Engineering, 6(12):1407–1419, 2022
  • Advancing horizons in remote sensing: a comprehensive survey of deep learning models and applications in image classification and beyond
  • Color transfer between images
  • Do multiple instance learning models transfer? In Forty-second International Conference on Machine Learning, 2025
  • Transformer based correlated multiple instance learning for whole slide image classification
  • Morphological prototyping for unsupervised slide representation learning in computational pathology
  • Deep CORAL: Correlation alignment for deep domain adaptation
  • Scanner-induced domain shifts undermine the robustness of pathology foundation models, 2026
  • Adversarial discriminative domain adaptation
  • A multicenter benchmark of multiple instance learning models for lymphoma subtyping from HE-stained whole slide images
  • Discrepancy minimization improves cross-hospital robustness in digital pathology, 2026
  • Nature medicine, 30(10):2924–2935, 2024
  • Distill-SODA: Distilling self-supervised vision transformer for source-free open-set domain adaptation in computational pathology
  • Advances in multiple instance learning for whole slide image analysis: Techniques, challenges, and future directions (opens arXiv in a new tab)
  • Deep visual domain adaptation: A survey
  • A survey of unsupervised deep domain adaptation
  • Accelerating data processing and benchmarking of AI models for pathology, 2025
  • Deep subdomain adaptation network for image classification