Towards a Theoretical Understanding of Memorization in Diffusion Models

Yunhao Chen, Xingjun Ma, Difan Zou, Yu-Gang JiangSubmission to ICLR 2025 · Withdrawn

TL;DR

Why do conditional diffusion models memorize training data far more aggressively than unconditional ones, and can unconditional models still be cracked? This paper provides a rigorous mathematical framework showing that conditioning inevitably shrinks latent variance and concentrates generation around training samples. Leveraging this insight, the authors introduce SIDE (Surrogate condItional Data Extraction), an attack that forces unconditional diffusion models into behaving like conditional ones—boosting training data extraction rates by over 50% across benchmarks.

What Problem Does This Paper Address?

Diffusion probabilistic models (DPMs) have taken the generative AI world by storm, powering systems like Stable Diffusion and Sora. However, when these models memorize and regenerate exact copies of their training images, they trigger serious privacy breaches and copyright disputes.

Empirical work has repeatedly shown that conditional models (e.g., text-to-image or class-conditioned models) are much more prone to memorization than unconditional models. Consequently, existing data-extraction attacks primarily target conditional setups, while unconditional models have remained notoriously difficult to extract data from without brute-force generation. Before this work, the community lacked a unified theoretical explanation for why conditioning triggers memorization and whether unconditional models are genuinely safe from targeted extraction.

Methods

The authors build a theory-driven pipeline from first principles:

  1. Pointwise Memorization Metric ($M_{\text{point}}$): Defines memorization as the statistical overlap (KL divergence) between the model’s generated distribution and narrow Gaussian balls centered at each training point. The authors formally prove that $M_{\text{point}}$ is monotonic with respect to semantic memorization in the latent space.
  2. Theory of Informative Labels: An "informative label" is defined as any attribute (class labels, text captions, or unsupervised clusters) that partitions the dataset. Under model convergence assumptions, the authors prove that conditioning on informative labels strictly reduces latent covariance and induces tighter clustering around local means, which provably increases pointwise memorization.
  3. Surrogate condItional Data Extraction (SIDE):
  4. Pseudo-Labeling: Since unconditional models lack explicit class labels, the authors construct implicit informative labels. The target DPM generates a synthetic dataset, which is labeled using an external classifier or feature clusterer.
  5. Time-Dependent Knowledge Distillation (TDKD): Standard classifiers struggle to provide accurate gradients on heavily noised latents. The authors modify a ResNet architecture by inserting a time-conditioning module right after batch normalization and distill the classifier into a time-dependent classifier $p_\theta^t(y \mid x_t)$.
  6. Guided Sampling: Sampling uses a power-prior-calibrated classifier guidance term ($\lambda$) to drive the unconditional diffusion trajectory toward memorized training clusters.
  7. New Evaluation Metrics: To fix flaws in existing percentile-based heuristics, they propose the Average Memorization Score (AMS) and Unique Memorization Score (UMS), partitioned across low, mid, and high visual similarity thresholds.

Datasets

The authors evaluated memorization and extraction across three image datasets:

  • CelebA-HQ-Face-Identity (CelebA-HQ-FI): 5,478 high-resolution facial images.
  • CelebA-25000: A 25,000-image subset of CelebA.
  • CIFAR-10: 50,000 low-resolution images across 10 classes.

Key Insights and Ideas

  • Conditioning naturally concentrates probability mass: Any conditioning signal reduces entropy and latent variance. This forces the reverse diffusion process to focus on tighter manifolds, making training point replication mathematically much more likely.
  • Random labels still memorize: The theory explains the counterintuitive empirical finding that models trained on completely random labels still over-memorize: random labels still partition the dataset, triggering the exact same latent variance reduction.
  • Unconditional models have hidden conditional structure: An unconditional model internally learns implicit data clusters. Extracting from it simply requires constructing a "surrogate condition" to steer generation into those dense clusters.
  • The sample budget $N_G$ fundamentally biases evaluation: The authors prove analytically that the expected number of uniquely memorized images scales non-linearly with the number of generated trials $N_G$ ($\mathbb{E}[N_{\text{umem}}] = \sum [1 - (1 - p_i)^{N_G}]$). Benchmarks that do not hold $N_G$ constant produce skewed, invalid comparisons.

Key Results

  • Large-Scale Extraction on CelebA-25000: On this dataset—previously deemed too large for unconditional extraction—standard random sampling extracted zero high-similarity images ($0.000\%$). SIDE successfully extracted memorized training samples at high similarity ($0.012\%$) and more than doubled both AMS ($0.100\% \to 0.224\%$) and UMS ($0.100\% \to 0.212\%$) at mid similarity.
  • CelebA-HQ-FI Gains: Mid-level similarity AMS jumped by 87% ($0.596\% \to 1.115\%$) and UMS by 37% ($0.328\% \to 0.444\%$) over random generation.
  • CIFAR-10 Improvements: At high similarity, SIDE reached an AMS of $1.770\%$ and UMS of $0.560\%$, outperforming random baseline rates ($0.510\%$ and $0.420\%$).
  • Necessity of TDKD: Using a standard, time-independent classifier (OL-TI) instead of the distilled time-dependent classifier achieved only $\sim 10\%$ of SIDE’s extraction effectiveness on high-resolution CelebA data, demonstrating the necessity of accurate multi-timestep gradients.

Limitations and Future Work

  • Convergence Assumptions: The core proofs assume asymptotic model convergence to the ground-truth conditional score/distribution, which may not hold uniformly across under-trained or capacity-constrained diffusion networks.
  • Guidance Scale Sensitivity: The guidance hyperparameter $\lambda$ exhibits a sharp trade-off: if $\lambda$ is set too high, generation overfits the classifier’s decision boundaries, collapsing sample diversity and hurting overall memorization yield.
  • Defenses Left for Future Exploration: While the theoretical framework pinpoints why memorization occurs, designing active mitigation strategies (such as provably anti-memorization regularizers or latent-variance constraints during training) remains open for future research.

Summary updated

Abstract

As diffusion probabilistic models (DPMs) are being employed as mainstream models for Generative Artificial Intelligence (GenAI), the study of their memorization of training data has attracted growing attention. Existing works in this direction aim to establish an understanding of whether or to what extent DPMs learn via memorization. Such an understanding is crucial for identifying potential risks of data leakage and copyright infringement in diffusion models and, more importantly, for trustworthy application of GenAI. Existing works revealed that conditional DPMs are more prone to training data memorization than unconditional DPMs, and the motivated data extraction methods are mostly for conditional DPMs. However, these understandings are primarily empirical, and extracting training data from unconditional models has been found to be extremely challenging. In this work, we provide a theoretical understanding of memorization in both conditional and unconditional DPMs under the assumption of model convergence. Our theoretical analysis indicates that extracting data from unconditional models can also be effective by constructing a proper surrogate condition. Based on this result, we propose a novel data extraction method named \textbf{Surrogate condItional Data Extraction (SIDE)} that leverages a time-dependent classifier trained on the generated data as a surrogate condition to extract training data from unconditional DPMs. Empirical results demonstrate that our SIDE can extract training data in challenging scenarios where previous methods fail, and it is, on average, over 50\% more effective across different scales of the CelebA dataset.
BibTeX
@misc{chen2024towards,
  author = {Yunhao Chen and Xingjun Ma and Difan Zou and Yu-Gang Jiang},
  title = {{Towards a Theoretical Understanding of Memorization in Diffusion Models}},
  year = {2024},
  eprint = {2410.02467},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.02467},
}
Figure