Transformers Learn the Optimal DDPM Denoiser for Multi-Token GMMs
Organizations: Department of Electrical and Systems Engineering, University of Pennsylvania, Philadelphia, USA · Institute of Natural Sciences & School of Mathematical Sciences, Shanghai Jiao Tong University, Shanghai, China
Abstract
Transformer-based diffusion models have demonstrated remarkable performance at generating high-quality samples. However, our theoretical understanding of the reasons for this success remains limited. For instance, existing models are typically trained by minimizing a denoising objective, which is equivalent to fitting the score function of the training data. However, we do not know why transformer-based models can match the score function for denoising, or why gradient-based methods converge to the optimal denoising model despite the non-convex loss landscape. To the best of our knowledge, this paper provides the first convergence analysis for training transformer-based diffusion models. More specifically, we consider the population Denoising Diffusion Probabilistic Model (DDPM) objective for denoising data that follow a multi-token Gaussian mixture distribution. We theoretically quantify the required number of tokens per data point and training iterations for the global convergence towards the Bayes optimal risk of the denoising objective, thereby achieving a desired score matching error. A deeper investigation reveals that the self-attention module of the trained transformer implements a mean denoising mechanism that enables the trained model to approximate the oracle Minimum Mean Squared Error (MMSE) estimator of the injected noise in the diffusion steps. Numerical experiments validate these findings.
Figures & tables
| Theoretical Works | Network Model | Loss Landscape | Convergence Analysis | Denoising Mechanism |
| Wang et al. (2024a) | U-Net | Global optimum | ✗ | PCA |
| Han et al. (2024) | Fully-connected | N/A | ✓ | N/A |
| Wang et al. (2024b) | Fully-connected | N/A | ✓ | N/A |
| Han et al. (2025) | Convolutional | Stationary point | ✗ | Balanced FL |
| Ours | Transformer | Global optimum | ✓ | Mean denoising |
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Notations | Annotation |
| , | is the dimension of each token of data. is the total number of tokens in each data. |
| , | is the total number of mean patterns. is the number of distinct patterns in each data. |
| , , | is the fraction vector of all the Gaussian components of the MTGM distribution. is the set of all the mean patterns. is the variance of the Gaussian components. |
| , , | denotes the data. ad are the latent variable to define the distribution of . |
| , , , | is the set of parameters in the learning model. In our work, contains and , where is the self-attention parameter, and is the coefficient parameter. is the total number of diffusion time steps. |
| , , , | is the noisy input at time step . is the clean input before adding the noise. is the noise schedule coefficients. is the additive Gaussian noise. |
Diffusion Models
Diffusion models learn to reverse gradual data corruption, enabling flexible generation, editing, forecasting, and inference.
See all 1,136 papers