SCALE: Towards Whole-Slide Counterfactual Explanations in Cancer Histopathology
Authors: Weiyi Qin, Yingci Liu-Swetz, Shiwei Tan, Yi Wang, Mohammad Alexanderani, Dimitrios Korentzelos, Peizi Li, Soo Yeon Sohn, Xintong Wang, Hao Peng, Yue Guo, Yuzhe Yang, Han Zhao, Hao Wang
Organizations: University of Illinois Urbana-Champaign · Rutgers University · University of Pennsylvania · University of Pittsburgh · Mount Sinai Hospital · University of California, Los Angeles
Accurate cancer diagnosis depends on histopathological evaluation, in which tumor morphology drives disease classification and therapeutic decision-making. While deep learning models have demonstrated strong performance in predicting diagnostic and prognostic properties from histopathology images, their clinical adoption remains limited by a lack of interpretability. Unlike conventional medical images where diagnostic findings are spatially localized, histopathological images are characterized by complex textural patterns distributed across the entire whole slide image (WSI), making it difficult to explain model predictions through region-based localization alone. Counterfactual explanations offer a promising alternative by asking "what changes in the image could have altered the model prediction." To achieve this, we propose SCALE, a framework for generating such counterfactual explanations for histopathological DL models. Across nine counterfactual directions spanning multiple cancer types, SCALE generates counterfactual explanations that consistently shift model predictions toward the intended diagnostic target while maintaining biological feasibility. In a blinded review by pathologists, SCALE demonstrated superior morphological plausibility compared to baseline methods (win rate of 91.7%) and robust counterfactual effectiveness (target consistency of 96.7%). These results suggest that SCALE generates morphologically plausible and effective counterfactual explanations that can be applied to improve the interpretability of deep learning models for histopathology.
Figures & tables
Figure 1: Overview of SCALE. a, Feature extraction. Whole-slide images are partitioned into tiles and encoded by a pretrained tile encoder to obtain tile-level feature embeddings. Each slide is represented as a feature matrix X∈RN×D , where N denotes the number of tiles and D denotes the feature dimension. b, Attention-based multiple instance learning. Tile-level feature embeddings are aggregated using an attention-based MIL model to produce slide-level predictions. The model assigns attention weights to individual tiles, highlighting regions that contribute most to the prediction and enabling attention-guided region selection for generating counterfactual explanations. c, Concept-guided counterfactual generation. An SAE is trained on large-scale TCGA data to discover a reusable concept bank from pathology feature representations, with each concept grounded by prototype examples. Concept-class association identifies task-relevant concepts, and a target concept cj∗ is selected for intervention. The original feature x is steered in the SAE latent space to obtain a modified feature x′ ; a diffusion model is then conditioned on x′ to generate region-level (e.g., tile-level) counterfactual explanations. Progressive editing integrates these local edits across the slide to produce a coherent slide-level counterfactual with the desired prediction shift.
Figure 2: Pan-cancer concept discovery and class-associated morphology. a, Sparse autoencoder (SAE) training data comprise 141.1 million tissue tiles from 10,484 whole-slide images and 8,641 patients across 32 The Cancer Genome Atlas (TCGA) cohorts and 25 anatomical sites. Tiles measure 256×256 pixels at 20× magnification or 0.5 µm per pixel. b, Tile contributions by cohort, grouped by anatomical system; labels report counts in millions. c, The SAE maps a dense tile feature x∈R1536 to an overcomplete sparse concept vector z∈R12288 . Colored and gray entries schematically indicate nonzero and zero activations, respectively. d, Spatial concept map of an example tissue region. Each tile is colored by its highest-activation SAE concept; different colors denote distinct concepts. e, Representative top-activating tiles for concepts C12283 , C2957 and C7920 , illustrating trabecular hepatic architecture, cytoplasmic vacuolization and fascicular or striated muscle, respectively. Subscripts denote SAE concept indices. f, Class-associated concepts across histologic subtype, tumor grade and molecular status: keratinization in LUSC and gland formation in LUAD; low atypia and pleomorphic nuclei in low- and high-grade KIRC; and basaloid morphology and keratinization associated with HPV + and HPV - head-and-neck squamous cell carcinoma, respectively. Galleries show representative top-activating tiles for the concept with the highest mean attention-weighted activation within each class.
Figure 3: Whole-slide prediction responses to increasing counterfactual editing extent using SCALE across nine pathology tasks. Target-class probability as a function of the percentage of tissue tiles counterfactually edited across whole-slide images (WSIs). The evaluation included n=134 distinct WSIs from 101 TCGA cases across nine counterfactual task directions. For PRAD, Gleason patterns 1–3 (GP1–3) were grouped into a single class characterized by discrete, well-formed glands based on the historical Gleason morphological classification. Panels show, from left to right and top to bottom: BRCA normal-to-tumor, COAD normal-to-tumor, KIRC normal-to-tumor, HNSCC HPV - -to-HPV + , HNSCC HPV + -to-HPV - , LUAD normal-to-tumor, PRAD GP1–3-to-GP4, PRAD GP4-to-GP5 and PRAD GP1–3-to-GP5 editing. Horizontal red dashed lines indicate a target-class probability of 0.5 as a common reference level.
Figure 4: Spatial selection, steering strength and intervention extent. a, Colorectal counterfactuals generated using attention-guided selection (left) or random selection (right) at a matched selected-tile budget. The inset highlights high-attention tiles selected for intervention. Red outlines indicate representative intervention areas, rather than exact affected-pixel masks. b, Steering-strength sweep in a representative kidney region, with the selected area fixed (red box). Images show the source and counterfactuals at increasing steering strengths. Plots show region-level target-class probability (left) and mean target-concept SAE activation across the indicated 16 tiles (right). c, Intervention-extent sweep in the same kidney region, with steering strength fixed and increasing percentages of valid tissue tiles selected for intervention. Plots show region-level target-class probability (left) and mean target-concept SAE activation across all 55 valid tissue tiles (right).
Figure 5: Representative counterfactual explanations across pathology tasks from SCALE. a, Source and concept-guided counterfactual regions for colorectal (COAD) normal-to-tumor, kidney (KIRC) normal-to-tumor and HNSCC HPV + -to-HPV - editing. For PRAD, the same source region is steered toward progressively higher-grade Gleason pattern (GP) targets, illustrating controlled changes in glandular architecture. b, Colorectal normal-to-tumor counterfactuals generated while increasing the fraction of edited valid-tissue tiles from 40% to 80%. Increasing the edited fraction expands tumor-associated morphology across the tissue region, providing a spatial analogue of increasing local tumor involvement. Percentages denote the fraction of valid-tissue tiles selected for intervention. c, Representative COAD normal-to-tumor whole-slide counterfactual. Progressive editing propagates the target-associated morphological intervention across spatially distributed tissue regions while retaining the overall slide context. Red boxes indicate the enlarged region. Across all panels, counterfactual labels indicate intended intervention targets rather than definitive pathological classifications of the generated tissue.
Figure 6: Spatial continuity and prediction changes during progressive editing. a, Local editing uses overlapping 4×4 -tile windows with a fully edited 2×2 center and a blended peripheral region (10% generated, 90% existing content). b, Source tissue and counterfactuals generated by independent stitching or progressive editing (ours). Green boxes mark zoomed-in regions. c, Mean absolute RGB change ( left ) and excess border discontinuity ( right ) across increasing selected-tile budgets (lower is better for both metrics). Lines indicate means, and shaded bands indicate the standard error of the mean across nine intervention directions ( n=9 ). d–g, Representative HPV + -to-HPV - intervention. d, Source region, attention map and selected tiles. e, Progressive editing through overlapping windows. f, Source and resulting counterfactual. g, Target HPV - probability across editing steps ( left ) and source and counterfactual class probabilities ( right ). Target probability increases from 0.002 to 0.955; the dotted line marks the 0.5 decision threshold.
Counterfactual explanations show how changing an input could alter a model’s prediction, supporting model understanding, auditing, and actionable recourse.
Laboratory of Molecular Pharmacokinetics, Graduate School of Pharmaceutical Sciences, The University of Tokyo, Tokyo, Japan · The Institute of Statistical Mathematics, Research Organization of Information and Systems, Tachikawa, Japan