prov-gigapath/prov-gigapath

Prov-GigaPath: A whole-slide foundation model for digital pathology from real-world data

634

stars

31

commits

Python

primary language

Aug 7, 2026

updated

README

Prov-GigaPath

A whole-slide foundation model for digital pathology from real-world data

[Model] [Paper] [BibTeX]

Hanwen Xu*, Naoto Usuyama*, Jaspreet Bagga, Sheng Zhang, Rajesh Rao, Tristan Naumann, Cliff Wong, Zelalem Gero, Javier González, Yu Gu, Yanbo Xu, Mu Wei, Wenhui Wang, Shuming Ma, Furu Wei, Jianwei Yang, Chunyuan Li, Jianfeng Gao, Jaylen Rosemon, Tucker Bower, Soohee Lee, Roshanthi Weerasinghe, Bill J. Wright, Ari Robicsek, Brian Piening, Carlo Bifulco, Sheng Wang, Hoifung Poon (*Equal Contribution)

License

📢 News

July 2026

  • GigaPath-Flash and GigaTIME-Flash: We are releasing lightweight "Flash" variants of GigaPath and GigaTIME for faster, more memory-efficient inference and finetuning. See the GigaPath-Flash model and GigaTIME-Flash model

December 2025

  • GigaTIME: We released GigaTIME, scaling tumor microenvironment modeling using a virtual population generated by multimodal AI. Check out the repo, paper, and blog.

September 2024

  • Embeddings: We are pleased to share a new notebook, showcasing embedding visualization for Prov-GigaPath. Check out the notebook to get started.

GigaPath Embedding Visualization

July 2024

  • WSI Preprocessing/Tiling: We are pleased to share new preprocessing guide for Prov-GigaPath. This guide provides a walkthrough on setting up the environment and preprocessing WSI files for Prov-GigaPath. Check out the guide to get started.

June 2024

  • New Demo Notebook Available: We have prepared a new notebook for the walkthrough of the Prov-GigaPath model. This notebook provides a detailed demonstration of how to load and run the pretrained model. You can check it out here.

May 2024

  • Initial Model and Code Release: We are excited to announce that the initial release of the Prov-GigaPath model and its code is now available. The GigaPath paper has been published in Nature.

Model Overview


Overview of Prov-GigaPath model architecture

Model Family

ModelDescriptionPaperLicense
GigaPathWhole-slide foundation modelNature (2024)Apache-2.0
GigaPath-FlashEfficient whole-slide foundation modelarXiv (2026)Apache-2.0
GigaTIMESpatial proteomics prediction from H&ECell (2026)Apache-2.0
GigaTIME-FlashEfficient spatial proteomics prediction from H&EarXiv (2026)Apache-2.0

Install

On an NVIDIA A100 Tensor Core GPU machine, with CUDA toolkit enabled.

  1. Download our repository and open the Prov-GigaPath
git clone https://github.com/prov-gigapath/prov-gigapath
cd prov-gigapath
  1. Install GigaPath and its dependencies
conda env create -f environment.yaml
conda activate gigapath
pip install -e .

Model Download

The Prov-GigaPath models can be accessed from HuggingFace Hub.

You need to agree to the terms to access the models. Once you have the necessary access, set your HuggingFace read-only token as an environment variable:

export HF_TOKEN=<huggingface read-only token>

If you don’t set the token, you might encounter the following error:

ValueError: We have no connection or you passed local_files_only, so force_download is not an accepted option.

GigaPath-Flash

GigaPath-Flash is a lightweight variant of the GigaPath slide encoder for faster, more memory-efficient slide-level inference and finetuning. It uses a LongNet backbone with 12 layers and a 384-dim hidden size (~21M parameters), paired with a 384-dim DINOv2-small tile encoder (ViT-S/16, ~22M parameters). Compared to the original GigaPath slide encoder (12L/768d over 1536-dim tile embeddings), both the slide encoder hidden dim and the input tile-embedding dim are 384.

Model architecture names: gigapath_slide_enc12l384d (slide encoder, input_dim=384, latent_dim=384) and gigapath_tile_enc_dinov2s (tile encoder).

Released weights follow the original Prov-GigaPath packaging:

  • Tile encoder — config.json + pytorch_model.bin (timm format)
  • Slide encoder — slide_encoder.pth ({"model": ...}, encoder only, no decoder)

Preparing the release checkpoints

Raw pretraining checkpoints contain parameters not needed for downstream use. Strip them and convert to the release formats:

# Slide encoder: strip the MAE decoder / masking params
python scripts/convert_slide_encoder_checkpoint.py <pretrain_checkpoint.pth> <slide_encoder.pth>

# Tile encoder: convert the DINOv2-small student checkpoint to timm/HF format
# (drops the DINOv2 SSL heads; writes config.json + pytorch_model.bin)
python scripts/convert_tile_encoder_checkpoint.py <dinov2_student.pth> <tile_encoder_dir>

Both mirror the format of the original Prov-GigaPath slide_encoder.pth and tile encoder.

Loading GigaPath-Flash

import timm
import gigapath.slide_encoder as slide_encoder
import gigapath.tile_encoder as tile_encoder  # registers gigapath_tile_enc_dinov2s

tile_enc = tile_encoder.create_model("hf_hub:prov-gigapath/prov-gigapath-flash")
slide_enc = slide_encoder.create_model("hf_hub:prov-gigapath/prov-gigapath-flash", "gigapath_slide_enc12l384d", 384)

Finetuning with GigaPath-Flash

Point the finetune scripts at the converted slide-encoder checkpoint via GIGAPATH_FLASH_CKPT:

GIGAPATH_FLASH_CKPT=/path/to/slide_encoder.pth bash scripts/run_panda_flash.sh [ROOT_PATH]

Inference

The Prov-GigaPath model consists of a tile encoder, that extracts local patterns at patch level, and a slide encoder, that outputs representations at slide level. This model can be used in both tile-level and slide-level tasks. When doing inference at the slide level, we recommend following this pipeline: (1) Tile the whole slide into N image tiles, with the coordinates of each tile. (2) Get the embeddings for each tile using our tile encoder. (3) Pass the N image tile embeddings and their coordinates into the slide encoder, to get slide level representations.

Inference with the tile encoder

First, load GigaPath tile encoder:

import timm
from PIL import Image
from torchvision import transforms
import torch

# Older versions of timm have compatibility issues. Please ensure that you use a newer version by running the following command: pip install timm>=1.0.3.
tile_encoder = timm.create_model("hf_hub:prov-gigapath/prov-gigapath", pretrained=True)

transform = transforms.Compose(
    [
        transforms.Resize(256, interpolation=transforms.InterpolationMode.BICUBIC),
        transforms.CenterCrop(224),
        transforms.ToTensor(),
        transforms.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
    ]
)

Running inference to extract tile level features:

img_path = "images/prov_normal_000_1.png"
sample_input = transform(Image.open(img_path).convert("RGB")).unsqueeze(0)

tile_encoder.eval()
with torch.no_grad():
    output = tile_encoder(sample_input).squeeze()

**

Inference with the slide encoder

To inference with our slide encoder, we need both the tile embeddings and their coordinates as input. First, let's load the GigaPath slide encoder:

import gigapath

slide_encoder = gigapath.slide_encoder.create_model("hf_hub:prov-gigapath/prov-gigapath", "gigapath_slide_enc12l768d", 1536)

Run the inference to get the slide level embeddings:

slide_encoder.eval()
with torch.no_grad():
    output = slide_encoder(tile_embed, coordinates).squeeze()

Note Older versions of timm have compatibility issues. Please ensure that you use a newer version by running the following command: pip install timm>=1.0.3.

Fine-tuning

Tile-Level Linear Probing Example Using PCam Dataset

For your convenience, we provide the pre-extracted embeddings for the PCam dataset. You can download them from this link. Note that the file size is 2GB.

There is no need to unzip this file.

To run the fine-tuning experiment, execute the following script:

bash scripts/run_pcam.sh data/GigaPath_PCam_embeddings.zip

Slide-Level Fine-Tuning Example Using PANDA Dataset

For your convenience, we provide the pre-extracted embeddings for the PANDA dataset. You can download them from this link. Note that the file size is 32GB. Please unzip this file.

unzip -n data/GigaPath_PANDA_embeddings.zip -d data/

To run the fine-tuning experiment, execute the following script:

bash scripts/run_panda.sh data/GigaPath_PANDA_embeddings/h5_files

Sample Data Download

A sample de-identified subset of the Prov-Path data can be accessed from these links [1, 2].

Model Uses

Intended Use

The data, code, and model checkpoints are intended to be used solely for (I) future research on pathology foundation models and (II) reproducibility of the experimental results reported in the reference paper. The data, code, and model checkpoints are not intended to be used in clinical care or for any clinical decision-making purposes.

Primary Intended Use

The primary intended use is to support AI researchers reproducing and building on top of this work. GigaPath should be helpful for exploring pre-training, and encoding of digital pathology slides data.

Out-of-Scope Use

Any deployed use case of the model --- commercial or otherwise --- is out of scope. Although we evaluated the models using a broad set of publicly-available research benchmarks, the models and evaluations are intended for research use only and not intended for deployed use cases.

Usage and License Notices

The model is not intended or made available for clinical use as a medical device, clinical support, diagnostic tool, or other technology intended to be used in the diagnosis, cure, mitigation, treatment, or prevention of disease or other conditions. The model is not designed or intended to be a substitute for professional medical advice, diagnosis, treatment, or judgment and should not be used as such. All users are responsible for reviewing the output of the developed model to determine whether the model meets the user’s needs and for validating and evaluating the model before any clinical use.

Acknowledgements

We would like to express our gratitude to the authors and developers of the exceptional repositories that this project is built upon: DINOv2, MAE, Timm, and TorchScale. Their contributions have been invaluable to our work.

Citation

If you find Prov-GigaPath useful for your your research and applications, please cite using this BibTeX:

@article{xu2024gigapath,
  title={A whole-slide foundation model for digital pathology from real-world data},
  author={Xu, Hanwen and Usuyama, Naoto and Bagga, Jaspreet and Zhang, Sheng and Rao, Rajesh and Naumann, Tristan and Wong, Cliff and Gero, Zelalem and González, Javier and Gu, Yu and Xu, Yanbo and Wei, Mu and Wang, Wenhui and Ma, Shuming and Wei, Furu and Yang, Jianwei and Li, Chunyuan and Gao, Jianfeng and Rosemon, Jaylen and Bower, Tucker and Lee, Soohee and Weerasinghe, Roshanthi and Wright, Bill J. and Robicsek, Ari and Piening, Brian and Bifulco, Carlo and Wang, Sheng and Poon, Hoifung},
  journal={Nature},
  year={2024},
  publisher={Nature Publishing Group UK London}
}

@article{usuyama2026gigapathflash,
  title={{GigaPath-Flash} and {GigaTIME-Flash}: Efficient Pathology Foundation Models for Whole-Slide and Tumor Microenvironment Analysis},
  author={Usuyama, Naoto and Valanarasu, Jeya Maria Jose and Yao, Sicong and Xu, Hanwen and Bagga, Jaspreet and Qin, Guanghui and Kramer, Robert E. and Wong, Cliff and Lee, Soohee and Qiu, Hao and Zhao, Theodore Zhengde and Ben Shimol, Racheli and Crabtree, Angela and Matlock, Kevin and Lozano Garcia, Eduardo Alejandro and Sangani, Naiteek and Santamaria-Pang, Alberto and Rokuss, Maximilian and Hasija, Yashna and Patel, Naisargi Manishkumar and Entenmann, Jason and Bartlett, Alexandra Q. and Wright, Bill J. and Fox, Bernard A. and Piening, Brian and Zhang, Sheng and Wang, Sheng and Naumann, Tristan and Bifulco, Carlo and Poon, Hoifung},
  journal={arXiv preprint arXiv:2607.18218},
  year={2026},
  doi={10.48550/arXiv.2607.18218},
  url={https://arxiv.org/abs/2607.18218}
}

Contributors

usuyama

24 commits

HanwenXuTHU

5 commits

GeorgeBatch

2 commits

prov-gigapath/prov-gigapath

Prov-GigaPath: A whole-slide foundation model for digital pathology from real-world data

634

stars

31

commits

Python

primary language

Aug 7, 2026

updated

README

Prov-GigaPath

A whole-slide foundation model for digital pathology from real-world data

[Model] [Paper] [BibTeX]

Hanwen Xu*, Naoto Usuyama*, Jaspreet Bagga, Sheng Zhang, Rajesh Rao, Tristan Naumann, Cliff Wong, Zelalem Gero, Javier González, Yu Gu, Yanbo Xu, Mu Wei, Wenhui Wang, Shuming Ma, Furu Wei, Jianwei Yang, Chunyuan Li, Jianfeng Gao, Jaylen Rosemon, Tucker Bower, Soohee Lee, Roshanthi Weerasinghe, Bill J. Wright, Ari Robicsek, Brian Piening, Carlo Bifulco, Sheng Wang, Hoifung Poon (*Equal Contribution)

License

📢 News

July 2026

  • GigaPath-Flash and GigaTIME-Flash: We are releasing lightweight "Flash" variants of GigaPath and GigaTIME for faster, more memory-efficient inference and finetuning. See the GigaPath-Flash model and GigaTIME-Flash model

December 2025

  • GigaTIME: We released GigaTIME, scaling tumor microenvironment modeling using a virtual population generated by multimodal AI. Check out the repo, paper, and blog.

September 2024

  • Embeddings: We are pleased to share a new notebook, showcasing embedding visualization for Prov-GigaPath. Check out the notebook to get started.

GigaPath Embedding Visualization

July 2024

  • WSI Preprocessing/Tiling: We are pleased to share new preprocessing guide for Prov-GigaPath. This guide provides a walkthrough on setting up the environment and preprocessing WSI files for Prov-GigaPath. Check out the guide to get started.

June 2024

  • New Demo Notebook Available: We have prepared a new notebook for the walkthrough of the Prov-GigaPath model. This notebook provides a detailed demonstration of how to load and run the pretrained model. You can check it out here.

May 2024

  • Initial Model and Code Release: We are excited to announce that the initial release of the Prov-GigaPath model and its code is now available. The GigaPath paper has been published in Nature.

Model Overview


Overview of Prov-GigaPath model architecture

Model Family

ModelDescriptionPaperLicense
GigaPathWhole-slide foundation modelNature (2024)Apache-2.0
GigaPath-FlashEfficient whole-slide foundation modelarXiv (2026)Apache-2.0
GigaTIMESpatial proteomics prediction from H&ECell (2026)Apache-2.0
GigaTIME-FlashEfficient spatial proteomics prediction from H&EarXiv (2026)Apache-2.0

Install

On an NVIDIA A100 Tensor Core GPU machine, with CUDA toolkit enabled.

  1. Download our repository and open the Prov-GigaPath
git clone https://github.com/prov-gigapath/prov-gigapath
cd prov-gigapath
  1. Install GigaPath and its dependencies
conda env create -f environment.yaml
conda activate gigapath
pip install -e .

Model Download

The Prov-GigaPath models can be accessed from HuggingFace Hub.

You need to agree to the terms to access the models. Once you have the necessary access, set your HuggingFace read-only token as an environment variable:

export HF_TOKEN=<huggingface read-only token>

If you don’t set the token, you might encounter the following error:

ValueError: We have no connection or you passed local_files_only, so force_download is not an accepted option.

GigaPath-Flash

GigaPath-Flash is a lightweight variant of the GigaPath slide encoder for faster, more memory-efficient slide-level inference and finetuning. It uses a LongNet backbone with 12 layers and a 384-dim hidden size (~21M parameters), paired with a 384-dim DINOv2-small tile encoder (ViT-S/16, ~22M parameters). Compared to the original GigaPath slide encoder (12L/768d over 1536-dim tile embeddings), both the slide encoder hidden dim and the input tile-embedding dim are 384.

Model architecture names: gigapath_slide_enc12l384d (slide encoder, input_dim=384, latent_dim=384) and gigapath_tile_enc_dinov2s (tile encoder).

Released weights follow the original Prov-GigaPath packaging:

  • Tile encoder — config.json + pytorch_model.bin (timm format)
  • Slide encoder — slide_encoder.pth ({"model": ...}, encoder only, no decoder)

Preparing the release checkpoints

Raw pretraining checkpoints contain parameters not needed for downstream use. Strip them and convert to the release formats:

# Slide encoder: strip the MAE decoder / masking params
python scripts/convert_slide_encoder_checkpoint.py <pretrain_checkpoint.pth> <slide_encoder.pth>

# Tile encoder: convert the DINOv2-small student checkpoint to timm/HF format
# (drops the DINOv2 SSL heads; writes config.json + pytorch_model.bin)
python scripts/convert_tile_encoder_checkpoint.py <dinov2_student.pth> <tile_encoder_dir>

Both mirror the format of the original Prov-GigaPath slide_encoder.pth and tile encoder.

Loading GigaPath-Flash

import timm
import gigapath.slide_encoder as slide_encoder
import gigapath.tile_encoder as tile_encoder  # registers gigapath_tile_enc_dinov2s

tile_enc = tile_encoder.create_model("hf_hub:prov-gigapath/prov-gigapath-flash")
slide_enc = slide_encoder.create_model("hf_hub:prov-gigapath/prov-gigapath-flash", "gigapath_slide_enc12l384d", 384)

Finetuning with GigaPath-Flash

Point the finetune scripts at the converted slide-encoder checkpoint via GIGAPATH_FLASH_CKPT:

GIGAPATH_FLASH_CKPT=/path/to/slide_encoder.pth bash scripts/run_panda_flash.sh [ROOT_PATH]

Inference

The Prov-GigaPath model consists of a tile encoder, that extracts local patterns at patch level, and a slide encoder, that outputs representations at slide level. This model can be used in both tile-level and slide-level tasks. When doing inference at the slide level, we recommend following this pipeline: (1) Tile the whole slide into N image tiles, with the coordinates of each tile. (2) Get the embeddings for each tile using our tile encoder. (3) Pass the N image tile embeddings and their coordinates into the slide encoder, to get slide level representations.

Inference with the tile encoder

First, load GigaPath tile encoder:

import timm
from PIL import Image
from torchvision import transforms
import torch

# Older versions of timm have compatibility issues. Please ensure that you use a newer version by running the following command: pip install timm>=1.0.3.
tile_encoder = timm.create_model("hf_hub:prov-gigapath/prov-gigapath", pretrained=True)

transform = transforms.Compose(
    [
        transforms.Resize(256, interpolation=transforms.InterpolationMode.BICUBIC),
        transforms.CenterCrop(224),
        transforms.ToTensor(),
        transforms.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
    ]
)

Running inference to extract tile level features:

img_path = "images/prov_normal_000_1.png"
sample_input = transform(Image.open(img_path).convert("RGB")).unsqueeze(0)

tile_encoder.eval()
with torch.no_grad():
    output = tile_encoder(sample_input).squeeze()

**

Inference with the slide encoder

To inference with our slide encoder, we need both the tile embeddings and their coordinates as input. First, let's load the GigaPath slide encoder:

import gigapath

slide_encoder = gigapath.slide_encoder.create_model("hf_hub:prov-gigapath/prov-gigapath", "gigapath_slide_enc12l768d", 1536)

Run the inference to get the slide level embeddings:

slide_encoder.eval()
with torch.no_grad():
    output = slide_encoder(tile_embed, coordinates).squeeze()

Note Older versions of timm have compatibility issues. Please ensure that you use a newer version by running the following command: pip install timm>=1.0.3.

Fine-tuning

Tile-Level Linear Probing Example Using PCam Dataset

For your convenience, we provide the pre-extracted embeddings for the PCam dataset. You can download them from this link. Note that the file size is 2GB.

There is no need to unzip this file.

To run the fine-tuning experiment, execute the following script:

bash scripts/run_pcam.sh data/GigaPath_PCam_embeddings.zip

Slide-Level Fine-Tuning Example Using PANDA Dataset

For your convenience, we provide the pre-extracted embeddings for the PANDA dataset. You can download them from this link. Note that the file size is 32GB. Please unzip this file.

unzip -n data/GigaPath_PANDA_embeddings.zip -d data/

To run the fine-tuning experiment, execute the following script:

bash scripts/run_panda.sh data/GigaPath_PANDA_embeddings/h5_files

Sample Data Download

A sample de-identified subset of the Prov-Path data can be accessed from these links [1, 2].

Model Uses

Intended Use

The data, code, and model checkpoints are intended to be used solely for (I) future research on pathology foundation models and (II) reproducibility of the experimental results reported in the reference paper. The data, code, and model checkpoints are not intended to be used in clinical care or for any clinical decision-making purposes.

Primary Intended Use

The primary intended use is to support AI researchers reproducing and building on top of this work. GigaPath should be helpful for exploring pre-training, and encoding of digital pathology slides data.

Out-of-Scope Use

Any deployed use case of the model --- commercial or otherwise --- is out of scope. Although we evaluated the models using a broad set of publicly-available research benchmarks, the models and evaluations are intended for research use only and not intended for deployed use cases.

Usage and License Notices

The model is not intended or made available for clinical use as a medical device, clinical support, diagnostic tool, or other technology intended to be used in the diagnosis, cure, mitigation, treatment, or prevention of disease or other conditions. The model is not designed or intended to be a substitute for professional medical advice, diagnosis, treatment, or judgment and should not be used as such. All users are responsible for reviewing the output of the developed model to determine whether the model meets the user’s needs and for validating and evaluating the model before any clinical use.

Acknowledgements

We would like to express our gratitude to the authors and developers of the exceptional repositories that this project is built upon: DINOv2, MAE, Timm, and TorchScale. Their contributions have been invaluable to our work.

Citation

If you find Prov-GigaPath useful for your your research and applications, please cite using this BibTeX:

@article{xu2024gigapath,
  title={A whole-slide foundation model for digital pathology from real-world data},
  author={Xu, Hanwen and Usuyama, Naoto and Bagga, Jaspreet and Zhang, Sheng and Rao, Rajesh and Naumann, Tristan and Wong, Cliff and Gero, Zelalem and González, Javier and Gu, Yu and Xu, Yanbo and Wei, Mu and Wang, Wenhui and Ma, Shuming and Wei, Furu and Yang, Jianwei and Li, Chunyuan and Gao, Jianfeng and Rosemon, Jaylen and Bower, Tucker and Lee, Soohee and Weerasinghe, Roshanthi and Wright, Bill J. and Robicsek, Ari and Piening, Brian and Bifulco, Carlo and Wang, Sheng and Poon, Hoifung},
  journal={Nature},
  year={2024},
  publisher={Nature Publishing Group UK London}
}

@article{usuyama2026gigapathflash,
  title={{GigaPath-Flash} and {GigaTIME-Flash}: Efficient Pathology Foundation Models for Whole-Slide and Tumor Microenvironment Analysis},
  author={Usuyama, Naoto and Valanarasu, Jeya Maria Jose and Yao, Sicong and Xu, Hanwen and Bagga, Jaspreet and Qin, Guanghui and Kramer, Robert E. and Wong, Cliff and Lee, Soohee and Qiu, Hao and Zhao, Theodore Zhengde and Ben Shimol, Racheli and Crabtree, Angela and Matlock, Kevin and Lozano Garcia, Eduardo Alejandro and Sangani, Naiteek and Santamaria-Pang, Alberto and Rokuss, Maximilian and Hasija, Yashna and Patel, Naisargi Manishkumar and Entenmann, Jason and Bartlett, Alexandra Q. and Wright, Bill J. and Fox, Bernard A. and Piening, Brian and Zhang, Sheng and Wang, Sheng and Naumann, Tristan and Bifulco, Carlo and Poon, Hoifung},
  journal={arXiv preprint arXiv:2607.18218},
  year={2026},
  doi={10.48550/arXiv.2607.18218},
  url={https://arxiv.org/abs/2607.18218}
}

Contributors

usuyama

24 commits

HanwenXuTHU

5 commits

GeorgeBatch

2 commits

Languages

Python

98.6%

Shell

1.4%