Skip to Content
  • Article
  • Open Access

25 November 2026

24 Pages

RNA-Conditioned Attention Distillation for Histology-Based Microsatellite Instability Prediction in Gastric Cancer

,
,
and
1
School of Computer Science & Technology, Hainan University, Haikou 570228, China
2
School of Undergraduate Education, Shenzhen Polytechnic University, Shenzhen 518055, China
*
Author to whom correspondence should be addressed.

Abstract

Microsatellite instability (MSI) is an important molecular biomarker associated with immunotherapy in gastric cancer. Predicting MSI from hematoxylin and eosin (H&E)-stained slides can support molecular screening. However, patient-level labels provide limited guidance for effectively aggregating heterogeneous tissues within slides, while multimodal models requiring paired transcriptomic data impose additional data requirements at inference. We propose an RNA-conditioned attention distillation framework that enables multimodal-assisted training and independent image-only inference. The teacher generates a query from a patient-level, 50-dimensional Hallmark pathway representation, which interacts with image instances to produce an attention distribution. It also combines image and RNA data for classification. The teacher is then frozen, and an attention-based multiple instance learning (ABMIL) image student is jointly trained using attention distribution matching and classification losses. In internal five-fold cross-validation on TCGA-STAD, the method achieved a numerical improvement in average precision (AP), the primary metric (0.6729 vs. 0.6506), with an area under the receiver operating characteristic curve (AUROC) comparable to that of the matched baseline (0.9005 vs. 0.8959). On the independent external CPTAC-STAD cohort without fine-tuning, the model retained small numerical advantages over the primary image-only baseline (AP, 0.6305 vs. 0.6234; AUROC, 0.8991 vs. 0.8958), ranking near the top on both metrics. Mechanistic analyses indicated that RNA pairing conditions and transfer targets both influenced student performance, and higher teacher AP did not translate into higher student AP. Cross-cohort generalization requires further validation.

1. Introduction

Microsatellite instability (MSI) is an important molecular feature in the precision diagnosis and treatment of gastric cancer, with implications for immunotherapy selection, prognostic assessment, and molecular classification. Studies of mismatch repair-deficient solid tumors have established an association between MSI and response to PD-1 blockade [1,2]. Clinical studies in gastric cancer have further shown that MSI-high (MSI-H) status helps identify patients who may benefit from immune checkpoint inhibitor therapy [3]. MSI-H status also has value for prognostic stratification in resectable gastric cancer [4]. The Cancer Genome Atlas (TCGA) has also established MSI as one of the major molecular subtypes of gastric cancer [5]. Therefore, accurate identification of MSI status is important for patient stratification and personalized treatment.
Currently, MSI can be detected using polymerase chain reaction (PCR) or sequencing, while immunohistochemical testing of mismatch repair proteins is used to assess mismatch repair deficiency [6]. These tests require appropriate laboratory facilities and tissue specimens. Additional tissue processing, testing costs, and turnaround time increase the burden of implementing molecular screening, particularly when tissue availability or testing resources are limited [7].
Routine hematoxylin and eosin (H&E)-stained slides contain morphological information about tumor cells, tissue architecture, and the microenvironment, providing a basis for predicting molecular status from histopathological images. Pan-cancer studies have also shown that certain clinically relevant genetic alterations can be predicted from tissue morphology [8]. Kather et al. demonstrated the feasibility of using deep learning to predict MSI from H&E images of gastrointestinal tumors [9]. Muti et al. further developed and validated models in multicenter gastric cancer cohorts, supporting research into the use of routine histopathological images to assist MSI screening [10].
Gastric cancer whole-slide images contain diverse morphological components, including tumor tissue, stroma, and the immune microenvironment. Multicenter morphological studies have shown that conventional Laurén or WHO classifications are insufficient to distinguish MSI status. Relevant clues are distributed across local features, such as solid components, mucin, and inflammatory backgrounds [11]. The recent MSI-SEER study combined weakly supervised local prediction with uncertainty estimation to evaluate MSI prediction across multiple cohorts, including gastric cancer [12]. These studies suggest that predicting molecular status from morphology requires both identifying informative local cues and accounting for the heterogeneity of evidence within the same slide.
Multiple instance learning (MIL) aggregates local image patches to generate slide-level predictions, and large-scale weakly supervised studies have demonstrated the feasibility of this strategy [13]. Attention-based MIL (ABMIL) uses attention weights to determine each instance’s contribution to aggregation [14], CLAM introduces instance-level clustering constraints [15], and TransMIL models correlations among instances [16]. These methods improve information aggregation, but the same patient-level label can correspond to different combinations of local evidence. With this label alone, models struggle to distinguish task-relevant morphological information from cohort-dependent predictive cues. Therefore, determining what additional supervision should guide instance weighting is a key design question in molecular status prediction.
Contrastive self-supervised learning and hierarchical pretraining in pathology enable representation learning from unlabeled images [17,18]. Foundation models such as UNI and CONCH have further broadened the applicability of learned representations across tasks [19,20]. These advances have improved the quality of local image features, but slide-level prediction still depends on how models select and combine instances. In this study, we keep the UNI encoder fixed and focus on how molecular supervision influences subsequent instance aggregation.
Transcriptomic data provide information on gene expression and pathways in tissue samples, adding patient-level molecular context to histopathological image modeling. Previous studies jointly modeling histology and genomics have reported the predictive value of multimodal information in tasks such as cancer prognosis, supporting the use of molecular data to assist image learning [21]. Pathomic Fusion integrates histomorphological and genomic features to build predictive models [22], while MCAT uses omics-guided co-attention to connect image instances with molecular features [23]. Pan-cancer integrative analyses have further demonstrated the complementary information provided by histological and molecular data for prognostic modeling [24]. However, the conditions available during model development do not always hold at prediction time. Compared with routine H&E slides, obtaining paired RNA data additionally requires nucleic acid extraction, quality control, and sequencing analysis, and transcriptomic data may be unavailable for new patients. If prediction requires both modalities as simultaneous inputs, the applicability of the model is constrained by the availability of paired data [25].
Knowledge distillation and learning using privileged information provide paradigms for using additional modalities during training to support image model learning [26,27,28]. Within this framework, paired RNA data contribute to teacher learning and the generation of supervision targets, while the student learns the prediction task from image inputs. After training, the student independently performs image aggregation and classification, decoupling the molecular data used during model development from the inputs required for prediction in new patients.
Existing studies on molecularly assisted learning and cross-modal distillation have primarily focused on pan-cancer survival prognosis, breast cancer biomarker prediction, or general slide representation learning, and they differ fundamentally from our approach in both molecular input structure and supervision targets. Specifically, TANGLE [29] employs contrastive learning to align ABMIL-aggregated slide-level image embeddings with high-dimensional gene expression representations across pan-cancer cohorts. G-HANet [25] learns histo-genomic associations for survival prediction by reconstructing gene expression profiles across six functional gene groups from morphological features. In biomarker prediction, MKD [30] (originally developed for breast cancer histopathology using 8192 genes selected via survival information) and MoMKD [31] (using 768 genes and cross-batch momentum memory) decompose multimodal representations and enforce feature- or logit-level consistency, while the MoPE preprint [32] aligns modality usage distributions over shared pathway memory basis vectors.
Despite these advances, applying existing unimodal MIL and cross-modal distillation methods to histology-based MSI prediction in gastric cancer leaves three critical research gaps:
  • Insufficient local guidance under high intra-slide heterogeneity in gastric cancer: Gastric adenocarcinomas exhibit pronounced morphological heterogeneity across tumor epithelium, mucinous components, stroma, and inflammatory infiltrates [11]. Unimodal MIL methods (e.g., ABMIL [14], CLAM [15], TransMIL [16]) supervised solely by binary patient-level MSI labels struggle to distinguish biologically meaningful local cues from spurious, cohort-dependent patterns.
  • Inference-time bottleneck of multimodal fusion models: Conventional histo-genomic fusion frameworks (e.g., Pathomic Fusion [22], MCAT [23]) require paired transcriptomic sequencing at deployment, which is unavailable in routine clinical H&E screening workflows.
  • Over-constrained representation alignment in existing cross-modal distillation: Prior privileged distillation approaches (e.g., TANGLE [29], G-HANet [25], MKD [30], MoMKD [31]) rely on high-dimensional raw gene inputs and force the image student’s slide-level embeddings or logits to match the teacher’s multimodal feature space dimension by dimension. Because routine H&E morphology only partially reflects transcriptomic variation, strict feature-space matching can over-constrain the student network and degrade task-specific morphological representation learning.
To address these gaps, we propose an RNA-conditioned attention distillation framework tailored for gastric cancer MSI prediction. Unlike methods using thousands of individual genes, our teacher network summarizes transcriptomic activity into a compact, biologically interpretable 50-dimensional Hallmark pathway representation [33] to generate a conditional query. More importantly, rather than aligning high-dimensional slide embeddings, we transfer supervision exclusively at the level of intra-slide instance attention weights over matched patch indices. In this paradigm, molecular conditioning teaches the student “where to look” (which tissue patches warrant higher aggregation weights), while leaving the student’s local feature projection and classification head free to independently learn “how to interpret” those morphological regions under MSI label supervision.

2. Methods

2.1. Clinicopathological Background, Hallmark Pathways, and Problem Formulation

Microsatellite Instability and Histopathological Correlates in Gastric Cancer. Microsatellite instability (MSI) arises from a defective DNA mismatch repair (dMMR) system—most commonly through epigenetic silencing of MLH1 or mutations in MLH1, MSH2, MSH6, and PMS2—resulting in hypermutation across repetitive DNA motifs and elevated neoantigen loads [5,6]. In gastric adenocarcinoma, MSI-high (MSI-H) tumors constitute one of the four major molecular subtypes defined by The Cancer Genome Atlas (TCGA) and exhibit distinct clinical sensitivity to immune checkpoint blockade [3,4,5]. Histopathologically, routine H&E-stained slides of MSI-H gastric cancers frequently display characteristic morphological patterns recognized by pathologists, including prominent tumor-infiltrating lymphocytes (TILs) and peritumoral lymphoid aggregates triggered by neoantigen immunogenicity, intestinal or mixed Lauren phenotypes, medullary or solid poorly differentiated growth patterns, mucinous differentiation, and pushing tumor borders (Figure 1) [11]. However, these morphological features are heterogeneously distributed across whole-slide images (WSIs) and overlap substantially with microsatellite-stable (MSS) tumors. Consequently, such visual patterns are statistically associated with MSI but are not independently diagnostic of MSI status on their own [11]. Accurately predicting MSI from H&E slides therefore requires aggregating distributed local morphological cues across thousands of tissue patches while suppressing non-specific background regions.
Figure 1. Representative H&E-stained histopathological patches from the gastric cancer dataset illustrating morphological patterns associated with MSI status. Hematoxylin stains nuclei blue to purple, and eosin stains the cytoplasm and extracellular matrix in shades of pink. (a,b) MSI-H cases showing prominent immune-cell infiltration (lymphoid stroma) and poorly differentiated solid/irregular glandular morphology. (c,d) MSS cases showing well-to-moderately differentiated tubular glands and fibrotic stroma. Each patch corresponds to an instance xis,m in the mathematical formulation (Equation (1)). Note that while these histological features are associated with MSI status, they are heterogeneous within slides and are not independently diagnostic.
Biological Rationale of the 50 Hallmark Pathways and Connection to H&E Morphology. To guide this local aggregation during model training, we incorporate patient-level transcriptomic priors derived from the Molecular Signatures Database (MSigDB) Hallmark gene set collection [33]. Unlike raw transcriptomic profiles comprising tens of thousands of noisy, collinear genes, the 50 Hallmark gene sets distill coordinately expressed genes into compact, non-redundant signatures representing eight major biological categories: immune response (e.g., interferon-γ response, interferon-α response, inflammatory response, allograft rejection), DNA damage repair, cellular proliferation (e.g., E2F targets, G2M checkpoint, MYC targets), signaling pathways (e.g., TNF-α signaling via NF-kB, KRAS and PI3K/AKT/mTOR signaling), stromal/structural remodeling (e.g., epithelial–mesenchymal transition, angiogenesis), metabolism, cellular stress, and development [33,34,35]. Crucially, these functional pathways directly underpin the tissue phenotypes visible on H&E slides: for instance, upregulated interferon and inflammatory pathways reflect dense immune-cell infiltration in the tumor microenvironment, DNA repair and cell-cycle pathways correlate with nuclear pleomorphism and mitotic activity, and epithelial–mesenchymal transition relates to desmoplastic stroma and invasive architecture. Conditioning the teacher model on these 50 Hallmark pathways thus provides a biologically grounded bridge between patient-level molecular states and local histological instances.
This study aims to develop a microsatellite instability (MSI) prediction framework that incorporates transcriptomic molecular priors during training and is fully independent of transcriptomic data at inference, relying exclusively on routine H&E slides.
Formally, for patient i, let Si denote the number of associated slides. The set of instance-level morphological features corresponding to the s-th whole-slide image (WSI) is represented as follows:
X is = { x is , m } m = 1 M is ,   x is , m ∈ R D
where Mis is the total number of patch instances in the slide and D is the dimensionality of the pretrained feature encoding. During model training, each patient has a molecular representation vector r i ∈ R C derived from Hallmark pathway enrichment analysis, where C is the number of functional pathways, and a binary study label yi ∈ {0,1}, representing MSS and MSI-H, respectively. Multiple slides from the same patient share the same molecular representation and patient-level supervision label:
D train = { ( { X is } s = 1 S i , r i , y i ) } i = 1 N train
During clinical deployment and inference, however, the model has access only to the morphological feature sets of the slides to be evaluated, D test = { { X is } s = 1 S i } . The learning objective is to train an image-only MIL student classifier fstu such that, for any input slide Xis:
p ^ is = f stu X is ≈ P y i = 1 ∣ X is
The patient-level predicted probability P ^ i is obtained by aggregating the predicted probabilities of all slides from that patient:
P ^ i = 1 S i ∑ s = 1 S i p ^ is

2.2. Overall Framework and Methodology

Building upon the problem statement in Section 2.1, our framework converts patient-level molecular conditioning into instance-weight supervision through two sequential training stages followed by independent unimodal deployment (Figure 2): (1) Multimodal Teacher Learning, where a query generated from the 50-dimensional Hallmark representation interacts with 512-dimensional projected image keys (derived from 1024-dimensional frozen UNI features) to form a 128-dimensional cross-modal attention space and classify MSI status; (2) Image-Only Student Distillation, where the frozen teacher provides intra-slide attention targets over the exact same patch indices to supervise a standard non-gated ABMIL student alongside binary label supervision; and (3) Image-Only Inference, where slides from new patients are processed solely through the frozen UNI encoder and trained student model.
Figure 2. Overview of the proposed RNA-conditioned attention distillation framework, illustrating (a) multimodal teacher learning, (b) image-only student distillation, and (c) independent image-only inference with corresponding equation annotations.

2.2.1. Image Preprocessing, Patch Sampling, and Pathway Feature Standardization

All diagnostic H&E WSIs undergo a standardized preprocessing pipeline to extract informative tissue regions and ensure reproducibility. First, tissue foreground masks are generated on low-resolution thumbnail images by converting RGB slides to the HSV color space and applying Otsu’s adaptive thresholding on the saturation channel, followed by morphological closing and hole-filling to remove glass background, pen markings, and small artifacts. Second, non-overlapping image patches of 256 × 256 pixels are tiled from the segmented foreground regions at an objective magnification of 20× (≈0.5 μm/pixel); patches with a foreground tissue coverage ratio below 50% are discarded. To standardize computational memory while maintaining slide-wide coverage, up to Mmax = 5000 patches are uniformly sampled using a fixed random seed for slides exceeding 5000 foreground patches, whereas all available foreground patches are retained for smaller slides. Each sampled patch is then encoded into a fixed D = 1024-dimensional feature vector xis,m using the pretrained pathology foundation model UNI [19].
For the transcriptomic branch, patient-level RNA-seq expression profiles are converted into C = 50 Hallmark pathway enrichment scores using single-sample gene set enrichment analysis (ssGSEA) [33,36]. To prevent data leakage across cross-validation splits, the raw enrichment score of each pathway dimension is z-score standardized using the mean μ ∈ R C and standard deviation σ ∈ R C computed exclusively from patients in the current training fold:
r ~ i = r i − μ σ + ϵ
where r ~ i ∈ R C denotes the raw ssGSEA score vector for patient i, and ϵ = 10−8 is a small positive constant added for numerical stability.

2.2.2. Multimodal Teacher Learning

The multimodal teacher module conditions intra-slide instance aggregation on the patient’s Hallmark molecular profile. For notational simplicity, the patient and slide indices (i,s) are omitted below. Given M patch features x m m = 1 M in a slide, each D-dimensional instance feature x m ∈ R D (D = 1024) is first mapped into a lower-dimensional latent space via a teacher-specific linear projection layer followed by a rectified linear unit (ReLU) activation:
h m T = ϕ T x m = ReLU W proj T x m + b proj T ∈ R d proj
where W proj T ∈ R d proj × D and b proj T ∈ R d proj denote the learnable projection weight matrix and bias vector of the teacher, respectively, and dproj = 512 is the projected feature dimension.
Next, the standardized C-dimensional Hallmark vector r ∈ R C (C = 50) is transformed through a nonlinear projection with hyperbolic tangent (tanh) activation to generate a slide-global molecular query vector q ∈ R d k , while each projected patch feature h m T is linearly mapped to an instance key vector k m ∈ R d k :
q = tanh W q r ~ + b q ,   k m = W k h m T
where W q ∈ R d k × C and b q ∈ R d k are the learnable weight matrix and bias vector of the molecular query generator, W k ∈ R d k × d proj is the learnable key projection matrix without bias, and dk = 128 is the shared attention dimension.
The compatibility score between the patient’s molecular query q and each morphological instance key km is computed via scaled dot-product attention [37] and normalized across all M patches in the slide using the Softmax function to yield the teacher attention distribution a T = a 1 T a 2 T … a M T ⊤ ∈ Δ M − 1 :
a m T = exp q ⊤ k m d k ∑ j = 1 M exp q ⊤ k j d k
where d k serves as the scaling factor to prevent gradient saturation during dot-product computation, and a m T ∈ 0 1 represents the relative importance weight assigned to the m-th patch ( ∑ m = 1 M a m T = 1 ).
Using these attention weights, the teacher aggregates local patch representations into a slide-level morphological vector z T ∈ R d proj , which is concatenated with the pathway vector r and fed into a linear classification head gT:
z T = ∑ m = 1 M a m T h m T ,   p ^ T = σ g T [ z T   ‖       r ~ ]
where [⋅‖⋅] denotes vector concatenation producing a (dproj + C)-dimensional multimodal vector, g T : R d proj + C → R is the teacher’s linear classifier parameterized by weight vector w cls T ∈ R d proj + C and scalar bias b cls T ∈ R , σ u = 1 + e − u − 1 is the Sigmoid activation function, and pT ∈ (0, 1) is the teacher’s predicted probability of MSI-H status.

2.2.3. Image-Only Student Distillation and Joint Optimization

The student network adopts a standard non-gated ABMIL architecture [14] that operates exclusively on H&E patch features x m m = 1 M . First, each instance x m ∈ R D is mapped into the student’s independent latent space:
h m S = ϕ S x m = ReLU W proj S x m + b proj S ∈ R d proj
where W proj S ∈ R d proj × D and b proj S ∈ R d proj (dproj = 512) are the student’s learnable projection matrix and bias vector, optimized independently from the teacher.
The student then computes unimodal instance attention scores e m S ∈ R and normalized attention weights a S = a 1 S a 2 S … a M S ⊤ solely from visual features:
e m S = w ⊤ tanh V h m S ,   a m S = exp e m S ∑ j = 1 M exp e j S
where V ∈ R d attn × d proj (dattn = 256) is the hidden attention weight matrix, and w ∈ R d attn is the attention scoring vector.
The student’s slide-level aggregated representation z S ∈ R d proj and predicted MSI-H probability pS ∈ (0, 1) are obtained via:
z S = ∑ m = 1 M a m S h m S ,   p ^ S = σ g S z S
where g S : R d proj → R denotes the student’s linear classification head parameterized by w cls S ∈ R d proj and bias b cls S ∈ R .

2.2.4. Joint Loss Function

Student training combines a slide classification loss with an attention distillation loss. The classification loss provides MSI label supervision, while the distillation loss constrains instance aggregation weights. The UNI feature encoder and teacher parameters remain frozen, and gradients update only the student network.
For slide classification supervision, we use binary cross-entropy with a positive-class weight (weighted BCE) to address the class imbalance caused by the scarcity of MSI-H samples in the pathology data:
L cls p ^ , y = − w pos ⋅ y log p ^ + 1 − y log 1 − p ^
The positive-class weight is calculated as the ratio of negative to positive slides in the current training fold: wpos = NMSS/NMSI-H.
During distillation, teacher attention serves as a fixed target, while student attention is the distribution to be optimized. We use the forward Kullback–Leibler (KL) divergence, weighted by the teacher distribution, to fit the teacher’s weight allocation over the same set of patches:
L attn a T , a S = D KL a T ∥ a S = ∑ m = 1 M a m T log a m T a m S + ϵ
In this loss, instances assigned greater weight by the teacher contribute more to distribution matching, while the label loss continues to constrain the final classification result. The teacher distribution is a learned supervision target, and its transfer value is evaluated through the performance of the corresponding student.
The student’s overall joint optimization objective is defined as:
L total = L cls p ^ S , y + λ L attn a T , a S
where λ ≥ 0 is the hyperparameter balancing distillation. Gradients are backpropagated only within the student network, and teacher parameters remain frozen throughout distillation.

2.2.5. Training and Image-Only Inference Workflow

Algorithm 1 summarizes the three-stage workflow for teacher optimization, attention distillation, and unimodal inference. The subscripts T and S on parameter θ denote the teacher and student networks, respectively, and an asterisk denotes optimal parameters selected by validation patient-level AP. The symbol π_T denotes the teacher’s attention-generation mapping, and f_S^prob denotes the student’s probability prediction mapping. Implementation details, environment specifications, and hyperparameter settings are provided in Section 3.1.2.
Algorithm 1: RNA-Conditioned Attention Distillation Workflow
Input: Training data Dtrain = {({Xis}, ri, yi)}, validation set Dval
Output: Image-only student f S ( · ;   θ S * )
Stage 1: Teacher Parameter Optimization
1: For training sample ( X is ,   r i ,   y i ) , compute ( p ^ T ,   a T ) = f T ( X is ,   r ~ i ;   θ T ) .
2: θ T   ←   AdamW ( θ T ,   ∇ θ T L cls ( p ^ T ,   y i ) ) ; repeat optimization until the stopping criterion is met.
3: Select θ T * by validation patient-level AP, freeze the teacher, and disable dropout.
Stage 2: Instance-Weight Distillation and Student Optimization
4: a T = π T ( X is ,   r ~ i ;   θ T * ) ; ( p ^ S ,   a S )   =   f S ( X is ;   θ S ) .
5: L total   =   L cls ( p ^ S ,   y i )   +   λ L attn ( a T ,   a S ) .
6: θ S   ←   AdamW ( θ S ,   ∇ θ S L total ) ; update only the student and repeat until the stopping criterion is met.
7: Select θ S * by image-only validation patient-level AP.
Stage 3: Independent Image-Only Inference
8: p ^ is = f S prob ( X is ;   θ S * ) ; average slide probabilities within each patient using Equation (4).

3. Experiments and Results

3.1. Experimental Setup

3.1.1. Datasets, Cohort Selection Rationale, and Patient Splits

Internal development used diagnostic H&E whole-slide images and paired RNA-seq data from TCGA-STAD [5]. Study labels were derived from MANTIS scores provided by cBioPortal [38,39,40]. Patients with scores greater than 0.6 were assigned to the MSI-H group, and those with scores below 0.4 were assigned to the microsatellite-stable (MSS) group. Patients with scores between 0.4 and 0.6, inclusive, were excluded. Following screening for diagnostic slides, paired RNA availability, labels, and feature quality, the final cohort included 342 patients, comprising 54 MSI-H and 288 MSS cases, with 365 slides.
Internal evaluation used a fixed, stratified five-fold cross-validation split at the patient level, with training repeated across three random seeds under the same split. All slides from the same patient were assigned to the same subset, and both teacher and student checkpoints were selected based on validation patient-level AP.
External evaluation used the CPTAC-STAD cohort [41], with molecular annotations obtained through LinkedOmics [42] and study labels assigned according to the recorded MSI status [43]. After screening for label consistency and slide quality, the final cohort included 149 patients, comprising 30 MSI-H and 119 MSS cases, with 557 slides. External predictions were generated using image models frozen after internal training. Model selection decisions, parameters, and calibration settings were fixed before external evaluation, and prediction inputs consisted solely of H&E image features.
TCGA-STAD [5] and CPTAC-STAD [41] were specifically selected among public gastric cancer resources because they are the two primary multi-institutional reference cohorts providing quality-controlled diagnostic H&E WSIs alongside validated MSI annotations. Other well-known gastric cancer transcriptomic cohorts, such as the Asian Cancer Research Group (ACRG/GSE62254) study, lack publicly available whole-slide H&E images, whereas patch-cropped datasets lack intact whole-slide spatial context or paired RNA-seq data required for teacher training. Crucially, TCGA-STAD and CPTAC-STAD exhibit pronounced cohort-level differences that rigorously test cross-cohort generalization (Figure 3): (1) specimen sampling density: TCGA-STAD predominantly provides a single diagnostic FFPE resection slide per patient (365 slides across 342 patients; mean 1.07 slides/patient), whereas CPTAC-STAD prospectively collected multiple tumor sections per case (557 slides across 149 patients; mean 3.74 slides/patient); (2) staining and scanning characteristics: Originating from distinct clinical centers and collection protocols, the two cohorts differ noticeably in H&E stain intensity and eosin-to-hematoxylin color balance; and (3) assay protocols: TCGA-STAD MSI labels are derived from whole-exome MANTIS scores [39,40], whereas CPTAC-STAD uses clinical-grade MSI annotations curated in LinkedOmics [42,43].
Figure 3. Comparison of histopathological characteristics and cohort specifications between (a) the internal development cohort (TCGA-STAD, 342 patients, 365 slides) and (b) the independent external validation cohort (CPTAC-STAD, 149 patients, 557 slides), illustrating differences in H&E staining appearance, slide sampling density per patient, and evaluation protocol. Blue circles on the whole-slide thumbnails mark the locations of the corresponding 20× views shown to the right. The pink and purple hues in the tissue images reflect H&E staining. Patient and slide counts are shown in blue for TCGA-STAD and in brown for CPTAC-STAD.

3.1.2. Implementation Details, Experimental Environment, and Comparison Methods

All preprocessing, training, and evaluation pipelines were implemented in Python (v3.10.12) using the PyTorch (v2.9.0) framework compiled with CUDA 12.8 on a 64-bit Ubuntu 22.04 LTS Linux server. Whole-slide image reading and tissue segmentation were performed using OpenSlide-Python (v1.3.1) and OpenCV-Python (v4.8.0); pretrained UNI encoder weights [19] were executed via timm (v0.9.16); ssGSEA pathway scoring was performed using GSEApy (v1.1.0); and evaluation metrics and bootstrap confidence intervals were computed using scikit-learn (v1.3.2) and NumPy (v1.26.0). Experiments were conducted on a workstation equipped with an NVIDIA GeForce RTX 5090 GPU (32 GB).
In our network implementation, frozen UNI instance features have D = 1024 dimensions, and the local projection dimension is d_proj = 512 for both teacher and student. Teacher molecular queries and instance keys have d_k = 128 dimensions, the student’s non-gated ABMIL attention hidden dimension is d_attn = 256, and the transcriptomic input is a C = 50-dimensional Hallmark pathway vector. Both networks apply dropout [44] with a probability of 0.5 at the local projection layer and before the classification head; dropout is disabled when precomputing frozen teacher attention targets and during evaluation. Both teacher and student are optimized using AdamW [45] with a weight decay of 10−4, a batch size of one slide, a maximum of 100 epochs, and an early-stopping patience of 8 epochs based on validation patient-level AP (retaining the earliest checkpoint achieving peak validation AP). The teacher learning rate is fixed at 5 × 10−5. Candidate student learning rates are searched over {2 × 10−5, 5 × 10−5, 10−4}, and candidate attention distillation weights λ are searched over {0.01, 0.03, 0.1, 0.3}, selecting the final student model by validation patient-level AP.
All comparison methods were trained and evaluated using the exact same patient splits, cached UNI features, and random seeds. Unimodal image-only baselines included matched UNI [19] + ABMIL [14] (primary control sharing the exact student architecture, initialization, slide order, and optimizer schedule), CLAM-SB [15], TransMIL [16], and MKD student-only [30]. Same-teacher distillation controls included output probability distillation [26] and slide-level aggregated feature distillation [46]. Cross-modal privileged learning baselines included MKD [30], MoMKD [31], and G-HANet [25].

3.1.3. Evaluation Metrics and Statistical Analysis

The patient was the unit of evaluation. For patients with multiple slides, positive-class probabilities were first averaged arithmetically across slides before calculating patient-level average precision (AP) and AUROC. AP was the primary metric, emphasizing precision–recall performance under class imbalance [47]. For internal evaluation, metrics were first averaged across the five test folds within each training seed. The mean and sample standard deviation across the three seeds were then reported.
Internal comparisons between groups used metric differences calculated within the same test fold and training seed, followed by summarization across five folds and three seeds. The primary comparison was defined as attention distillation minus matched UNI + ABMIL. The directions of differences in the design analyses are specified in the corresponding table notes and figure captions. Differences were calculated using unrounded metric values, and comparisons between groups used descriptive difference analyses.
For external evaluation, patient-level probabilities were first obtained from each model and then equally averaged across the 15 models from five folds and three training seeds. AP and AUROC were calculated on the same external patient cohort, and differences between methods were reported. External ensemble metrics and internal test-fold metrics were summarized separately. Internal results also included the sample standard deviation across the three training seeds.

3.2. Results

3.2.1. Comparison of Internal Predictive Performance

With image features and student architecture matched, RNA-conditioned attention distillation achieved higher internal predictive performance on TCGA-STAD: mean AP increased from 0.6506 for matched UNI + ABMIL [14,19] to 0.6729 (+0.0223), while mean AUROC increased from 0.8959 to 0.9005 (+0.0046) (Table 1). Among the other image-only baselines, MKD student-only [30] achieved the second-highest mean AP (0.6666) and AUROC (0.8970); our method exceeded this baseline by 0.0063 in AP and 0.0035 in AUROC, and outperformed all three cross-modal adaptation baselines—MKD [30], MoMKD [31], and G-HANet [25]—on both metrics.
Table 1. Internal evaluation on TCGA-STAD: patient-level predictive performance with image-only inference.

3.2.2. External Validation on CPTAC-STAD

To evaluate cross-cohort generalizability without target-domain fine-tuning, the 15 frozen image models trained on TCGA-STAD were directly evaluated on the 557 slides from 149 patients in CPTAC-STAD (Table 2). Using the 15-model ensemble, our method achieved an external AP of 0.6305 (95% CI: 0.4612–0.7784) and an AUROC of 0.8991 (95% CI: 0.8315–0.9518), retaining a positive numerical advantage over the matched UNI + ABMIL baseline (AP: 0.6234, ΔAP = +0.0071; AUROC: 0.8958, ΔAUROC = +0.0033). Method rankings varied across metrics: MoMKD [31] attained the highest external AP (0.6432) but a lower AUROC (0.8818), whereas CLAM-SB [15] attained the highest AUROC (0.9006) with a lower AP (0.6253). Our method ranked second on both metrics, demonstrating balanced discrimination and precision–recall performance across cohorts, though the overlapping 95% bootstrap confidence intervals indicate that small point-estimate differences should be interpreted cautiously in light of external sample size.
Table 2. External validation on CPTAC-STAD: patient-level predictive performance of frozen image models.
Figure 4 presents the patient-level precision–recall and ROC curves on CPTAC-STAD for RNA-conditioned attention distillation, matched UNI + ABMIL [14,19], MKD [30], and MoMKD [31]. While the ROC curves were broadly comparable across methods (Figure 4b), the precision–recall curves exhibited distinct behaviors across recall regimes, with our method maintaining higher precision than matched ABMIL across intermediate recall thresholds (0.25–0.65; Figure 4a).
Figure 4. Patient-level prediction curves in the external CPTAC-STAD cohort. (a) Precision–recall curves; (b) ROC curves. Attention distillation, matched UNI + ABMIL, MKD, and MoMKD are compared. The evaluation included 149 patients, comprising 30 MSI-H and 119 MSS cases. For each frozen model, slide-level probabilities were first averaged within each patient, followed by equally weighted ensembling across the 15 models corresponding to three training seeds and five folds. The horizontal reference line in (a) indicates the proportion of positive cases in the cohort, and the diagonal line in (b) represents chance-level discrimination.

3.2.3. Effects of RNA Pairing Conditions on Student Performance

To examine how molecular inputs and their pairing relationships affect student performance, we compared four teacher RNA conditions: true pairing, zeroing, global shuffling, and within-class shuffling (Table 3). Global shuffling changes the correspondence between RNA and both patients and labels, whereas within-class shuffling exchanges RNA only among patients in the same MSI class.
Table 3. Image of student performance under altered teacher RNA conditions.
Comparing the two permutation controls in Table 3 reveals a notable distinction between class-level and patient-specific molecular conditioning. Global shuffling caused the sharpest drop in student performance (AP decreased by 0.0398 to 0.6331 ± 0.0207; AUROC decreased to 0.8683 ± 0.0049), whereas within-class shuffling preserved a substantially higher AP (0.6550 ± 0.0218, ΔAP = +0.0219 over global shuffling) while still underperforming true patient pairing (ΔAP = −0.0179) and suffering a pronounced decline in AUROC (0.8567 ± 0.0037).
This divergence can be understood from the biological structure of Hallmark pathway profiles in gastric cancer. MSI-H tumors share strong, canonical class-level transcriptomic signatures across patients—most notably concerted activation of immune-related pathways (e.g., interferon-γ response, inflammatory response) and DNA repair/proliferation pathways. Under global shuffling, an MSI-H slide is frequently paired with an MSS patient’s Hallmark profile during teacher training; the resulting cross-modal query actively directs teacher attention away from MSI-relevant tissue phenotypes, generating corrupted supervision targets that degrade student precision. By contrast, under within-class shuffling, an MSI-H slide is paired with another MSI-H patient’s Hallmark vector. Because patients within the same molecular subtype share coarse pathway activation directions, the permuted query still functions as a valid class-level molecular prototype, guiding attention toward characteristic high-confidence MSI-H regions (such as dense lymphoid infiltrates) and thereby maintaining relatively strong precision at the top of the ranked list (reflected in AP). However, gastric tumors also exhibit substantial inter-patient heterogeneity in stromal proportion, immune exclusion, and histological differentiation. Exchanging RNA profiles within the same class disrupts fine-grained, patient-specific correspondence between the strength of a pathway signal and the exact tissue composition of a given slide. This mismatch impairs probability calibration across borderline cases and degrades overall ranking discrimination across the full decision spectrum (reflected in the lower AUROC of 0.8567 vs. 0.9005 under true pairing). Thus, within-class shuffling captures coarse subtype-shared pathway priors, whereas true patient-level pairing is necessary to achieve both high positive-retrieval precision (AP) and robust global discrimination (AUROC).

3.2.4. Effects of Distillation Targets on Student Performance

Using the same teacher and matched student architectures, attention distillation achieved a mean AP that exceeded those of output distribution distillation and aggregated feature distillation by 0.0279 and 0.0190, respectively. Its AUROC also exceeded both controls (Table 1). This comparison suggests that the target through which teacher information constrains the student affects transfer outcomes under the current training configuration. Instance weights provide an effective form of supervision for the image student.
The three types of targets constrain classification outputs, slide-level aggregated representations, and instance weight allocation, respectively. Attention distillation uses instance correspondence across a shared image patch set and matching indices to guide relative weighting. It allows the student to learn the prediction task through its own projection and classification parameters, without requiring dimension-wise agreement between teacher and student aggregated features. The current results provide empirical support for this transfer approach. However, its advantages may also be influenced by optimization factors such as target distributions, loss scales, and normalization, and cannot be attributed solely to avoiding dimension-wise feature alignment.

3.2.5. Teacher RNA Input Placement and Student Transfer Performance

To examine the relationship between how RNA is used in the teacher and the resulting student gains, we compared “query vector + classification head” and “query vector only” configurations (Table 4). The former uses RNA both to generate a conditional query vector and to support teacher classification, whereas the latter retains RNA only for attention generation. Both student groups received attention distillation. Their learning rates and distillation weights were retained from the settings selected for the main method in the corresponding folds, allowing transfer performance to be compared under fixed student training configurations.
Table 4. Patient-level performance of teachers with different RNA input locations and their corresponding image students.
Removing RNA input from the classification head increased teacher AP by 0.0095, but the corresponding student AP point estimates differed by only 0.0004, while student AUROC increased slightly (Table 4). The improvement in teacher classification performance was not accompanied by a clear increase in student AP. This suggests that teacher scores cannot directly substitute for evaluating the transfer value of attention targets. Teacher predictions also depend on the teacher’s local representations and classification parameters, whereas the student directly receives instance weights.

3.2.6. Attention Transfer and Regional Perturbation Analysis

We first compared teacher–student and teacher–matched baseline attention JS divergences using frozen models from each patient’s corresponding test fold. All models computed weights using the same image patch set and indices. Student attention was closer to teacher attention than matched baseline attention in 330 of 342 patients. The mean ΔJS was 0.1652, with a 95% confidence interval of [0.1576, 0.1728] (Figure 5a). This result supports the student’s learning of the teacher’s allocation of instance weights at the distributional level. However, similar distributions do not establish agreement in regional semantics; the relationship between weights and model predictions must also be assessed through perturbation responses.
Figure 5. Cohort-wide attention transfer and perturbation analysis of regions receiving high teacher attention. (a) Comparison of attention JS divergences across 342 patients. The horizontal axis shows teacher–matched baseline divergence, and the vertical axis shows teacher–student divergence. Each point represents one patient; points below the line of equality indicate that student attention is closer to teacher attention. ΔJS is defined as teacher–baseline divergence minus teacher–student divergence. (b) Absolute change in predicted probability following deletion of patches with high teacher attention, minus the mean absolute change across 100 random deletions of the same number of patches. Positive values indicate a larger perturbation response to high-weight deletion. (c) AP after high-weight deletion minus the mean AP after random deletion. Negative values indicate lower classification performance following high-weight deletion. The solid blue line represents the attention-distilled student, and the dashed gray line represents the matched baseline. Deletion fractions are 0%, 5%, 10%, 20%, 30%, and 50%. Intervals and shaded regions represent 95% confidence intervals obtained from 2000 patient-level paired bootstrap resamples stratified by test fold and class. Shaded bands around the curves represent pointwise intervals. The confidence intervals in this section assess patient sampling uncertainty in the attention and perturbation metrics. The teacher uses paired RNA for post hoc diagnostic analysis, whereas the student and baseline receive image inputs only.
We then removed image patches in descending order of teacher attention and compared the results with those from removing the same number of randomly selected patches. High-weight deletion generally produced larger absolute changes in predicted probability than random deletion, and the additional change generally increased with the deletion fraction. Both the student and matched baseline exhibited this pattern (Figure 5b). This indicates that regions assigned higher weights by the teacher are relevant to predictions from both image models, and that this response is not unique to the student.
Classification metrics changed in the same direction: removing regions with high teacher weights caused a greater AP decline than random deletion. At a deletion fraction of 20%, the AP differences relative to random deletion were −0.2496 and −0.1995 for the student and matched baseline, respectively (Figure 5c). These results connect high-weight regions with classification behavior. However, because the baseline also relies on these regions, regional perturbation evidence alone does not establish attention transfer as the cause of the performance gains in the main comparison.

3.2.7. Case Analysis

To relate cohort-level weight analyses to specific tissue images, Figure 6 presents true-positive, true-negative, false-positive, and false-negative cases from the student model. It compares the original WSIs, attention distributions from the teacher and image models, and the local morphology of regions assigned high weights by the student. These cases illustrate differences and limitations in individual predictions and do not represent overall performance within each patient category.
Figure 6. Attention distributions in four cases classified by the student model. The positive class is microsatellite instability-high (MSI-H). The reported probabilities are patient-level predictions of MSI-H. Case 1 is a true-positive MSI-H case. (a) Original whole-slide image (WSI). (b) Teacher attention map. (c) Student attention map (p = 0.791). (d) Matched baseline attention map (p = 0.806). (e) Close-up of a region receiving high student attention, showing irregular gland-like structures and surrounding stroma. Case 2 is a true-negative microsatellite-stable (MSS) case. (f) Original WSI. (g) Teacher attention map. (h) Student attention map (p = 0.079). (i) Matched baseline attention map (p = 0.980). (j) Close-up of a region receiving high student attention, showing gland-like cell clusters intermingled with stroma. Case 3 is a false-positive MSS case. (k) Original WSI. (l) Teacher attention map. (m) Student attention map (p = 0.717). (n) Matched baseline attention map (p = 0.709). (o) Close-up of a region receiving high student attention, showing densely packed gland-like epithelium, focal dark staining, and vascular lumina containing red blood cells. Case 4 is a false-negative MSI-H case. (p) Original WSI. (q) Teacher attention map. (r) Student attention map (p = 0.316). (s) Matched baseline attention map (p = 0.453). (t) Close-up of a region receiving high student attention, showing dense cell clusters with less distinct glandular lumina. Each case uses 5000 cached patches. The color scale indicates within-slide attention percentiles, and the bands in the heatmaps reflect the spatial coverage of the sampled patches. Black boxes mark the regions shown in the close-ups. Scale bars represent 1 mm in whole-slide views and 100 μm in close-ups. For post hoc comparison, teacher heatmaps use paired RNA data standardized using parameters from the corresponding training fold. The student and matched baseline use images only. Cases were selected according to rules established before heatmap inspection.
In Case 2, the student correctly classified the case as MSS, whereas both the teacher and baseline assigned relatively high probabilities to the positive class. Attention transfer allows this divergence in predictions. Even when the same instances receive similar weights, they can produce different responses through each model’s feature projection and classification head. The student can therefore use the teacher’s aggregation guidance while retaining the ability to learn independently from task labels.
High-weight local regions show that the areas contributing to aggregation encompass diverse tissue morphologies. The true-positive region (Figure 6e) shows irregular gland-like structures, epithelial cells with variable nuclear sizes, and surrounding eosinophilic stroma. The true-negative region (Figure 6j) contains relatively dense gland-like cell clusters intermingled with stroma, with scattered small, darkly stained nuclei. The false-positive region (Figure 6o) contains densely packed gland-like epithelium, focal darkly stained areas, and vascular lumina containing red blood cells. The false-negative region (Figure 6t) predominantly comprises relatively dense cell clusters, with less distinct glandular lumina and narrow strands of eosinophilic tissue between them.
These local observations connect high-weight regions with visible tissue structures. They also show that appearances such as gland-like structures, dense cellularity, and dark staining can occur across different MSI labels and prediction outcomes. Models therefore need to learn combinations of evidence from multiple regions; an individual high-weight region does not correspond to an MSI-specific morphology. The percentile heatmaps in Figure 6 indicate each model’s relative areas of attention within a single slide and cannot be used to compare the concentration of attention distributions across models.

4. Discussion

4.1. Molecular Conditioning as a Complement to Weakly Supervised Aggregation

Patient-level MSI labels supervise the final prediction, while the model learns how individual tissue regions within a slide contribute to that prediction [14]. In WSIs with complex tissue composition, different combinations of instances may produce similar classification outputs. Even with fixed, high-quality image features, the model must determine how to assign instance weights and combine local information into patient-level evidence. This study focuses on this aggregation process, using an RNA-conditioned teacher to transform patient-level molecular context into additional supervision corresponding to image instances.
Molecular information directly participates in generating instance weights within this framework. The teacher constructs a query from the patient’s pathway representation and assigns relative weights through interactions between the query and image instances. The student learns these weighting relationships on the same set of patches, developing an aggregation rule that depends only on images. The matched baseline comparison evaluates the effect of the complete supervision scheme. Distillation comparisons using the same teacher examine the influence of the level at which supervision is applied, while RNA condition controls test the role of molecular correspondence.
Compared with the matched baseline, the RNA-zeroing condition increased AP but decreased AUROC. This suggests that additional teacher targets may themselves alter the student’s optimization outcomes, with effects that differ across metrics. True pairing improved both metrics relative to RNA zeroing, supporting the incremental value of molecular conditioning within the current framework. These results suggest that evaluating molecularly assisted learning requires examining both what paired information contributes and through which supervision targets it influences the student network.

4.2. Matching Transfer Targets to the Student’s Input Conditions

Attention transfer uses the explicit instance correspondence between the teacher and student. They match relative weights on the same set of patches while independently learning their local representations and classification parameters. This design explicitly aligns instance weights, leaving room for the student to adjust its feature mappings and classification rules under label supervision. Similar attention distributions can therefore produce different predictions through different representations and classifiers.
The choice of the explicit alignment target also determines how the training process should be understood. Student attention is computed from its local representations, and the attention loss influences representation learning through backpropagation. The classification loss jointly adjusts the projection, aggregation, and classification parameters. The two losses are jointly optimized within the same network, keeping attention learning and representation learning coupled. The method constrains relative weights among instances rather than requiring dimension-wise agreement between the teacher’s and student’s aggregated vectors.
The learning objective in Equation (14) further clarifies the meaning of this transfer. Let X denote the set of image instances and R the molecular input. Let aT(X,R) and aS(X) denote teacher and student attention, respectively. Consider the idealized setting in which only the population expectation of the standard forward KL divergence DKL(aT ‖ aS) is minimized. Temporarily disregarding numerical stabilization terms and the classification loss, and assuming unrestricted model capacity, the optimal image-based attention satisfies:
a S * X = E a T X , R ∣ X
For a given image input, taking the conditional expectation over molecular inputs makes the weights of the logarithmic matching term in the forward KL divergence equal to the conditional mean of teacher attention. Attention transfer can therefore be understood as an image-based estimate of the molecularly conditioned weighting rule. Equation (16) concerns aggregation weights only and does not describe the recovery of a patient’s complete molecular state. In practice, learning is jointly influenced by finite sample size, model capacity, and the classification objective. This also indicates that supervision targets should contain patterns learnable from the student’s own inputs, in addition to being relevant to the task.
The teacher’s predictive performance and the learnability of its supervision targets require separate evaluation. In the teacher input-placement controls, the query-only teacher achieved a higher AP. However, when the student hyperparameters from the main method were reused, student AP did not improve further. This suggests that, under the current setting, teacher AP alone is insufficient to assess transfer gains. Teacher selection should also consider the supervision targets generated and the resulting student performance. Future analyses could compare teacher and student weights, assess their alignment across tissue regions, and examine how these differences relate to predictive gains. These analyses would help test the explanation based on target learnability.

4.3. Image-Only Inference and Cross-Cohort Applicability

Separating training inputs from prediction inputs allows the model to use only H&E images at inference, without requiring paired RNA from new patients. External validation with frozen models further examines the image prediction rules learned through this training strategy. On CPTAC-STAD, our method improved AP and AUROC over the matched baseline by 0.0071 and 0.0033, respectively, retaining a small numerical advantage under the current external evaluation conditions.
Image-only inference simplifies data requirements, whereas cross-cohort performance depends on how the complete image-processing pipeline performs in a new cohort [48,49]. This pipeline uses frozen UNI features, while the subsequent local projection, instance weighting, and classification parameters are learned from the development cohort. External validation therefore evaluates these parameters and the prediction rules shaped by their training supervision. The student and baseline share the same architecture, facilitating comparison of supervision strategies. Whether the gains persist across cohorts, however, must be assessed through external results.
The internal and external evaluations differ in patient composition, sources of study labels, and metric summarization procedures. Internal evaluation first averages metrics across the five test folds within each seed and then summarizes the results across three seeds. External evaluation calculates metrics after equally averaging patient-level probabilities from the 15 frozen models. Results should therefore be interpreted primarily by comparing methods against the same baseline within each cohort. Changes in the differences relative to the baseline between internal and external evaluations involve both cohort differences and summarization procedures. They cannot be directly attributed to attenuation of supervision gains across cohorts.

4.4. Histological Interpretation and Study Limitations

Case analysis connects instance weights with specific tissue regions, providing clues to how models aggregate image information. Weights indicate the relative extent to which regions participate in aggregation, while the direction of their influence on the final prediction also depends on local features and classification. High-weight regions therefore do not necessarily represent MSI-H-specific morphology, and similar heatmaps are insufficient to establish that two models use the same discriminative evidence. Similar tissue appearances in correctly and incorrectly predicted cases suggest that histological interpretation should further examine how information from multiple regions jointly contributes to prediction.
This study maps the 50-dimensional Hallmark representation [33] to a single conditional query, with attention jointly determined by pathway representations, image content, and training objectives. The resulting weights reflect these combined influences and cannot be directly interpreted as the spatial distribution of an individual pathway within a slide. Shared patch indices provide instance correspondence for subsequent analyses. Region annotations, tissue composition statistics, and targeted input interventions could help examine the relationship between weights and specific morphological features. They could also provide independent evidence linking patient-level molecular context with local histological mechanisms.
This study used retrospective public cohorts, with three training seeds run under fixed patient splits and fixed mappings used for RNA permutations. Current comparisons between groups primarily rely on descriptive differences, while standard deviations across seeds reflect variation arising from training randomness. Uncertainty due to patient sampling should be assessed at the patient level while preserving pairing between methods. The stability of the effects of molecular correspondence requires repeated permutation testing. Teacher input-placement controls should also be supplemented with student results obtained after separately tuning each configuration. This would distinguish performance under fixed student settings from the transfer performance achievable with each configuration.
AP and AUROC describe model ranking performance [47]. For practical screening workflows, operating points should be prespecified according to clearly defined application goals. Detection performance, downstream testing burden, and probability calibration should then be evaluated and validated in independent cohorts [50,51]. These evaluations can help determine whether the numerical gains from attention supervision translate into consistent practical value.

5. Conclusions

This study proposes an RNA-conditioned attention distillation framework that transforms patient-level molecular context available during training into instance weight supervision, enabling a standard ABMIL student to rely exclusively on H&E images at inference. The method improved AP over the matched baseline in internal evaluation and retained a small numerical advantage in external validation with frozen models. Design analyses indicate that both RNA pairing conditions and transfer targets influence student performance. Under the examined input-placement controls and fixed student hyperparameters, higher teacher AP did not translate into higher student AP. These results suggest that molecularly assisted image learning should prioritize the match between supervision targets and the student’s input conditions. Instance weights provide an explicit transfer target, allowing molecular information to guide the learning of aggregation rules while preserving the student’s independent optimization of task representations and classification parameters.

Author Contributions

Conceptualization, X.L. (Xiaozhang Liu); methodology, X.L. (Xiaoxin Li); software, X.L. (Xiaoxin Li); validation, X.L. (Xiaoxin Li); formal analysis, X.L. (Xiaoxin Li); investigation, X.L. (Xiaoxin Li); resources, X.L. (Xiaozhang Liu); data curation, X.L. (Xiaozhang Liu) Y.P.; writing—original draft preparation, X.L. (Xiaoxin Li); writing—review and editing, X.L. (Xiaozhang Liu) and X.L. (Xiaoxin Li); supervision, X.L. (Xiaozhang Liu), Z.L.; project administration, X.L. (Xiaozhang Liu), Z.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The TCGA-STAD diagnostic whole-slide images and RNA-seq data are available through the National Cancer Institute’s Genomic Data Commons (project TCGA-STAD). The MANTIS scores used to derive MSI labels for this cohort are available from cBioPortal DataHub in the MSI_SCORE_MANTIS field [40]. The CPTAC-STAD whole-slide images are available from The Cancer Imaging Archive (DOI 10.7937/jw9a-8k71) [41]. The MSI labels used for external validation are available from LinkedOmics in the MSI_Status field of GC_metatable.tsi [43].

Acknowledgments

During the preparation of this manuscript, the author(s) used DeepSeek-V4.1-Flash (DeepSeek, Version 4.1-Flash) for translation and language polishing purposes only. The authors reviewed and edited all suggested changes and take full responsibility for the content of the publication.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
MSIMicrosatellite instability
WSIWhole-slide image
MILMultiple instance learning
H&EHematoxylin and eosin
TCGAThe Cancer Genome Atlas
CIConfidence interval
CLAMClustering-constrained attention multiple instance learning

References

  1. Le, D.T.; Uram, J.N.; Wang, H.; Bartlett, B.R.; Kemberling, H.; Eyring, A.D.; Skora, A.D.; Luber, B.S.; Azad, N.S.; Laheru, D.; et al. PD-1 Blockade in Tumors with Mismatch-Repair Deficiency. N. Engl. J. Med. 2015, 372, 2509–2520. [Google Scholar] [CrossRef] [Scilit]
  2. Le, D.T.; Durham, J.N.; Smith, K.N.; Wang, H.; Bartlett, B.R.; Aulakh, L.K.; Lu, S.; Kemberling, H.; Wilt, C.; Luber, B.S.; et al. Mismatch Repair Deficiency Predicts Response of Solid Tumors to PD-1 Blockade. Science 2017, 357, 409–413. [Google Scholar] [CrossRef] [Scilit]
  3. Chao, J.; Fuchs, C.S.; Shitara, K.; Tabernero, J.; Muro, K.; Van Cutsem, E.; Bang, Y.-J.; De Vita, F.; Landers, G.; Yen, C.-J.; et al. Assessment of Pembrolizumab Therapy for the Treatment of Microsatellite Instability–High Gastric or Gastroesophageal Junction Cancer Among Patients in the KEYNOTE-059, KEYNOTE-061, and KEYNOTE-062 Clinical Trials. JAMA Oncol. 2021, 7, 895–902. [Google Scholar] [CrossRef] [Scilit]
  4. Pietrantonio, F.; Miceli, R.; Raimondi, A.; Kim, Y.W.; Kang, W.K.; Langley, R.E.; Choi, Y.Y.; Kim, K.-M.; Nankivell, M.G.; Morano, F.; et al. Individual Patient Data Meta-Analysis of the Value of Microsatellite Instability As a Biomarker in Gastric Cancer. J. Clin. Oncol. 2019, 37, 3392–3400. [Google Scholar] [CrossRef] [Scilit]
  5. The Cancer Genome Atlas Research Network. Comprehensive Molecular Characterization of Gastric Adenocarcinoma. Nature 2014, 513, 202–209. [Google Scholar] [CrossRef] [Scilit]
  6. Bartley, A.N.; Mills, A.M.; Konnick, E.; Overman, M.; Ventura, C.B.; Souter, L.; Colasacco, C.; Stadler, Z.K.; Kerr, S.; Howitt, B.E.; et al. Mismatch Repair and Microsatellite Instability Testing for Immune Checkpoint Inhibitor Therapy: Guideline From the College of American Pathologists in Collaboration with the Association for Molecular Pathology and Fight Colorectal Cancer. Arch. Pathol. Lab. Med. 2022, 146, 1194–1210. [Google Scholar] [CrossRef] [Scilit]
  7. Echle, A.; Grabsch, H.I.; Quirke, P.; van den Brandt, P.A.; West, N.P.; Hutchins, G.G.A.; Heij, L.R.; Tan, X.; Richman, S.D.; Krause, J.; et al. Clinical-Grade Detection of Microsatellite Instability in Colorectal Tumors by Deep Learning. Gastroenterology 2020, 159, 1406–1416.e11. [Google Scholar] [CrossRef] [Scilit]
  8. Fu, Y.; Jung, A.W.; Torne, R.V.; Gonzalez, S.; Vöhringer, H.; Shmatko, A.; Yates, L.R.; Jimenez-Linan, M.; Moore, L.; Gerstung, M. Pan-Cancer Computational Histopathology Reveals Mutations, Tumor Composition and Prognosis. Nat. Cancer 2020, 1, 800–810. [Google Scholar] [CrossRef] [Scilit]
  9. Kather, J.N.; Pearson, A.T.; Halama, N.; Jäger, D.; Krause, J.; Loosen, S.H.; Marx, A.; Boor, P.; Tacke, F.; Neumann, U.P.; et al. Deep Learning Can Predict Microsatellite Instability Directly from Histology in Gastrointestinal Cancer. Nat. Med. 2019, 25, 1054–1056. [Google Scholar] [CrossRef] [Scilit]
  10. Wang, Y.; Hu, C.; Kwok, T.; Bain, C.A.; Xue, X.; Gasser, R.B.; Webb, G.I.; Boussioutas, A.; Shen, X.; Daly, R.J.; et al. DEMoS: A Deep Learning-Based Ensemble Approach for Predicting the Molecular Subtypes of Gastric Adenocarcinomas from Histopathological Images. Bioinformatics 2022, 38, 4206–4213. [Google Scholar] [CrossRef] [Scilit]
  11. Silva, J.R.; Mascarenhas-Lemos, L.; Neto do Nascimento, C.; Sousa Marques, D.; Wen, X.; Pinho, L.; Maio, R.; Pontes, P.; Cirnes, L.; Cravo, M.; et al. Role of Endoscopic Biopsies and Morphologic Features in Predicting Microsatellite Instability Status in Gastric Cancer: A Multicenter Comparative Study of Endoscopic Biopsies and Surgical Specimens. Am. J. Surg. Pathol. 2023, 47, 990–1000. [Google Scholar] [CrossRef] [Scilit]
  12. Park, S.; Pettigrew, M.F.; Cha, Y.J.; Kim, I.-H.; Kim, M.; Banerjee, I.; Barnfather, I.; Clemenceau, J.R.; Jang, I.; Kim, H.; et al. Deep Gaussian Process with Uncertainty Estimation for Microsatellite Instability and Immunotherapy Response Prediction from Histology. npj Digit. Med. 2025, 8, 294. [Google Scholar] [CrossRef] [Scilit]
  13. Campanella, G.; Hanna, M.G.; Geneslaw, L.; Miraflor, A.; Werneck Krauss Silva, V.; Busam, K.J.; Brogi, E.; Reuter, V.E.; Klimstra, D.S.; Fuchs, T.J. Clinical-Grade Computational Pathology Using Weakly Supervised Deep Learning on Whole Slide Images. Nat. Med. 2019, 25, 1301–1309. [Google Scholar] [CrossRef] [Scilit]
  14. Ilse, M.; Tomczak, J.; Welling, M. Attention-Based Deep Multiple Instance Learning. In Proceedings of the 35th International Conference on Machine Learning (ICML 2018), Stockholm, Sweden, 10–15 July 2018; Volume 80, pp. 2127–2136. [Google Scholar]
  15. Lu, M.Y.; Williamson, D.F.K.; Chen, T.Y.; Chen, R.J.; Barbieri, M.; Mahmood, F. Data-Efficient and Weakly Supervised Computational Pathology on Whole-Slide Images. Nat. Biomed. Eng. 2021, 5, 555–570. [Google Scholar] [CrossRef] [Scilit]
  16. Shao, Z.; Bian, H.; Chen, Y.; Wang, Y.; Zhang, J.; Ji, X.; Zhang, Y. TransMIL: Transformer Based Correlated Multiple Instance Learning for Whole Slide Image Classification. In Proceedings of the 35th Conference on Neural Information Processing Systems (NeurIPS 2021), Virtual, 6–14 December 2021; Volume 34, pp. 2136–2147. [Google Scholar]
  17. Ciga, O.; Xu, T.; Martel, A.L. Self Supervised Contrastive Learning for Digital Histopathology. Mach. Learn. Appl. 2022, 7, 100198. [Google Scholar] [CrossRef] [Scilit]
  18. Chen, R.J.; Chen, C.; Li, Y.; Chen, T.Y.; Trister, A.D.; Krishnan, R.G.; Mahmood, F. Scaling Vision Transformers to Gigapixel Images via Hierarchical Self-Supervised Learning. In Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), New Orleans, LA, USA, 18–24 June 2022; pp. 16123–16134. [Google Scholar] [CrossRef] [Scilit]
  19. Chen, R.J.; Ding, T.; Lu, M.Y.; Williamson, D.F.K.; Jaume, G.; Song, A.H.; Chen, B.; Zhang, A.; Shao, D.; Shaban, M.; et al. Towards a General-Purpose Foundation Model for Computational Pathology. Nat. Med. 2024, 30, 850–862. [Google Scholar] [CrossRef] [Scilit]
  20. Lu, M.Y.; Chen, B.; Williamson, D.F.K.; Chen, R.J.; Liang, I.; Ding, T.; Jaume, G.; Odintsov, I.; Le, L.P.; Gerber, G.; et al. A Visual-Language Foundation Model for Computational Pathology. Nat. Med. 2024, 30, 863–874. [Google Scholar] [CrossRef] [Scilit]
  21. Mobadersany, P.; Yousefi, S.; Amgad, M.; Gutman, D.A.; Barnholtz-Sloan, J.S.; Velázquez Vega, J.E.; Brat, D.J.; Cooper, L.A.D. Predicting Cancer Outcomes from Histology and Genomics Using Convolutional Networks. Proc. Natl. Acad. Sci. USA 2018, 115, E2970–E2979. [Google Scholar] [CrossRef] [Scilit]
  22. Chen, R.J.; Lu, M.Y.; Wang, J.; Williamson, D.F.K.; Rodig, S.J.; Lindeman, N.I.; Mahmood, F. Pathomic Fusion: An Integrated Framework for Fusing Histopathology and Genomic Features for Cancer Diagnosis and Prognosis. IEEE Trans. Med. Imaging 2022, 41, 757–770. [Google Scholar] [CrossRef] [Scilit]
  23. Chen, R.J.; Lu, M.Y.; Weng, W.-H.; Chen, T.Y.; Williamson, D.F.K.; Manz, T.; Shady, M.; Mahmood, F. Multimodal Co-Attention Transformer for Survival Prediction in Gigapixel Whole Slide Images. In Proceedings of the 2021 IEEE/CVF International Conference on Computer Vision (ICCV), Montreal, QC, Canada, 11–17 October 2021; pp. 3995–4005. [Google Scholar] [CrossRef] [Scilit]
  24. Chen, R.J.; Lu, M.Y.; Williamson, D.F.K.; Chen, T.Y.; Lipkova, J.; Noor, Z.; Shaban, M.; Shady, M.; Williams, M.; Joo, B.; et al. Pan-Cancer Integrative Histology-Genomic Analysis via Multimodal Deep Learning. Cancer Cell 2022, 40, 865–878.e6. [Google Scholar] [CrossRef] [Scilit]
  25. Wang, Z.; Zhang, Y.; Xu, Y.; Imoto, S.; Chen, H.; Song, J. Histo-Genomic Knowledge Association for Cancer Prognosis From Histopathology Whole Slide Images. IEEE Trans. Med. Imaging 2025, 44, 2170–2181. [Google Scholar] [CrossRef] [Scilit]
  26. Hinton, G.; Vinyals, O.; Dean, J. Distilling the Knowledge in a Neural Network. arXiv 2015, arXiv:1503.02531. [Google Scholar] [CrossRef] [Scilit]
  27. Vapnik, V.; Vashist, A. A New Learning Paradigm: Learning Using Privileged Information. Neural Netw. 2009, 22, 544–557. [Google Scholar] [CrossRef] [Scilit]
  28. Lopez-Paz, D.; Bottou, L.; Schölkopf, B.; Vapnik, V. Unifying Distillation and Privileged Information. In Proceedings of the 4th International Conference on Learning Representations (ICLR 2016), San Juan, Puerto Rico, 2–4 May 2016. [Google Scholar]
  29. Jaume, G.; Oldenburg, L.; Vaidya, A.; Chen, R.J.; Williamson, D.F.K.; Peeters, T.; Song, A.H.; Mahmood, F. Transcriptomics-Guided Slide Representation Learning in Computational Pathology. In Proceedings of the 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 17–21 June 2024; pp. 9632–9644. [Google Scholar] [CrossRef] [Scilit]
  30. Zhang, Q.; Hao, X.; Chen, Q.; Xu, R.; Cong, F.; Lu, C.; Xu, H. Multi-Modal Knowledge Decomposition Based Online Distillation for Biomarker Prediction in Breast Cancer Histopathology. In Medical Image Computing and Computer Assisted Intervention—MICCAI 2025; Gee, J.C., Alexander, D.C., Hong, J., Iglesias, J.E., Sudre, C.H., Venkataraman, A., Golland, P., Kim, J.H., Park, J., Eds.; Lecture Notes in Computer Science; Springer Nature: Cham, Switzerland, 2026; Volume 15974, pp. 353–363. [Google Scholar] [CrossRef] [Scilit]
  31. Guo, Y.; Lu, H.; Koyun, O.C.; Zhu, Z.; Demir, M.F.; Gurcan, M.N. Momentum Memory for Knowledge Distillation in Computational Pathology. In Proceedings of the 2026 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Denver, CO, USA, 3–7 June 2026; pp. 6889–6899. [Google Scholar]
  32. Guo, Y.; Lu, H.; Koyun, O.C.; Demir, M.F.; Gurcan, M.N. Pathway-Structured Privileged Distillation for Deployable Computational Pathology. arXiv 2026, arXiv:2606.02877v2. [Google Scholar] [CrossRef] [Scilit]
  33. Liberzon, A.; Birger, C.; Thorvaldsdóttir, H.; Ghandi, M.; Mesirov, J.P.; Tamayo, P. The Molecular Signatures Database Hallmark Gene Set Collection. Cell Syst. 2015, 1, 417–425. [Google Scholar] [CrossRef] [Scilit]
  34. Subramanian, A.; Tamayo, P.; Mootha, V.K.; Mukherjee, S.; Ebert, B.L.; Gillette, M.A.; Paulovich, A.; Pomeroy, S.L.; Golub, T.R.; Lander, E.S.; et al. Gene Set Enrichment Analysis: A Knowledge-Based Approach for Interpreting Genome-Wide Expression Profiles. Proc. Natl. Acad. Sci. USA 2005, 102, 15545–15550. [Google Scholar] [CrossRef] [Scilit]
  35. Hänzelmann, S.; Castelo, R.; Guinney, J. GSVA: Gene Set Variation Analysis for Microarray and RNA-Seq Data. BMC Bioinform. 2013, 14, 7. [Google Scholar] [CrossRef] [Scilit]
  36. Barbie, D.A.; Tamayo, P.; Boehm, J.S.; Kim, S.Y.; Moody, S.E.; Dunn, I.F.; Schinzel, A.C.; Sandy, P.; Meylan, E.; Scholl, C.; et al. Systematic RNA Interference Reveals That Oncogenic KRAS-Driven Cancers Require TBK1. Nature 2009, 462, 108–112. [Google Scholar] [CrossRef] [Scilit]
  37. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention Is All You Need. In Proceedings of the 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA, 4–9 December 2017; Volume 30, pp. 5998–6008. [Google Scholar]
  38. Gao, J.; Aksoy, B.A.; Dogrusoz, U.; Dresdner, G.; Gross, B.; Sumer, S.O.; Sun, Y.; Jacobsen, A.; Sinha, R.; Larsson, E.; et al. Integrative Analysis of Complex Cancer Genomics and Clinical Profiles Using the cBioPortal. Sci. Signal. 2013, 6, pl1. [Google Scholar] [CrossRef] [Scilit]
  39. Kautto, E.A.; Bonneville, R.; Miya, J.; Yu, L.; Krook, M.A.; Reeser, J.W.; Roychowdhury, S. Performance Evaluation for Rapid Detection of Pan-Cancer Microsatellite Instability with MANTIS. Oncotarget 2017, 8, 7452–7463. [Google Scholar] [CrossRef] [Scilit]
  40. cBioPortal DataHub. Stomach Adenocarcinoma (TCGA, PanCancer Atlas): Data_clinical_sample.txt [Data File]. Field: MSI_SCORE_MANTIS. Available online: https://github.com/cBioPortal/datahub/blob/dca75cb3f32b82d54a6f78bf0a6323e5b975aca1/public/stad_tcga_pan_can_atlas_2018/data_clinical_sample.txt (accessed on 7 October 2026).
  41. National Cancer Institute Clinical Proteomic Tumor Analysis Consortium (CPTAC). The Clinical Proteomic Tumor Analysis Consortium Stomach Adenocarcinoma Collection (CPTAC-STAD) [Data Set]; Version 1; The Cancer Imaging Archive; CPTAC: Bethesda, MD, USA, 2026. [Google Scholar] [CrossRef]
  42. Vasaikar, S.V.; Straub, P.; Wang, J.; Zhang, B. LinkedOmics: Analyzing Multi-Omics Data within and across 32 Cancer Types. Nucleic Acids Res. 2018, 46, D956–D963. [Google Scholar] [CrossRef] [Scilit]
  43. LinkedOmics. CPTAC Gastric Cancer Data Download: GC_metatable.tsi [Data File]. Field: MSI_Status. Available online: https://www.linkedomics.org/data_download/CPTAC-GC/GC_metatable.tsi (accessed on 7 October 2026).
  44. Srivastava, N.; Hinton, G.; Krizhevsky, A.; Sutskever, I.; Salakhutdinov, R. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. J. Mach. Learn. Res. 2014, 15, 1929–1958. [Google Scholar]
  45. Loshchilov, I.; Hutter, F. Decoupled Weight Decay Regularization. In Proceedings of the 7th International Conference on Learning Representations (ICLR 2019), New Orleans, LA, USA, 6–9 May 2019. [Google Scholar]
  46. Romero, A.; Ballas, N.; Ebrahimi Kahou, S.; Chassang, A.; Gatta, C.; Bengio, Y. FitNets: Hints for Thin Deep Nets. In Proceedings of the 3rd International Conference on Learning Representations (ICLR 2015), San Diego, CA, USA, 7–9 May 2015. [Google Scholar]
  47. Saito, T.; Rehmsmeier, M. The Precision-Recall Plot Is More Informative than the ROC Plot When Evaluating Binary Classifiers on Imbalanced Datasets. PLoS ONE 2015, 10, e0118432. [Google Scholar] [CrossRef] [Scilit]
  48. Tellez, D.; Litjens, G.; Bándi, P.; Bulten, W.; Bokhorst, J.-M.; Ciompi, F.; van der Laak, J. Quantifying the Effects of Data Augmentation and Stain Color Normalization in Convolutional Neural Networks for Computational Pathology. Med. Image Anal. 2019, 58, 101544. [Google Scholar] [CrossRef] [Scilit]
  49. Howard, F.M.; Dolezal, J.; Kochanny, S.; Schulte, J.; Chen, H.; Heij, L.; Huo, D.; Nanda, R.; Olopade, O.I.; Kather, J.N.; et al. The Impact of Site-Specific Digital Histology Signatures on Deep Learning Model Accuracy and Bias. Nat. Commun. 2021, 12, 4423. [Google Scholar] [CrossRef] [Scilit]
  50. Collins, G.S.; Reitsma, J.B.; Altman, D.G.; Moons, K.G.M. Transparent Reporting of a Multivariable Prediction Model for Individual Prognosis or Diagnosis (TRIPOD): The TRIPOD Statement. Ann. Intern. Med. 2015, 162, 55–63. [Google Scholar] [CrossRef] [Scilit]
  51. Van Calster, B.; McLernon, D.J.; van Smeden, M.; Wynants, L.; Steyerberg, E.W. On behalf of Topic Group ‘Evaluating diagnostic tests and prediction models’ of the STRATOS initiative. Calibration: The Achilles Heel of Predictive Analytics. BMC Med. 2019, 17, 230. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.