On the Feature Learning in Diffusion Models

Andi Han, Wei Huang, Yuan Cao, Difan Zou

Diffusion models have revolutionized generative AI, but researchers have increasingly noticed their surprising efficacy in "representation learning"—extracting meaningful, robust features for downstream tasks like classification and segmentation. While existing theory largely focuses on how these models sample images or estimate distributions, there remains a significant gap in understanding their feature learning dynamics.

This paper provides a rigorous theoretical framework to explain how the weights of a diffusion model evolve during training compared to a standard supervised classifier, revealing why diffusion models capture a more complete picture of the data.

The Problem: Shortcut Learning vs. Holistic Representation

Standard classifiers often fall victim to "shortcut learning." If a simple pattern (even background noise) is sufficient to distinguish classes, the network will focus entirely on that easy feature and ignore more complex, meaningful structures. Diffusion models, however, seem immune to this. The authors set out to mathematically prove why the denoising objective forces a network to learn a holistic representation of both signal and noise.

Methodology

To analyze these dynamics, the authors study a two-layer convolutional neural network (CNN) with quadratic activation. They compare two distinct training objectives:

  1. DDPM Loss: The standard denoising objective used in diffusion models.
  2. Logistic Loss: The standard objective used in supervised classification.

They utilize a "multi-patch" data model where each input consists of a signal patch (the actual class information) and a noise patch. "Learning" is quantified by measuring the alignment (inner product) between the network's weights and the directions of the signal and noise. The analysis tracks the network from random initialization through to convergence.

Key Insights and Theoretical Results

The core discovery of the paper is the stark contrast between balanced and biased learning.

Theoretical comparison of feature learning dynamics between classification and diffusion models.

As illustrated above, classification models exhibit a "sharp phase transition" based on the Signal-to-Noise Ratio (SNR):

  • Theorem 3.2 (Classification): If the SNR is above a certain threshold, the classifier learns only the signal and ignores the noise. If it is below the threshold, it overfits the noise and ignores the signal entirely.
  • Theorem 3.1 (Diffusion): Conversely, diffusion models learn both signal and noise to the same order of magnitude, scaled proportionally by the SNR. There is no phase transition; both components are preserved in the representation.

Because a diffusion model must reconstruct the entire input to satisfy its denoising mandate, it cannot "ignore" parts of the data just because they aren't useful for a specific label. This fundamentally prevents the model from taking the shortcuts that plague supervised learning.

Empirical Evidence and Training Dynamics

The theoretical findings are strongly supported by empirical tests on synthetic multi-patch data and Noisy-MNIST (where digits are concatenated with Gaussian noise patches).

Empirical feature learning trajectories for classification and diffusion models under low and high SNR conditions.

The training trajectories reveal distinct growth patterns. In the early stages of training, classifier weights grow exponentially, leading to a "winner-take-all" scenario where the strongest features dominate. Diffusion model weights, however, grow linearly, allowing for a more gradual and balanced accumulation of all features.

On the Noisy-MNIST dataset with low SNR, the classifier achieved nearly 100% training accuracy but hovered around 50% test accuracy (random guessing), proving it had only learned the noise. The diffusion model successfully captured the digit patterns even in these high-noise environments.

Conclusion and Future Work

This balanced feature learning explains why diffusion models are more robust to adversarial attacks and generalize better to out-of-distribution (OOD) data—they learn the "global" structure of the data rather than just a few discriminative pixels.

While the current theory relies on a simplified two-layer CNN and a two-patch data model, it lays a crucial mathematical foundation. Future work will aim to extend this framework to analyze conditional diffusion models (like Stable Diffusion) and explore how different optimizers or noise schedules might further influence the balance of feature learning in complex architectures like U-Nets and Transformers.

Summary updated

BibTeX
@inproceedings{han2025feature,
  author = {Andi Han and Wei Huang and Yuan Cao and Difan Zou},
  title = {{On the Feature Learning in Diffusion Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=JjdU6ysnCr},
}
Figure