Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SlotPath - MICCAI 2026 REG² Challenge

Structured slot prediction and report retrieval for reasoning-guided pathology reporting. Complete training and inference code for our submission.

Team Threat_CoT - Sanket Kachole, Spyridon Bakas (Division of Computational Pathology, Indiana University School of Medicine). Contact: skachole@iu.edu.


Method

The report is treated as structured prediction, not free-form generation. The training corpus shows the chain of thought collapses to 109 graph topologies, and the report is a deterministic function of the reasoning answers - a lookup keyed on the answers reproduces 11,216 of 11,220 reports byte-for-byte (99.96%). The task therefore reduces to predicting diagnostic slots from the slide:

  1. Patch extraction - 256×256 tissue patches by a fixed saturation criterion (saturation > 25, mean intensity < 225, retained when > 15% of pixels qualify); 256 patches per slide at inference.
  2. Dual encoding - two frozen backbones: H-optimus-1 (CLS, 1536-d) and Virchow2 (CLS ⊕ mean patch token, excluding 4 register tokens, 2560-d).
  3. Attention MIL - one gated attention MIL trunk per backbone predicts the 109-way template and 83 categorical slots.
  4. Per-organ blending - slot posteriors blended per organ (Virchow2 weight 0.6, except uterine cervix where it is 0).
  5. Report retrieval - the report is selected from a bank of 699 training reports by maximum likelihood; no text is generated.
  6. Visual grounding - the same saturation criterion answers the region-of-interest interface deterministically, with no model.

Results

Official challenge test leaderboard (scored by the organisers):

Phase BPV Edge F1 MESS Report Metric B Overall
Test Phase 1 0.4543 0.8171 0.7179 0.5688 1.0000 0.7724
Test Phase 2 0.3000 0.7672 0.5896 0.3936 1.0000 0.6850

Internal held-out split (organisers' evaluation code, 1,672 slides):

Configuration BPV Edge F1 MESS Report Metric A Exact
H-optimus-1 only 0.7584 0.9304 0.9128 0.8262 0.8757 51.7%
Per-organ, λ_cervix=0 0.7727 0.9360 0.9198 0.8360 0.8838 53.3%
Per-organ + oracle template 1.0000 1.0000 0.9830 0.9301 0.9678 65.7%

The oracle-template row fixes the template to ground truth, isolating error: template selection is the largest lever, and the residual is carried by grading and quantitative slots. Runtime on the evaluation platform (single T4) was 53.6 s per slide against a 300 s budget. Submitted models were retrained on all 11,220 slides using the selected epoch counts (19 for H-optimus-1, 25 for Virchow2).


Repository layout

.
├── Dockerfile              inference container (built by Grand Challenge)
├── requirements.txt        container dependencies (pinned)
├── core.py, inference.py   challenge-provided I/O and entry point
├── src/                    container source
│   ├── tissue.py             saturation criterion (shared by both interfaces)
│   ├── wsi.py                sequential WSI reader
│   ├── abmil.py              gated attention MIL definition
│   ├── interf0/model.py      visual grounding handler
│   └── interf1/model.py      chain-of-thought handler
├── training/               full training and evaluation pipeline
└── environment/            conda environment specifications

Quick start

# 1. clone
git clone https://github.com/IUCompPath/reg2026-submission.git
cd reg2026-submission

# 2. check Python (3.11 required; 3.11.15 used)
python --version

# 3. create the container environment and install
conda create -p ./envs/reg2 python=3.11 && conda activate ./envs/reg2
pip install -r requirements.txt

Dependencies are pinned in requirements.txt to the versions used for the submission. torch is pinned by version; install the CUDA build matching your platform (we used torch==2.6.0+cu124).


Environment (training and scoring)

Two environments are required and cannot be merged. imagecodecs needs numpy ≥ 2; the grader's en_core_sci_lg needs numpy < 2. They exchange JSON on disk.

conda create -p ./envs/reg2 python=3.11 && conda activate ./envs/reg2
pip install -r environment/requirements_reg2.txt

conda create -p ./envs/reg2-eval python=3.11 && conda activate ./envs/reg2-eval
pip install -r environment/requirements_reg2eval.txt
pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.4/en_core_sci_lg-0.5.4.tar.gz

bioptimus/H-optimus-1 and paige-ai/Virchow2 are gated on Hugging Face and need licence acceptance and a token. Hardware used: NVIDIA A100 40 GB (Big Red 200).


Reproducing the results

Scripts are numbered in execution order; edit the paths at the top of each.

cd training
python build_labels.py                    # mine grammar, build labels/templates/banks
sbatch 01_extract_features.slurm          # features, H-optimus-1 (~2 h)
sbatch 01_extract_virchow2.slurm          # features, Virchow2 (~2 h)
sbatch 02_train_heads.slurm               # train MIL trunk, H-optimus-1
sbatch 02_train_virchow2.slurm            # train MIL trunk, Virchow2
sbatch 03b_ensemble_perorgan.slurm        # final configuration, predict and score
sbatch 07_train_full.slurm                # retrain on 100% for submission
sbatch 09_build_fp16_package.slurm        # package model for upload

training/README.md describes each script, including experiments that did not work.


Model weights

Trained weights and runtime assets are archived on Zenodo:

https://doi.org/10.5281/zenodo.21436533

Download and extract model.tar.gz (3.3 GB):

abmil_hoptimus.pt   trained MIL trunk and heads, H-optimus-1 branch
abmil_virchow2.pt   trained MIL trunk and heads, Virchow2 branch
assets.json         109 templates, 699-entry report bank, answer bank
hf/                 H-optimus-1 and Virchow2 weights (fp16)

Backbone weights are stored fp16; the container casts to fp16 on load, so this is numerically identical and halves the download and cold-start read.


Running inference

Grand Challenge - the container builds automatically on tag push; upload model.tar.gz as the algorithm model, mounted at /opt/ml/model.

Locally

docker build -t slotpath .
docker run --rm --gpus all \
  -v /path/to/input:/input:ro \
  -v /path/to/output:/output \
  -v /path/to/extracted/model:/opt/ml/model:ro \
  slotpath

The entry point detects the active interface from the files in /input:

Interface Input Output
Workflow reasoning images/whole-slide-image/<uid>.tiff chain-of-thought.json
Visual grounding visual-context-question.json, histopathology-region-of-interest-thumbnail.jpeg visual-context-response.json

Caveats

  • Validation is a random split, not held-out institution. One institution contributes 77.3% of slides, so figures are optimistic relative to a genuine distribution shift - as the test-phase drop confirms.
  • Retrieval cannot express findings absent from the 699-string bank. A corpus with different reporting conventions requires the bank to be rebuilt.
  • Grading is the dominant error source. Tumour volume reaches 0.205 and Gleason score and grade group sit near 0.61; identification slots are near saturated.

Licence

Code is released under the Apache License 2.0 (see LICENSE). The archived model weights include derivatives of H-optimus-1 and Virchow2, distributed under their own licences; both are gated, and Virchow2 is non-commercial only. Consult each model's licence before use beyond reproducing these results.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages