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.
Deep learning has achieved strong performance in computational pathology, but explaining whole-slide image (WSI) predictions remains challenging. Existing explanation methods often highlight important regions without identifying their morphological patterns, leaving a gap between patch-level computational evidence and slide-level pathological interpretation. We propose ProtoGTX, a graph-based framework that combines spatial contextualization with a flexible morphological prototype vocabulary. ProtoGTX separates the reference prototypes used to define morphological concepts from the predictive model: the reference vocabulary can be generated from training data by unsupervised clustering or supplied externally, and remains fixed during classifier training. Patch features are first contextualized over a spatial graph, after which learnable prototypes representing morphological concepts are optimized through cross-attention. Their slide-level activation profile is aligned with the morphological composition induced by the fixed reference prototype bank. On the CPTAC and BRACS datasets, ProtoGTX outperforms the evaluated MIL, prototype-based, and graph-based baselines, with particularly pronounced improvements on BRACS. Qualitative analyses further show that spatial contextualization transforms fragmented patch-level prototype assignments into more coherent tissue regions. In BRACS, prototype maps also co-localize with pathologist annotations and regions relevant to slide-level prediction. These results demonstrate that ProtoGTX provides complementary semantic and spatial explanations while retaining a prototype vocabulary that can be defined independently of the predictive model. Code is available at https://github.com/mizuno-group/ProtoGTX.
Iori Azuma, Hiroyuki Kusuhara, Tadahaya Mizuno
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
Whole-slide images (WSIs) present a fundamental challenge for computational pathology due to their extreme resolution, multi-scale heterogeneity, and the requirement for clinically reliable interpretation. Although recent pathology foundation models have enabled fluent report generation, they often lack clinical grounding, failing to accurately represent key diagnostic concepts and relationships observed by pathologists. This limitation arises from the difficulty of integrating heterogeneous visual evidence spanning fine-grained cellular patterns, slide-level tissue architecture, and high-level diagnostic concepts, while maintaining interpretability and clinical coherence. Here we present SCOUT: Semantic Context-aware mOdality fUsion Transformer, a context-aware concept-grounded multimodal framework for pathology report generation that enables progressive conditioning of image representations by global slide information and explicit diagnostic concepts. The method integrates local histological patterns, whole-slide context, and expert-curated semantic descriptors within a unified learning paradigm, allowing visual features to be dynamically refined throughout the encoding process. By combining depth-aware contextual modulation with adaptive multimodal fusion during text generation, the framework produces clinically coherent reports while preserving complementarity across representational scales. Using CONCH1.5 features, we evaluate SCOUT against WSI-Caption, HistGen, and BiGen on TCGA-BRCA, MICCAI REG, and HistAI. SCOUT achieves the best BLEU-1 to BLEU-4 and METEOR scores on all datasets, plus the best ROUGE-L on TCGA-BRCA and MICCAI REG. On TCGA-BRCA, it reaches 0.436/0.303/0.202/0.156 BLEU-1/2/3/4 and 0.204 METEOR; on REG 2025, it achieves 0.865/0.834/0.805/0.780 and 0.568. These results support progressive contextual conditioning for grounded pathology report generation.
Whole Slide Image (WSI) analysis serves as the fundamental method for the clinical diagnosis of cancer in digital histopathology. Recent advances in Multimodal Large Language Models (MLLMs) have enabled state-of-the-art (SOTA) automated histopathology report generation. However, MLLMs reason purely through distributions encoded in their neural parameters, limiting the amount of knowledge and reasoning logic they can contain given the model scale. Their black-box reasoning poses another challenge to the human interpretation of intermediate reasoning. We address these issues by utilizing knowledge graphs to inject external structured knowledge for MLLMs to reason over, while making this reasoning component visible. Knowledge graphs are capable of partially externalizing the containment of medical knowledge, an area that remains underexplored in pathology report generation. We introduce PathKGen, a knowledge graph-assisted MLLM for histopathology report generation. PathKGen has two main branches: (1) a visual path that learns visual token inputs to the MLLM using pathology foundation models, and (2) a knowledge path that learns knowledge token inputs by extracting key morphological features of WSIs through querying a pathology-specific knowledge graph. A comprehensive evaluation on WSI-Bench dataset shows that PathKGen surpasses previous SOTA methods while revealing diagnostic reasoning as visually intuitive graphs. Due to its modular design, the proposed knowledge path is complementary to vision-aligned MLLMs and can be extended to other applications by curating domain-specific knowledge graphs to generate knowledge tokens.