Examining tissue samples under a microscope has long been the gold standard for diagnosing cancer. A pathologist reviews a whole slide image (WSI), a gigapixel-scale digital scan of a tissue sample, and identifies cancer based on the shape, size, and arrangement of cells and tissue structures. This process is time-consuming and highly dependent on the pathologist's expertise and experience.
Deep learning has shown tremendous promise for automating this kind of analysis. However, most AI models trained to analyze pathology images have a fundamental problem: they learn to perform one specific task on one specific cancer type. If a model is trained to detect breast cancer subtypes, it cannot generalize to kidney or lung cancer without starting from scratch.
The scarcity of labeled training data compounds this problem. Expert pathologists must manually annotate thousands of slides before an AI model can be trained for a new task. This bottleneck makes it impractical to develop high-performing AI tools for every cancer type and clinical application.
Foundation models offer a solution. These are large AI models pre-trained on enormous, diverse datasets without requiring labels, building up a general understanding of patterns that can then be efficiently adapted to specific tasks with far less labeled data. This paper introduces BEPH, a foundation model built specifically for pathological image analysis.
BEPH (BEiT-based model Pre-training on Histopathological Image) was built using a technique called self-supervised learning (SSL), specifically a method called masked image modeling (MIM). In this approach, portions of an image are randomly hidden, and the model learns to predict what the missing regions look like. This forces the model to deeply understand the structure and patterns in tissue images without needing any human-provided labels.
The pre-training dataset was drawn from The Cancer Genome Atlas (TCGA), a publicly available repository of cancer tissue slides. After processing 11,760 whole slide images spanning 32 cancer types, researchers generated approximately 11 million individual image patches, each 224 by 224 pixels. This dataset is 10 times larger than the widely used ImageNet-1K benchmark used to train general computer vision models.
The model architecture uses a Vision Transformer (ViT-Base), which processes images by dividing them into small patches and learning how these patches relate to one another across the full image context. Pre-training began with weights learned from natural images and was then continued on the pathology dataset, allowing the model to first learn basic visual structure and then specialize in tissue-specific features.
After pre-training, BEPH was fine-tuned and evaluated on three types of tasks: patch-level tumor classification, WSI-level cancer subtype classification, and patient survival prediction. This range of tasks tests whether the model has truly learned generalizable features or just memorized patterns from the training data.
On the task of classifying breast tumor tissue patches as benign or malignant (BreakHis dataset), BEPH achieved an average accuracy of 94.05 percent, which is 5 to 10 percent higher than standard deep learning models and 1.9 percent higher than the best previously reported self-supervised model.
For lung cancer subtype classification across three tissue categories (LC25000 dataset), BEPH achieved 99.99 percent accuracy, the highest reported by any model tested, outperforming standard CNN architectures including ResNet, VGG19, and AlexNet.
At the whole slide level, where the model classifies cancer subtypes based on complete tissue scans, BEPH achieved an AUC of 0.994 for kidney cancer subtypes, 0.970 for lung cancer subtypes, and 0.946 for breast cancer subtypes. These results significantly outperformed earlier weakly supervised models and most previously published foundation models.
Only two models, GigaPath and UNI, performed comparably or slightly better on WSI classification. Both were trained on substantially larger datasets (GigaPath on 17 times more data, UNI on 10 times more). BEPH's competitive performance despite its smaller training dataset underlines the efficiency of the MIM pre-training approach.
A critical practical advantage of foundation models is label efficiency: the ability to perform well even when fine-tuning data is limited. Labeled pathology datasets are expensive to create because they require expert annotation, so a model that performs well with fewer labeled examples has real clinical value.
When BEPH was trained on only 25 percent of the available labeled data for cancer subtype classification, it still outperformed all weakly supervised models trained on 100 percent of the same data. This is a striking result, suggesting that BEPH's pre-trained knowledge is rich enough to compensate for limited supervision.
With 50 percent of labeled training data, BEPH's performance became comparable to self-supervised foundation models like GigaPath, UNI, and CHIEF despite those models having been pre-trained on datasets 6, 10, and 17 times larger respectively. This demonstrates that the quality of the MIM approach can, in part, compensate for scale.
This label efficiency is especially significant for rare cancer types, where gathering enough labeled slides is practically impossible. A model that can achieve strong performance from a small number of labeled examples would allow AI pathology tools to be deployed across a much wider range of diseases and clinical settings.
Beyond diagnosis, BEPH was also applied to survival prediction: given only a tissue slide, can the AI estimate which patients are likely to survive longer? This is measured using the C-index, where 0.5 means random guessing and 1.0 means perfect prediction.
BEPH ranked first in survival prediction performance across all six cancer types tested: breast cancer (C-index 0.664), colorectal cancer (0.676), clear cell renal carcinoma (0.669), papillary renal carcinoma (0.714), lung adenocarcinoma (0.604), and stomach cancer (0.594). Performance improvements over other models ranged from 1.1 to 5.5 percent in C-index.
Most importantly, BEPH successfully separated patients into high-risk and low-risk groups in a clinically meaningful way. For colorectal cancer, BEPH's separation achieved a log-rank test p-value of 0.016, meaning the survival curves of the two groups were statistically significantly different. Competing models failed to achieve this separation for the same cancer type.
BEPH's survival prediction relies only on tissue slide images and does not require additional genetic data, blood tests, or clinical measurements. This makes it highly practical for real-world deployment in settings where multi-omic data may not be available for every patient.
Understanding why an AI model makes a particular prediction is essential for clinical trust and adoption. The researchers visualized attention heatmaps showing which regions of tissue slides the model focused on when making diagnoses.
Even though BEPH was trained with only slide-level labels (for example, knowing a slide contained cancer but not where the cancer was), the attention maps showed high consistency with annotations made by expert pathologists. The model independently learned to focus on tumor regions without ever being explicitly told where tumors were located.
UMAP visualization confirmed that the model's learned feature space organized different tissue types into distinct, separable clusters, including cancer stroma and cancer epithelium. This internal organization reflects biologically meaningful groupings rather than arbitrary patterns.
Ablation experiments confirmed that pre-training on pathology images specifically was crucial. A model pre-trained only on natural images (ImageNet) performed substantially worse on all tasks, confirming that tissue images contain unique structural patterns that require domain-specific learning to capture properly.
BEPH represents a meaningful step toward the vision of a single AI system that can support pathological diagnosis and prognosis across many cancer types. By pre-training on 11 million unlabeled tissue patches from 32 cancers and then adapting efficiently to specific tasks, it demonstrates that self-supervised foundation models are a viable path forward for computational pathology.
The model is being made publicly available at a dedicated GitHub repository, allowing other research groups to apply and further develop it for their own cancer detection tasks. This open science approach could accelerate the development of AI pathology tools across a wide range of diseases.
Key limitations include the fact that BEPH has been validated primarily on TCGA data, which may not fully represent real-world clinical variation. Larger and more diverse institutional datasets, combined with a larger model backbone, could further improve generalization. The researchers also note that longer pre-training may yield additional gains.
Future directions include expanding the pre-training dataset, incorporating multimodal data that combines tissue images with genomic profiles and clinical text, and eventually developing models that can assist pathologists across the full spectrum of diagnostic tasks from biopsy evaluation to treatment response monitoring.