A phase transition in diffusion models reveals the hierarchical nature of data

Antonio Sclocchi, Alessandro Favero, Matthieu Wyart

TL;DR

This paper demonstrates that denoising diffusion models generate data by traversing a hidden hierarchy across different time scales. By using a "forward-backward" noising and denoising protocol, the authors discover a sharp phase transition: at a critical noise threshold, the high-level semantic class of an image abruptly changes, while its low-level features persist and are creatively recombined to form the new class.

What Problem Does This Paper Address?

Why are deep generative models, particularly diffusion models, so incredibly effective at creating realistic images and text? The prevailing wisdom is that natural data is inherently hierarchical and compositional—small features (like edges) combine to form parts (like eyes or paws), which combine to form objects (like a leopard).

However, formally proving how diffusion models interact with this structure has been an open challenge. Previous qualitative studies suggested that adding a lot of noise destroys fine details while preserving large-scale structures. This paper challenges that view, addressing a fundamental question: How do diffusion models navigate the different structural scales of data over time?

Methods

The authors tackle this question using a clever combination of empirical experiments and mathematical modeling:

  1. Forward-Backward Protocol: They take a clean image, inject a controlled amount of Gaussian noise up to a time $t$ (the forward process), and then run the trained diffusion model in reverse to generate a clean image again.
  2. Layer-wise Representation Analysis: To quantify what information survives the noise, they feed both the original and the newly generated images into a state-of-the-art classifier (like ConvNeXt or ResNet). They measure the cosine similarity between the network's internal activations at different depths. Since deep networks learn hierarchical representations, early layers act as a proxy for low-level features, while the final layers (logits) represent the high-level class.
  3. The Random Hierarchy Model (RHM): To explain their empirical findings theoretically, the authors analyze a synthetic data model where data points are generated via a tree-like hierarchy of production rules (Figure 3). They compute the mathematically optimal denoising process on this tree using Belief Propagation (BP) and apply a mean-field approximation to analytically predict how features at different levels recover from noise.
Hierarchical generative model structure compared to natural image decomposition.

Datasets

  • ImageNet-1k: Used for large-scale empirical validation, utilizing a class-unconditional diffusion model trained on 256x256 images, with representations analyzed via pre-trained ConvNeXt and ResNet architectures over $10^5$ samples.
  • Synthetic RHM Data: Generated explicitly to validate the mathematical equations derived from the tree-structured belief propagation.

Key Insights and Ideas

  • The Semantic Phase Transition: High-level features (the image class) undergo a sudden, sharp phase transition. Below a threshold time $t^*$, the image class remains identical. Above it, the probability of reconstructing the original class drops instantly to near-random chance.
  • Low-Level Feature Persistence: Crucially, when the class changes after the phase transition, the low-level features do not disappear. Instead, they evolve smoothly and persist, acting as building blocks that the model recombines to construct the new class. For example, the spots and eyes of a diffused leopard might be repurposed to compose a wolf or a butterfly (Figure 1).
  • U-Nets as Belief Propagation: The authors point out a striking structural parallel: the encoder-decoder architecture of the U-Nets commonly used in diffusion models (with their characteristic skip connections) closely mirrors the upward and downward message-passing loops of the Belief Propagation algorithm on hierarchical trees.
  • Compositional vs. Simple Data: When repeating the experiment on a simple, non-hierarchical bi-modal Gaussian mixture, the phase transition occurred, but the smooth persistence and inversion of low-level features did not. This proves that the observed phenomenon is a unique fingerprint of hierarchical, compositional data.

Key Results

  • Empirical Inversion: On ImageNet, around $t \approx T/2$, the similarity of the final logits drops sharply to zero. Meanwhile, the early layers maintain a higher similarity that decays much more smoothly.
  • Theoretical Alignment: The mean-field theory perfectly predicts the phase diagram for class inference. When plotting the probability of correct node reconstruction against noise level $\epsilon$, the theoretical curves match the experimental belief propagation curves flawlessly, capturing the exact point where the top-level and bottom-level curves invert.
Phase diagram for inferring the class node using the upward iteration of BP.

Limitations and Future Work

  • Bayes-Optimal Assumption: The theoretical analysis assumes the denoising algorithm has perfect knowledge of the data's underlying production rules (Bayes-optimal). Real-world neural networks only approximate this through empirical risk minimization on finite training sets.
  • Proving the U-Net Connection: While the structural similarity between U-Nets and Belief Propagation is compelling, formally proving that trained U-Nets are mathematically executing an approximate form of BP remains an objective for future research.
  • Broader Modalities: The authors suggest extending this framework to explore how diffusion models handle hierarchy in other complex data types, such as natural language syntax or the structural folding of biological proteins.

Summary updated

BibTeX
@inproceedings{sclocchi2025phase,
  author = {Antonio Sclocchi and Alessandro Favero and Matthieu Wyart},
  title = {{A phase transition in diffusion models reveals the hierarchical nature of data}},
  booktitle = {Proceedings of the National Academy of Sciences},
  year = {2025},
  doi = {10.1073/pnas.2408799121},
}
Figure