On the Generalization of Diffusion Model

Mingyang Yi, Jiacheng Sun, Zhenguo LiarXiv 2023 · DOI

Abstract

Diffusion models have demonstrated remarkable success in generating high-quality, novel images. However, the theoretical basis for their generalization capabilities—why they do not simply memorize training data—remains poorly understood. This paper investigates the generalization of diffusion models by decomposing performance into optimization and generalization errors. We demonstrate that while the mathematically optimal solution for a finite dataset leads to memorization, the inherent optimization bias of neural networks acts as a crucial regularizer. We further propose a novel training objective that mitigates memorization risks, albeit with a trade-off in image quality.

Introduction

Diffusion models like Stable Diffusion and Midjourney have transformed generative AI, yet a fundamental question persists: why do these models generalize to unseen data instead of merely "copy-pasting" their training sets? This research from Huawei Noah’s Ark Lab explores the mathematical underpinnings of diffusion training to reveal that the "imperfections" of neural network optimization are essential for creativity.

Theoretical Framework

The study introduces a framework for measuring generalization in generative models using Excess Risk, which is decomposed into:

  1. Optimization Error: The model's ability to capture the target distribution, determining image quality.
  2. Generalization Error: The degree of correlation between generated data and the training set, quantified via Mutual Information.

The authors derive the Empirical Optimal Solution—the theoretical global minimum for a diffusion model trained on a finite dataset. They prove that this solution is essentially a weighted linear combination of training samples. Consequently, a deterministic sampler (like DDIM) applied to this "perfect" model would primarily produce images highly correlated with the training data, leading to memorization.

Methodology

To address the memorization trap, the researchers propose a training objective where the model predicts the "previous status" ($x_s$, an intermediate noisy step) rather than the added noise ($\epsilon$) or the original image ($x_0$). This formulation reduces direct dependence on training samples. The theories were validated using the CIFAR-10 and CelebA datasets.

Key Results

A key finding is that the distance between a trained neural network and the memorizing empirical optima increases as the diffusion process approaches the clean image state ($x_0$). This suggests that the optimization bias of U-Nets prevents them from reaching the memorization-prone mathematical optima.

Comparison of trained model vs. empirical optima showing increasing distance and improved image structure over time.

The authors also tested the models' ability to extrapolate by starting the reverse process from noisy versions of test images (unseen during training). The trained model successfully recovered these images, whereas the empirical optima remained biased toward the training set.

Extrapolation performance on unseen test images for the trained model vs. empirical optima.

While the proposed "previous status" objective improves theoretical generalization, it introduces a quality-diversity trade-off. On CIFAR-10, the standard model achieved an FID of 3.17, while the generalization-focused model scored 11.30.

Conclusion

This research concludes that optimization bias is a vital feature of diffusion models. The failure of neural networks to reach the exact empirical optima is precisely what enables them to extrapolate and generate novel content. Future work will focus on balancing this trade-off to maintain high image quality while ensuring robust generalization.

Summary updated

BibTeX
@misc{yi2023generalization,
  author = {Mingyang Yi and Jiacheng Sun and Zhenguo Li},
  title = {{On the Generalization of Diffusion Model}},
  year = {2023},
  eprint = {2305.14712},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.14712},
}
Figure