Diffusion models generalize well in practice. Paradoxically, an optimal diffusion model fully memorizes the training data and therefore fails to generalize, raising the question of what induces generalization in a real diffusion model. We show that diffusion models progressively overfit the denoising training objective, creating a generalization gap between validation and training performance at intermediate noise levels. In a fully analytic 2D toy model with a controlled denoising error, we trace this gap to the interaction between model error and the density of the data distribution's support. The optimal denoising flow field localizes sharply around individual training points, whereas model error suppresses exact recall of training points, yielding a smooth, generalizing flow field. Finally, we examine how training-time overfitting manifests along inference trajectories. We find that predictions made from intermediate trajectory states occupy a distinct feature-space regime from predictions made from noised training and validation images. As training progresses and model size increases, these predictions develop greater relative affinity to the training data, despite the absolute similarity to the validation data not decreasing. Together, these findings show that the denoising objective and inference trajectories express structural memorization differently.
Figures & tables
Figure 1: Qualitative summary of contributions. (a) State-of-the-art diffusion models exhibit a growing generalization gap: the difference in reconstruction error (denoising training objective) between training and validation data increases as training progresses. (b) This gap is modulated by model error: Increasing model error smoothes the learned flow field, suppressing the generalization gap. For low model error (top), the flow field localizes sharply around training points, while for high model error (bottom), it more smoothly approaches the data manifold. (c) Similarly, during inference, trajectories become increasingly biased towards the training data, relative to the validation data, despite increasing their absolute similarity to both.
Figure 2: The relative generalization gap G(σ) increases with images seen during training (colorbar in millions) and with model size in relation to dataset size. The black line indicates the beginning of overfitting (validation error starts increasing) for each noise level σ .
Figure 3: Flow field lines of the optimal target predictor y at different noise levels σ=28,2.8,0.63 . Blue dots show predictions y∗(x,σ) for x=y+σn,n∼N(0,I),y∼Dtrain . Color indicates the magnitude of y∗(x,σ)−x . Field geometry is (a) global, predictions tend towards the superposition of all training points, (b) moderately localized around training points, predictions approximate the data manifold, and (c) highly localized around each training point, predictions replicate the training points.
Figure 4: Relative generalization gap G(σ) in our 2D toy model with circular data manifold (a) for different settings of the model error parameter δ (colorbar), (b) for different number of training points N (colorbar), and (c) computed using a single point on the data manifold as the validation set, parametrized by its angle ( σ≈1.1 ). The resulting gap is zero at training points, and largest between training points, with magnitude related inversely to δ .
Figure 5: (a) and (b) Average cosine similarity between predictions of query images q∈Q and clean images from the reference sets Dtrain/val ( Eq. 11 ). As the noise level σ decreases, overall similarity to the reference sets increases. At low noise, both noisy training and noisy validation images as queries (blue and orange lines) exceed intermediate trajectory states (green line) in absolute similarity to both reference sets. (c) The relative train affinity ( Eq. 12 ) of intermediate trajectory states (green line) increases alongside the absolute similarities to the reference sets. All plots show EDM2-S on ImageNet64.
Figure 6: (a) Average cosine similarity between predictions of query images q∈Q and clean images from the reference sets Dtrain/val ( Eq. 11 ). As training time increases, the absolute similarity of intermediate trajectory states (green line) to both reference sets increases. (b) So does their relative train-affinity ( Eq. 12 , green line). (c) Their positive relative train-affinity is robust across choices of k . All plots show EDM2-S on ImageNet64.
Figure 7: The relative generalization gap G(σ) with average L2-reconstruction error increases and shifts towards higher noise levels when the number of classes (colorbar) for a class-conditioned model increases. Each line corresponds to a re-trained EDM model on CIFAR-10.
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
Metric
Sample size
GPU-h
Wall-clock
ImageNet-64
L(D,σ)
8192
4m - 4m
1m - 1m
Standard FD
50.000
56m - 4h20m
14m - 1h5m
Sk(Q,R;σ)
10.000
4m - 4m
1m - 1m
ImageNet-512
L(D,σ)
8192
16m - 16m
4m - 4m
Standard FD
50.000
2h28m - 7h44m
37m - 1h56m
Sk(Q,R;σ)
10.000
-
-
Appendix
Table 1: Compute requirements for metric evaluation on ImageNet-64, for one model (checkpoint) and a single noise level σ . GPU-h and wall-clock time for ImageNet range from smallest to largest model size. They are approximate and refer to a server with 4xNVIDIA-A100 (45GB).
Figure 8: Relative generalization gaps ( Eq. 1 ) with EDM2-S on ImageNet-64. w=0 corresponds to no guidance. An increasing guidance weight amplifies the gap, but this trend reverses for moderate to high guidance weights. (c) fixes σ close to the peak of the generalization gaps in (a) and (b), indicated by the dotted black line.
Figure 9: (a) Decreasing the receptive field mitigates the relative generalization gap ( Eq. 1 ) with ML2 . Colorbar shows the sliding window size. 64 corresponds to regular inference. (b) During inference, the model shifts from long-range correlations to short-range correlations. The correlation score is averaged over pixels and images. (c) Edge pixels tend to have longer-range dependencies. σ≈1.2 . RGB shows the pixel-wise correlation score, agg is aggregated over channels. All plots show ImageNet-64, EDM2-S.
Figure 10: Edge pixels tend to have longer-range dependencies. Shown is the pixel-wise correlation score, averaged over 128 images and aggregated over channels, computed with EDM2-S on ImageNet-64 at σ=1 .
Figure 11: Flow field lines and predictions of the optimal target predictor y∗(x,σ) at different noise levels σ=28,2.8,0.63 . Color indicates the magnitude of the prediction error y∗(x,σ)−x . Field geometry is (a) global, predictions tend towards the superposition of all training points. (b) moderately localized around training points, predictions approximate the data manifold (c) highly localized around each training point, predictions replicate the training points.
Figure 12: Relative generalization gap ( Eq. 1 ) with ML2 in our 2D toy model with random data on a circular manifold and (a) different settings of the model error parameter δ , (b) different number of training points, and (c) different settings for the guidance weight w . w=0 corresponds to no guidance.
Figure 13: Relative generalization gap ( Eq. 1 ) with EDM2 on ImageNet-64 for various model sizes, plotted vs σ . Colorbar shows images seen during training. Dotted black lines indicate σ values used in Fig. 14 .
Figure 14: Relative generalization gap ( Eq. 1 ) and training and validation results, with EDM2 on ImageNet-64 for various model sizes. For each model size, σ is fixed at the peak of the generalization gap in Fig. 13 .
Figure 15: Relative generalization gap ( Eq. 1 ) with EDM2 on ImageNet-512 for various model sizes, plotted against the noise level σ . Colorbar shows images seen during training. Dotted black lines indicate σ values used in Fig. 16 .
Figure 16: Relative generalization gap ( Eq. 1 ) and training and validation results, with EDM2 on ImageNet-64 for various model sizes. For each model size, σ is fixed at the peak of the generalization gap in Fig. 15 .
Figure 17: Relative generalization gap ( Eq. 1 ) with EDM on CIFAR-10/100. Colorbar shows images seen during training. Dotted black lines indicate σ values used in Fig. 18
Figure 18: Relative generalization gap ( Eq. 1 ) and training and validation results with EDM on CIFAR-10/100 for model sizes. σ is fixed at the peak of the generalization gap, see Fig. 17 .
Figure 19: The gap between the absolute similarity to the references between predictions from intermediate states of trajectories (green line) and predictions from noised data points (blue and orange lines) closes with increasing model size. All plots show fully trained models. First column: EDM2-XS. Second column: EDM2-XL.
Figure 20: Qualitative trends in the metrics of Section 4 are robust to the choice of k . All plots show fully trained models.
Figure 21: The gap between the absolute similarity to the references between predictions from intermediate states of trajectories (green line) and predictions from noised data points (blue and orange lines) closes with increasing model size. All plots show fully trained models. First column: EDM2-XS. Second column: EDM2-XL.
Yardi School of Artificial Intelligence, Indian Institute of Technology Delhi · Department of Computer Science and Engineering, Indian Institute of Technology Delhi · Jawaharlal Nehru Centre for Advanced Scientific Research +2
School of Computing & Data Science, The University of Hong Kong. · School of Computing & Data Science and Institute of Data Science, The University of Hong Kong.