PDA-MIL / UNLOCK — full reproducibility bundle
Code, environment, frozen features, results, and plotting for the controlled whole-slide study "When Do Pathology Foundation Models Pay Off?" (UNLOCK), whose aggregator contribution is PDA-MIL. This bundle is designed so that every number, table, and figure in the paper can be reproduced end-to-end — either from the raw slides, or (much faster) from the frozen features shipped here.
What is in this repo
code/ experiment pipeline (feature extraction, MIL training, probes, ablations, sweeps)
feats/ FROZEN per-encoder tile embeddings (.pt), one file per slide per encoder (~21 GB)
index/ fixed 256x256 tile coordinates per slide (byte-identical across all encoders)
results/ every experiment output the paper is built from
(*.jsonl, cohorts.json, meta_multisplit.json, reproduction.json, oof_*.npy, ids_*.csv)
plotting/ analyze.py (generates generated/*.tex numbers+tables and Figures/*.pdf)
+ make_*.py (the redesigned manuscript figures)
environment/ requirements.txt (pip freeze) + versions.txt (python/torch/cuda)
data_manifests/ RAW_DATA_SOURCES.md (where to get the WSIs) + encoder_weights_hf_repos.txt
README.md this file
NOT shipped here (obtain externally — size/license) — see data_manifests/
- Raw whole-slide images: TCGA-OV (public, NIH GDC, ~150 GB) and PTRC-HGSOC (controlled access).
- Frozen encoder weights: 16 public/gated HF models (UNI, Virchow2, H-optimus-0, …). Download
them yourself with
code/fetch_weights.py— redistributing gated weights would violate their licenses. The HF repo ids are indata_manifests/encoder_weights_hf_repos.txt. - Trained MIL/PDA-MIL head weights: not saved — the heads are cheap and retrained deterministically
from
feats/by the training scripts (seeded), so results reproduce exactly.
The 16 encoders (9 pathology VFMs + 7 general-vision)
pathology: UNI, UNI2-h, Prov-GigaPath, Virchow2, H-optimus-0, Phikon, Phikon-v2, Midnight-12k, Lunit-DINO
general: ResNet-50, ConvNeXt-B, ViT-B/16, Swin-B, DINO, DINOv2, MambaOut-B
(encoder_weights_hf_repos.txt lists the HF cache; use only the 16 above.)
Cohorts (results/cohorts.json)
- TCGA-OV: 156 WSI / 125 patients (140 frozen, 16 FFPE, 10 sites) — public.
- PTRC-HGSOC: 347 WSI / 158 patients (3 sites) — Chowdhury et al. proteogenomic HGSOC study.
- metadata-only platinum baseline: site 57.5 / specimen 64.7 / both 67.5 AUC.
Environment
- Python 3.10, PyTorch 2.12 / CUDA 13 (see
environment/versions.txt). - Recreate:
conda create -n hgsoc python=3.10 && conda activate hgsoc && pip install -r environment/requirements.txt.
Reproduce
Fast path (from frozen features — no GPU / no raw slides / no encoder weights):
pip install -r environment/requirements.txt- Run the MIL / probe / sweep scripts in
code/onfeats/(drivers:run_*.sh,pipeline*.sh) — regenerates everything inresults/. python plotting/analyze.py— readsresults/, writesgenerated/*.tex(numbers + tables) andFigures/*.pdf. Manuscript numbers were verified to match this output exactly.
Full path (from raw slides): additionally download the WSIs (data_manifests/RAW_DATA_SOURCES.md)
and the encoder weights (code/fetch_weights.py), then code/extract_feats.py regenerates feats/
over the fixed tile set in index/.
Verification performed at packaging time
- results/*.jsonl byte-identical (md5) to the copy the manuscript was built from.
- All 195 auto-generated number macros in the manuscript match a fresh
analyze.pyrun. - Cohort sizes / resistance rates / metadata baselines match the manuscript.
Known gap
results/reproduction.json(drives Fig. 5, the protocol-decomposition ladder) is included, but the script that produced it is not incode/and should be recovered for full end-to-end reproduction.
License / citation
- Code & derived results: CC-BY-NC-4.0 (non-commercial academic use). Cite the associated paper.
- Raw data and encoder weights are governed by their original licenses.
- Downloads last month
- 77