Score-Based Generative Models Detect Manifolds

Jakiw Pidstrigach

TL;DR

This paper provides a theoretical framework to understand when Score-Based Generative Models (SGMs), like diffusion models, generate samples that lie on the underlying data manifold. It establishes conditions for SGMs to produce "the right kind of samples" and offers insights into their generalization capabilities by precisely describing when they memorize training data.

What Problem Does This Paper Address?

Score-Based Generative Models (SGMs) have shown remarkable success in generating realistic data. However, a key challenge is that these models rely on approximating the "score" function ($\nabla \log p_t$) of intermediate data distributions during their training process. The theoretical implications of these approximations, especially concerning the quality and diversity of generated samples, are not fully understood. Specifically, it's unclear under what conditions SGMs can reliably generate samples that conform to the underlying structure of the data (i.e., lie on the data manifold) and when they simply memorize the training set without true generalization. This paper aims to bridge this gap by providing a rigorous analysis of these approximation errors and their impact on sample generation.

Methods

The paper leverages the framework of Stochastic Differential Equations (SDEs) to model both the forward diffusion process and the reverse generative process. The core of their analysis involves:

  • Forward SDE: This process gradually adds noise to the data, with its intermediate distributions denoted by $\pi_t$.
  • Reverse SDE: This process aims to reverse the diffusion by starting from a simple prior distribution (e.g., Gaussian) and denoising it. The key challenge is that the reverse SDE requires the score function $\nabla \log p_t$, which is often approximated by a neural network trained via score matching.
  • Approximation Errors: The paper meticulously analyzes two main sources of error:
  • Prior Approximation: Using a proxy distribution (e.g., Gaussian) for the final distribution of the forward process ($\pi_T$) instead of the true one.
  • Score Approximation: Using a learned score function $s(x, t)$ instead of the true score $\nabla \log p_t$.
  • Manifold Hypothesis: The analysis is grounded in the manifold hypothesis, which posits that real-world data often lies on a lower-dimensional manifold within the high-dimensional data space. The paper investigates conditions under which the generated samples ($\mu_{sample}$) have the same support as the true data distribution ($\mu_{data}$), effectively learning this manifold.
  • Theoretical Tools: The authors employ tools from probability theory, including f-divergences and martingale theory, to bound the distances between the generated distribution, the true data distribution, and the prior distribution.

Datasets

The paper uses the CIFAR-10 dataset for experimental validation. The authors also refer to experiments on a Gaussian mixture dataset and a unit sphere dataset to illustrate specific theoretical points.

Key Insights and Ideas

  • "Right Kind of Samples": The paper provides precise conditions under which SGMs generate samples that lie on the data manifold $\mathcal{M}$. This means that even if the model doesn't perfectly capture the frequency of data points, it can still generate samples that belong to the correct category (e.g., generating faces if the manifold is faces).
  • Generalization vs. Memorization: A crucial finding is that for SGMs to generalize (i.e., produce novel samples not seen in training), the approximation error in the learned score function ($s(x,t)$) must be unbounded. Conversely, if this error is bounded, the SGM is likely to memorize the training data.
  • Drift Explosion and Manifold Learning: The paper connects the observed phenomenon of "drift explosion" in the reverse SDE as $t \to T$ to the manifold hypothesis. This explosion acts as a "support matching force," driving the generated samples towards the data manifold.
  • Initial Condition vs. Score Error: The analysis suggests that errors in the initial condition of the reverse SDE are less responsible for generalization failures compared to errors in the score approximation.

Key Results

  • Theorem 1: Establishes that the distribution of generated samples ($\mu_{sample}$) is absolutely continuous with respect to the true data distribution ($\mu_{data}$) if the prior distribution ($\mu_{prior}$) is absolutely continuous with respect to the forward process marginals ($\pi_t$). It also shows that the f-divergence between $\mu_{sample}$ and $\mu_{data}$ is bounded by the f-divergence between $\mu_{prior}$ and $\pi_t$. This implies that initial condition errors alone do not prevent generalization.
  • Theorem 2: Demonstrates that if the approximation error in the score function ($s(x,t)$) is bounded, then the SGM memorizes its training data (i.e., $\mu_{sample}$ has the same support as $\mu_{data}$). This provides a direct link between bounded score errors and memorization.
  • Corollary 1: Offers a practical condition for memorization: if the exponential integral of the drift approximation error is finite, the SGM memorizes its training data. This implies that for generalization, this integral must be infinite.
  • Empirical Validation: Experiments on CIFAR-10 (Figure 3 and 4) illustrate these concepts, showing how perturbed drifts lead to samples on the manifold but potentially skewed distributions, and how unbounded score errors are necessary for generating novel samples.

Limitations and Future Work

  • Assumptions: The theoretical results rely on certain assumptions about the forward SDE (e.g., Lipschitz continuity of the drift, existence of solutions) and the properties of the Girsanov weights ($Z_t$). While Lemma 1 shows these are often met in practice, they are still formal assumptions.
  • Understanding $Z_t$: The paper highlights that a deeper understanding of the Girsanov weights ($Z_t$), their relation to score matching loss minimization, and their heavy-tailed nature is crucial for understanding SGMs and their generalization.
  • Neural Network Architecture: The influence of neural network architecture and parametrization on the properties of $Z_t$ is identified as an important area for future research.
  • Robust Estimators: Developing robust estimators for $Z_t$ or its expectation is suggested for better practical usage in training and evaluation.
  • Data Manifold Complexity: While the paper assumes the data manifold is contained within a ball, this assumption could be weakened for broader applicability.

Summary updated

Abstract

Score-based generative models (SGMs) need to approximate the scores $\nabla \log p_t$ of the intermediate distributions as well as the final distribution $p_T$ of the forward process. The theoretical underpinnings of the effects of these approximations are still lacking. We find precise conditions under which SGMs are able to produce samples from an underlying (low-dimensional) data manifold $\mathcal{M}$. This assures us that SGMs are able to generate the "right kind of samples". For example, taking $\mathcal{M}$ to be the subset of images of faces, we provide conditions under which the SGM robustly produces an image of a face, even though the relative frequencies of these images might not accurately represent the true data generating distribution. Moreover, this analysis is a first step towards understanding the generalization properties of SGMs: Taking $\mathcal{M}$ to be the set of all training samples, our results provide a precise description of when the SGM memorizes its training data.
BibTeX
@inproceedings{pidstrigach2022score,
  author = {Jakiw Pidstrigach},
  title = {{Score-Based Generative Models Detect Manifolds}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=AiNrnIrDfD9},
}
Figure