Source-linked AI summary

DeCo-MIL: Debiased Counterfactual Reasoning for Long-Tailed Whole Slide Image Analysis

Xiaoxiao Li, Xitong Ling, Jiawen Li, Weiming Chen, Zhenyang Cai, Xidong Wang, Tian Guan, Benyou Wang, Yonghong He

arXiv:2608.14719v1cs.CVcs.AI

TL;DR

Long-tailed WSI classification suffers from coupled slide-level class imbalance and within-slide scarcity of discriminative patches. DeCo-MIL uses frequency-debiased counterfactual reasoning, redundancy masking, and tail-aware pseudo-bag augmentation to address both levels, achieving state-of-the-art overall and tail-class performance across three benchmarks.

  • Problem

    Long-tailed WSI classification couples scarce tail-class slides with sparse, redundancy-obscured discriminative patches, limiting tail recognition and overall reliability.

  • Method

    DeCo-MIL uses debiased counterfactual contributions from tissue anchors to guide redundancy masking, then applies anchor-stratified pseudo-bags and tail-aware oversampling.

  • Results

    DeCo-MIL achieves the highest mean on every reported metric across three datasets, with Tail-F1 gains of 18.82, 7.40, and 6.98 percentage points over the best baselines.

  • Takeaways & Limitations

    DeCo-MIL delivers state-of-the-art overall and tail-class performance on three long-tailed WSI datasets.

Abstract

from arXiv · show

Multiple instance learning (MIL) is widely used for weakly supervised whole slide image (WSI) analysis. However, under long-tailed distributions, MIL-based WSI analysis faces a nested dual long-tail: an inter-slide class long tail and an intra-slide long tail of instance-level discriminative evidence. The two long tails are coupled: tail classes have few training slides, while their limited diagnostic evidence is concentrated in a few patches and obscured by abundant within-bag redundancy. This coupling biases models toward head classes and degrades rare-class recognition. To address this, we propose DeCo-MIL for long-tailed WSI analysis, which jointly alleviates the nested dual long-tail through frequency-debiased counterfactual reasoning. For the inner long tail, DeCo-MIL clusters patches into tissue-morphology anchors, replaces each anchor with its matched normal prototype to perform a counterfactual intervention, and estimates its counterfactual contribution to the ground-truth class using class-frequency-corrected predictions. These contributions guide redundancy masking to preserve scarce discriminative instances. For the outer long tail, DeCo-MIL constructs anchor-stratified pseudo-bags from redundancy-reduced bags and combines tail-aware oversampling with consistency regularization, increasing effective supervision for tail classes while preserving tissue-morphology composition. Extensive experiments on three long-tailed WSI benchmarks demonstrate that DeCo-MIL achieves state-of-the-art performance in both tail-class recognition and overall classification.

Introduction

The introduction frames long-tailed WSI classification as a nested dual long-tail: slide-level class imbalance is coupled with sparse, redundant instance-level evidence. DeCo-MIL addresses both levels through frequency-debiased counterfactual reasoning, redundancy masking, and tail-aware pseudo-bag augmentation.

  • Research gap: The method jointly targets coupled class-level and instance-level imbalance rather than addressing only tail-class recognition through representation or aggregation improvements.Prior MIL advances improve overall accuracy but implicitly assume balanced label distributions, while existing long-tailed methods do not explicitly preserve sparse diagnostic morphology.
  • Motivation: Class imbalance causes MIL models to overfit head classes and underfit tail classes, weakening rare-class recognition and overall reliability.Clinical WSI categories are heavily skewed, with common subtypes dominating and rare categories having few samples.
  • Problem formulation: Long-tailed WSI classification combines an outer slide-level class long tail with an inner long tail of sparse, discriminative instances within each slide.Only a small subset of patches carries diagnostic information, while common or redundant tissue patterns dominate the bag.
  • DeCo-MIL: DeCo-MIL uses matched normal prototypes for counterfactual interventions and frequency-debiased contribution estimates to guide redundancy masking of scarce diagnostic evidence.Debiasing is necessary because long-tailed class frequencies distort posterior predictions and can hide tail evidence during attribution.
  • DeCo-MIL: DeCo-MIL constructs anchor-stratified pseudo-bags from redundancy-reduced bags and applies tail-aware augmentation to alleviate the inter-slide class long tail.The pseudo-bags preserve tissue-morphology composition while increasing effective supervision for tail classes.

Related Work

Related work improves WSI classification through increasingly adaptive aggregation and redundancy reduction, while long-tailed learning adapts rebalancing and representation methods to pathology. Counterfactual reasoning provides established tools for attribution and model debiasing, motivating class-specific evidence analysis.

  • WSI MIL Aggregation: WSI MIL aggregation has progressed from prior-based non-parametric pooling to learnable attention and Transformer-based mechanisms for adaptive weighting and global context.Representative methods include AB-MIL, CLAM, TransMIL, and FR-.
  • Redundancy Reduction: Redundancy removal and hard-instance mining suppress uninformative regions, but class-agnostic selection may overlook scarce tail-class evidence.Examples include MHIM-MIL, AMD-MIL, and SAM-MIL.
  • Long-Tailed Learning: Long-tailed learning spans resampling, margin-based loss rebalancing, augmentation, logit adjustment, transfer learning, decoupled training, and ensemble learning.WSI adaptations include MDE-MIL’s multimodal distillation-driven ensemble learning and SC-MIL’s supervised contrastive learning for imbalanced pathology.
  • Counterfactual Reasoning: Counterfactual reasoning supports attribution through masking or replacement and output changes, while SHAP unifies feature attributions and CAL contrasts factual and counterfactual predictions for debiasing.The cited attribution methods include occlusion and meaningfulperturbation.

Method

DeCo-MIL addresses nested inter-slide and intra-slide long tails with a three-stage pipeline: debiased counterfactual scoring preserves discriminative morphology, then tail-aware pseudo-bag training improves supervision for rare classes.

  • Overall framework: DeCo-MIL first trains and freezes a standard MIL judge, then uses it to score morphology anchors and train the final model with redundancy reduction and pseudo-bags.The three stages comprise judge training, debiased counterfactual scoring with masking-ratio estimation, and final training with tail-aware oversampling and consistency regularization.
  • Counterfactual reasoning: Global K-means forms K = 64 shared morphology anchors, each matched to a similar normal prototype for group-level counterfactual intervention.Replacing all instances assigned to an anchor with its matched normal prototype estimates how the frozen model’s diagnosis changes while reducing intervention-induced feature shift.
  • Counterfactual reasoning: Frequency-calibrated counterfactual contributions identify discriminative anchors: large ground-truth decreases indicate evidence, whereas near-zero changes indicate redundancy.Anchor scoring also penalizes anchors supporting the highest-probability competing class; λ = 0.6 and ϵ = 10^-8 are used in the reported implementation.
  • Redundancy reduction: Anchor-specific masking ratios preferentially retain high-contribution morphology and aggressively remove low-contribution redundancy, with masking computed offline and random removal performed online.Normal slides use rk = 0, while retained instances are resampled at each visit to provide instance-level augmentation.
  • Tail-aware training: Tail-aware oversampling combines redundancy-reduced bags with anchor-stratified pseudo-bags, generating Mpb = 3 labeled pseudo-bags per visit while preserving retained anchors.The final objective sums main-bag and pseudo-bag cross-entropy with consistency regularization; β = 0.5, and inference uses only the final model on the original full bag.

Experiments

Across three long-tailed WSI benchmarks, DeCo-MIL achieves the strongest reported overall performance while improving rare-class recognition without sacrificing head-class performance. Ablation, robustness, concentration, and visualization analyses support its counterfactual masking, frequency debiasing, and anchor-stratified sampling design.

  • Overall comparison: DeCo-MIL achieves the highest mean on every reported metric across Camelyon+-LT, PANDA-LT, and TissueNet-LT, with especially pronounced gains in rare-class recognition.The evaluation covers four-class Camelyon+-LT, six-class PANDA-LT, and four-class TissueNet-LT under imbalance ratios of 30, 50, and 10, respectively.
  • Overall comparison: DeCo-MIL substantially improves Tail-F1 while keeping Head-F1 comparable to strong baselines and also improving Medium-F1 across all three datasets.The tail-class gains are not obtained at the expense of head-class recognition.
  • Ablation studies: Counterfactual-guided masking provides the most immediate tail-class gains, while frequency debiasing further improves tail-class performance on Camelyon+-LT and TissueNet-LT.On PANDA-LT, frequency debiasing improves overall metrics while largely preserving Tail-F1.
  • Ablation studies: Matched normal prototype replacement performs best across all three datasets, outperforming zero replacement and morphology-prototype replacement for counterfactual construction.Zero replacement produces off-manifold features, whereas morphology prototypes retain anchor-specific tissue semantics.
  • Ablation studies: Anchor-stratified pseudo-bag sampling achieves the highest macro-F1 and Tail-F1 across all three datasets, consistently improving tail-class performance.Random sampling can omit scarce discriminative regions, while equal-per-anchor sampling alters tissue-morphology composition.
  • Robustness analysis: Under PANDA-LT imbalance ratios IR ∈{10, 20, 30, 40, 50}, DeCo-MIL maintains more stable overall and tail-class performance than AB-MIL as imbalance increases.AB-MIL declines markedly with increasing imbalance, particularly in Tail-F1.
  • Long-tail analysis: The top 10% of anchors account for 53%–74% of total positive contribution while covering only 15%–22% of patches, with concentration increasing from Head to Tail.This supports the coupling between class-level and instance-level long tails.
  • Interpretability analysis: On tail-class slides, high-contribution regions spatially agree with annotated lesions and receive higher retention probabilities, while non-discriminative regions are preferentially masked.The visualization illustrates that debiased counterfactual reasoning identifies lesion-related morphologies and preserves them during redundancy masking.

Conclusion

The paper frames long-tailed WSI analysis as a coupled nested dual long-tail and proposes DeCo-MIL to preserve scarce discriminative instances through frequency-debiased counterfactual reasoning.

  • Conclusion: DeCo-MIL addresses the coupled inter-slide class and intra-slide instance-level discriminative-evidence long tails in WSI analysis.The framework explicitly treats these as a nested dual long-tail problem.
  • Conclusion: DeCo-MIL uses matched normal prototypes for frequency-debiased counterfactual reasoning to quantify tissue-morphology-anchor contributions.These quantified contributions characterize the discriminative value of tissue-morphology anchors.
  • Conclusion: The quantified anchor contributions guide redundancy masking, thereby preserving scarce discriminative instances.Redundancy masking is the stated mechanism for retaining limited diagnostic evidence.

A Dataset Details and Long-Tail Construction … B Implementation Details and Training Protocol

The paper evaluates DeCo-MIL on three long-tailed WSI benchmarks using standardized patch preprocessing, class-specific training construction, adaptive frequency-based grouping, and morphology-normal prototype construction. Training distributions vary across datasets, while validation and testing remain class-balanced and prototype construction excludes validation and test slides.

  • A.1 Common Preprocessing and Split Protocol: WSIs are tiled into non-overlapping 512×512 patches at 20×, encoded with frozen CONCH features, and ℓ2-normalized before prototype construction and MIL training.The frozen feature encoder is shared by all methods.
  • A.1 Common Preprocessing and Split Protocol: Class-balanced validation and test quotas are fixed before training, while PANDA-LT and TissueNet-LT training sets are class-wise downsampled and Camelyon+-LT retains its natural imbalance.Validation and test sets are never downsampled; realized imbalance ratios can differ slightly from nominal values because of rounding or limited class pools.
  • A.2 Head, Medium, and Tail Groups: Head, Medium, and Tail groups are assigned from final training frequencies for evaluation and analysis, not model training.When any class has fewer than 20 slides, thresholds of more than 100 and fewer than 20 define Head and Tail; otherwise frequencies are divided into three balanced contiguous groups.
  • A.3 Camelyon+-LT: Camelyon+-LT has four lymph-node metastasis categories and a naturally imbalanced training distribution with realized IR 844/28 ≈30.1.No artificial downsampling is applied when constructing its training split.
  • A.4 PANDA-LT: PANDA-LT is a six-class prostate cancer grading task with head-to-tail order (0, 1, 2, 4, 3, 5) and realized IR 2,303/46 ≈50.1.Its validation and test sets are identical across the reported imbalance-ratio settings.
  • A.5 TissueNet-LT: TissueNet-LT contains four cervical pathology categories, uses head-to-tail order (1, 0, 2, 3), and realizes IR 238/23 ≈10.3.The tail-class target is ⌊238/10⌋ = 23.
  • A.6 Morphology and Normal Prototypes: Global K-means produces K = 64 morphology prototypes from ℓ2-normalized training patches, assigning each patch to its nearest prototype by cosine similarity.The clustering pool contains at most K × 10,000 patches.
  • A.6 Morphology and Normal Prototypes: Normal prototypes are independently learned with Kn = 32 from label-0 training slides and matched to morphology prototypes by cosine-nearest neighbors.Neither prototype set uses validation or test slides.

B.1 Three-Stage Training Pipeline · B.2 Frequency-Debiased Counterfactual Attribution

DeCo-MIL uses a three-stage pipeline in which a frozen judge performs offline, frequency-debiased counterfactual attribution before final-model training. Anchor contributions compare factual and intervention-based calibrated predictions, then determine slide-wise masking while preserving higher-contribution evidence.

  • B.1 Three-Stage Training Pipeline: DeCo-MIL trains a judge on original full bags for 30 epochs, freezes it, performs attribution without gradients, and then trains a freshly initialized final model.The judge is trained separately for each random seed and used solely for offline scoring.
  • B.1 Three-Stage Training Pipeline: The resulting causal table is reused throughout final-model training for the same seed, while the discarded judge adds training-time overhead but no inference parameters or computation.Training uses one WSI per batch, and final performance is reported over five independent runs.
  • B.2 Frequency-Debiased Counterfactual Attribution: For each non-empty morphology anchor, DeCo-MIL replaces its instances with a matched normal prototype and evaluates the resulting counterfactual slide.The frozen judge produces frequency-calibrated probabilities before anchor contributions are computed.
  • B.2 Frequency-Debiased Counterfactual Attribution: Anchor contributions use frequency-calibrated log-posteriors, incorporating both target-class logit changes and intervention-induced changes in prior-adjusted normalization.Calibration affects factual and intervened predictions through the difference between their normalization terms.
  • B.2 Frequency-Debiased Counterfactual Attribution: The method fixes the strongest competing class from the original calibrated prediction and combines ground-truth and competing-class contributions.The weighting parameter λ trades off class specificity against calibrated absolute contribution.
  • B.2 Frequency-Debiased Counterfactual Attribution: With λ = 0.6, the prior-dependent normalization term remains active with coefficient 1 −λ = 0.4 in the final anchor score.The calibrated log-probability applies class-frequency correction through the prior term and normalization factor.
  • B.2 Frequency-Debiased Counterfactual Attribution: Anchor scores are normalized slide-wise with ϵ = 10^-8; higher-contribution anchors receive lower masking ratios, while normal slides use rk = 0.The maximum masking ratio is rmax = 0.9 for Camelyon+-LT and rmax = 0.5 for PANDA-LT and TissueNet-LT; identical scores normalize to zero.

C Precise Definitions of Ablation Strategies … D.1 Hyperparameter Sensitivity

The ablation definitions isolate masking, counterfactual construction, and pseudo-bag sampling choices under largely shared experimental settings. The proposed variants preserve or modify tissue-anchor composition through distinct rules for masking and sampling.

  • C.1 Masking Strategies: All masking strategies share features, prototype assignments, the frozen judge, masking limits, model architecture, optimization, and tail-aware training settings.These controls are held fixed within each random seed.
  • Counterfactual-Guided Masking: The proposed counterfactual-guided masking strategy derives anchor ratios from frequency-debiased counterfactual scores.These ratios guide the masking policy.
  • Random Masking: Random masking independently permutes each slide’s causal-ratio vector, preserving its multiset, mean, and sum but not necessarily the realized patch-level masked fraction P.The permutation is uniformly sampled.
  • Anchor-Size Masking: Anchor-size masking assigns higher masking ratios to larger tissue regions, while equal non-empty anchor sizes produce zero ratios.The strategy depends on anchor instance counts.
  • Attention-Based Masking: Attention-based masking assigns higher masking ratios to anchors with lower mean attention, while identical non-empty-anchor means produce zero ratios.Mean attention is computed from the frozen judge’s patch attention.
  • C.2 Counterfactual Constructions: The compared counterfactual constructions replace all instances in a target anchor while leaving other instances unchanged, with three constructions summarized in Table C.1.All other Stage-1 and Stage-2 settings remain unchanged.
  • C.3 Pseudo-Bag Sampling Strategies: Pseudo-bag strategies use the same redundancy-reduced bag, ρ = 0.5, Mpb = 3, source-slide label, and training objective, though integer rounding and lower bounds can change sizes.The shared sampling ratio does not guarantee identical pseudo-bag sizes.
  • C.3 Pseudo-Bag Sampling Strategies: Random sampling draws round(ρ|X⋆|) instances globally, equal-per-anchor sampling allocates near-equal quotas, and anchor-stratified sampling samples every retained anchor while keeping at least one instance.Anchor-stratified sampling is the proposed strategy.

Sensitivity to λ

Sensitivity analysis across six λ settings identifies λ = 0.6 as the best unified choice, balancing absolute contribution and competing-class suppression. With λ fixed at 0.6, frequency calibration further improves tail recognition on two datasets and overall metrics on PANDA-LT.

  • Sensitivity to λ: λ = 0.6 achieves the highest macro-F1 and Tail-F1 on all three datasets.The evaluation covers λ = 0, 0.2, 0.4, 0.6, 0.8, and 1.0, with each bar averaging five runs.
  • Sensitivity to λ: λ = 0.6 balances class-specific contrast with the calibrated absolute-contribution term, unlike λ = 1, which removes the latter.The result supports retaining a nonzero absolute contribution while preserving competing-class suppression.
  • Sensitivity to λ: Frequency calibration improves Tail-F1 on Camelyon+-LT and TissueNet-LT, while improving overall metrics on PANDA-LT with Tail-F1 largely preserved.“+ Counterfactual” uses τ = 0, whereas “+ Debiasing” uses τ = 1; both fix λ = 0.6 and keep other components unchanged.

Sensitivity to rmax · D.2 Nested Dual Long-Tail Statistics

Sensitivity analysis selects dataset-specific masking while fixing a unified oversampling setting, and nested dual long-tail statistics show that discriminative contribution is concentrated in few anchors, increasingly so for tail classes.

  • Sensitivity to rmax: The rmax sweep evaluates six settings from 0.4 to 0.9, with each bar representing the mean over five runs.The corresponding results are reported in Fig. D.2.
  • Sensitivity to rmax: Camelyon+-LT achieves its best macro-F1 and Tail-F1 at rmax = 0.9, whereas PANDA-LT and TissueNet-LT use rmax = 0.5.The masking ratio is selected per dataset and then fixed across runs and comparisons.
  • Sensitivity to rmax: The α sweep evaluates six settings from 0.5 to 1.0, also averaging each bar over five runs.The corresponding results are reported in Fig. D.3.
  • Sensitivity to rmax: α = 0.8 provides the strongest overall balance on Camelyon+-LT and PANDA-LT and the highest Tail-F1 on TissueNet-LT.Although α = 1.0 gives slightly higher macro-F1 on TissueNet-LT, its Tail-F1 is lower.
  • D.2 Nested Dual Long-Tail Statistics: For PANDA-LT at IR=50, contribution statistics group lesion slides into Head, Medium, and Tail classes, then average valid anchor contributions within each group.For anchor k, only slides where the anchor is present and has a valid contribution are included.
  • D.2 Nested Dual Long-Tail Statistics: Slides are equally weighted within each frequency group, while absent anchors and groups without valid observations are excluded from the corresponding statistics.Normal slides are omitted because no counterfactual contribution is stored for them.
  • D.2 Nested Dual Long-Tail Statistics: 53%–74% of total positive contribution comes from the top 10% of anchors, which cover only 15%–22% of patches.The top-ranked anchors are defined using non-negative contribution statistics and their patch coverage is measured over the same lesion slides.
  • D.2 Nested Dual Long-Tail Statistics: The Gini coefficient increases from Head to Tail, indicating greater concentration of contribution among anchors for tail groups.The ranked-contribution and concentration curves are shown in Figure 5 of the main paper.

D.3 Additional Visualization Results

Additional Camelyon+-LT visualizations show that positive counterfactual contributions localize to annotated tumor regions across varied lesion morphologies, while non-lesion regions are mostly near-zero or negative. Supplementary figures also examine sensitivity to λ, maximum masking ratio rmax, and oversampling strength α.

  • Interpretability visualizations: Across small, fragmented, and extensive lesions, high positive counterfactual contributions generally align with official tumor annotations despite substantial tissue-morphology variation.The visualizations use correctly classified Camelyon+-LT slides with differing lesion extents.
  • Interpretability visualizations: Most non-lesion regions exhibit near-zero or negative counterfactual contributions, contrasting with the annotated tumor regions.Figure D.4 presents these contribution patterns alongside morphology-anchor assignments and expected retention maps.
  • Sensitivity analyses: Supplementary sensitivity visualizations evaluate λ, the maximum masking ratio rmax, and oversampling strength α, with each bar averaged over five runs.These analyses are shown in Figures D.1–D.3.
Loading 2608.14719v1…