NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Masked Diffusion as Self-supervised Representation Learner

Zixuan Pan, Jianxu Chen, Yiyu Shi

TL;DR

The Masked Diffusion Model (MDM) reimagines self-supervised representation learning by replacing the Gaussian noise of traditional diffusion models with a dynamic masking mechanism. By optimizing for structural similarity (SSIM) rather than pixel-wise error, MDM achieves state-of-the-art performance in few-shot semantic segmentation for both medical and natural images.

What Problem Does This Paper Address?

Denoising Diffusion Probabilistic Models (DDPMs) have become the gold standard for image generation, and researchers recently discovered they are also excellent at learning "representations"—internal features that help a computer understand what is in an image. However, there is a fundamental mismatch: generative models spend a lot of their "brain power" learning high-frequency details (like fine textures) to make images look pretty. In contrast, downstream tasks like semantic segmentation (labeling every pixel in an image, e.g., "this pixel is part of a tumor") require high-level structural information.

Furthermore, traditional diffusion relies heavily on adding Gaussian noise. The authors argue that this specific type of corruption isn't necessarily the best way to learn semantic features. They also address the challenge of few-shot learning, where a model must learn to segment images using very few labeled examples—a common hurdle in medical imaging where expert annotations are expensive.

Methods

The authors introduce the Masked Diffusion Model (MDM), which blends the iterative nature of diffusion models with the masking strategy of Masked Autoencoders (MAE).

  1. Dynamic Masking Process: Instead of adding Gaussian noise to an image $x_0$ to get a noisy version $x_t$, MDM divides the image into patches and randomly masks them. Crucially, the masking ratio is tied to the timestep $t$. As $t$ increases, more of the image is hidden, creating a "curriculum" of reconstruction tasks ranging from easy to difficult.

    Figure 1: Dynamic masking process. Portions of data are probabilistically masked according to the timestep t and subsequently reconstructed via a time-aware U-Net.
  2. Time-aware U-Net: The model uses a standard U-Net architecture that is "aware" of the current timestep $t$. It takes the corrupted image and tries to reconstruct the original, intact image.

  3. SSIM Loss: Most models use Mean Squared Error (MSE) to compare the reconstruction to the original. MDM instead uses the Structural Similarity Index (SSIM) loss. SSIM is designed to perceive changes in structural information, luminance, and contrast, which aligns much better with the needs of a segmentation task than simple pixel-wise differences.
  4. Two-Step Pipeline:
    • Step 1: Pre-train the MDM on a large set of unlabeled images to reconstruct masked patches.
  5. Step 2: Freeze the MDM and use it as a feature generator. A lightweight "segmentation head" (a simple MLP) is then trained on these features using a small labeled dataset.
Figure 2: Overview of our proposed method. During pre-training, only the masked diffusion model (Encoder and Decoder) in Step 1 is trained. We partially mask the clean image based on a randomly sampled timestep t. The masked diffusion model then takes the masked image and reconstructs it. For the downstream segmentation task, the pre-trained model in Step 1 is frozen as a representation generator, and the segmentation network in Step 2 is trained with the representations extracted from Step 1.

Datasets

The authors evaluated MDM across two distinct domains:

  • Medical Images: The Gland segmentation dataset (GlaS) and the Multi-organ nucleus segmentation dataset (MoNuSeg).
  • Natural Images: FFHQ-34 (a subset of the Flickr-Faces-HQ dataset) and CelebA-19 (face attributes).
  • Pre-training: They used the larger FFHQ-256 dataset for natural image pre-training and in-domain images for medical pre-training.

Key Insights and Ideas

  • Generative Power $\neq$ Representation Quality: The paper demonstrates that a model doesn't need to be a great image generator to be a great feature learner. By stripping away Gaussian noise, they show that the "diffusion" framework (iterative corruption) is the real hero, not the noise itself.
  • Masking as a Semantic Driver: Masking forces the model to learn the relationship between distant parts of an image to "fill in the blanks," which builds a stronger semantic understanding than just removing pixel-level noise.
  • The "Aha" of SSIM: While SSIM is common in image restoration, its use here bridges the gap between pre-training and segmentation. Interestingly, ablation studies showed that SSIM loss significantly helped MDM but actually hindered the performance of standard Masked Autoencoders (MAE), suggesting a unique synergy between SSIM and the diffusion-style time-aware architecture.

Key Results

MDM consistently outperformed both traditional segmentation models (like UNet++) and modern self-supervised baselines (like MAE and DDPM).

  • Few-Shot Excellence: In the 10% label scenario for the GlaS dataset, MDM achieved a 91.60% Dice score, significantly higher than DDPM (90.30%) and MAE (88.56%).
  • Medical Precision: On MoNuSeg (10% labels), MDM reached a 79.71% Dice score, whereas traditional models like UNet struggled at around 54.79%.
  • Qualitative Superiority: Qualitative results show that MDM is much better at identifying complex semantic boundaries, such as correctly classifying a hat as a distinct semantic part where other models failed.
Figure 4: Qualitative Visualization on MoNuSeg test sets under full training labels setting (first 2 rows) and 10% training labels setting (last 2 rows) with the dice score (%) of each prediction.

Limitations and Future Work

The authors acknowledge a few areas for growth:

  • Architecture Scope: The current implementation is tied to the U-Net architecture. Future work could explore integrating MDM with other backbones like ConvNeXt or Vision Transformers (ViT) beyond the standard MAE setup.
  • Task Diversity: While segmentation is a rigorous test, the model's performance on other dense prediction tasks (like depth estimation) or other data domains (like audio) remains an open question.
  • Loss Optimization: While SSIM proved effective, the authors suggest that even more tailored optimization objectives could be discovered for specific datasets.

Summary updated

BibTeX
@misc{pan2023masked,
  author = {Zixuan Pan and Jianxu Chen and Yiyu Shi},
  title = {{Masked Diffusion as Self-supervised Representation Learner}},
  year = {2023},
  eprint = {2308.05695},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.05695},
}
Figure