V7-DiVA: a feature-based Deep MIL colorectal whole-slide histopathology research platform with blinded external image-input validation Authors: Mingchen Sun, Wencong Kong, Shuanglong Qiu, Xinyu Ge Published: 2026 ABSTRACT AbstractBackgroundWhole-slide imaging offers a route to scalable computational assessment of colorectal histology, but models developed on public cohorts may not transfer reliably to real-world clinical practice. We developed V7-DiVA (Version 7 Deep Integrated Visual Analytics), a feature-based, gated-attention deep multiple-instance learning (MIL) research platform that links slide-level classification with quality metadata and reviewable image regions.MethodsPatch-level feature vectors were generated using a supervised feature extractor developed on NCT-CRC-HE-100K and independently evaluated on CRC-VAL-HE-7K. They were organized as 95-dimensional vectors comprising an 82-dimensional supervised feature core, tumor-evidence and morphology scores, coordinates, tissue fraction, and focus-quality features. The primary gated-attention Deep MIL model was developed on 1,972 TCGA-COAD/READ slides from 631 cases using case-grouped fivefold cross-validation. The trained model and its prespecified preprocessing specification, including standardization parameters estimated from TCGA, feature order, and inference rules, were then applied without modification to 300 de-identified local WSIs (150 malignant and 150 normal/non-neoplastic; one slide per case). A same-feature Transformer aggregator and a separately trained public-data-only CTransPath branch were secondary comparators. Scores were generated before reference-label mapping, and no local slide was used for model fitting, calibration, or threshold optimization.ResultsPatch-level tumor-evidence AUROCs were 0.997 on NCT-CRC-HE-100K and 0.987 on CRC-VAL-HE-7K. The primary Deep MIL model yielded a case-grouped TCGA development AUROC of 0.991 (95% CI 0.980–0.999) and an external AUROC of 0.918 (0.882–0.950) after transfer without refitting. Slide-level quality metadata characterized differences in tissue extent and focus and provided review cues for misclassified slides.ConclusionsV7-DiVA places feature-based gated-attention Deep MIL at the center of an integrated colorectal WSI research workflow. By learning from slide-level labels, aggregating variable-length feature bags, and retaining instance-level attention weights for review, the primary branch directly links weakly supervised learning to auditable image evidence. Its performance after transfer without refitting supports further multicenter evaluation, while the Transformer and CTransPath analyses provide complementary evidence across alternative aggregation and representation strategies. Independent calibration, broader diagnostic spectra, and prospective reader studies are required before clinical use.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12967-026-08794-8.Keywords: Colorectal cancer, Digital pathology, Whole-slide imaging, Multiple-instance learning, Gated attention, External validation, Quality metadata, CTransPath Background Colorectal cancer is a major global health burden. GLOBOCAN 2022 estimated more than 20 million new cancer cases and 9.7 million cancer deaths overall, with colorectal cancer among the leading contributors to both incidence and mortality [1]. In the United States, colorectal cancer remains a major cause of cancer death despite screening and treatment advances [2, 3]. Treatment decisions depend on an integrated assessment of tumor stage, anatomical site, resectability, histological diagnosis, molecular features, and patient factors. Contemporary guidelines emphasize multidisciplinary evaluation, pathological confirmation, surgery for localized disease, and systemic therapy or targeted strategies for advanced disease [4–6]. Recent clinical studies have used machine learning to combine ferroptosis-related and serum biomarkers for colorectal cancer detection and to integrate inflammatory, immunonutritional, and clinicopathological features for recurrence-risk estimation in stage III colon cancer [7, 8]. Complementary work has combined transcriptomic feature selection, CT radiomics, and population-scale clinicopathological variables for candidate biomarker discovery, microsatellite-instability prediction, and post-chemotherapy survival modeling [9–11]. Beyond colorectal cancer, random-survival-forest modeling of population-scale clinical variables has supported individualized prognostic estimation in hepatocellular carcinoma [12]. Together, these studies illustrate how computational models can extract clinically relevant diagnostic and prognostic signals from heterogeneous data across digestive-system oncology. Histopathology provides a complementary tissue-level view and remains central to this pathway. Hematoxylin and eosin (H&E) slides are used to confirm malignancy, assess tumor architecture, identify normal or benign tissue, and guide downstream testing. However, diagnostic pathology faces practical limitations: case volume is rising, expert availability varies by region, slide preparation and scanner characteristics differ across institutions, and whole-slide images contain gigapixel-scale information that is not naturally compatible with conventional image classification. These issues have motivated artificial intelligence (AI) systems for slide triage, uncertainty estimation, suspicious-region localization, and WSI review support [13–16]. Dense region-level annotation is particularly demanding in gigapixel pathology and constrains both cohort size and diagnostic breadth. Weak supervision instead exploits labels already available at slide or case level, allowing MIL to learn from variable-length collections of tissue patches while retaining attention-weighted regions for review. Large-scale and data-efficient WSI studies have shown that this design can support slide-level learning with substantially less annotation than fully supervised pipelines [17, 18]. Gated attention further learns nonlinear instance weights, enabling diagnostically informative regions to contribute more strongly without exhaustive lesion contours [19]. These properties make weakly supervised MIL particularly attractive for clinical pathology archives, where slide-level diagnoses are abundant but detailed spatial annotations are not. In colorectal cancer, deep learning from H&E histology has been used to predict prognosis, microsatellite instability, and clinically actionable molecular alterations, indicating that WSI morphology contains learnable signals beyond conventional visual assessment [20–24]. Recent multicenter and international studies have extended these applications to multimodal MSI prediction, quantitative tumor–stroma assessment, and prognostic or therapeutic stratification, underscoring the growing clinical relevance of externally evaluated colorectal pathomics [25–28]. Architectures including CLAM, DSMIL, TransMIL, and hierarchical transformers have expanded attention modeling, instance selection, and contextual patch encoding [18, 29–31]. Pathology foundation models such as CTransPath, UNI, Virchow, and GigaPath provide reusable histology representations through large-scale self-supervised pretraining [32–35]. Recent benchmarks indicate that the patch encoder and slide aggregator are distinct design choices and reinforce the need for multicenter clinical evaluation [36, 37]. Whole-slide foundation models such as TITAN and BEPH extend this direction while increasing the importance of task-matched evaluation, calibration, and reproducibility [38, 39]. Despite these advances, translating colorectal WSI models across institutions remains challenging. Patch accuracy does not establish slide-level transportability, and local images can differ from public cohorts in tissue handling, scanner optics, format, magnification, compression, color distribution, and pyramid metadata. Stain normalization and augmentation may improve robustness but do not replace independent external evaluation without refitting, calibration assessment, failure analysis, or explicit reporting of technical covariates [40, 41]. Robust translational evaluation should therefore preserve the trained model and inference procedure, compare architectures on the same cases, and report calibration and input quality alongside discrimination. We therefore centered V7-DiVA on feature-based gated-attention Deep MIL, combining weakly supervised slide-level learning with reproducibility-oriented reporting, multiscale review, and input-quality metadata. The primary objective was to develop a WSI-level MIL model from supervised public-patch features and evaluate the trained model without refitting in an independent single-center cohort. A same-feature Transformer aggregator and a separately trained public-data-only CTransPath branch were retained as secondary comparisons; calibration, technical-covariate, and failure analyses defined the interpretation and quality-control boundaries of the platform. Methods Study design V7-DiVA was developed as a retrospective, staged computational-pathology study with a shared 95-dimensional feature pathway for MIL and a separate CTransPath image-encoder pathway. Stage 1 developed the supervised patch-level feature extractor on NCT-CRC-HE-100K, and Stage 2 independently evaluated it on CRC-VAL-HE-7K. Stage 3 used these features to train a primary gated-attention MIL head and a Transformer MIL comparator on identical TCGA-COAD/READ feature bags. The trained model parameters and prespecified preprocessing specification, including standardization parameters estimated from TCGA, feature order, and model-specific instance-subsampling rules, were subsequently applied without modification to 95-dimensional feature bags from 300 de-identified local slides at The First Affiliated Hospital of Jinzhou Medical University. A CTransPath patch-level classifier trained exclusively on public data and coupled to fixed WSI aggregation was evaluated on the same slides. The local cohort supported single-center external validation without refitting, together with calibration, technical-confounding, and error analyses; it did not contribute to image-model fitting or threshold selection. The overall workflow and branch boundaries are shown in Fig. 1. V7-DiVA analysis pipeline and claim boundary. Public patch learning produces 95-dimensional feature bags for TCGA development of gated-attention and Transformer MIL. The trained MIL models and preprocessing rules are then applied without modification to identically ordered local feature bags. A separate CTransPath patch-level classifier trained exclusively on public data uses fixed spatial aggregation and operates directly on local image patches. Model scores are generated before reference-label mapping; quality metadata and top patches are retained for audit Data separation and leakage prevention To limit data leakage, Stage 1/2 patch modeling used only NCT-CRC-HE-100K and CRC-VAL-HE-7K. The CTransPath patch-level classifier used only public benign and malignant histology patches, GlaS-derived glandular samples, NCT patches, and hard-sample enrichment. Stage 3 MIL and WSI-summary-model training, cross-validation, hyperparameter search, model selection, and standardization used only TCGA-COAD/READ. The 300 local slides and their reference labels were excluded from feature learning, weight fitting, image-model calibration, hyperparameter search, and model updating. During external inference, every source row retained ground_truth_label = unknown; the two MIL scores and CTransPath score were written before reference labels were linked. Before construction of the released analysis tables and default review-interface display, a separate script replaced source filenames with randomly generated study codes that did not encode the reference class. The source-name mapping was stored separately from the submission data; a local reconciliation control can reveal the source filename and export the filename-to-code mapping when required. The gated-MIL threshold 0.998 and Transformer threshold 0.995 were derived from TCGA out-of-fold (OOF) predictions by maximizing balanced accuracy over a 0.001-spaced threshold grid and were applied without local optimization. The CTransPath cutoffs of 0.25 and 0.50 were examined on the local cohort and are reported as descriptive cohort-level operating points. Threshold-free AUROC was the primary external statistic. The level of validation differed by stage. The Stage 1 hold-out evaluation and Stage 3 case-grouped TCGA cross-validation were internal development evaluations. CRC-VAL-HE-7K was an independent public patch-level validation set comprising 50 patients with no overlap with NCT-CRC-HE-100K, but it did not validate the WSI-level MIL models. COAD-to-READ analysis represented transfer within the TCGA ecosystem. Only the 300-slide local cohort provided independent external validation of the trained WSI-level models. Datasets Stage 1 used NCT-CRC-HE-100K, a public dataset containing 100,000 non-overlapping H&E patches from human colorectal cancer and normal tissue [42]. Stage 2 used CRC-VAL-HE-7K, an independent public validation set of 7,180 patches from 50 patients with no patient overlap with NCT-CRC-HE-100K [21, 42]. The patches are 224× 224 pixels at approximately . Stage 3 used TCGA colorectal WSIs, including TCGA-COAD and TCGA-READ [43]. The completed processing set contained 1,972 WSIs: 1,442 TCGA-COAD and 530 TCGA-READ slides. There were 1,838 tumor slides and 134 normal slides. Sample types included 1,832 primary tumor slides, 134 solid tissue normal slides, four recurrent tumor slides, and two metastatic slides. For binary WSI analysis, primary, recurrent, and metastatic tumor slides were treated as tumor, whereas solid tissue normal slides were treated as normal. The local image-input evaluation cohort comprised 300 de-identified colorectal WSIs from The First Affiliated Hospital of Jinzhou Medical University, with one slide per study case: 150 slides with colorectal malignancy and 150 slides with normal/non-neoplastic colorectal tissue. These balanced research strata do not represent the prevalence or diagnostic spectrum encountered in routine practice. Slides were converted to OpenSlide-readable pyramidal SVS-like files before inference. The reference diagnosis for each case was obtained from the final pathology report, which had undergone senior-pathologist review as part of routine diagnostic sign-out. Slides were prepared under departmental standard operating procedures; scanning and data curation were performed by pathology physicians using an SQS120P scanner. Acquisition metadata recorded 20× magnification and a resolution of 0.205729 μm/pixel along both axes. All 300 inputs were pyramidal and completed slide-level inference. During inference, the ground-truth field was set to “unknown”, and filename text was not used as a model input or branching rule. After model scores had been written, a separate script generated random study codes for the released analysis tables and the default review-interface display; the private mapping was retained outside the submission dataset. The use of the local cohort was approved by the Ethics Committee of The First Affiliated Hospital of Jinzhou Medical University. Slide reading, SDPC conversion, and quality metadata WSIs were read using vendor-neutral slide software, including OpenSlide-compatible formats [44]. The interactive pathology image-analysis platform supports review of SVS and pyramidal TIFF images, zooming, patch preview, quality-metadata display, and local-network deployment. Before inference, the system records image dimensions, pyramid level count, micrometers per pixel (MPP) or objective magnification when available, pyramid status, tissue-patch count, focus statistics, and representative patches. Files lacking pyramid or magnification metadata are flagged for review because scanner export and viewer conversion can influence downstream inference. No explicit stain-color normalization was applied to TCGA or the 300 local slides. Patch encoders used their recorded training-time preprocessing and augmentation, while local slides were processed using the same inference transforms. This design evaluates the implemented image-input pathway without refitting across the public-development and local clinical domains. For SDPC slides, we developed SlideForge, a macOS tool that reads SDPC files and converts them to tiled pyramidal BigTIFF or SVS-like files accessible to OpenSlide-compatible analysis software [45]. SlideForge supports input preparation by preserving pyramid structure and magnification metadata that may be lost during single-frame viewer export. The converted local inputs carried metadata indicating 20× objective magnification and an MPP of along both axes. Interactive research platform A browser-based HTML interface operationalizes the V7-DiVA workflow by bringing model provenance, external-evaluation status, quality metadata, and reviewable image evidence into a single research dashboard. Its external-validation workspace traces the route from public feature learning and TCGA model development to evaluation without refitting in the independent hospital cohort. It displays completion of all 300 slides, the external performance of the prespecified gated-attention Deep MIL model and secondary branches, and the safeguards that preserve evaluation independence, including unchanged model objects, score generation before reference-label linkage, and randomly generated display codes. Random study codes are shown by default; for local data reconciliation, an explicit control can reveal source filenames and export the filename-to-code mapping. Whole-slide coverage, selected image regions, and acquisition metadata remain available for case-level audit (Fig. 2). External-validation image-evidence workspace in the V7-DiVA HTML research platform. A randomly generated study code replaces the source filename. The interface links the whole-slide overview and tissue/high-evidence overlays to input quality-control metadata and the highest-scoring image patches, enabling case-level review of the unchanged inference pathway in the independent hospital cohort Patch extraction and field of view The first two stages used the original 224×224 public patches. In Stage 3, larger physical fields of view were read from WSIs and resized to the network input size for feature extraction. This design provided broader glandular and stromal context within each WSI patch while preserving compatibility with patch encoders trained at 224-pixel input resolution. The automatic segmentation mode constructs a thumbnail-level tissue mask using the conjunction of grayscale intensity below 0.90 and HSV saturation above 0.03. Candidate grid patches are retained when at least 15% of resized patch pixels satisfy the same tissue rule. Background therefore refers primarily to bright, low-saturation regions; pen marks, folds, bubbles, and other artifacts are not removed by a dedicated artifact classifier. Patch sharpness is summarized by Laplacian variance and mean squared gradient (Tenengrad). Patch coordinates, tissue fraction, focus measures, and accepted-patch count are retained for audit. Patch size and stride are implementation or multiscale-review settings rather than label-driven decisions. Because all WSI windows are resized to 224×224 before encoding, the 224–768 pixel comparisons jointly vary tissue context and downsampling and are not proof of an optimized physical magnification. Representative public patch morphology examples are shown in Fig. 3. Public patch morphology gallery. Each column represents one model morphology or QC class, with three real representative patches from NCT-CRC-HE-100K or CRC-VAL-HE-7K Stage 1 and Stage 2 patch morphology model The patch model was designed to recognize model-derived colorectal tissue patterns rather than only a binary label. Seven retained morphology or QC-associated categories were used: tumor evidence, mucin/goblet pattern, inflammatory tissue, reactive or normal gland, debris/edge, stroma/muscle, and adipose/background. These categories combine tissue patterns and image-quality or background classes, and should be interpreted as model-output descriptors rather than manual pathologist annotations. NCT-CRC-HE-100K was partitioned into a training set and an internal Stage 1 hold-out test set containing 4,725 patches; CRC-VAL-HE-7K was retained as the independent Stage 2 public validation set. A total of 82 engineered and learned patch features were retained for downstream interpretation; the complete feature dictionary is provided in Supplementary Table S1. Tumor-evidence AUROC used the continuous tumor-evidence score against the tumor-related target, whereas binary tumor-evidence AUROC evaluated the corresponding tumor-versus-non-tumor collapsed target. Performance was reported using accuracy, balanced accuracy, tumor-evidence AUROC, and binary tumor-evidence AUROC. Public-data-trained CTransPath patch-level classifier To complement feature-based MIL with a deep histology representation, we trained a CTransPath patch-level classifier exclusively on public data [32]. Training data comprised NCT-CRC tissue patches, GlaS-derived glandular examples [46], and VIM-Polyp-derived difficult benign/non-carcinoma and carcinoma examples [47]; no local evaluation slide was used for training. The final dataset contained 34,783 patches, including 24,876 benign or carcinoma-negative and 9,907 malignant patches. Source-specific counts and licenses are reported in Supplementary Table S3. GlaS-derived patches inherited image-level glandular labels and were treated as development examples. OOF performance was estimated by patch-stratified cross-validation after public-data hard-sample enrichment. Because source-image grouping and strictly fold-internal hard-sample mining were not recorded, these estimates characterize classifier development; generalization was subsequently assessed at WSI level in the independent local cohort. The classifier generated a malignancy-evidence score for each accepted image patch. Fixed top-patch and spatial summaries yielded the named CTransPath WSI score. The closely related Deep Pathologist and multi-output Fusion scores combined the same evidence in alternative ways and were retained as exploratory sensitivity analyses. Figure 4 summarizes classifier development and the composition of its public sources. CTransPath patch-level classifier trained exclusively on public data. Panel A reports threshold-free and thresholded development metrics with the confusion matrix; panel B reports the composition of the public training sources Stage 3 WSI aggregation For full-slide TCGA development, each WSI was represented as a bag of accepted tissue patches. The 82-dimensional core comprised the complete output of the Stage 1/2 supervised feature extractor; its names and order are provided in Supplementary Table S1. The 95-dimensional instance vector appended one tumor-evidence score, seven morphology/QC probabilities, two normalized coordinates, one tissue-fraction descriptor, and two focus-quality features. Patch size and stride were implementation metadata rather than model inputs. The primary aggregator was gated-attention MIL [19]; a Transformer-attention MIL model used the identical feature order as an architecture comparator. CTransPath was reserved for the separate image-encoder branch. Hyperparameter search selected hidden dimension 64, attention dimension 32, dropout 0.15, learning rate 0.001, weight decay 0.0001, and at most 3,072 instances per bag for gated MIL. The Transformer comparator used hidden dimension 96, attention dimension 48, one encoder layer with four attention heads, dropout 0.20, and at most 256 instances per bag. Five-fold StratifiedGroupKFold splitting used the case submitter identifier for all 631 cases; all slides from a case remained in one fold, and recorded train–test group overlap was zero. To reduce the effect of the 1,838:134 slide imbalance, each training fold used binary cross-entropy with tumor-class weight . Because hyperparameters were selected in the same development cross-validation process rather than a nested design, these results are internal development estimates. For external validation, no model refitting was performed; the trained gated-MIL and Transformer weights and the prespecified preprocessing specification were held fixed, including standardization parameters estimated from TCGA, feature order, and model-specific instance caps. Every local feature bag contained the same arrays used in TCGA processing: 82 core features, tumor evidence, seven class probabilities, coordinates and tissue fraction, and two focus-quality features. Coordinates were normalized within each slide using the training implementation. Gated MIL retained up to 3,072 instances and Transformer MIL up to 256 instances, using the same deterministic tumor-evidence-enriched subsampling rule and seed sequence as in development. No local label entered bag construction, scaling, subsampling, attention, or score generation. The inference-stage file, in which all labels were recorded as unknown, and the subsequently reference-mapped score table are provided as Supplementary Data S13 and S14, respectively. A component-ablation analysis used the same five case-grouped splits and fixed training hyperparameters to compare the following feature sets: the complete 95 features; the 82-feature core alone; tumor plus morphology scores alone; the 82-feature core plus those eight scores; technical metadata alone (coordinates, tissue fraction, and focus-quality features); and the full vector after separately removing coordinates, tissue fraction, or focus-quality features. No local slide was used in this ablation. Case-clustered nonparametric percentile bootstrap confidence intervals used 1,000 resamples. These comparisons assess feature-group dependence within TCGA and complement, but do not replace, local external validation without refitting. An auxiliary WSI summary model used 93 slide-level descriptors spanning tissue composition, patch counts, morphology-probability distributions, and quality metadata; the complete feature dictionary is provided in Supplementary Table S2. Model development compared balanced extra-trees, balanced random forest, and histogram gradient boosting, with histogram gradient boosting selected as the best-performing candidate. Agreement between this summary model and the image-based outputs was used to identify slides meriting review of image quality, physical scale, or application-domain differences. The auxiliary output did not alter the Deep MIL or CTransPath scores. The gated-MIL model-selection results and candidate configurations are summarized in Fig. 5 and Table 1, respectively. Feature-based Deep MIL model selection in the TCGA development setting. Candidate identifiers correspond to the recorded hyperparameter configurations; the selected gated-attention MIL model was subsequently carried forward unchanged for local external validation Table 1Deep MIL candidate configurationsCandidateHiddenAttentionDropoutLRWeight decayAUROCBA164320.150.00100.00010.9910.971296640.200.00080.00010.9910.9673128640.250.00050.00020.9890.9674128960.300.00030.00010.9900.964 Deep MIL candidate configurations Multiscale consistency and auxiliary review flags The local inference process records field-of-view variation and agreement between the CTransPath-based output and the auxiliary WSI summary model. These signals direct attention to image quality, physical scale, and evidence consistency during case review. The TCGA-trained MIL models were scored independently, and no cross-model rule altered the output of another branch. Mathematical formulation of V7-DiVA For a slide s, the tissue-aware tiling module defines a candidate patch set at field-of-view g as where is the tissue-mask fraction and is the patch sharpness score. Each accepted patch is resized to the encoder input size and converted into a supervised patch-level feature vector: where denotes resizing to 224×224 pixels and denotes the supervised patch-feature extractor used in the Stage 1/2 branch. The retained WSI instance vector is then where is the 82-dimensional supervised patch-feature core. The current MIL instance vector appends the recorded model scores and metadata used by the training script: where is the tumor-evidence score, are seven morphology/QC probabilities, are normalized patch coordinates, is the tissue fraction, and contains focus-quality features. Thus the TCGA MIL head operates on supervised patch-derived feature vectors and recorded descriptors rather than raw image pixels. For readability, the field-of-view superscript g is omitted below when no ambiguity is introduced. The morphology head estimates class probabilities over the seven retained tissue categories, These category probabilities provide interpretable tissue-composition descriptors for WSI aggregation and reporting. For the Deep MIL head, gated attention assigns an instance weight to each patch: Model selection was written as a grouped cross-validation optimization problem, where each fold is grouped at the case level. Hard-sample enrichment identifies public benign mimics and difficult malignant examples for the public-data-trained patch-level classifier: In the present manuscript this expression describes the enrichment rule; fold-internal mining thresholds, iteration counts, and source-image grouping should be prespecified and reported in a future confirmatory evaluation of the patch-level classifier. For local evaluation, the public-data-trained Deep Pathologist WSI score can be written as an implementation-level spatial aggregation score: where is the patch-level malignant-evidence score, is the top-20 patch mean, is the 90th percentile, is the high-score patch fraction, and is the fraction of accepted tissue patches contained in the largest four-neighbor connected component among patches with . The coefficients are fixed implementation weights in the audit script and were not statistically fitted on the 300 local reference labels. For multiscale review, single-scale slide scores from multiple fields of view can be summarized by a weighted score and a scale-discordance term if the weights are prespecified. Let denote the single-scale model score for slide s at field of view g: Here is used only to describe sensitivity to image-array field of view. No deployable multiscale weight vector, uncertainty threshold, or WSI-head disagreement threshold was prespecified or validated. WSI-head disagreement is therefore reported qualitatively as an auxiliary review cue, not as a mathematical override, calibrated uncertainty score, or validated domain-shift detector. Statistical analysis Patch- and slide-level discrimination were summarized by AUROC and average precision. For threshold-based reporting, and PPV, NPV, and accuracy were reported from the same confusion matrix when relevant. AUROC was interpreted as the probability that a randomly selected positive sample receives a higher score than a randomly selected negative sample, with tied scores counted as one half: The TCGA MIL threshold of 0.50 was the model-default descriptive setting rather than a clinical threshold. Development-OOF balanced-accuracy optimization yielded 0.998 for gated MIL and 0.995 for Transformer MIL; these TCGA-derived cutoffs were applied to the local cohort without using local labels. For the separate CTransPath WSI score, 0.25 and 0.50 were evaluated on the same local data as descriptive operating points: The review zone is not equivalent to a malignant diagnosis. Neither CTransPath cutoff was optimized for or validated as a deployable threshold, and local post-hoc Youden calculations were excluded from the primary claims. Calibration was assessed using the Brier score, equal-width 10-bin ECE, reliability diagrams, and logistic calibration intercept and slope; the latter two parameters were reported for diagnostic assessment and were not used to recalibrate the local scores. In addition, Platt scaling was fitted only to TCGA OOF predictions for each MIL architecture and transported unchanged to the local cohort; this tested whether development-domain calibration transferred without compromising the independence of the local evaluation. No calibrator was fitted to the 300 local labels. Confidence intervals for AUROC, average precision, and Brier score were estimated using 5,000 stratified nonparametric percentile bootstrap resamples. Confidence intervals for threshold-dependent sensitivity, specificity, balanced accuracy, PPV, and NPV were estimated using 2,000 stratified percentile resamples that preserved the 150:150 class counts. Because the local cohort contained one slide per case, slide-level resampling was equivalent to case-level resampling. TCGA confidence intervals used case-clustered resampling. PPV and NPV were additionally projected at illustrative prevalences of 5 and 10% from the observed sensitivity and specificity; these projections are not estimates of clinical prevalence. Average precision refers to the threshold-free definition implemented in scikit-learn. The external architecture audit used paired stratified bootstrap resampling to estimate AUROC differences for CTransPath versus gated MIL, CTransPath versus Transformer MIL, Transformer versus gated MIL, and CTransPath versus the technical-only probe. These are descriptive 95% confidence intervals on this cohort rather than multiplicity-adjusted confirmatory superiority tests; no model was selected by P value. A local technical-confounding probe used 12 prespecified sampling and focus variables in logistic regression with median imputation, standardization, class balancing, and 10 repetitions of five-fold stratified cross-validation. Each slide was predicted only when held out, and the 10 predictions were averaged. This label-informed local analysis is not a deployable comparator or independent validation model; it quantifies how readily technical metadata alone separate the study strata. Performance was also tabulated across tertiles of accepted tissue-patch count and low-focus-patch fraction. Implementation environment and reproducibility status Development, model training, WSI inference, figure generation, and platform testing were performed on a Mac mini with an Apple M4 Pro (14 CPU cores) and 64 GB unified memory. The core analysis environment used Miniforge/Python 3.12.8 with PyTorch 2.12.0, scikit-learn 1.6.1, NumPy 2.2.6, pandas 2.3.3, OpenSlide Python 1.4.3, Pillow 12.0.0, and Matplotlib 3.10.9. The 300-slide local run used six concurrent workers and completed in 3 h 22 min 44 s, corresponding to approximately 40.5 s per slide in wall-clock throughput. This measurement included WSI reading, tissue tiling, CTransPath and auxiliary inference, QC calculation, and export. WSI reading preferentially used OpenSlide-compatible files; SDPC source slides were converted through SlideForge when needed. The revision package provides analysis scripts, exact software versions, feature dictionaries, split identifiers, threshold-dependent tables, calibration plots, the inference-stage label-unknown score file, and the later reference-mapped de-identified score table. Full source code and trained weights are not publicly released because related components remain under institutional intellectual-property review. This restriction limits independent reproducibility and is stated as a study limitation; materials permitted for disclosure can be requested from the corresponding author subject to data and institutional restrictions. Results Patch-level morphology learning The Stage 1 internal development hold-out set contained 4,725 patches and yielded a tumor-evidence AUROC of 0.997. On the independent CRC-VAL-HE-7K patch set, the corresponding AUROC was 0.987 (Table 2). The accompanying accuracy and balanced-accuracy estimates confirm that the public-data branch learned a robust colorectal morphology signal across non-overlapping source patients. Figure 6 summarizes these results, and Fig. 7 shows representative TCGA patches re-read from Stage 3 feature-bag coordinates. Together, these analyses established the supervised patch-level feature basis for subsequent WSI-level Deep MIL. Table 2Patch-level performance in Stage 1 and Stage 2EvaluationAccuracyBalanced accuracyTumor AUROCBinary tumor AUROCStage 1 internal development hold-out0.9590.9580.9970.999Stage 2 CRC-VAL-HE-7K0.9190.9100.9870.986 Patch-level performance in Stage 1 and Stage 2 Public patch performance in the Stage 1 internal development hold-out set and the independent Stage 2 CRC-VAL-HE-7K set Stage 3 morphology category gallery. These are real TCGA WSI patches re-read from local TCGA slide files using saved phase 3 feature-bag coordinates and model probabilities. The displayed categories are model-predicted morphology/QC classes for interpretability, not manual pathologist annotations Public-data-trained CTransPath patch-level classifier The CTransPath patch-level classifier achieved an OOF AUROC of 0.998 and balanced accuracy of 0.971 (Table 3). This result established a strong deep histology signal for the complementary WSI branch. Its interpretation remains at the classifier-development level because the recorded evaluation used patch-stratified splitting after hard-sample enrichment; external evidence is provided by the slide-level local cohort. Table 3Development performance of the public-data-trained CTransPath patch-level classifierMetricValuePatches34783Benign / malignant patches24876 / 9907Out-of-fold AUROC0.9979Balanced accuracy0.9707Confusion matrixTN 24,829; FP 47; FN 562; TP 9,345 Development performance of the public-data-trained CTransPath patch-level classifier Full TCGA WSI processing Stage 3 processed all 1,972 TCGA colorectal WSIs in the analysis manifest without slide-level failure. The dataset contained 1,442 TCGA-COAD and 530 TCGA-READ slides, comprising 1,838 tumor slides and 134 solid-tissue normal slides. The resulting feature bags retained WSI coordinates, tissue-patch counts, morphology probabilities, QC descriptors, and slide-level labels for Deep MIL training and interpretability review. Figure 8 summarizes the manifest-level inclusion flow and case-grouped analysis structure. TCGA-COAD/READ WSI manifest-level inclusion and processing flow. The figure reports the current completed local manifest and case-grouped analysis structure; no slide-level processing failure was recorded within this manifest QC descriptors differed between tumor and normal slides. A sampling-and-focus-only baseline achieved an AUROC of 0.923, showing that specimen composition and acquisition-related descriptors were not class-neutral in this imbalanced TCGA development set. We therefore retained these variables as explicit covariates for ablation and stratified analyses, preventing their contribution from being hidden within the full feature set. Feature-based Deep MIL TCGA development cross-validation Across five case-grouped folds comprising 1,972 slides from 631 cases, the primary Deep MIL model achieved an OOF AUROC of 0.991 (case-clustered 95% CI 0.980–0.999) and balanced accuracy of 0.971 at the 0.50 threshold (Table 4). Performance was consistent across folds, with zero train–test case overlap. These findings show that gated attention converted patch-level morphology features into a highly discriminative slide-level representation while accommodating broad, variable-length tissue sampling. The model configuration was selected within the same cross-validation framework, so this estimate represents internal TCGA development performance. Patient-level AUROC was not estimable because every case in the final manifest contributed at least one tumor slide. Figure 9 summarizes the WSI-level results, and Fig. 10 shows how the operating balance changed across thresholds. Table 4Stage 3 WSI-level resultsModel / settingAUROCAPBalanced accuracyNotesFeature-based Deep MIL, threshold 0.500.9910.9990.971TN 127; FP 7; FN 12; TP 1826Transformer MIL, exploratory0.9920.9990.935TN 117; FP 17; FN 6; TP 1832WSI head, internal CV0.9790.9980.836Auxiliary review model; best recorded candidateWSI head, COAD-to-READ transfer0.9961.0000.935Auxiliary review modelTechnical-variable baseline0.9230.9930.844Sampling and focus-quality features only; confounding audit Stage 3 WSI-level results Feature-based Deep MIL WSI-level performance on TCGA colorectal slides Stage 3 threshold sweep. Threshold-dependent metrics are shown for transparency; post-hoc thresholds are interpreted only as secondary analyses Across the fixed-hyperparameter ablation reruns, models containing the 82-feature morphology core achieved AUROCs of 0.988–0.995, whereas morphology scores alone achieved 0.975 and technical metadata alone achieved 0.882 (Table 5). The overlapping confidence intervals among near-complete variants indicate that no single added descriptor drove performance. The larger decrement for the technical-only model supports morphology as the dominant source of discrimination, while confirming the value of retaining technical variables for explicit sensitivity analysis. Full machine-readable results and case-grouped predictions are provided in Supplementary Table S7, with a visual summary in Supplementary Figure S2. Table 5TCGA Deep MIL feature ablation using fixed five-fold case-grouped development splitsFeature variantDimensionsAUROC (95% CI)APBA at 0.50 (95% CI)All features950.992 (0.978–0.999)0.9990.964 (0.940–0.983)Supervised feature core only820.991 (0.977–0.999)0.9990.957 (0.931–0.978)Tumor evidence + morphology only80.975 (0.957–0.989)0.9970.920 (0.890–0.947)Core + tumor evidence/morphology900.995 (0.986–0.999)0.9990.976 (0.957–0.992)Technical metadata only50.882 (0.849–0.912)0.9880.803 (0.760–0.846)All except coordinates930.994 (0.986–0.999)0.9990.960 (0.935–0.980)All except tissue fraction940.988 (0.971–0.999)0.9980.965 (0.942–0.984)All except focus-quality features930.992 (0.978–0.999)0.9990.960 (0.935–0.980) TCGA Deep MIL feature ablation using fixed five-fold case-grouped development splits Single-center external validation of V7-DiVA The auxiliary WSI summary model achieved an AUROC of 0.996 when fitted on TCGA-COAD and evaluated on TCGA-READ without refitting. Because both cohorts belong to the TCGA ecosystem, this analysis measures within-public-data transfer. The full operating-point results are provided in Table 4. The local cohort contained 300 de-identified WSIs, equally divided between colorectal malignancy and normal/non-neoplastic colorectal tissue. The trained MIL models and CTransPath branch generated scores before a separate audit mapped the reference labels, and all slides completed inference. This cohort therefore provided independent single-center external validation of the trained WSI-level models without local fitting, calibration, or threshold selection. The primary gated-attention Deep MIL model achieved an external AUROC of 0.918 (95% CI 0.882–0.950). At the model-default threshold of 0.50, sensitivity was 0.967 and specificity was 0.727; applying the TCGA-OOF-derived threshold of 0.998 shifted the operating balance to sensitivity 0.893 and specificity 0.833. Thus, the model preserved clinically relevant ranking performance across domains, whereas the choice of operating threshold materially changed the sensitivity–specificity trade-off. Complete threshold and calibration results are provided in Supplementary Tables S8 and S9. The same-feature Transformer comparator achieved an external AUROC of 0.932. Its paired AUROC difference from gated MIL was 0.014 (95% CI -0.005 to 0.034), providing no evidence of a discernible difference in discrimination between the two aggregators on the shared feature representation. Gated-attention Deep MIL remained the prespecified primary model and, in the implemented pipeline, could aggregate a broader sample of tissue patches while retaining direct instance-level attention weights. The complementary CTransPath WSI score achieved an AUROC of 0.974. Paired differences relative to gated and Transformer MIL were 0.055 (0.025–0.089) and 0.041 (0.013–0.071), respectively; both confidence intervals excluded zero, indicating higher discrimination in this local cohort. CTransPath simultaneously differed in encoder, public training corpus, and aggregation rule, so the comparison does not isolate a single architectural component. Its result instead demonstrates the value of maintaining a complementary deep-representation branch within the platform. Threshold-specific results and paired AUROC comparisons are reported in Supplementary Tables S9 and S10, respectively. Calibration and technical-covariate analyses are summarized in Supplementary Tables S8, S9, and S11 and Supplementary Figure S1. The local technical-only probe reached an AUROC of 0.920, confirming measurable class-associated differences in sampling and focus and motivating prospective QC stratification. The Deep Pathologist and Fusion sensitivity outputs yielded AUROCs of 0.977 and 0.979, respectively. The patch-summary and WSI-summary outputs were less discriminative than the principal image-model branches and were retained as review signals (Table 6). Table 6Single-center external evaluation of the primary feature-based MIL model and complementary architecturesOutputAUROC (95% CI)AP (95% CI)BrierECEGated-attention MIL0.918 (0.882–0.950)0.889 (0.838–0.937)0.1440.150Transformer MIL0.932 (0.899–0.962)0.924 (0.883–0.959)0.1060.099CTransPath WSI0.974 (0.950–0.991)0.982 (0.967–0.994)0.0880.167WSI summary head0.869 (0.827–0.907)0.878 (0.836–0.916)0.1580.106Gated-attention MIL was the prespecified primary feature-based model. Transformer MIL used identical feature bags; CTransPath used a complementary representation and aggregation pathway. Threshold provenance and confusion matrices are reported in Supplementary Table S9 Single-center external evaluation of the primary feature-based MIL model and complementary architectures Gated-attention MIL was the prespecified primary feature-based model. Transformer MIL used identical feature bags; CTransPath used a complementary representation and aggregation pathway. Threshold provenance and confusion matrices are reported in Supplementary Table S9 The CTransPath-based local evaluation is summarized in Fig. 11, whereas Fig. 12 presents same-cohort comparisons of the transferred TCGA-trained MIL models, reliability patterns, and score distributions. Independent 300-slide local evaluation of the CTransPath branch. Panel A compares AUROC with bootstrap 95% confidence intervals. Panels B and C show descriptive confusion matrices at 0.25 for the CTransPath-based WSI score and exploratory Fusion. Panel D shows score separation External evaluation of the TCGA-trained MIL models and complementary analyses in the same cohort. Panel A shows ROC curves; panel B shows AUROC with stratified bootstrap 95% confidence intervals; panel C shows equal-frequency-bin reliability diagrams; and panel D shows the MIL score distributions after cross-domain application. The technical probe uses repeated local cross-validation and is shown only as a confounding analysis Local input quality, automatic patch selection, and failure analysis All 300 local scans were acquired on the SQS120P platform at 20× magnification, with recorded resolution of along both axes and a pyramidal input structure. Adaptive tiling selected 768-pixel patches in 258 slides and smaller fields in 42; multiscale review was triggered in 41 slides. This pattern indicates that the automated procedure converged on a common field of view for most cases while retaining a defined fallback for variable tissue geometry. Malignant and normal/non-neoplastic slides differed in tissue extent and focus distributions (Fig. 13). These measurements were available for every case and enabled technical-stratum and error analyses without entering the reference-label mapping step. Detailed distributions and tertile-specific performance are reported in Supplementary Table S11. Input quality and segmentation metadata in the 300-slide local evaluation. Tissue-patch counts differed between reference classes, automatic patch size and stride were predominantly 768 pixels, and all slides had recorded MPP, objective magnification, and pyramidal input metadata At the descriptive CTransPath cutoff of 0.25, 289 of 300 slides were classified correctly. Threshold-specific estimates, illustrative prevalence projections, and primary-model error cases are provided in Supplementary Tables S4–S6, respectively. Quality metadata were available for all 11 errors and showed heterogeneous patterns of tissue extent, focus, and multiscale variation, supporting case-specific review rather than a single QC exclusion rule. Only five slides were misclassified by all three principal branches at their 0.50 cutoffs, suggesting that the models captured partly complementary image evidence. Complete cross-model error flags and slide-level metadata are provided in Supplementary Data S12, and representative model-selected regions are shown in Fig. 14. Local 300-slide top-patch evidence examples. The rows illustrate high-score malignant slides, low-score normal/non-neoplastic slides, and review-triggering discordance. Categories and scores are model-derived cues rather than manual patch annotations Discussion This study developed and externally evaluated V7-DiVA as a colorectal WSI research platform centered on feature-based gated-attention Deep MIL. Its principal strength is the efficient use of routine slide-level labels: each WSI is represented as a variable-length bag, diagnostically informative instances receive learned attention weights, and influential regions remain available for review. In the implemented pipeline, gated MIL sampled up to 3,072 instances per slide compared with 256 for the Transformer comparator, providing broader tissue coverage at modest model complexity. This combination of low annotation burden, variable-length aggregation, and reviewable spatial evidence makes gated-attention MIL a practical analytical core for large pathology archives. The central finding is that this prespecified Deep MIL pipeline achieved good discrimination in an independent clinical cohort. Its AUROC was 0.991 in case-grouped TCGA development and 0.918 in the 300-slide local cohort when model weights, standardization, feature order, subsampling, and inference rules were held fixed. The external estimate is therefore a direct measure of cross-institution transport rather than a locally adapted result. The same-feature Transformer achieved an AUROC of 0.932, with a paired difference of 0.014 (95% CI -0.005 to 0.034); the interval crossed zero and provided no evidence of a statistically discernible difference in discrimination. This matched-feature comparison supports the transferable information in the shared patch-level features while preserving Deep MIL as the prespecified primary analysis. The CTransPath branch achieved the highest external AUROC (0.974), and its paired differences from gated and Transformer MIL excluded zero in this cohort. This branch, however, changed the encoder, public training corpus, and aggregation rule simultaneously. The result therefore identifies a strong complementary image-representation pathway without isolating the effect of any single architectural choice. Viewed together, the analyses support a modular platform in which weakly supervised Deep MIL provides the primary, attention-based slide model and CTransPath supplies orthogonal evidence from a separately trained deep histology representation. This interpretation aligns with studies showing that patch representation and slide aggregation are distinct determinants of WSI performance [18, 29–31, 33–38]. The staged design also clarifies the evidence contributed by each dataset. The Stage 1 hold-out and TCGA case-grouped cross-validation evaluated internal development. CRC-VAL-HE-7K provided independent validation of the public patch-level morphology model because its 50 source patients did not overlap with NCT-CRC-HE-100K, whereas COAD-to-READ represented transfer within TCGA. The 300-slide local cohort was the independent external test of the trained WSI-level pipeline. This distinction resolves the apparent tension between database independence and model-level validation: a new dataset validates only the component and prediction level to which the trained model is directly applied. V7-DiVA extends beyond a set of model scores. The browser-based interface records stage completion, sample counts, model summaries, quality metadata, and links to reviewable image evidence, making the computational workflow easier to inspect and reproduce. Feature ablation further showed that morphology-containing feature groups drove TCGA performance, while technical descriptors captured class-associated acquisition and specimen differences that should be addressed explicitly in sensitivity analyses. The platform thus connects model development, external evaluation, quality review, and evidence localization within one traceable workflow. The current malignant-versus-normal/non-neoplastic task establishes WSI discrimination and cross-domain transport under a controlled diagnostic contrast. Recent multicenter and international studies have extended computational pathology to MSI prediction, tumor–stroma quantification, recurrence-risk estimation, and therapeutic stratification [25–28]. V7-DiVA provides reusable infrastructure for such studies by separating representation, aggregation, quality assessment, calibration, and evidence review. Subsequent cohorts should encompass adenoma, dysplasia, inflammatory bowel disease, treatment effect, uncommon carcinoma subtypes, and benign mimics at clinically representative prevalence. The evidence remains bounded by a retrospective, single-center external cohort with balanced sampling and one slide per case. Detailed staining-batch variables and individual reader ratings were not available, TCGA model selection was not fully nested, and public patch sources had limited staining diversity. Although released tables and the default review-interface display use randomly generated study codes, operator-level blinding was not prospectively implemented as a reader-study procedure. Full platform weights also remain under institutional intellectual-property review. These factors motivate multicenter, multiscanner evaluation of the unchanged pipeline, with prespecified calibration and final test sets and prospective reader studies measuring accuracy, review time, inter-reader agreement, and error severity. Reporting should follow TRIPOD+AI, with CONSORT-AI and SPIRIT-AI applied if prospective interventional testing is undertaken [48–50]. Conclusions V7-DiVA establishes feature-based gated-attention Deep MIL as the primary analytical core of a colorectal WSI research platform that records quality metadata and reviewable image evidence. The model combined slide-level weak supervision, broad variable-length patch aggregation, and instance-level attention, achieving high discrimination during TCGA development and good discrimination after transfer without refitting to an independent clinical cohort. Transformer and CTransPath analyses supplied complementary evidence across alternative aggregation and representation strategies. V7-DiVA should next be evaluated in multicenter cohorts with independent calibration, broader diagnostic spectra, and prospective reader studies to determine its value in colorectal computational-pathology research and pathology-workflow support. Electronic supplementary material Below is the link to the electronic supplementary material. Supplementary Material 1 Acknowledgements Not applicable. Abbreviations Artificial intelligence Average precision Area under the receiver operating characteristic curve Balanced accuracy Confidence interval Colon adenocarcinoma Colorectal cancer Expected calibration error Genomic Data Commons Hematoxylin and eosin Multiple-instance learning Micrometers per pixel Negative predictive value Positive predictive value Quality control Rectum adenocarcinoma A digital pathology slide format The Cancer Genome Atlas Whole-slide image Author contributions Mingchen Sun, Wencong Kong, Shuanglong Qiu, and Xinyu Ge contributed to study conception, data organization, software implementation, model validation, visualization, and manuscript drafting. Funding The authors received no specific funding for this work. Data availability NCT-CRC-HE-100K and CRC-VAL-HE-7K are available through Zenodo. TCGA-COAD and TCGA-READ are available through the Genomic Data Commons. GlaS and VIM-Polyp are cited public datasets. The 300 local WSIs cannot be openly distributed because they derive from patient material. Supplementary Tables S1–S11 and Data S12–S14 provide feature dictionaries, source audit, threshold estimates, prevalence projections, component ablation, external model comparison, paired AUROC differences, technical-stratum analysis, external-validation error flags, the inference-stage label-unknown score file, and the later reference-mapped score table. Code availability The revision package includes the added statistical and ablation scripts, software environment, feature dictionaries, split identifiers, and score-level supplementary tables. Because related components remain under institutional intellectual-property review, the complete platform source and trained weights are not publicly released. Materials permitted for disclosure can be requested from the corresponding author subject to data, institutional, and intellectual-property restrictions; this limitation is explicitly acknowledged in the Discussion. Declarations Ethics approval and consent to participate This manuscript reports public-data research and a 300-slide label-independent local image-input evaluation. The public-data component used publicly available datasets. The local component used de-identified slide-level inputs and aggregate reporting. This study was approved by the Ethics Committee of The First Affiliated Hospital of Jinzhou Medical University. Consent for publication Not applicable; no identifiable individual participant data are presented. Competing interests The authors declare no competing interests. Footnotes Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Supplementary Materials Supplementary Material 1 Data Availability Statement NCT-CRC-HE-100K and CRC-VAL-HE-7K are available through Zenodo. TCGA-COAD and TCGA-READ are available through the Genomic Data Commons. GlaS and VIM-Polyp are cited public datasets. The 300 local WSIs cannot be openly distributed because they derive from patient material. Supplementary Tables S1–S11 and Data S12–S14 provide feature dictionaries, source audit, threshold estimates, prevalence projections, component ablation, external model comparison, paired AUROC differences, technical-stratum analysis, external-validation error flags, the inference-stage label-unknown score file, and the later reference-mapped score table. The revision package includes the added statistical and ablation scripts, software environment, feature dictionaries, split identifiers, and score-level supplementary tables. Because related components remain under institutional intellectual-property review, the complete platform source and trained weights are not publicly released. Materials permitted for disclosure can be requested from the corresponding author subject to data, institutional, and intellectual-property restrictions; this limitation is explicitly acknowledged in the Discussion.