Validation of histopathology foundation models through whole slide image retrieval

Saghir Alfasly, Ghazal Alabtah, Sobhan Hemati, Krishna R. Kalari, Joaquín J. García, Hamid R. TizhooshScientific 2025

Abstract

We evaluated several foundation models in histopathology for image retrieval using a zero-shot approach. These models generated embeddings that were directly employed for retrieval without additional fine-tuning. Our experiments were conducted on diagnostic slides from The Cancer Genome Atlas (TCGA), which covers 23 organs and 117 cancer subtypes. We used Yottixel as the framework for whole-slide image (WSI) retrieval via patch-based embeddings. Retrieval performance was evaluated using macro-averaged F1 scores for top-1, top-3, and top-5 retrievals. The top-5 retrieval F1 scores indicated varying levels of performance: Yottixel-DenseNet (27% ± 13%), Yottixel-UNI (42% ± 14%), Yottixel-Virchow (40% ± 13%), Yottixel-GigaPath (41% ± 13%), and GigaPath WSI (40% ± 14%). These results demonstrate the potential and limitations of foundation models for histopathology image retrieval, underscoring the need for further advancements in embedding and retrieval techniques.

Introduction

In digital pathology, a single Whole-Slide Image (WSI) is a gigapixel-scale file containing immense biological detail. Pathologists frequently require the ability to find "similar cases" within a database to confirm a diagnosis or refine a treatment plan—a task known as content-based image retrieval (CBIR).

The primary challenge in this field is the "semantic gap": while machines excel at identifying low-level pixel patterns like texture and color, they often struggle to interpret high-level anatomical concepts such as tissue architecture and tumor margins. This study evaluates whether state-of-the-art "foundation models"—AI models pre-trained on billions of pathology image patches—can bridge this gap in a "zero-shot" capacity, meaning they are used without any task-specific fine-tuning.

Methodology

The researchers employed the Yottixel framework, an open-source search engine for pathology, to benchmark several foundation models including UNI, Virchow, and GigaPath. These were compared against a traditional DenseNet baseline.

The Yottixel retrieval pipeline, illustrating the transition from raw WSI to mosaic generation, feature extraction, and final database matching.

The retrieval process follows a structured pipeline:

  1. Mosaic Generation: To manage the massive scale of WSIs, Yottixel creates a "mosaic" by sampling a small percentage (2%) of representative patches based on color and spatial clustering.
  2. Feature Extraction: The foundation models generate mathematical embeddings (feature vectors) for these patches.
  3. Barcoding: These embeddings are converted into compact binary "barcodes" to enable fast, distance-based searching across large databases.

Experimental Setup

The evaluation was conducted using The Cancer Genome Atlas (TCGA), a premier public repository. The study utilized 11,444 diagnostic slides from 9,339 patients, covering 23 different organs and 117 cancer subtypes. This diversity provides a rigorous test of how well these models generalize across the entire human body.

Key Results and Discussion

Performance Gains over Baselines

Foundation models specifically trained on pathology data vastly outperformed the general-purpose DenseNet. For "Top-5" retrieval (finding the correct cancer subtype within the first five results), the foundation models achieved F1-scores between 40-42%, compared to just 27% for the DenseNet baseline. Yottixel-UNI generally led the pack, achieving a macro-averaged F1-score of 44% for Top-1 retrieval.

The Complexity Ceiling and Organ Variability

Despite the improvements, no model surpassed the 50% F1-score barrier in a zero-shot setting. Performance was highly dependent on tissue type; models performed exceptionally well on organs with homogeneous, well-structured patterns (such as the bladder and kidneys, where UNI reached 82% accuracy) but failed significantly on heterogeneous tissues like the lungs and cervix (dropping to ~21%).

The Aggregation Paradox

The study also tested GigaPath WSI, a version of the model that attempts to compress an entire slide into a single embedding. Interestingly, this global aggregation often performed worse than patch-based methods. The aggregation process appears to "wash out" critical local spatial information necessary for distinguishing subtle cancer subtypes.

Conclusion

While foundation models provide a significant head start for pathology AI, the "zero-shot" gap suggests they are not yet ready for standalone clinical-grade diagnostic support. Future work should focus on fine-tuning models for specific organs and developing hybrid architectures that better combine local histological detail with global tissue context. Technical validation on research datasets like TCGA is a vital first step toward "in-the-wild" clinical implementation.

Summary updated

BibTeX
@inproceedings{alfasly2025validation,
  author = {Saghir Alfasly and Ghazal Alabtah and Sobhan Hemati and Krishna R. Kalari and Joaquín J. García and Hamid R. Tizhoosh},
  title = {{Validation of histopathology foundation models through whole slide image retrieval}},
  booktitle = {Scientific},
  year = {2025},
  doi = {10.1038/s41598-025-88545-9},
}
Figure