Dynamical Regimes of Diffusion Models

Giulio Biroli, Tony Bonnaire, Valentin de Bortoli, Marc Mézard · DOI

TL;DR

This paper uses statistical physics to map out the inner workings of generative diffusion models, revealing that the backward denoising process moves through three distinct dynamical phases: pure noise, macro-structure formation (speciation), and data memorization (collapse). By framing these phases as physical phase transitions, the authors provide precise mathematical formulas to predict exactly when a model generalizes versus when it succumbs to the curse of dimensionality and memorizes the training set.

What Problem Does This Paper Address?

Diffusion models (DMs) excel at generating incredibly realistic high-dimensional data like images and videos, seemingly escaping the "curse of dimensionality" that typically causes machine learning models to fail when interpolating in high-dimensional spaces. However, we still lack a rigorous theoretical understanding of how and when these models generalize versus when they simply memorize their training data.

To tackle this, the authors investigate the backward (generative) path of a diffusion model under the assumption that it has perfectly learned the score function of the training data (the "exact empirical score"). The core challenge is characterizing the complex, high-dimensional trajectories of the denoising process to determine the exact boundary between true data generalization and rote memorization.

Methods

The authors bridge the gap between deep learning and statistical mechanics, employing tools originally developed to study disordered systems, spin glasses, and stochastic processes.

  1. Exact Empirical Score Framework: The analysis focuses on strongly overparameterized models that have undergone long training on a finite dataset, meaning the model has perfectly captured the noised empirical distribution.
  2. Trajectory Cloning Protocol: To pinpoint when the model makes "decisions" during generation, the authors introduce a cloning technique. They run a backward trajectory to a specific time $t$, split it into two "clones" with independent noise, and observe whether the clones end up in the same data class (detecting speciation) or collapse onto the exact same training data point (detecting memorization).
  3. Theoretical Modeling: The authors derive exact analytical solutions using a high-dimensional Gaussian mixture model and then generalize these findings using a Landau-type expansion and Bernard Derrida’s Random Energy Model (REM) from glass transition physics.

Datasets

The theoretical predictions were validated using several standard image benchmarks, filtered into balanced two-class subsets (e.g., zero vs. seven, horses vs. cars, pandas vs. seashores):

  • MNIST
  • CIFAR-10
  • ImageNet (downsampled to $16\times16$ and $32\times32$)
  • LSUN

Key Insights and Ideas

The paper’s most compelling insight is that the generative process is not a uniform denoising path, but rather a sequence of three distinct dynamical regimes separated by sharp phase transitions:

Figure 1: Illustration of the three regimes of the backward dynamics though an example corresponding to a Gaussian mixture in two di- mensions. Trajectories are colored white and blue according to their class at the end of the backward dynamics. In regime I, blue and white trajectories are fluctuating within the same bundle and ⃗x is similar to white noise. At the speciation time tS, the ensembles of blue and white trajectories divide and head towards the distribution associated to their respective class. Regime II is where the generative process constructs an ⃗x which resembles to one element of the class (e.g., a seashore in the illustration) without being linked to any data of the training set. At the collapse time tC, trajectories start to be attracted by the data point on which they collapse at t = 0. Regime III corresponds to memorization, whereas in regime I and II, the diffusion model truly generalizes. The images on the right and on the left are illustrations obtained from our ImageNet numerical experiment (notice the collapse on the panda and seashore from the training set at t = 0).
  • Regime I (Pure Noise): At the start of the backward process, the trajectory behaves like standard Brownian motion. The model hasn't committed to any specific structure or class.
  • Regime II (Speciation/Generalization): The trajectory hits a "speciation" time ($t_S$). Here, the model undergoes spontaneous symmetry breaking—similar to a ferromagnetic phase transition—where it commits to a macro-category (e.g., deciding to draw a "seashore" instead of a "panda"). In this regime, the model truly generalizes, creating novel samples belonging to the class.
  • Regime III (Collapse/Memorization): As the process nears $t=0$, it hits a "collapse" time ($t_C$). The trajectory falls into the inescapable attraction basin of a single training data point. This is mathematically identical to a glass transition, where the model completely stops generalizing and memorizes an exact training sample.

Key Results

  • Predicting Speciation: The authors proved that the speciation time is entirely determined by the largest eigenvalue ($\Lambda$) of the data's covariance matrix, governed by the threshold $\Lambda e^{-2t_S} = 1$.
  • Predicting Collapse: The collapse transition occurs exactly when the "excess entropy density" of the empirical distribution crosses zero ($s(t_C) = s^{sep}(t_C)$).
  • Quantifying the Curse of Dimensionality: For a Gaussian mixture, the collapse time is explicitly given by: $$t_C = \frac{1}{2} \log \left( 1 + \frac{\sigma^2}{n^{2/d} - 1} \right)$$ This formula reveals a stark truth: to prevent the model from collapsing into memorization at finite times, the number of training samples $n$ must scale exponentially with the data dimension $d$ ($\frac{\log n}{d} \sim \mathcal{O}(1)$).

  • Empirical Validation: Experiments on real-world datasets perfectly mirrored these theoretical thresholds. When plotting the probability of cloned trajectories falling into the same class, the transitions for vastly different image datasets aligned tightly when rescaled by the predicted $t_S$.

Figure 4: Speciation in realistic datasets: Evolution of ϕ(t), the proba- bility that the two clones end up in the same class, as a function of t/tS for several image datasets. The values of tS are the theoretical predic- tion for the speciation time obtained using (4) and listed in Table 1. The dashed horizontal line indicate ϕ(t) = 0.775 and the errorbars correspond to thrice the standard error.

Limitations and Future Work

The primary limitation of this work is its reliance on the "exact empirical score" hypothesis. In practical applications, deep neural networks rarely learn the exact empirical score perfectly; instead, early stopping, network capacity limits, and explicit regularization act as smoothing mechanisms.

The authors note that while regularization prevents collapse and aids generalization in practice, it can be a double-edged sword—potentially harming the speciation phase by distorting the proportions of generated classes. A crucial next step for the field is to quantitatively model how approximate score learning and network architectures smooth out these sharp phase transitions.

Summary updated

BibTeX
@inproceedings{biroli2024dynamical,
  author = {Giulio Biroli and Tony Bonnaire and Valentin de Bortoli and Marc Mézard},
  title = {{Dynamical Regimes of Diffusion Models}},
  booktitle = {Nature Communications},
  year = {2024},
  doi = {10.1038/s41467-024-54281-3},
}
Figure