MGPATH: Vision-Language Model with Multi-Granular Prompt Learning for Few-Shot WSI Classification

Anh-Tien Nguyen, Duy Minh Ho Nguyen, Nghiem Tuong Diep, Trung Quoc Nguyen, Nhat Ho, Jacqueline Michelle Metsch, Miriam Cindy Maurer, Daniel Sonntag, Hanibal Bohnenberger, Anne-Christin HauschildarXiv 2025 · DOI

Abstract

MGPATH is a novel vision-language model (VLM) designed to classify massive Whole Slide Images (WSI) in pathology using only a handful of labeled examples. By combining a 1.3-billion-parameter vision foundation model with hierarchical spatial attention and Optimal Transport-based alignment, it significantly outperforms existing state-of-the-art models in few-shot cancer subtyping. MGPATH addresses the challenges of gigapixel-scale image analysis, data scarcity, and the domain gap between natural and medical imagery.

Introduction: The Challenge of Gigapixel Pathology

In digital pathology, a single Whole Slide Image (WSI) can contain billions of pixels. Classifying these images is a daunting task due to three primary factors:

  1. Data Scarcity: Expert annotations are expensive and rare, making "few-shot" learning (learning from just 2–16 examples) essential for practical clinical applications.
  2. Structural Complexity: Pathology is inherently hierarchical. It is not just about individual cells; it is about how those cells are organized into complex tissue regions. Most current models treat image patches as an independent "bag of words," ignoring critical spatial context.
  3. Domain Gap: General-purpose models like CLIP are trained on natural images (e.g., cats, cars) and struggle with the specific visual language of medical histology.
Comparison of MGPATH against prior work, highlighting the shift from simple patch-level attention to multi-granular attention guided by prompts.

MGPATH bridges these gaps by creating a pathology-specific VLM that understands both fine-grained cellular details and broader regional tissue structures through a multi-granular approach.

Methodology

MGPATH introduces three major innovations to the standard vision-language pipeline to handle the unique demands of pathology.

1. Foundation and Alignment

The model utilizes Prov-GigaPath, a vision foundation model pre-trained on 1.3 billion pathology tiles, and aligns it with the PLIP text encoder. To ensure these components "speak the same language" without retraining the massive backbones, the authors use lightweight adaptors trained on 923,000 image-text pairs.

2. Multi-Granular Attention

Unlike prior methods that analyze patches in isolation, MGPATH employs a Graph Attention Network (GAT) to model spatial relationships. As shown in the architecture below, it performs multi-granular prompting: one branch focuses on individual patches (fine-grained), while another branch aggregates groups of neighboring patches to capture regional context.

The detailed architecture of MGPATH, showcasing the integration of multi-scale image patches, Graph Attention Networks for message passing, and LLM-generated descriptive prompts aligned via Optimal Transport.

3. Optimal Transport (OT) Alignment

Instead of relying on simple cosine similarity to match images to text, MGPATH employs Optimal Transport. This mathematical framework treats visual features and text descriptions as probability distributions. This makes the model significantly more robust to "noisy" data or perturbations caused by data augmentation, especially when a text description only partially overlaps with the visual evidence in a massive slide.

4. LLMs as Pathology Experts

The authors leveraged GPT-4 to generate detailed descriptive prompts for different cancer types at both low and high magnifications. This multi-scale text guidance (e.g., describing "irregular tumor margins" at low power vs. "prominent nucleoli" at high power) helps the model identify specific diagnostic visual features.

Experimental Results

The model was evaluated using three benchmarks from The Cancer Genome Atlas (TCGA): TCGA-NSCLC (Lung Cancer), TCGA-RCC (Renal Cell Carcinoma), and TCGA-BRCA (Breast Carcinoma).

  • Superior Few-Shot Accuracy: In 16-shot settings on the TCGA-BRCA dataset, MGPATH achieved an AUC of 87.36%, vastly outperforming previous state-of-the-art models like MSCPT (75.55%) and ViLa-MIL (74.06%).
  • Zero-Shot Strength: Even without specific training on certain cancer types, MGPATH's zero-shot performance was highly competitive, often surpassing models that were explicitly fine-tuned for those tasks.
  • Architecture Agnostic: The multi-granular approach consistently improved performance across different backbones, including standard CLIP and PLIP, proving its general utility.

Key Insights and Future Directions

The primary "aha moment" of this research is that modeling the neighborhood of a patch via GATs provides a significant performance boost. Cancer diagnosis often depends on the architecture of the tissue, not just the presence of a single malignant cell.

While powerful, the authors identify areas for future growth, including the integration of "Flash Attention" to handle even higher resolutions and extending the model from classification to segmentation (identifying exactly where a tumor is located). There is also potential to integrate MGPATH with other emerging large-scale pathology VLMs like CONCH to further push the boundaries of medical AI.

Summary updated

BibTeX
@misc{nguyen2025mgpath,
  author = {Anh-Tien Nguyen and Duy Minh Ho Nguyen and Nghiem Tuong Diep and Trung Quoc Nguyen and Nhat Ho and Jacqueline Michelle Metsch and Miriam Cindy Maurer and Daniel Sonntag and Hanibal Bohnenberger and Anne-Christin Hauschild},
  title = {{MGPATH: Vision-Language Model with Multi-Granular Prompt Learning for Few-Shot WSI Classification}},
  year = {2025},
  eprint = {2502.07409},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.07409},
}
Figure