Skip to main content
Back

Stanford's MASS Beats Medical Imaging SSL Baselines by 20 Dice Points Without Labels

Stanford's MASS turns automatic mask proposals into a pretext task, teaching 3D medical encoders anatomy without a single expert annotation.

Pro

  • Stanford AIMI released MASS, a CVPR 2026 self-supervised method for 3D medical imaging.
  • It uses SAM2 auto-generated class-agnostic masks as in-context segmentation pretraining tasks.
  • Pretrained on 5,000 unlabeled CT, MRI, and PET volumes without expert annotations.
  • Matches full supervision with 20 to 40 percent of labels; beats SSL baselines by 20-plus Dice points.
  • Frozen encoder rivals fully supervised classification on unseen pathologies.
  • Checkpoint mass_base.pth available on Hugging Face under MIT license.

Building foundation models for 3D medical imaging has been stuck in an awkward place. The tricks that made CLIP and DINO work on natural images, reconstructing missing pixels or pulling augmented views together, do not translate cleanly to CT, MRI, or PET volumes, where the whole point is to know the exact shape and location of an organ or lesion. A team from Stanford AIMI is proposing a different pretext task: MASS, a mask-guided self-supervised framework that treats segmentation itself as the pretraining objective, using masks that were never touched by a radiologist.

The paper, Learning Generalizable 3D Medical Image Representations from Mask-Guided Self-Supervision, was accepted to CVPR 2026. The released checkpoint was trained with the Iris in-context segmentation architecture on the data used in the paper. Code, preprocessing scripts, and a pretrained checkpoint called mass_base.pth are all public.

Why reconstruction and contrastive SSL fall short in 3D

Medical image understanding usually requires both semantic recognition and spatial localization: a model must know what an anatomical structure or pathology is, and also where it is, how its boundary is shaped, and how it sits relative to surrounding anatomy. The dominant self-supervised recipes only get you part of the way there.

Reconstruction objectives like masked autoencoders teach the network to fill in missing intensities, which biases it toward low-level texture. Contrastive learning, whether pure image-to-image or CLIP-style image-report alignment, produces strong global embeddings but is weakly localized. Neither directly forces the encoder to answer the question a segmentation head actually asks: given this reference anatomy, where is the same thing in a new scan?

The core idea: every automatic mask is a free training task

MASS reframes pretraining as in-context segmentation. The key idea is to turn automatically generated class-agnostic masks into a large collection of in-context segmentation tasks. Given a reference image-mask pair, the model learns to segment the corresponding region in a query image. Across many masks, modalities, anatomies, and spatial scales, MASS learns generalizable medical image representations from diverse dense prediction tasks.

MASS architecture diagram showing 3D mask propagation and the in-context segmentation network

The masks themselves come from SAM2 running over the 3D volumes as a class-agnostic proposer. No one labels them as "liver" or "lung nodule"; they are just coherent regions. But because there are hundreds to thousands of such regions per volume, the encoder sees an enormous variety of dense prediction tasks. That diversity is what supplies the semantic pressure that reconstruction cannot.

How the training loop actually runs

At each step the model receives a reference image with one of its auto-generated masks, plus a differently augmented query view of the same or a related volume. A task encoder turns the reference mask into a task embedding, a shared 3D image encoder processes both views, and a decoder predicts the segmentation of the query. The auto-mask serves as the supervision signal. Because the reference and query are augmented independently, the network cannot cheat by memorizing pixel intensities; it has to actually recognize the structure.

The scale of the mask vocabulary is what makes this generalize. By training on thousands of diverse mask proposals spanning anatomical structures and pathological findings, MASS learns what semantically defines medical structures: the holistic combination of appearance, shape, spatial context, and anatomical relationships. The authors demonstrate effectiveness across data regimes: from small-scale pretraining on individual datasets of 20 to 200 scans to large-scale multi-modal pretraining on 5,000 CT, MRI, and PET volumes, all without annotations.

What the numbers say

The headline results cover three transfer regimes:

  • Few-shot segmentation on novel structures the model never saw during pretraining.
  • Matching full supervision with only 20 to 40 percent of the labeled data, while outperforming self-supervised baselines by over 20 Dice points in low-data regimes.
  • Frozen-encoder classification on unseen pathologies that matches full supervised training with thousands of samples.

A 20-plus Dice-point gap over other SSL baselines when labels are scarce is a big number in this field. It reflects the fact that segmentation-native pretraining aligns directly with the downstream metric, rather than approaching it through a proxy.

Three ways to actually use it

The MASS checkpoint on Hugging Face supports three concrete workflows:

  1. Training-free in-context segmentation. Give it a reference image and its mask, then hand it a new query volume. It segments the same structure without any finetuning.
  2. Low-label finetuning. Initialize a segmentation network from mass_base.pth and finetune with whatever labels you do have.
  3. Frozen-encoder classification. Freeze the encoder and train a small classification head on downstream pathology labels.

Inference runs directly on NIfTI files. A minimal call looks like this:

python inference.py \
  --checkpoint checkpoints/mass_base.pth \
  --test-image test.nii.gz \
  --reference-image ref.nii.gz \
  --reference-mask ref_mask.nii.gz \
  --output out.nii.gz \
  --modality ct --orientation RAS \
  --target-spacing 1.5 1.5 1.5 \
  --use-ema

Raw NIfTI inference depends on reliable image metadata and preprocessing choices. Cases with missing or incorrect spacing/orientation metadata should be inspected carefully. The checkpoint was standardized to RAS orientation, so keep that flag on unless you have a good reason not to.

What it is not

Two caveats worth flagging. First, the checkpoint is intended for research use, not for clinical decision-making. Second, this is not a drop-in Transformers model. The release is a PyTorch checkpoint for the MASS/Iris architecture, not a standalone Transformers model. You need the Stanford-AIMI codebase to load it.

The MASS objective is also tied to having a reasonable mask proposer. SAM2 is the default, but the authors note that other automatic masks, and even mixtures with expert masks, work. If you tried to pretrain on a modality where SAM2 gives you garbage proposals, the whole diversity story would collapse.

The real breakthrough

Under the headline of another SSL method, the more interesting shift is philosophical. For years, medical SSL borrowed pretext tasks from natural images: rotate, inpaint, contrast. MASS argues that the right pretext task for medical imaging is the downstream task itself, in a class-agnostic form. Because a foundation model built for radiology has to answer "what and where" questions about anatomy, it might as well be trained on "what and where" from day one, using masks that anyone with a segmentation model can produce for free.