Paper deep dive
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
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 91%
Last extracted: 8/18/2026, 4:18:33 AM
Summary
The paper introduces DeCo-MIL, a method for long-tailed whole slide image (WSI) analysis using multiple instance learning (MIL). It addresses a 'nested dual long-tail' problem consisting of inter-slide class imbalance and intra-slide instance-level evidence scarcity. DeCo-MIL employs frequency-debiased counterfactual reasoning to identify and preserve discriminative tissue-morphology anchors while masking redundancy. It further alleviates class imbalance through tail-aware oversampling and anchor-stratified pseudo-bag construction, achieving state-of-the-art performance on three benchmarks.
Entities (14)
Relation Signals (11)
DeCo-MIL → addresses → Long-tailed Distribution
confidence 95% · DeCo-MIL for long-tailed WSI analysis, which jointly alleviates the nested dual long-tail
Multiple Instance Learning → appliedto → Whole-Slide Image
confidence 95% · Multiple instance learning (MIL) is widely used for weakly supervised whole slide image (WSI) analysis.
DeCo-MIL → uses → Counterfactual Reasoning
confidence 92% · jointly alleviates the nested dual long-tail through frequency-debiased counterfactual reasoning
DeCo-MIL → evaluatedon → PANDA-LT
confidence 90% · Extensive experiments on three long-tailed WSI benchmarks... PANDA-LT
DeCo-MIL → evaluatedon → Camelyon+-LT
confidence 90% · Extensive experiments on three long-tailed WSI benchmarks... Camelyon+-LT
DeCo-MIL → evaluatedon → TissueNet-LT
confidence 90% · Extensive experiments on three long-tailed WSI benchmarks... TissueNet-LT
DeCo-MIL → uses → Redundancy Masking
confidence 90% · These contributions guide redundancy masking to preserve scarce discriminative instances.
DeCo-MIL → uses → Tail-Aware Oversampling
confidence 90% · combines tail-aware oversampling with consistency regularization
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract: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.
Tags
Links
- Source: https://arxiv.org/abs/2608.14719v1
- Canonical: https://arxiv.org/abs/2608.14719v1
Trouble viewing inline? Open PDF directly →
Full Text
73,775 characters extracted from source content.
Expand or collapse full text
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 Abstract 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 Advances in deep learning and computing power have driven the adoption of computational pathology in diagnosis. However, a whole slide image (WSI) is a gigapixel pathology scan that cannot be processed at full resolution, while pixel- or region-level annotation is prohibitively expensive. Multiple instance learning (MIL) has thus become the dominant paradigm for WSI analysis using only slide-level annotations. In MIL, a WSI is tessellated into thousands of patches after non-tissue background removal; the patches are then encoded by a pretrained encoder and aggregated into a bag-level representation for classification. Figure 1: The nested dual long-tail: (a) the inter-slide class long tail, (b) the intra-slide long tail of instance-level discriminative evidence. Research on MIL for WSIs advances along two complementary directions—stronger patch representations and more expressive aggregation—steadily improving overall accuracy. These advances, however, implicitly assume a balanced label distribution. In real clinical data, diagnostic categories are heavily long-tailed: common subtypes dominate while rare yet critical categories have few samples. Under such skew, MIL models overfit head classes and underfit tail classes, weakening tail recognition and overall reliability. We argue that the difficulty of long-tailed WSI classification does not arise from a single source of imbalance, but from a nested dual long-tail. At the outer level, the numbers of slides across diagnostic categories follow a long-tailed distribution. At the inner level, instance-level discriminative evidence within each slide is also long-tailed: only a small subset of instances in a bag carries diagnostic information, while most correspond to common tissue patterns or redundant, non-discriminative content. The two levels are therefore not independent: tail classes already contain fewer training slides, while their limited discriminative evidence is further obscured by abundant redundant instances within each bag. This coupling makes slide-level class rebalancing alone insufficient to fully recover tail-class performance. Existing long-tailed WSI methods, including MDE-MIL (16) and SC-MIL (9), improve tail recognition through multimodal ensemble learning or supervised contrastive learning. However, how to explicitly identify and preserve sparse diagnostic morphologies within tail-class bags remains underexplored. A natural way to expose this evidence is to score each region by counterfactual attribution—replacing a region and observing how the prediction changes; however, under a long tail the model’s posterior is distorted by class frequency, so reading it directly keeps tail evidence hidden, and the attribution must be performed after debiasing. We therefore propose DeCo-MIL, a WSI classification method that jointly addresses the nested dual long-tail problem through debiased counterfactual reasoning. At the inner level, we perform counterfactual interventions by replacing each tissue anchor with a matched normal prototype and use frequency-debiased counterfactual contributions to guide redundancy masking, thereby uncovering buried tail-class evidence. At the outer level, we construct anchor-stratified pseudo-bags from the redundancy-reduced subset and oversample tail-class slides, further amplifying at the slide level the tail evidence recovered in the preceding step. Our contributions are summarized as follows: • We characterize long-tailed WSI classification as a nested dual long-tail and empirically reveal the coupling between its class-level and instance-level evidence long tails. • We introduce debiased counterfactual-guided redundancy masking to identify and preserve scarce intra-slide discriminative evidence. • We develop tail-aware stratified pseudo-bag augmentation to alleviate the inter-slide class long tail. • Experiments on three long-tailed WSI benchmarks demonstrate that our method outperforms the baseline methods in both tail-class and overall performance. Related Work Multiple Instance Learning for WSIs MIL studies for WSI classification have largely focused on improving bag aggregation. Instance aggregation has evolved from prior-based non-parametric pooling to learnable attention mechanisms that assign adaptive weights to instances, such as AB-MIL (8) and CLAM (19). To capture long-range dependencies and model global context, self-attention- and Transformer-based aggregators have also been widely explored, including TransMIL (24) and FR-MIL (3). Complementary directions include graph-based methods for modeling relational dependencies among patches, such as H2-MIL (7) and WiKG (12), and clustering-based methods, such as MiCo (13), PANTHER (25) and PAMoE (30). Other studies suppress uninformative regions through redundancy removal or hard-instance mining, including masked hard-instance mining (MHIM-MIL (27)), attention-driven selection (AMD-MIL (17)), and saliency-guided masking (SAM-MIL (5)). However, these methods generally use class-agnostic selection criteria, identifying broadly salient regions rather than class-specific evidence and potentially overlooking scarce tail-class evidence. Long-Tailed Learning In natural images, mainstream approaches to the long-tailed problem span resampling (1), margin-based loss rebalancing (2), data augmentation (4), logit adjustment (23; 21), transfer learning (29), decoupled training (10), and ensemble learning (28). Recent work brings these into WSIs: MDE-MIL (16) addresses long-tailed pathology with multimodal distillation-driven ensemble learning, and SC-MIL (9) handles imbalanced pathology with supervised contrastive learning. These methods improve representations and decision boundaries under imbalanced slide distributions, while explicit morphology-level evidence estimation and redundancy control within tail-class bags remain underexplored. Counterfactual Reasoning Counterfactual reasoning has been widely used to analyze and improve deep models. For explanation and attribution, occlusion (32) and meaningful-perturbation (6) methods measure the importance of an input region by masking or replacing it and observing the output change, and SHAP (20) unifies such feature attributions through Shapley values. For debiasing, CAL (22) suppresses spurious focus by contrasting factual and counterfactual attention, whereas De-confound-TDE (26) treats the head-class momentum as a confounder and removes its direct effect at inference to improve tail classes in long-tailed recognition. In computational pathology, CIMIL (15) uses counterfactual-inference-based sub-bag evaluation and hierarchical instance searching for binary tumor detection, while IBMIL (14) performs backdoor adjustment at the bag-representation level to deconfound contextual priors. However, none of these works is specifically tailored to long-tailed classification. Figure 2: Overview of the DeCo-MIL training framework. (a) WSI preprocessing and prototype clustering. (b) Debiased counterfactual scoring maps anchor contributions to masking ratios. (c) Tail-class oversampling and anchor-stratified sampling construct pseudo-bags. (d) The main and pseudo-bag auxiliary branches jointly train the final MIL model. Method Problem Formulation After background removal, a whole-slide image (WSI) is divided into a large number of patches. Multiple instance learning (MIL) represents each slide as a bag of instances and uses only slide-level supervision. Let =(Xi,yi)i=1MD=\(X_i,y_i)\_i=1^M denote the training set, where XiX_i contains NiN_i patches and yi∈1,…,Cy_i∈\1,…,C\ is the slide-level label. A frozen encoder ϕφ maps the n-th patch to an ℓ2 _2-normalized feature: xi,n=ϕ(patchi,n)∥ϕ(patchi,n)∥2∈ℝd.x_i,n= φ(patch_i,n) φ(patch_i,n) _2 ^d. (1) The resulting bag is Xi=xi,nn=1NiX_i=\x_i,n\_n=1^N_i. An MIL aggregator g summarizes the instances into a slide representation, from which a classifier h predicts the class probabilities: pi=softmax(h(g(Xi))).p_i=softmax (h (g(X_i) ) ). (2) Inter-slide Class Long Tail. Let ncn_c be the number of training slides in class c, with n1≥n2≥⋯≥nCn_1≥ n_2≥·s≥ n_C. We measure the skew of the class distribution by the imbalance ratio IR=maxcncmincnc.IR= _cn_c _cn_c. (3) When IRIR is large, slide-level supervision is dominated by head classes, biasing the model against tail classes. Intra-slide Long Tail of Instance-level Discriminative Evidence. Within each instance bag, the discriminative contributions of individual instances follow a highly skewed, long-tailed distribution: only a small fraction of patches carry the dominant diagnostic evidence, whereas the majority correspond to normal tissue or non-discriminative redundancy. Since instance-level annotations are unavailable, this evidence distribution cannot be directly observed. The subsequent Visualization and Analysis section provides empirical support for the intra-slide long tail of instance-level discriminative evidence and its coupling with the class-level long tail through an analysis of debiased counterfactual contributions. Method Overview As illustrated in Fig. 2, DeCo-MIL follows three stages. In Stage 0, a standard MIL model is trained on the original bags and frozen as fjudgef_judge. In Stage 1, the frozen judge estimates debiased counterfactual contributions for shared morphology anchors and maps them to anchor-specific masking ratios. In Stage 2, these masking ratios are used to construct redundancy-reduced bags and anchor-stratified pseudo-bags for training ffinalf_final with tail-aware oversampling and consistency regularization. Only ffinalf_final is used for inference. Debiased Counterfactual-Guided Redundancy Masking DeCo-MIL intervenes on groups of morphologically related instances rather than individual patches. We apply global K-means clustering to all training patch features and obtain K=64K=64 fixed morphology prototypes Hkk=1K\H_k\_k=1^K. Each patch is assigned to its nearest anchor by cosine similarity: zn=argmaxkcos(xn,Hk).z_n= *arg\,max_k (x_n,H_k). (4) Because the prototypes are shared across the training set, they provide a common feature-space reference across slides. We additionally cluster patches from normal slides and select, for each HkH_k, the most similar normal prototype q^k q_k. For anchor k in slide X, we perform a model-level counterfactual intervention do(xn=q^k)do(x_n= q_k) for all instances assigned to that anchor while leaving the remaining instances unchanged. Let Xdo(k)=x~n(k)n=1NX^do(k)=\ x_n^(k)\_n=1^N denote the intervened bag, where x~n(k)=q^k,zn=k,xn,zn≠k. x_n^(k)= cases q_k,&z_n=k,\\ x_n,&z_n≠ k. cases (5) This intervention asks how the frozen model’s diagnosis would change if the k-th morphology were replaced by its matched normal counterpart. Compared with zeroing or random noise, normal-prototype replacement helps reduce intervention-induced feature shift. We next evaluate the prediction change using the frozen judge model. Since class frequency can bias its posterior toward head classes, we calibrate the judge logits using the training prior πc=nc/∑c′nc′ _c=n_c/ _c n_c , following prior-aware logit adjustment (21): p′(c∣X)=softmax(fjudge(X)−τlogπ)c.p (c X)=softmax\! (f_judge(X)-τ π )_c. (6) Here, τ controls the calibration strength, and is set to 1.01.0 for all datasets. The debiased counterfactual contribution of anchor k to class c is the difference in debiased log-probability before and after the intervention: E′kc=logp′(c∣X)−logp′(c∣Xdo(k)).E _k^\,c= p (c X)- p \! (c X^do(k) ). (7) For the ground-truth class y, a large E′kyE _k^\,y indicates that replacing anchor k substantially decreases the probability of the ground-truth class, suggesting that the anchor carries discriminative evidence. A contribution close to zero instead indicates likely redundancy. To penalize non-specific anchors that also support competing classes, we define y~=argmaxc≠yp′(c∣X) y= _c≠ yp (c X) as the highest-probability non-ground-truth class under the frequency-calibrated prediction of the original slide. We define the anchor score as: sk=E′ky−λE′ky~.s_k=E _k^\,y-λ\,E _k^\, y. (8) Equivalently, sk=λ(Ek′y−Ek′y~)+(1−λ)Ek′ys_k=λ(E_k y-E_k y)+(1-λ)E_k y balances class-specific contrast with frequency-calibrated ground-truth contribution. Based on sensitivity analysis, we set λ=0.6λ=0.6 for all datasets, thereby retaining the frequency-calibrated normalization term in sks_k. We apply slide-wise min-max normalization to the anchor scores, denoted by Norm(sk)Norm(s_k), with ϵ=10−8ε=10^-8 added to the denominator for numerical stability, and map them to masking ratios: rk=rmax[1−Norm(sk)].r_k=r_ [1-Norm(s_k) ]. (9) Here, rmax<1r_ <1 is the maximum masking ratio. High-contribution anchors receive smaller masking ratios and are preferentially retained, whereas low-contribution anchors are more aggressively removed. We set rk=0r_k=0 for normal slides. All masking ratios are computed offline before final model training; instance-level random removal is performed online as described next. Tail-Aware Pseudo-Bag Augmentation Although the preceding redundancy-masking stage recovers discriminative evidence within each bag, tail classes still suffer from limited slide-level samples. We therefore construct stratified pseudo-bags from redundancy-reduced bags and combine them with class-aware oversampling. For slide X, let GkG_k be the instance set assigned to anchor k, and let =k:Gk≠∅K=\k:G_k≠ \ denote the set of its non-empty anchor indices. Based on rkr_k, we randomly retain instances from each anchor to obtain the redundancy-reduced bag: X∗=⋃k∈RandSubset(Gk,⌊(1−rk)|Gk|⌉). X^*= _k RandSubset (G_k,\, (1-r_k)|G_k| ). (10) Here, RandSubset(G,m)RandSubset(G,m) uniformly samples m instances without replacement, and ⌊⋅⌉ · denotes nearest-integer rounding. With fixed masking ratios, retained instances are resampled at each visit, providing instance-level augmentation. We then construct pseudo-bags by stratified sampling over the retained anchors. Let Gk∗G_k^* be the instances of anchor k retained in X∗X^*, and let ∗=k∈:Gk∗≠∅K^*=\k :G_k^*≠ \. The m-th pseudo-bag is B(m)=⋃k∈⋆RandSubset(Gk⋆,max1,⌊ρ|Gk⋆|⌉),B^(m)= _\!k RandSubset\! (G_k , \1, ρ|G_k | \ ), (11) where the sampling ratio is fixed at ρ=0.5ρ=0.5. The lower bound of one prevents any retained anchor from being omitted, reducing the risk that a discriminative anchor is absent from a pseudo-bag. At every visit, we independently generate Mpb=3M_pb=3 pseudo-bags inheriting the source-slide label y. Class-level rebalancing is implemented through tail-aware oversampling. Let nmaxn_ be the size of the largest class. A slide from class c is sampled aca_c times per epoch: ac=clip(round[(nmaxnc)α],1,cap),a_c=clip (round [ ( n_ n_c )^α ],1,cap ), (12) where α controls the oversampling strength and capcap limits the maximum number of repetitions; we set cap=8cap=8 across datasets. Tail-class slides are thus sampled more frequently, and each sampling generates different redundancy-reduced bags and pseudo-bags. The resulting X∗X^* and pseudo-bags are used by the main and auxiliary branches, respectively. Method Camelyon+-LT (IR=30) PANDA-LT (IR=50) TissueNet-LT (IR=10) ACC(%) AUC(%) F1(%) Tail-F1(%) ACC(%) AUC(%) F1(%) Tail-F1(%) ACC(%) AUC(%) F1(%) Tail-F1(%) AB-MIL 61.562.5461.56_ 2.54 87.761.6987.76_ 1.69 52.462.7152.46_ 2.71 0.000.000.00_ 0.00 51.280.8351.28_ 0.83 86.740.3686.74_ 0.36 45.901.3045.90_ 1.30 19.853.3819.85_ 3.38 56.671.0556.67_ 1.05 83.060.9683.06_ 0.96 49.640.8149.64_ 0.81 0.000.000.00_ 0.00 CLAM-SB 63.751.5363.75_ 1.53 89.430.5989.43_ 0.59 54.541.6154.54_ 1.61 0.000.000.00_ 0.00 49.480.5049.48_ 0.50 86.800.3286.80_ 0.32 41.740.8441.74_ 0.84 6.763.226.76_ 3.22 55.500.4155.50_ 0.41 81.960.4381.96_ 0.43 48.420.3048.42_ 0.30 0.000.000.00_ 0.00 CLAM-MB 61.880.7761.88_ 0.77 80.460.3680.46_ 0.36 52.840.8252.84_ 0.82 0.000.000.00_ 0.00 51.400.8451.40_ 0.84 86.930.2886.93_ 0.28 45.701.6845.70_ 1.68 18.405.2118.40_ 5.21 59.500.8559.50_ 0.85 83.820.5783.82_ 0.57 52.751.4752.75_ 1.47 3.674.873.67_ 4.87 DS-MIL 64.693.6464.69_ 3.64 88.652.3188.65_ 2.31 55.673.5555.67_ 3.55 0.000.000.00_ 0.00 57.401.2357.40_ 1.23 88.320.3588.32_ 0.35 55.181.5055.18_ 1.50 41.686.1541.68_ 6.15 62.832.5162.83_ 2.51 86.161.8686.16_ 1.86 57.471.7057.47_ 1.70 15.484.3715.48_ 4.37 TransMIL 63.123.0663.12_ 3.06 83.822.4883.82_ 2.48 56.594.3056.59_ 4.30 14.379.7414.37_ 9.74 53.351.4953.35_ 1.49 85.461.1085.46_ 1.10 51.082.3151.08_ 2.31 40.618.2140.61_ 8.21 63.332.6463.33_ 2.64 86.361.6186.36_ 1.61 60.533.2960.53_ 3.29 26.9610.5426.96_ 10.54 ILRA-MIL 64.693.2264.69_ 3.22 88.731.2788.73_ 1.27 56.774.2256.77_ 4.22 6.935.666.93_ 5.66 58.020.8558.02_ 0.85 88.470.3288.47_ 0.32 56.600.6956.60_ 0.69 45.672.8245.67_ 2.82 62.832.2762.83_ 2.27 84.660.9884.66_ 0.98 60.962.8760.96_ 2.87 35.427.2335.42_ 7.23 MHIM-MIL 62.191.5362.19_ 1.53 88.171.0988.17_ 1.09 53.151.9653.15_ 1.96 0.000.000.00_ 0.00 56.850.7756.85_ 0.77 87.620.3287.62_ 0.32 55.381.3855.38_ 1.38 45.043.3145.04_ 3.31 63.502.9163.50_ 2.91 84.991.4584.99_ 1.45 59.354.3459.35_ 4.34 20.6713.8120.67_ 13.81 MiCo-MIL 60.001.5960.00_ 1.59 87.271.3887.27_ 1.38 51.211.4451.21_ 1.44 4.715.764.71_ 5.76 54.822.1754.82_ 2.17 87.040.6987.04_ 0.69 52.462.5152.46_ 2.51 37.865.8137.86_ 5.81 66.833.6366.83_ 3.63 87.720.6587.72_ 0.65 65.094.3665.09_ 4.36 41.018.3841.01_ 8.38 AMD-MIL 61.562.7261.56_ 2.72 84.743.2984.74_ 3.29 54.162.5054.16_ 2.50 14.6012.1514.60_ 12.15 57.021.0957.02_ 1.09 87.740.4287.74_ 0.42 55.181.5355.18_ 1.53 43.863.2543.86_ 3.25 63.671.3563.67_ 1.35 85.500.6085.50_ 0.60 62.531.1162.53_ 1.11 36.813.4436.81_ 3.44 WiKG-MIL 63.123.3763.12_ 3.37 89.382.5689.38_ 2.56 57.004.0957.00_ 4.09 15.825.2415.82_ 5.24 59.271.8459.27_ 1.84 88.550.7388.55_ 0.73 57.812.4657.81_ 2.46 44.855.0244.85_ 5.02 63.831.2563.83_ 1.25 85.070.3785.07_ 0.37 61.921.1261.92_ 1.12 36.125.4036.12_ 5.40 MDE-MIL 60.621.8260.62_ 1.82 85.832.5685.83_ 2.56 52.952.7052.95_ 2.70 17.814.9517.81_ 4.95 56.081.6256.08_ 1.62 86.790.9786.79_ 0.97 54.662.4354.66_ 2.43 45.526.7545.52_ 6.75 65.501.7265.50_ 1.72 87.240.5087.24_ 0.50 64.091.6864.09_ 1.68 39.394.2239.39_ 4.22 DeCo-MIL 68.441.1768.44_ 1.17 91.080.3691.08_ 0.36 64.651.1164.65_ 1.11 36.634.1336.63_ 4.13 59.820.3959.82_ 0.39 88.630.2088.63_ 0.20 59.490.4359.49_ 0.43 53.071.3453.07_ 1.34 67.173.1467.17_ 3.14 88.890.5488.89_ 0.54 66.693.2866.69_ 3.28 47.995.6847.99_ 5.68 Table 1: Comparison with baseline methods on three long-tailed pathology datasets. Subscripts denote standard deviations. Figure 3: Overall and group-wise F1 scores of different methods on three long-tailed pathology datasets. Training Objective The final model is optimized using ℒfinal=ℒmain+ℒpseudo+βℒcons,L_final=L_main+L_pseudo+ _cons, (13) where ℒmainL_main applies cross-entropy supervision to the redundancy-reduced bag X∗X^*, and ℒpseudoL_pseudo averages the cross-entropy losses over the MpbM_pb pseudo-bags using their source-slide label y. To reduce the prediction variance caused by random pseudo-bag sampling, we further encourage pseudo-bags from the same slide to produce consistent predictions. Let p(m)p^(m) denote the predicted distribution of pseudo-bag B(m)B^(m) and p¯=1Mpb∑m=1Mpbp(m) p= 1M_pb _m=1^M_pbp^(m) their mean prediction. The consistency loss is defined as: ℒcons=1Mpb∑m=1MpbKL(p(m)∥p¯).L_cons= 1M_pb _m=1^M_pbKL (p^(m)\,\|\, p ). (14) Here, β controls the consistency regularization and is set to 0.50.5 for all datasets. At inference, only ffinalf_final is retained and applied to the original full bag X; the judge model, redundancy masking, and pseudo-bag construction are used only during training. Experiments Datasets and Evaluation Metrics We evaluate DeCo-MIL on three multi-class WSI datasets: Camelyon+-LT for four-class lymph-node metastasis classification, PANDA-LT for six-class prostate ISUP grading, and TissueNet-LT for four-class cervical lesion classification. Camelyon+-LT retains its natural long-tailed distribution (IR=30IR=30), while PANDA-LT and TissueNet-LT are constructed with training-set imbalance ratios of 50 and 10, respectively. The validation and test sets remain class-balanced. We report slide-level ACC, one-vs-rest macro-AUC, macro-F1, and frequency-group F1 averaged as the mean and standard deviation over five independent runs. Detailed data statistics and group assignments are provided in the supplementary material. Implementation Details All experiments are implemented in PyTorch and conducted on a workstation equipped with an NVIDIA A100 GPU (80 GB). Each WSI is tiled at 20×20× magnification into non-overlapping 512×512512× 512 patches. Patch features are extracted using the pretrained pathology foundation model CONCH (18) and then ℓ2 _2-normalized. In DeCo-MIL, the judge model fjudgef_judge and final model ffinalf_final both use AB-MIL as the default MIL backbone. Uniform hyperparameters are maintained across all experiments. Models are optimized using Adam with an initial learning rate of 2×10−42× 10^-4 and a weight decay of 1×10−51× 10^-5. The checkpoint with the highest validation macro-F1 is selected. Comparison with State-of-the-Art Methods We compare DeCo-MIL with eleven representative WSI MIL methods: AB-MIL (8), CLAM-SB/MB (19), DS-MIL (11), TransMIL (24), WiKG (12), ILRA-MIL (31), MHIM-MIL (27), AMD-MIL (17), MiCo (13), and MDE-MIL (16). As shown in Table 1, DeCo-MIL achieves the highest mean on every reported metric across the three datasets, with the most pronounced gains on tail classes. Compared with the best-performing Tail-F1 baseline on each dataset, DeCo-MIL achieves absolute gains of 18.8218.82, 7.407.40, and 6.986.98 percentage points on Camelyon+-LT, PANDA-LT, and TissueNet-LT, respectively, demonstrating that its debiased counterfactual reasoning effectively captures scarce tail-class evidence and enhances rare-class recognition under the nested dual long-tailed setting of WSI classification. As shown in Fig. 3, DeCo-MIL substantially improves Tail-F1 while maintaining Head-F1 comparable to strong baselines on all three datasets; it also improves Medium-F1. The tail-class gains are therefore not obtained at the expense of head-class recognition. Dataset Module ACC(%) AUC(%) F1(%) Tail-F1(%) Camelyon+ Base 61.562.5461.56_ 2.54 87.761.6987.76_ 1.69 52.462.7152.46_ 2.71 0.000.000.00_ 0.00 + Counterfactual 65.941.1765.94_ 1.17 85.270.5385.27_ 0.53 59.451.6059.45_ 1.60 13.864.1813.86_ 4.18 + Debiasing 64.381.8264.38_ 1.82 89.670.8689.67_ 0.86 58.181.8558.18_ 1.85 18.045.1218.04_ 5.12 + Pseudo-bag 63.751.8263.75_ 1.82 90.181.1990.18_ 1.19 58.961.7258.96_ 1.72 29.164.1029.16_ 4.10 + Oversampling 68.441.1768.44_ 1.17 91.080.3691.08_ 0.36 64.651.1164.65_ 1.11 36.634.1336.63_ 4.13 PANDA Base 51.280.8351.28_ 0.83 86.740.3686.74_ 0.36 45.901.3045.90_ 1.30 19.853.3819.85_ 3.38 + Counterfactual 57.301.0557.30_ 1.05 88.260.1488.26_ 0.14 56.071.3556.07_ 1.35 45.362.5545.36_ 2.55 + Debiasing 58.180.7258.18_ 0.72 88.600.1488.60_ 0.14 56.741.2156.74_ 1.21 45.033.9245.03_ 3.92 + Pseudo-bag 59.620.4559.62_ 0.45 89.030.1889.03_ 0.18 58.480.7158.48_ 0.71 48.272.7748.27_ 2.77 + Oversampling 59.820.3959.82_ 0.39 88.630.2088.63_ 0.20 59.490.4359.49_ 0.43 53.071.3453.07_ 1.34 TissueNet Base 56.671.0556.67_ 1.05 83.060.9683.06_ 0.96 49.640.8149.64_ 0.81 0.000.000.00_ 0.00 + Counterfactual 58.334.1258.33_ 4.12 84.001.3384.00_ 1.33 56.484.8756.48_ 4.87 33.127.4233.12_ 7.42 + Debiasing 60.001.5860.00_ 1.58 83.900.5483.90_ 0.54 58.901.7558.90_ 1.75 36.294.7236.29_ 4.72 + Pseudo-bag 62.502.6462.50_ 2.64 85.340.6685.34_ 0.66 61.462.3361.46_ 2.33 39.113.4139.11_ 3.41 + Oversampling 67.173.1467.17_ 3.14 88.890.5488.89_ 0.54 66.693.2866.69_ 3.28 47.995.6847.99_ 5.68 Table 2: Component ablation on three long-tailed pathology datasets. Ablation Studies Component Ablation Table 2 evaluates the incremental contribution of each component. Counterfactual-guided masking provides the most immediate gains for tail classes, demonstrating the importance of removing redundant instances while preserving discriminative evidence. Frequency debiasing further improves tail-class performance on Camelyon+-LT and TissueNet-LT, while improving the overall metrics on PANDA-LT with its Tail-F1 largely preserved, demonstrating that class-frequency calibration reduces interference from head-class priors. Finally, sequentially adding stratified pseudo-bags and tail-aware oversampling consistently improves Tail-F1 across all three datasets, validating their complementary roles in preserving morphology coverage and strengthening effective supervision for tail classes. Overall, all proposed components play key roles in DeCo-MIL and jointly mitigate the nested dual long-tail problem. Effectiveness of Debiased Counterfactual-Guided Masking Strategy Camelyon+-LT PANDA-LT TissueNet-LT F1(%) Tail-F1(%) F1(%) Tail-F1(%) F1(%) Tail-F1(%) Random 56.212.2556.21_ 2.25 25.097.5425.09_ 7.54 57.941.2157.94_ 1.21 48.371.8248.37_ 1.82 63.200.5963.20_ 0.59 38.572.1838.57_ 2.18 Attention 58.161.5158.16_ 1.51 20.347.5220.34_ 7.52 57.481.0157.48_ 1.01 46.811.4346.81_ 1.43 63.812.5663.81_ 2.56 41.913.2841.91_ 3.28 Anchor-size 61.303.4661.30_ 3.46 23.567.0523.56_ 7.05 58.830.7158.83_ 0.71 51.121.8451.12_ 1.84 65.461.8965.46_ 1.89 43.026.3543.02_ 6.35 Counterfactual 64.651.1164.65_ 1.11 36.634.1336.63_ 4.13 59.490.4359.49_ 0.43 53.071.3453.07_ 1.34 66.693.2866.69_ 3.28 47.995.6847.99_ 5.68 Table 3: Comparison of different masking strategies on three long-tailed pathology datasets. To evaluate the role of counterfactual contributions in instance selection, we compare the proposed counterfactual-guided masking with random, attention-based, and anchor-size masking under the same maximum masking ratio and training protocol; detailed definitions are provided in the supplementary material. As shown in Table 3, our strategy achieves the best macro-F1 and Tail-F1 across all three datasets. Random masking ignores the discriminative relevance of individual instances, while attention-based masking does not explicitly correct for class-frequency bias. Anchor-size masking favors larger tissue regions but cannot distinguish discriminative morphologies from redundant ones. In contrast, our strategy uses frequency-debiased counterfactual contributions to determine both masking targets and ratios, thereby removing redundant instances while preserving scarce tail-class evidence. Strategy Camelyon+-LT PANDA-LT TissueNet-LT F1(%) Tail-F1(%) F1(%) Tail-F1(%) F1(%) Tail-F1(%) Zero 56.162.6056.16_ 2.60 21.3013.1321.30_ 13.13 57.610.9257.61_ 0.92 48.263.2448.26_ 3.24 64.212.1164.21_ 2.11 41.014.5041.01_ 4.50 Anchor Proto. 61.223.4161.22_ 3.41 25.299.3725.29_ 9.37 58.281.1158.28_ 1.11 51.901.2051.90_ 1.20 64.532.6464.53_ 2.64 43.934.8443.93_ 4.84 Normal Proto. 64.651.1164.65_ 1.11 36.634.1336.63_ 4.13 59.490.4359.49_ 0.43 53.071.3453.07_ 1.34 66.693.2866.69_ 3.28 47.995.6847.99_ 5.68 Table 4: Comparison of different counterfactual constructions on three long-tailed pathology datasets. Strategy Camelyon+-LT PANDA-LT TissueNet-LT F1(%) Tail-F1(%) F1(%) Tail-F1(%) F1(%) Tail-F1(%) Random 58.203.4458.20_ 3.44 13.1112.4113.11_ 12.41 57.190.5457.19_ 0.54 47.511.0947.51_ 1.09 64.351.8264.35_ 1.82 38.484.4938.48_ 4.49 Equal-per-Anchor 61.314.2761.31_ 4.27 22.7214.8922.72_ 14.89 58.170.4858.17_ 0.48 50.471.5650.47_ 1.56 64.262.4364.26_ 2.43 42.173.2042.17_ 3.20 Stratified 64.651.1164.65_ 1.11 36.634.1336.63_ 4.13 59.490.4359.49_ 0.43 53.071.3453.07_ 1.34 66.693.2866.69_ 3.28 47.995.6847.99_ 5.68 Table 5: Effectiveness of different sampling strategies on three long-tailed pathology datasets. We further compare three counterfactual constructions: replacing all instances assigned to the target anchor with a zero vector, the corresponding morphology prototype HkH_k, or the matched normal prototype q^k q_k used in our method. As shown in Table 4, matched normal prototype replacement performs best across all three datasets. Zero replacement produces off-manifold interventional features, whereas HkH_k retains substantial anchor-specific tissue semantics. In contrast, q^k q_k attenuates pathology-specific information while remaining closer to the distribution of normal features, making it a more suitable counterfactual reference. Together, these results support the effectiveness of frequency-debiased counterfactual-guided masking and matched normal prototype intervention. Effectiveness of Anchor-Stratified Pseudo-Bag Sampling To evaluate the pseudo-bag construction strategy, we compare random, equal-per-anchor, and the proposed anchor-stratified sampling under the same sampling ratio and number of pseudo-bags. As shown in Table 5, stratified sampling achieves the highest macro-F1 and Tail-F1 across all three datasets, demonstrating consistent gains on tail classes. Random sampling can omit scarce discriminative regions, whereas equal-per-anchor sampling alters the relative composition across different tissue morphologies. The proposed strategy samples instances proportionally from each retained anchor, preserving both tissue coverage and relative instance composition while making fuller use of the limited discriminative evidence in tail-class slides. Figure 4: Performance comparison under different imbalance ratios on PANDA-LT. (a) Total F1 and (b) Tail-F1 of AB-MIL and DeCo-MIL. The purple annotations denote the Tail-F1 percentage-point gains of DeCo-MIL over AB-MIL. Robustness to Varying Imbalance Ratios To evaluate the robustness of DeCo-MIL under different degrees of long-tailed imbalance, we vary the training-set imbalance ratio on PANDA-LT as IR∈10,20,30,40,50IR∈\10,20,30,40,50\ and compare DeCo-MIL with AB-MIL on the same balanced test set. As shown in Fig. 4, the overall and tail-class performance of AB-MIL declines markedly as IRIR increases, with particularly severe degradation in Tail-F1. In contrast, DeCo-MIL maintains more stable overall and tail-class performance across different imbalance ratios, while its advantage consistently widens as the imbalance becomes more severe. These results show that DeCo-MIL effectively mitigates tail-class performance degradation caused by long-tailed distributions and is better suited to severely imbalanced settings. Figure 5: Nested dual long-tail analysis on PANDA-LT (IR=50IR=50): (a) ranked debiased counterfactual contributions of tissue anchors and (b) the corresponding Lorenz curves and Gini coefficients. Visualization and Analysis Analysis of the Nested Dual Long-Tail We aggregate the debiased counterfactual contributions E¯ky E_k^y produced by the judge on PANDA-LT (IR=50IR=50) according to the Head, Medium, and Tail groups. As shown in Fig. 5(a), only a few anchors in each group carry the dominant discriminative information, while the remaining contributions are close to zero or negative. After clipping negative contributions to zero, the Gini coefficient in Fig. 5(b) increases monotonically from Head to Tail. Moreover, the top 10% of anchors account for 53%–74% of the total positive contribution while covering only 15%–22% of the patches. These results show that discriminative evidence is concentrated in a small number of tissue morphologies and becomes increasingly concentrated for rarer classes, providing empirical support for the coupling between the class-level long tail and instance-level evidence long tail. Interpretability Analysis Figure 6: Visualization of DeCo-MIL on tail-class slides from Camelyon+-LT: From left to right: the original WSI with official lesion annotations, morphology-anchor assignments, debiased counterfactual contribution heatmaps, and expected retention maps. Yellow contours denote the official lesion annotations. We conduct an interpretability analysis of DeCo-MIL using tail-class slides from Camelyon+-LT, as shown in Fig. 6. Regions with high positive contributions exhibit clear spatial agreement with the annotated lesions and consequently receive higher retention probabilities, while most non-discriminative regions are preferentially masked. These results visually illustrate that debiased counterfactual reasoning can identify lesion-related tissue morphologies and guide redundancy masking to preserve scarce discriminative evidence for tail classes. Conclusion This paper studies long-tailed WSI analysis from the perspective of a nested dual long-tail, where the inter-slide class long tail is coupled with the intra-slide long tail of instance-level discriminative evidence. We propose DeCo-MIL, which uses frequency-debiased counterfactual reasoning with matched normal prototypes to quantify the discriminative contributions of tissue-morphology anchors and guide redundancy masking, thereby preserving scarce discriminative instances. It further combines anchor-stratified pseudo-bags, tail-aware oversampling, and consistency regularization to strengthen supervision for tail classes while maintaining relative tissue-morphology composition. Experiments on three long-tailed WSI datasets show that DeCo-MIL achieves state-of-the-art overall and tail-class performance. Component ablations, robustness evaluations across imbalance ratios, and visualization analyses further validate the proposed designs and provide empirical support for the nested dual long-tail. References Buda et al. (2018) M. Buda, A. Maki, and M. A. Mazurowski A systematic study of the class imbalance problem in convolutional neural networks. Neural Networks 106, p. 249–259. External Links: Document Cited by: Long-Tailed Learning. Cao et al. (2019) K. Cao, C. Wei, A. Gaidon, N. Arechiga, and T. Ma Learning imbalanced datasets with label-distribution-aware margin loss. In Advances in Neural Information Processing Systems, Vol. 32, p. 1565–1576. Cited by: Long-Tailed Learning. Chikontwe et al. (2025) P. Chikontwe, M. Kim, J. Jeong, H. J. Sung, H. Go, S. J. Nam, and S. H. Park FR-mil: distribution re-calibration-based multiple instance learning with transformer for whole slide image classification. IEEE Transactions on Medical Imaging 44 (1), p. 409–421. External Links: Document Cited by: Multiple Instance Learning for WSIs. Chou et al. (2020) H. Chou, S. Chang, J. Pan, W. Wei, and D. Juan Remix: rebalanced mixup. In Computer Vision – ECCV 2020 Workshops, p. 95–110. External Links: Document Cited by: Long-Tailed Learning. Fang et al. (2024) H. Fang, S. Huang, W. Tang, L. Huangfu, and B. Liu SAM-MIL: a spatial contextual aware multiple instance learning approach for whole slide image classification. In Proceedings of the ACM International Conference on Multimedia (ACM M), p. 6083–6092. Cited by: Multiple Instance Learning for WSIs. Fong and Vedaldi (2017) R. C. Fong and A. Vedaldi Interpretable explanations of black boxes by meaningful perturbation. In IEEE International Conference on Computer Vision (ICCV), p. 3429–3437. Cited by: Counterfactual Reasoning. Hou et al. (2022) W. Hou, L. Yu, C. Lin, H. Huang, R. Yu, J. Qin, and L. Wang H2^2-MIL: exploring hierarchical representation with heterogeneous multiple instance learning for whole slide image analysis. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 36, p. 933–941. External Links: Document Cited by: Multiple Instance Learning for WSIs. Ilse et al. (2018) M. Ilse, J. M. Tomczak, and M. Welling Attention-based deep multiple instance learning. In International Conference on Machine Learning (ICML), p. 2127–2136. Cited by: Multiple Instance Learning for WSIs, Comparison with State-of-the-Art Methods. Juyal et al. (2024) D. Juyal, S. Shingi, S. A. Javed, H. Padigela, C. Shah, A. Sampat, A. Khosla, J. Abel, and A. Taylor-Weiner SC-mil: supervised contrastive multiple instance learning for imbalanced classification in pathology. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), p. 7946–7955. Cited by: Introduction, Long-Tailed Learning. Kang et al. (2020) B. Kang, S. Xie, M. Rohrbach, Z. Yan, A. Gordo, J. Feng, and Y. Kalantidis Decoupling representation and classifier for long-tailed recognition. In International Conference on Learning Representations, Cited by: Long-Tailed Learning. Li et al. (2021) B. Li, Y. Li, and K. W. Eliceiri Dual-stream multiple instance learning network for whole slide image classification with self-supervised contrastive learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), p. 14318–14328. Cited by: Comparison with State-of-the-Art Methods. Li et al. (2024) J. Li, Y. Chen, H. Chu, Q. Sun, T. Guan, A. Han, and Y. He Dynamic graph representation with knowledge-aware attention for histopathology whole slide image analysis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, p. 11323–11332. Cited by: Multiple Instance Learning for WSIs, Comparison with State-of-the-Art Methods. Li et al. (2025) J. Li, J. Liu, H. Kuang, H. Yue, M. He, and J. Wang MiCo: multiple instance learning with context-aware clustering for whole slide image analysis. In International Conference on Medical Image Computing and Computer-Assisted Intervention, p. 376–385. Cited by: Multiple Instance Learning for WSIs, Comparison with State-of-the-Art Methods. Lin et al. (2023) T. Lin, Z. Yu, H. Hu, Y. Xu, and C. Chen Interventional bag multi-instance learning on whole-slide pathological images. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), p. 19830–19839. Cited by: Counterfactual Reasoning. Lin et al. (2024) W. Lin, Z. Zhuang, L. Yu, and L. Wang Boosting multiple instance learning models for whole slide image classification: a model-agnostic framework based on counterfactual inference. In Proceedings of the AAAI Conference on Artificial Intelligence, p. 3477–3485. Cited by: Counterfactual Reasoning. Ling et al. (2026) X. Ling, X. Li, J. Li, M. Fu, Y. Chen, J. Peng, M. Ouyang, Y. Wang, Y. He, X. Liu, et al. Multimodal distillation-driven ensemble learning for long-tailed histopathology whole slide images analysis. In 2026 IEEE 23rd International Symposium on Biomedical Imaging (ISBI), p. 1–5. Cited by: Introduction, Long-Tailed Learning, Comparison with State-of-the-Art Methods. Ling et al. (2024) X. Ling, M. Ouyang, Y. Wang, X. Chen, R. Yan, H. Chu, J. Cheng, T. Guan, S. Tian, X. Liu, et al. Agent aggregator with mask denoise mechanism for histopathology whole slide image analysis. In Proceedings of the 32nd ACM International Conference on Multimedia, p. 2795–2803. Cited by: Multiple Instance Learning for WSIs, Comparison with State-of-the-Art Methods. Lu et al. (2024) M. Y. Lu, B. Chen, D. F. K. Williamson, R. J. Chen, I. Liang, T. Ding, G. Jaume, I. Odintsov, L. P. Le, G. Gerber, A. V. Parwani, A. Zhang, and F. Mahmood A visual-language foundation model for computational pathology. Nature Medicine 30 (3), p. 863–874. External Links: Document Cited by: Implementation Details. Lu et al. (2021) M. Y. Lu, D. F. K. Williamson, T. Y. Chen, R. J. Chen, M. Barbieri, and F. Mahmood Data-efficient and weakly supervised computational pathology on whole-slide images. Nature Biomedical Engineering 5 (6), p. 555–570. Cited by: Multiple Instance Learning for WSIs, Comparison with State-of-the-Art Methods. Lundberg and Lee (2017) S. M. Lundberg and S. Lee A unified approach to interpreting model predictions. In Advances in Neural Information Processing Systems, Vol. 30, p. 4765–4774. Cited by: Counterfactual Reasoning. Menon et al. (2021) A. K. Menon, S. Jayasumana, A. S. Rawat, H. Jain, A. Veit, and S. Kumar Long-tail learning via logit adjustment. In International Conference on Learning Representations, Cited by: Long-Tailed Learning, Debiased Counterfactual-Guided Redundancy Masking. Rao et al. (2021) Y. Rao, G. Chen, J. Lu, and J. Zhou Counterfactual attention learning for fine-grained visual categorization and re-identification. In Proceedings of the IEEE/CVF International Conference on Computer Vision, p. 1025–1034. Cited by: Counterfactual Reasoning. Ren et al. (2020) J. Ren, C. Yu, S. Sheng, X. Ma, H. Zhao, S. Yi, and H. Li Balanced meta-softmax for long-tailed visual recognition. In Advances in Neural Information Processing Systems, Vol. 33, p. 4175–4186. Cited by: Long-Tailed Learning. Shao et al. (2021) Z. Shao, H. Bian, Y. Chen, Y. Wang, J. Zhang, X. Ji, and Y. Zhang TransMIL: transformer based correlated multiple instance learning for whole slide image classification. In Advances in Neural Information Processing Systems, Vol. 34, p. 2136–2147. Cited by: Multiple Instance Learning for WSIs, Comparison with State-of-the-Art Methods. Song et al. (2024) A. H. Song, R. J. Chen, T. Ding, D. F. Williamson, G. Jaume, and F. Mahmood Morphological prototyping for unsupervised slide representation learning in computational pathology. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, p. 11566–11578. Cited by: Multiple Instance Learning for WSIs. Tang et al. (2020) K. Tang, J. Huang, and H. Zhang Long-tailed classification by keeping the good and removing the bad momentum causal effect. In Advances in Neural Information Processing Systems, Vol. 33, p. 1513–1524. Cited by: Counterfactual Reasoning. Tang et al. (2023) W. Tang, S. Huang, X. Zhang, F. Zhou, Y. Zhang, and B. Liu Multiple instance learning framework with masked hard instance mining for whole slide image classification. In Proceedings of the IEEE/CVF International Conference on Computer Vision, p. 4078–4087. Cited by: Multiple Instance Learning for WSIs, Comparison with State-of-the-Art Methods. Wang et al. (2021) X. Wang, L. Lian, Z. Miao, Z. Liu, and S. X. Yu Long-tailed recognition by routing diverse distribution-aware experts. In International Conference on Learning Representations, Cited by: Long-Tailed Learning. Wang et al. (2017) Y. Wang, D. Ramanan, and M. Hebert Learning to model the tail. In Advances in Neural Information Processing Systems, Vol. 30, p. 7029–7039. Cited by: Long-Tailed Learning. Wu et al. (2025) J. Wu, M. Chen, X. Ke, T. Xun, X. Jiang, H. Zhou, L. Shao, and Y. Kong Learning heterogeneous tissues with mixture of experts for gigapixel whole slide images. In Proceedings of the Computer Vision and Pattern Recognition Conference, p. 5144–5153. Cited by: Multiple Instance Learning for WSIs. Xiang et al. (2023) J. Xiang, X. Wang, J. Zhang, S. Yang, X. Han, and W. Yang Exploring low-rank property in multiple instance learning for whole slide image classification. In The Eleventh International Conference on Learning Representations, Cited by: Comparison with State-of-the-Art Methods. Zeiler and Fergus (2014) M. D. Zeiler and R. Fergus Visualizing and understanding convolutional networks. In European Conference on Computer Vision (ECCV), p. 818–833. Cited by: Counterfactual Reasoning. Supplementary Material for DeCo-MIL: Debiased Counterfactual Reasoning for Long-Tailed Whole Slide Image Analysis Anonymous Authors Appendix A Dataset Details and Long-Tail Construction A.1 Common Preprocessing and Split Protocol We evaluate DeCo-MIL on three multi-class whole-slide image (WSI) datasets: naturally long-tailed Camelyon+-LT and artificially long-tailed PANDA-LT and TissueNet-LT. WSIs are tiled at 20×20× magnification into non-overlapping 512×512512× 512 patches. Patch features are extracted with the pretrained CONCH pathology foundation model and ℓ2 _2-normalized before prototype construction and MIL training. The frozen feature encoder is shared by all methods. For each class, slides are independently shuffled to reserve fixed class-balanced quotas for validation and testing, with the remaining slides forming the training pool. The natural training distribution is retained for Camelyon+-LT. For PANDA-LT and TissueNet-LT, long-tailed training sets are constructed by class-wise downsampling from the training pool. Validation and test sets remain class-balanced and are never downsampled. For an artificially long-tailed training set, the imbalance ratio is IR=nmaxnmin,IR= n_ n_ , (A.1) where nmaxn_ and nminn_ are the numbers of training slides in the head and tail classes, respectively. Let the classes ordered from head to tail be c0,c1,…,cC−1c_0,c_1,…,c_C-1. Given a target imbalance ratio, the target size of the class at rank r is nrtarget=⌊nmax(1IR)rC−1⌋.n_r^target= n_ ( 1IR ) rC-1 . (A.2) We uniformly sample without replacement nrkeep=min(nrtarget,|pool(cr)|)n_r^keep= (n_r^target,\,|pool(c_r)| ) (A.3) slides from each class-specific training pool. Consequently, the realized IR can differ slightly from the nominal value because of integer rounding or a limited class pool. A.2 Head, Medium, and Tail Groups Head, Medium, and Tail groups are determined only by the class frequencies in the final training set and are used for evaluation and analysis, rather than model training. Under the main settings, the class assignments are shown in Table A.1. Table A.1: Class assignments to frequency groups. Dataset Head Medium Tail Camelyon+-LT (IR=30) 0, 2 1 3 PANDA-LT (IR=50) 0, 1 2, 4 3, 5 TissueNet-LT (IR=10) 1, 0 2 3 We adopt an adaptive grouping protocol. If at least one class contains fewer than 20 training slides, classes with more than 100 slides are assigned to Head, those with fewer than 20 to Tail, and the remainder to Medium. Otherwise, classes are sorted by decreasing training frequency and divided into three contiguous groups as evenly as possible, with any remainder assigned to Head first and then Medium. The same grouping protocol is used in the evaluation and instance-level long-tail analyses. A.3 Camelyon+-LT Camelyon+-LT contains four lymph-node metastasis categories: Negative (label 0), macro-metastasis (label 1), micro-metastasis (label 2), and isolated tumor cells (ITC; label 3). Its original distribution is naturally imbalanced. Detailed split statistics are reported in Table A.2. Table A.2: Camelyon+-LT data statistics. Split 0 1 2 3 Total Full dataset 870 174 251 54 1,349 Train (IR=30) 844 148 225 28 1,245 Validation 10 10 10 10 40 Test 16 16 16 16 64 Table A.3: PANDA-LT data statistics under the main IR=50 setting. Split 0 1 2 3 4 5 Total Full dataset 2,603 2,399 1,209 1,118 1,124 1,102 9,555 Train (IR=50) 2,303 1,053 481 100 220 46 4,203 Validation 100 100 100 100 100 100 600 Test 200 200 200 200 200 200 1,200 Table A.4: PANDA-LT training-set statistics at different nominal imbalance ratios. Nominal IR Label 0 Label 1 Label 2 Label 3 Label 4 Label 5 Train total Realized IR 10 2,303 1,453 909 365 578 230 5,838 10.0 20 2,303 1,264 694 209 381 115 4,966 20.0 30 2,303 1,166 590 151 299 76 4,585 30.3 40 2,303 1,101 526 120 251 57 4,358 40.4 50 2,303 1,053 481 100 220 46 4,203 50.1 The realized training IR is 844/28≈30.1844/28≈ 30.1. No artificial downsampling is applied when constructing the training split. A.4 PANDA-LT PANDA-LT is a six-class prostate cancer grading task. Label 0 denotes benign tissue, and labels 1–5 correspond to ISUP grades 1–5. The head-to-tail order used for exponential downsampling is (0,1,2,4,3,5)(0,1,2,4,3,5). The realized IR of the main training split is 2,303/46≈50.12,303/46≈ 50.1. The main split statistics and additional imbalance settings are summarized in Tables A.3 and A.4. The validation and test sets are identical across these IR settings. A.5 TissueNet-LT TissueNet-LT contains four cervical pathology categories: normal/subnormal epithelium (label 0), low-grade squamous intraepithelial lesion (LSIL; label 1), high-grade squamous intraepithelial lesion (HSIL; label 2), and invasive squamous cell carcinoma (SCC; label 3). Detailed split statistics are provided in Table A.5. Table A.5: TissueNet-LT data statistics under the main IR=10 setting. Split 0 1 2 3 Total Full dataset 268 288 238 219 1,013 Train (IR=10) 110 238 51 23 422 Validation 20 20 20 20 80 Test 30 30 30 30 120 The head-to-tail order is (1,0,2,3)(1,0,2,3). The tail-class target is ⌊238/10⌋=23 238/10 =23, giving a realized IR of 238/23≈10.3238/23≈ 10.3. A.6 Morphology and Normal Prototypes For each dataset, global K-means is applied to ℓ2 _2-normalized patch features from training slides to obtain K=64K=64 morphology prototypes Hkk=1K\H_k\_k=1^K. At most K×10,000K× 10,000 patches are used to construct the clustering pool. Each patch is assigned to its nearest prototype according to cosine similarity. Normal prototypes are constructed independently from label-0 training slides only. K-means with Kn=32K_n=32 is applied to their ℓ2 _2-normalized patch features. Each morphology prototype HkH_k is matched to the cosine-nearest normal prototype q^k q_k. No validation or test slide is used to construct either prototype set. The numbers of label-0 training slides used to construct the normal prototypes are summarized in Table A.6. Table A.6: Training slides used to construct normal prototypes. Dataset Label-0 category Slides Camelyon+-LT Negative 844 PANDA-LT Benign 2,303 TissueNet-LT Normal/subnormal 110 Appendix B Implementation Details and Training Protocol B.1 Three-Stage Training Pipeline DeCo-MIL contains three stages and two independently parameterized MIL models. • Judge pretraining. A standard MIL model is trained on the original full bags for 30 epochs and then frozen as fjudgef_judge. • Debiased counterfactual attribution. For every training slide, the frozen judge produces anchor assignments, counterfactual contributions, and anchor-specific masking ratios. This stage is performed without gradient computation. • Final model training. A freshly initialized ffinalf_final is trained for 30 epochs with online redundancy masking, anchor-stratified pseudo-bags, tail-aware oversampling, and consistency regularization weighted by β=0.5β=0.5. All methods use the same frozen CONCH features, data splits, and evaluation protocol. For each random seed, a separate judge model is trained once and used solely for offline counterfactual scoring. The resulting causal table is reused throughout final-model training for the same seed and is not shared across seeds. The judge is discarded after scoring, so DeCo-MIL introduces additional training-time overhead only and does not increase the parameter count or computation at inference. Training uses one WSI per batch, and final performance is reported over five independent runs. B.2 Frequency-Debiased Counterfactual Attribution Let πc=nc/∑c′nc′ _c=n_c/ _c n_c be the training-set slide frequency of class c. For a slide X, the frozen judge produces frequency-calibrated probabilities p′(c∣X)=softmax(fjudge(X)−τlog)c,p (c X)=softmax (f_judge(X)-τ π )_c, (B.1) where τ=1.0τ=1.0 controls the calibration strength. For each non-empty morphology anchor k, all its instances are replaced by the matched normal prototype q^k q_k, yielding Xdo(k)X^do(k). The contribution of anchor k to an arbitrary class c is E′kc=logp′(c∣X)−logp′(c∣Xdo(k)).E _k^\,c= p (c X)- p (c X^do(k) ). (B.2) Because the contribution is computed from frequency-calibrated log-posteriors rather than raw logits, it reflects not only the change in the target-class logit but also the intervention-induced change in the prior-adjusted normalization over all classes. Frequency calibration therefore affects both the factual and intervened predictions and enters E′kcE _k^\,c through the difference between their normalization terms, as derived below. We select the strongest competing class from the calibrated prediction of the original slide as y~=argmaxc≠yp′(c∣X), y= _c≠ yp (c X), (B.3) and keep it fixed for all anchor interventions of that slide. The ground-truth and competing-class contributions are combined as sk=E′ky−λE′ky~,s_k=E _k^\,y-λE _k^\, y, (B.4) where λ=0.6λ=0.6 for all datasets. Equivalently, sk=λ(E′ky−E′ky~)+(1−λ)E′ky.s_k=λ (E _k^\,y-E _k^\, y )+(1-λ)E _k^\,y. (B.5) The first term measures class-specific evidence relative to the strongest competing class, whereas the second preserves the absolute ground-truth contribution measured under the frequency-calibrated posterior. Thus, λ controls the trade-off between class specificity and calibrated absolute contribution. To make the effect of frequency calibration explicit, let zc(X)=fjudge(X)cz_c(X)=f_judge(X)_c and Zπ(X)=∑jexp(zj(X)−τlogπj).Z_π(X)= _j (z_j(X)-τ _j ). (B.6) The calibrated log-probability is logp′(c∣X)=zc(X)−τlogπc−logZπ(X). p (c X)=z_c(X)-τ _c- Z_π(X). (B.7) Writing Δa=a(X)−a(Xdo(k)) a=a(X)-a(X^do(k)), the class prior πc _c is unchanged by the intervention, and hence E′kc=Δzc−ΔlogZπ.E _k^\,c= z_c- Z_π. (B.8) Substitution into the anchor score gives sk=Δzy−λΔzy~−(1−λ)ΔlogZπ.s_k= z_y-λ z_ y-(1-λ) Z_π. (B.9) Therefore, with λ=0.6λ=0.6, the prior-dependent normalization term is retained with coefficient 1−λ=0.41-λ=0.4, confirming that frequency calibration remains active in the final anchor score. For the set K of non-empty anchors in a slide, we use the numerically stable slide-wise normalization Norm(sk)=sk−minj∈sjmaxj∈sj−minj∈sj+ϵ,ϵ=10−8.Norm(s_k)= s_k- _j s_j _j s_j- _j s_j+ε, ε=10^-8. (B.10) If all anchor scores are identical, the normalized scores are zero. The normalized scores are mapped to rk=rmax[1−Norm(sk)].r_k=r_ [1-Norm(s_k) ]. (B.11) Higher-contribution anchors therefore receive lower masking ratios. For normal slides, rk=0r_k=0. We set rmax=0.9r_ =0.9 for Camelyon+-LT and rmax=0.5r_ =0.5 for PANDA-LT and TissueNet-LT, as supported by the sensitivity analysis in Sec. D.1. Appendix C Precise Definitions of Ablation Strategies C.1 Masking Strategies Within each random seed, all masking strategies use the same CONCH features, prototype assignments, frozen judge, maximum masking ratio rmaxr_ , online masking operator, final-model architecture, optimization settings, and tail-aware training protocol. Counterfactual-Guided Masking This is the proposed strategy. The anchor ratios are obtained from the frequency-debiased counterfactual scores: rkcausal=rmax[1−Norm(sk)].r_k^causal=r_ [1-Norm(s_k) ]. (C.1) Random Masking Within each slide, the causal ratio vector is independently permuted: rkrandom=rπ(k)causal,r_k^random=r_π(k)^causal, (C.2) where π is a uniformly sampled permutation. Random masking therefore preserves the multiset, mean, and sum of anchor-level ratios, but it does not necessarily preserve the realized patch-level masked fraction ∑kmkrk/∑kmk _km_kr_k/ _km_k. Anchor-Size Masking Let mkm_k be the number of instances assigned to anchor k. For non-degenerate anchor sizes, rksize=rmaxmk−mminmmax−mmin.r_k^size=r_ m_k-m_ m_ -m_ . (C.3) Thus, larger tissue regions receive higher masking ratios. If all non-empty anchors have the same size, all ratios are set to zero. Attention-Based Masking Let ana_n be the patch attention produced by the frozen judge and a¯k=mk−1∑n:zn=kan a_k=m_k^-1 _n:z_n=ka_n. For non-degenerate anchor-level attention, rkattn=rmax(1−a¯k−aminamax−amin).r_k^attn=r_ (1- a_k-a_ a_ -a_ ). (C.4) Anchors with lower mean attention receive higher masking ratios. If all non-empty anchors have identical mean attention, all ratios are set to zero. C.2 Counterfactual Constructions For a target anchor k, all assigned instances are replaced while the other instances remain unchanged: Xndo(k)=bk,zn=k,Xn,otherwise.X_n^do(k)= casesb_k,&z_n=k,\\ X_n,&otherwise. cases (C.5) The three compared constructions are summarized in Table C.1. Table C.1: Definitions of the compared counterfactual constructions. Construction Replacement bkb_k Zero replacement ∈ℝ5120 ^512 Morphology-prototype replacement HkH_k Matched-normal replacement (ours) q^k q_k All other Stage-1 and Stage-2 settings remain unchanged. C.3 Pseudo-Bag Sampling Strategies All pseudo-bag strategies use the same redundancy-reduced bag X⋆X , sampling ratio ρ=0.5ρ=0.5, number of pseudo-bags Mpb=3M_pb=3, source-slide label, and training objective. They use the same sampling ratio but do not necessarily produce exactly identical pseudo-bag sizes because of per-anchor integer rounding and lower bounds. • Random sampling: uniformly sample round(ρ|X⋆|)round(ρ|X |) instances from the entire reduced bag. • Equal-per-anchor sampling: allocate an approximately equal quota to each non-empty anchor, independent of its original size. • Anchor-stratified sampling (ours): independently sample a fraction ρ from every retained anchor while retaining at least one instance from each retained anchor. Appendix D Additional Analysis D.1 Hyperparameter Sensitivity Figure D.1: Sensitivity to λ. Each bar shows the mean over five runs. Figure D.2: Sensitivity to the maximum masking ratio rmaxr_ . Each bar shows the mean over five runs. Figure D.3: Sensitivity to the oversampling strength α. Each bar shows the mean over five runs. Sensitivity to λ We evaluate six settings on all three datasets: λ=0λ=0, 0.20.2, 0.40.4, 0.60.6, 0.80.8, and 1.01.0. Each bar is the mean over five runs, and the main experiments use the unified setting λ=0.6λ=0.6. The corresponding results are shown in Fig. D.1. The unified setting λ=0.6λ=0.6 achieves the highest macro-F1 and Tail-F1 on all three datasets. In particular, λ=1λ=1 retains only the class-specific contrast and removes the calibrated absolute-contribution term in the equivalent decomposition, whereas λ=0.6λ=0.6 balances both components. The result supports retaining a nonzero absolute contribution without discarding competing-class suppression. To isolate the effect of frequency calibration, “+ Counterfactual” in Table 2 of the main paper uses τ=0τ=0, whereas “+ Debiasing” uses τ=1τ=1. Both settings fix λ=0.6λ=0.6 and keep all other components unchanged. The results show that frequency calibration improves Tail-F1 on Camelyon+-LT and TissueNet-LT, while improving the overall metrics on PANDA-LT with its Tail-F1 largely preserved. These results support the effectiveness of frequency calibration in mitigating class-frequency bias. Sensitivity to rmaxr_ We sweep six settings on all three datasets: rmax=0.4r_ =0.4, 0.50.5, 0.60.6, 0.70.7, 0.80.8, and 0.90.9. Each bar is the mean over five runs. The corresponding results are shown in Fig. D.2. Camelyon+-LT benefits from stronger masking and reaches its best macro-F1 and Tail-F1 at rmax=0.9r_ =0.9. For PANDA-LT and TissueNet-LT, rmax=0.5r_ =0.5 provides the best balance and is used in the main experiments. The maximum masking ratio rmaxr_ is therefore selected at the dataset level based on the sensitivity analysis and then fixed across all runs and comparisons. Unless otherwise specified, all other hyperparameters are shared across datasets. The different optima reflect dataset-dependent redundancy and should not be interpreted as a universal masking strength. Sensitivity to α We sweep six oversampling settings on all three datasets: α=0.5α=0.5, 0.60.6, 0.70.7, 0.80.8, 0.90.9, and 1.01.0. Each bar is the mean over five runs. The corresponding results are shown in Fig. D.3. We use the unified setting α=0.8α=0.8, which gives the strongest overall balance on Camelyon+-LT and PANDA-LT and the highest Tail-F1 on TissueNet-LT. Although α=1.0α=1.0 yields a slightly higher macro-F1 on TissueNet-LT, its Tail-F1 is lower than that obtained with α=0.8α=0.8. Overall, performance remains relatively stable across a broad range of α, with α=0.8α=0.8 providing the most favorable balance between overall metrics and Tail-F1. D.2 Nested Dual Long-Tail Statistics For PANDA-LT at IR=50, let tS_t denote the pooled lesion slides whose classes belong to frequency group t∈Head,Medium,Tailt∈\Head,Medium,Tail\. For anchor k, let t,k⊆tS_t,k _t contain only slides in which that anchor is present and has a valid contribution. The group-level contribution is the slide-wise mean E¯kt=1|t,k|∑i∈t,kE′ikyi. E_k^t= 1|S_t,k| _i _t,kE _ik^\,y_i. (D.1) Thus, slides are equally weighted within each group. An absent anchor is stored as NaN and does not enter the denominator for that anchor. If t,kS_t,k is empty, anchor k is omitted from the group-level statistics. Normal slides are also omitted because no counterfactual contribution is stored for them. The ranked contribution curve uses the raw signed values of E¯kt E_k^t. For the concentration statistics, we define ukt=max(E¯kt,0)u_k^t= ( E_k^t,0) over all valid group-level anchors. The Gini coefficient for the resulting non-negative vector u=(u1,…,un)u=(u_1,…,u_n), sorted in ascending order, is G(u)=2∑i=1niuin∑i=1nui−n+1n.G(u)= 2 _i=1^niu_in _i=1^nu_i- n+1n. (D.2) The top-10% set contains max(1,round(0.1n)) (1,round(0.1n)) anchors with the largest raw E¯kt E_k^t. Its contribution share is the sum of their non-negative contributions divided by ∑kukt _ku_k^t. Patch coverage is the number of patches assigned to these top-ranked anchors, pooled over the same lesion slides, divided by the total number of patches assigned to all valid anchors. In the observed results, the top 10% of anchors account for 53%–74% of the total positive contribution while covering only 15%–22% of patches, and the Gini coefficient increases from Head to Tail. The corresponding ranked-contribution and concentration curves are shown in Figure 5 of the main paper. D.3 Additional Visualization Results Figure D.4 extends the interpretability analysis in Fig. 6 of the main paper with additional correctly classified slides from Camelyon+-LT, covering small, fragmented, and extensive lesions. Despite substantial variations in tissue morphology and lesion extent, regions with high positive counterfactual contributions generally align with the official tumor annotations, whereas most non-lesion regions exhibit near-zero or negative contributions. These high-contribution regions are consequently assigned higher expected retention, while less informative tissue is more likely to be removed during redundancy masking. A consistent correspondence among tumor annotations, counterfactual contributions, and retention maps is also observed across these additional cases, further complementing the visualization results presented in the main paper. Overall, these results further illustrate how DeCo-MIL identifies lesion-related tissue morphologies and preserves diagnostically informative evidence under long-tailed WSI classification. Figure D.4: Additional visualizations on Camelyon+-LT. Each row shows a different correctly classified slide. From left to right: the original tissue image, morphology-anchor assignment, debiased counterfactual contribution, and expected retention map. Yellow contours denote official tumor annotations. Warm and cool colors indicate positive and negative contributions, respectively, while darker green indicates higher expected retention.