Foundation model Gated weights (licence click-through) Research use only pathology

UNI UNI (v1)

General-purpose self-supervised vision encoder for H&E histopathology tiles, pretrained on more than 100 million tiles from over 100,000 whole-slide images; the reference foundation model for pathology feature extraction.

40 388 downloads / month ♥ 372 updated 2025-03-06 gated

At a glance

DeveloperMahmood Lab, Brigham and Women's Hospital / Harvard Medical School
VersionUNI (v1)
Released2024-03-19
Licencecc-by-nc-nd-4.0
AvailabilityGated weights (licence click-through)
KindFoundation model
Regulatory statusResearch use only
Parameters~303M

What it does

UNI turns a histopathology image tile into a fixed-length embedding without any task-specific training. Downstream, those embeddings are pooled per slide (e.g. with a lightweight attention model) to classify cancer subtype, grade, detect metastases or predict molecular status.

Notable uses in oncology

Benchmarked on 34 clinical tasks of varying difficulty across 20 major tissue types, including subtyping, grading, metastasis detection and biomarker prediction; widely used as the tile encoder in academic pathology pipelines.

Tasks, data types and cancers

CancerPan-cancer
Input224×224 H&E tile at 20× magnification (RGB, ImageNet normalisation)
Output1,024-dimensional tile embedding (CLS token)

Architecture

FamilyVision Transformer (ViT)
BackboneViT-L/16
Parameters~303M
Pre-trainingDINOv2 self-supervised learning (no labels)
Input size / contextsingle tile; slide-level tasks use multiple-instance learning over tile embeddings

Loaded through timm as hf-hub:MahmoodLab/UNI (ViT-L/16, patch 16, no classifier head). The DINOv2 recipe is unchanged; the novelty is the scale and diversity of the in-house pathology data.

Training data

Mass-100K: over 100 million tiles sampled from more than 100,000 diagnostic H&E whole-slide images across 20 major tissue types, collected at Massachusetts General Hospital and Brigham and Women's Hospital and complemented with GTEx slides. No public test data was included in pretraining, which is what makes the public benchmarks meaningful.

Training set size>100M tiles from >100,000 WSIs (Mass-100K)
InstitutionsMGH, BWH (Boston, USA); GTEx
Populations / geographyUS academic hospital population; not stratified in the paper by ancestry
Consent / provenance notesInstitutional slides under IRB approval; the pretraining set itself is not released.

Linked datasets

Evaluation

Benchmark / datasetMetricValueExternal validationSource
CAMELYON16 (breast lymph-node metastasis, slide-level) AUROC reported in paper (weakly supervised ABMIL) yes Source
PANDA (prostate Gleason grading) quadratic-weighted κ / balanced accuracy reported in paper yes Source
34-task suite (subtyping, grading, biomarkers; 20 tissue types) average performance vs. CTransPath / REMEDIS best or tied-best on the majority of tasks yes Source

How to run

# generic timm loader — check the model card for the exact init args and image normalisation
import timm, torch
from huggingface_hub import login
login()  # gated repos: accept the licence on huggingface.co first
model = timm.create_model('hf-hub:MahmoodLab/UNI', pretrained=True)
model.eval()
cfg = timm.data.resolve_data_config({}, model=model)
transform = timm.data.create_transform(**cfg)
# emb = model(transform(tile).unsqueeze(0))  # 1 x D tile embedding
Librarytimm
HardwareSingle GPU is enough for inference; a 20×-magnified slide yields thousands of tiles, so batch tiles and cache embeddings.

Weights are gated: request access on Hugging Face and accept the CC-BY-NC-ND licence (research only, no derivatives distribution). Use the exact 224×224 / 20× regime the card specifies — off-magnification tiles degrade features silently.

Regulatory status and intended use

Regulatory statusResearch use only
Intended useResearch feature extractor; not a medical device and not validated for clinical decision-making.

Source →

Regulatory status is quoted from the source linked above and can change. Research-use-only models must not be used for clinical decisions.

Limitations and bias

  • Trained on H&E only; immunohistochemistry, frozen sections and non-standard stains are out of distribution.
  • Scanner and lab colour variation still matters; the paper does not report per-ancestry performance.
  • Non-commercial licence blocks product use without a separate agreement.
  • Slide-level tasks need a second, task-specific aggregation model that you must train and validate yourself.

Sources

  1. Chen RJ et al. Towards a general-purpose foundation model for computational pathology. Nat Med 2024
  2. Hugging Face model card — MahmoodLab/UNI
  3. GitHub — mahmoodlab/UNI

This page is educational — it is not medical advice and does not replace consultation with an oncologist. Diagnostic and treatment decisions are made solely by specialist physicians.