Do Diffusion Models Learn Semantically Meaningful and Efficient Representations?

Ziming Liu, Qiyao Liang, Ziming Liu 0001, Ila FietearXiv 2024 · DOI

Introduction

State-of-the-art diffusion models, such as Stable Diffusion and DALL-E, demonstrate an uncanny ability to compose complex concepts into coherent images. This capability suggests an underlying understanding of semantic features. However, because these models are typically trained on massive, unstructured internet datasets, it is difficult to determine whether they are learning truly independent, factorized representations or simply memorizing high-dimensional correlations. Researchers from MIT investigated this fundamental question by stripping away the complexity of natural images in favor of a mathematically controlled "toy" environment.

Methodology: The Toy Task

To analyze the internal logic of diffusion models, the authors utilized a Conditional Denoising Diffusion Probabilistic Model (DDPM) with a standard UNet architecture. The model was trained to generate 32x32 grayscale images containing a single 2D spherical Gaussian bump.

The model was conditioned on two variables: the $x$ and $y$ coordinates of the bump's center. By varying the increment ($d$)—the spacing between bump locations—and the spread ($\sigma$) of the bumps, the researchers could control the data density and the degree of overlap between features. To inspect the model's internal state, they extracted representations from the UNet's fourth layer and projected them into 3D space using UMAP (Uniform Manifold Approximation and Projection).

The Three-Phase Evolution of Representations

The study revealed that diffusion models do not learn in a linear fashion. Instead, they progress through three distinct qualitative phases as they organize their internal latent space:

  1. Phase A (Wrong Representation): The model lacks any internal structure. It fails to generate recognizable bumps or places them randomly, and the UMAP projection shows a disorganized cloud of points.
  2. Phase B (Inaccurate Representation): A "disordered manifold" begins to emerge. The model understands the basic geometry of a bump, but its internal map is jumbled, leading to significant errors in spatial placement.
  3. Phase C (Accurate Representation): The model forms an "ordered manifold." The internal representations align into a clean grid that mirrors the ground-truth $x/y$ coordinate system, resulting in high precision during generation.
The three phases of learning: from a disordered state (Phase A) to a jumbled manifold (Phase B) and finally a semantically ordered grid (Phase C).

The Coupling of Independent Features

A key goal of representation learning is factorization—the ability to learn independent features (like $x$ and $y$ coordinates) separately. In a perfectly efficient system, learning about the $x$-axis should not depend on the resolution of the $y$-axis.

However, the authors discovered that diffusion models exhibit coupled learning. In experiments with imbalanced datasets (where $x$ had a much higher resolution than $y$), the model's ability to represent both coordinates improved in lockstep. This suggests that the model does not treat $x$ and $y$ as independent factors but rather as a combined manifold. While this leads to semantically meaningful results, it implies that diffusion models may be less representationally efficient than previously assumed, as they require dense data across all dimensions simultaneously.

Results: Data Density and Generalization

The speed at which a model reaches Phase C is heavily dependent on data density. Models trained with smaller increments (higher density) converged to an ordered manifold significantly faster than those trained on sparse data.

Predicted label accuracy as a function of training steps and data increment, showing that higher data density leads to faster convergence.

Despite the "coupling" inefficiency, the models showed impressive interpolation capabilities. In "poked hole" experiments, where a 10% region of the coordinate space was removed from the training set, the model could still accurately generate bumps in the missing area once it reached Phase C. This indicates that once a global manifold structure is established, the model can reliably fill in the gaps.

Conclusion

This research provides a rare look "under the hood" of diffusion models, demonstrating that they naturally seek to form ordered geometric manifolds to represent semantic data. While these models are capable of sophisticated interpolation and semantic organization, the discovery of coupled learning suggests that their current architectures may require more data than a perfectly factorized system would. Future work may focus on architectural changes that encourage independent feature learning to improve data efficiency in more complex, real-world applications.

Summary updated

BibTeX
@misc{liu2024do,
  author = {Ziming Liu and Qiyao Liang and Ziming Liu and Ila Fiete},
  title = {{Do Diffusion Models Learn Semantically Meaningful and Efficient Representations?}},
  year = {2024},
  eprint = {2402.03305},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.03305},
}
Figure