ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing
ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing

All Courses

Advanced Synthetic Data Generation: GANs and Diffusion Models
Chapter 1: Foundations of Generative Modeling Revisited
Probabilistic Modeling for Generation
Taxonomy of Generative Models
Challenges in High-Dimensional Data Synthesis
GAN Fundamentals
Introduction to Diffusion Model Concepts
Chapter 2: Advanced GAN Architectures and Techniques
Progressive Growing of GANs (ProGAN)
Style-Based Generators (StyleGAN variants)
Unpaired Image-to-Image Translation (CycleGAN)
Conditional GANs: Architectures and Control
Attention Mechanisms in GANs
Analyzing and Manipulating GAN Latent Spaces
Hands-on Practical: Implementing StyleGAN Components
Chapter 3: GAN Training Stability and Optimization
Diagnosing Training Instability: Oscillations and Divergence
Mode Collapse: Causes and Mitigation Strategies
Alternative Loss Functions (WGAN, WGAN-GP, LSGAN)
Regularization Techniques for GANs
Two Time-Scale Update Rule (TTUR)
Hyperparameter Tuning Strategies for GANs
Hands-on Practical: Implementing WGAN-GP
Chapter 4: Diffusion Models: Theory and Advanced Implementation
Mathematical Foundations: Stochastic Differential Equations
Denoising Diffusion Probabilistic Models (DDPM)
Score-Based Generative Modeling
Improved Techniques: DDIM and Variance Schedules
Classifier Guidance and Classifier-Free Guidance
Architectural Considerations for Diffusion Models (U-Net)
Hands-on Practical: Implementing a Basic DDPM
Chapter 5: Evaluating Synthetic Data Quality
Challenges in Generative Model Evaluation
Quantitative Metrics: IS, FID, Precision, Recall
Distributional Metrics: Kernel Inception Distance (KID)
Perceptual Path Length (PPL) for GANs
Qualitative Evaluation Methods
Evaluating Conditional Generation Models
Hands-on Practical: Calculating FID Scores
Chapter 6: Advanced Applications and Integration
High-Resolution Synthesis Strategies
Text-to-Image Synthesis Architectures
Synthetic Data for Augmentation and Privacy
Video Generation with Generative Models
Combining GANs and Diffusion Models
Computational Considerations and Scaling
Hands-on Practical: Conditional Image Generation

Denoising Diffusion Probabilistic Models (DDPM)

Denoising Diffusion Probabilistic Models (DDPMs) represent a prominent and highly effective framework within the broader family of diffusion models. Introduced by Ho et al. (2020), DDPMs utilize a fixed, multi-step forward process that gradually adds Gaussian noise to data, paired with a learned reverse process that iteratively removes the noise to generate new data samples.

The Forward Process: Adding Noise

The forward process, also known as the diffusion process, is defined as a Markov chain that progressively corrupts an initial data point x0∼q(x0)\mathbf{x}_0 \sim q(\mathbf{x}_0)x0​∼q(x0​) by adding small amounts of Gaussian noise over TTT discrete timesteps. The noise level at each step ttt is controlled by a predefined variance schedule {βt}t=1T\{\beta_t\}_{t=1}^T{βt​}t=1T​, where 0<β1<β2<...<βT<10 < \beta_1 < \beta_2 < ... < \beta_T < 10<β1​<β2​<...<βT​<1. Typically, TTT is large (e.g., T=1000T=1000T=1000), and the βt\beta_tβt​ values are small, ensuring that the change at each step is subtle.

The distribution of the noisy sample xt\mathbf{x}_txt​ given the previous sample xt−1\mathbf{x}_{t-1}xt−1​ is a Gaussian:

q(xt∣xt−1)=N(xt;1−βtxt−1,βtI)q(\mathbf{x}_t | \mathbf{x}_{t-1}) = \mathcal{N}(\mathbf{x}_t; \sqrt{1-\beta_t} \mathbf{x}_{t-1}, \beta_t \mathbf{I})q(xt​∣xt−1​)=N(xt​;1−βt​​xt−1​,βt​I)

Here, N(x;μ,σ2I)\mathcal{N}(\mathbf{x}; \boldsymbol{\mu}, \sigma^2\mathbf{I})N(x;μ,σ2I) denotes a Gaussian distribution over variable x\mathbf{x}x with mean μ\boldsymbol{\mu}μ and diagonal covariance σ2I\sigma^2\mathbf{I}σ2I.

A significant property of this process is that we can sample xt\mathbf{x}_txt​ directly from the original data x0\mathbf{x}_0x0​ in a closed form, avoiding the need to iterate through all intermediate steps. Let αt=1−βt\alpha_t = 1 - \beta_tαt​=1−βt​ and αˉt=∏i=1tαi\bar{\alpha}_t = \prod_{i=1}^t \alpha_iαˉt​=∏i=1t​αi​. Then, the distribution of xt\mathbf{x}_txt​ conditioned on x0\mathbf{x}_0x0​ is also Gaussian:

q(xt∣x0)=N(xt;αˉtx0,(1−αˉt)I)q(\mathbf{x}_t | \mathbf{x}_0) = \mathcal{N}(\mathbf{x}_t; \sqrt{\bar{\alpha}_t} \mathbf{x}_0, (1-\bar{\alpha}_t) \mathbf{I})q(xt​∣x0​)=N(xt​;αˉt​​x0​,(1−αˉt​)I)

This equation can be interpreted as scaling the original image x0\mathbf{x}_0x0​ by αˉt\sqrt{\bar{\alpha}_t}αˉt​​ and adding Gaussian noise ϵ∼N(0,I)\boldsymbol{\epsilon} \sim \mathcal{N}(0, \mathbf{I})ϵ∼N(0,I) scaled by 1−αˉt\sqrt{1-\bar{\alpha}_t}1−αˉt​​:

xt=αˉtx0+1−αˉtϵ\mathbf{x}_t = \sqrt{\bar{\alpha}_t}\mathbf{x}_0 + \sqrt{1-\bar{\alpha}_t}\boldsymbol{\epsilon}xt​=αˉt​​x0​+1−αˉt​​ϵ

As ttt approaches TTT, αˉt\bar{\alpha}_tαˉt​ approaches 0 (since 0<αt<10 < \alpha_t < 10<αt​<1). Consequently, xT\mathbf{x}_TxT​ becomes almost entirely independent of x0\mathbf{x}_0x0​ and resembles an isotropic Gaussian distribution N(0,I)\mathcal{N}(0, \mathbf{I})N(0,I). The variance schedule βt\beta_tβt​ is often chosen to be linearly increasing, quadratically increasing, or based on a cosine schedule.

The Reverse Process: Learning to Denoise

The generative power of DDPMs comes from learning the reverse process: starting from pure noise xT∼N(0,I)\mathbf{x}_T \sim \mathcal{N}(0, \mathbf{I})xT​∼N(0,I) and gradually removing noise to obtain a realistic sample x0\mathbf{x}_0x0​. This involves learning the transition probabilities pθ(xt−1∣xt)p_\theta(\mathbf{x}_{t-1} | \mathbf{x}_t)pθ​(xt−1​∣xt​) for t=T,T−1,...,1t = T, T-1, ..., 1t=T,T−1,...,1.

If βt\beta_tβt​ is sufficiently small, the true reverse transition q(xt−1∣xt)q(\mathbf{x}_{t-1} | \mathbf{x}_t)q(xt−1​∣xt​) would also be approximately Gaussian. The challenge is that computing the true reverse transition q(xt−1∣xt)q(\mathbf{x}_{t-1} | \mathbf{x}_t)q(xt−1​∣xt​) requires marginalizing over all possible data points, which is intractable. However, the posterior q(xt−1∣xt,x0)q(\mathbf{x}_{t-1} | \mathbf{x}_t, \mathbf{x}_0)q(xt−1​∣xt​,x0​) is tractable and can be shown to be Gaussian:

q(xt−1∣xt,x0)=N(xt−1;μ~t(xt,x0),β~tI)q(\mathbf{x}_{t-1} | \mathbf{x}_t, \mathbf{x}_0) = \mathcal{N}(\mathbf{x}_{t-1}; \tilde{\boldsymbol{\mu}}_t(\mathbf{x}_t, \mathbf{x}_0), \tilde{\beta}_t \mathbf{I})q(xt−1​∣xt​,x0​)=N(xt−1​;μ~​t​(xt​,x0​),β~​t​I)

where

μ~t(xt,x0)=αˉt−1βt1−αˉtx0+αt(1−αˉt−1)1−αˉtxt\tilde{\boldsymbol{\mu}}_t(\mathbf{x}_t, \mathbf{x}_0) = \frac{\sqrt{\bar{\alpha}_{t-1}}\beta_t}{1-\bar{\alpha}_t} \mathbf{x}_0 + \frac{\sqrt{\alpha_t}(1-\bar{\alpha}_{t-1})}{1-\bar{\alpha}_t} \mathbf{x}_tμ~​t​(xt​,x0​)=1−αˉt​αˉt−1​​βt​​x0​+1−αˉt​αt​​(1−αˉt−1​)​xt​

and β~t=1−αˉt−11−αˉtβt\tilde{\beta}_t = \frac{1-\bar{\alpha}_{t-1}}{1-\bar{\alpha}_t} \beta_tβ~​t​=1−αˉt​1−αˉt−1​​βt​.

Since we don't have x0\mathbf{x}_0x0​ during the reverse sampling process (that's what we want to generate!), we approximate this distribution using a neural network. DDPM parameterizes the reverse transitions pθ(xt−1∣xt)p_\theta(\mathbf{x}_{t-1} | \mathbf{x}_t)pθ​(xt−1​∣xt​) as Gaussians:

pθ(xt−1∣xt)=N(xt−1;μθ(xt,t),Σθ(xt,t))p_\theta(\mathbf{x}_{t-1} | \mathbf{x}_t) = \mathcal{N}(\mathbf{x}_{t-1}; \boldsymbol{\mu}_\theta(\mathbf{x}_t, t), \boldsymbol{\Sigma}_\theta(\mathbf{x}_t, t))pθ​(xt−1​∣xt​)=N(xt−1​;μθ​(xt​,t),Σθ​(xt​,t))

The goal is to train the parameters θ\thetaθ such that this distribution closely matches the true (but unknown) q(xt−1∣xt)q(\mathbf{x}_{t-1} | \mathbf{x}_t)q(xt−1​∣xt​).

Network Parameterization and the Simplified Objective

In the original DDPM paper, the variance of the reverse process is fixed to untrained constants Σθ(xt,t)=σt2I\boldsymbol{\Sigma}_\theta(\mathbf{x}_t, t) = \sigma_t^2 \mathbf{I}Σθ​(xt​,t)=σt2​I. Two common choices are σt2=βt\sigma_t^2 = \beta_tσt2​=βt​ or σt2=β~t\sigma_t^2 = \tilde{\beta}_tσt2​=β~​t​. The neural network, therefore, only needs to predict the mean μθ(xt,t)\boldsymbol{\mu}_\theta(\mathbf{x}_t, t)μθ​(xt​,t).

Instead of directly predicting the mean μθ\boldsymbol{\mu}_\thetaμθ​, DDPMs reparameterize the network to predict the noise ϵ\boldsymbol{\epsilon}ϵ that was added at step ttt. Recall the forward process equation: xt=αˉtx0+1−αˉtϵ\mathbf{x}_t = \sqrt{\bar{\alpha}_t}\mathbf{x}_0 + \sqrt{1-\bar{\alpha}_t}\boldsymbol{\epsilon}xt​=αˉt​​x0​+1−αˉt​​ϵ. We can rearrange this to express x0\mathbf{x}_0x0​ in terms of xt\mathbf{x}_txt​ and ϵ\boldsymbol{\epsilon}ϵ:

x0=1αˉt(xt−1−αˉtϵ)\mathbf{x}_0 = \frac{1}{\sqrt{\bar{\alpha}_t}}(\mathbf{x}_t - \sqrt{1-\bar{\alpha}_t}\boldsymbol{\epsilon})x0​=αˉt​​1​(xt​−1−αˉt​​ϵ)

Substituting this expression for x0\mathbf{x}_0x0​ into the formula for the ideal mean μ~t(xt,x0)\tilde{\boldsymbol{\mu}}_t(\mathbf{x}_t, \mathbf{x}_0)μ~​t​(xt​,x0​) allows us to express the mean μθ\boldsymbol{\mu}_\thetaμθ​ in terms of the predicted noise ϵθ(xt,t)\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t)ϵθ​(xt​,t):

μθ(xt,t)=1αt(xt−βt1−αˉtϵθ(xt,t))\boldsymbol{\mu}_\theta(\mathbf{x}_t, t) = \frac{1}{\sqrt{\alpha_t}} \left( \mathbf{x}_t - \frac{\beta_t}{\sqrt{1-\bar{\alpha}_t}} \boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) \right)μθ​(xt​,t)=αt​​1​(xt​−1−αˉt​​βt​​ϵθ​(xt​,t))

This reparameterization leads to a connection between minimizing the difference between the predicted mean μθ\boldsymbol{\mu}_\thetaμθ​ and the true mean μ~t\tilde{\boldsymbol{\mu}}_tμ~​t​ and minimizing the difference between the predicted noise ϵθ\boldsymbol{\epsilon}_\thetaϵθ​ and the actual noise ϵ\boldsymbol{\epsilon}ϵ.

The authors found that training the model using a simplified objective function, derived from the variational lower bound (VLB) on the data log-likelihood, works very well in practice and is easier to implement. This simplified objective aims to minimize the mean squared error between the true noise ϵ\boldsymbol{\epsilon}ϵ added during the forward process and the noise predicted by the network ϵθ\boldsymbol{\epsilon}_\thetaϵθ​:

Lsimple(θ)=Et∼U(1,T),x0∼q(x0),ϵ∼N(0,I)[∥ϵ−ϵθ(xt,t)∥2]L_{simple}(\theta) = \mathbb{E}_{t \sim \mathcal{U}(1, T), \mathbf{x}_0 \sim q(\mathbf{x}_0), \boldsymbol{\epsilon} \sim \mathcal{N}(0, \mathbf{I})} \left[ \| \boldsymbol{\epsilon} - \boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) \|^2 \right]Lsimple​(θ)=Et∼U(1,T),x0​∼q(x0​),ϵ∼N(0,I)​[∥ϵ−ϵθ​(xt​,t)∥2]

where xt=αˉtx0+1−αˉtϵ\mathbf{x}_t = \sqrt{\bar{\alpha}_t}\mathbf{x}_0 + \sqrt{1-\bar{\alpha}_t}\boldsymbol{\epsilon}xt​=αˉt​​x0​+1−αˉt​​ϵ is the noisy sample generated using the original data x0\mathbf{x}_0x0​ and the sampled noise ϵ\boldsymbol{\epsilon}ϵ at a randomly chosen timestep ttt.

Essentially, the network ϵθ\boldsymbol{\epsilon}_\thetaϵθ​ takes a noisy sample xt\mathbf{x}_txt​ and the timestep ttt as input and tries to predict the noise component ϵ\boldsymbol{\epsilon}ϵ that was used to create xt\mathbf{x}_txt​ from x0\mathbf{x}_0x0​. Training with this objective effectively teaches the network to denoise samples at various noise levels.

Diagram illustrating the fixed forward (noising) process from data x0\mathbf{x}_0x0​ to noise xT\mathbf{x}_TxT​, and the learned reverse (denoising) process generating data x0\mathbf{x}_0x0​ from noise xT\mathbf{x}_TxT​ by predicting the noise ϵθ\boldsymbol{\epsilon}_\thetaϵθ​ at each step.

DDPM Training and Sampling Algorithms

Training:

  1. Sample a real data point x0∼q(x0)\mathbf{x}_0 \sim q(\mathbf{x}_0)x0​∼q(x0​).
  2. Sample a timestep ttt uniformly from {1,...,T}\{1, ..., T\}{1,...,T}.
  3. Sample noise ϵ∼N(0,I)\boldsymbol{\epsilon} \sim \mathcal{N}(0, \mathbf{I})ϵ∼N(0,I).
  4. Compute the noisy sample xt=αˉtx0+1−αˉtϵ\mathbf{x}_t = \sqrt{\bar{\alpha}_t}\mathbf{x}_0 + \sqrt{1-\bar{\alpha}_t}\boldsymbol{\epsilon}xt​=αˉt​​x0​+1−αˉt​​ϵ.
  5. Train the neural network ϵθ\boldsymbol{\epsilon}_\thetaϵθ​ by minimizing the loss ∥ϵ−ϵθ(xt,t)∥2\| \boldsymbol{\epsilon} - \boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) \|^2∥ϵ−ϵθ​(xt​,t)∥2 using gradient descent. Repeat this process over many iterations and data points.

Sampling (Generation):

  1. Start with pure noise xT∼N(0,I)\mathbf{x}_T \sim \mathcal{N}(0, \mathbf{I})xT​∼N(0,I).
  2. Iterate backwards from t=Tt=Tt=T down to 111: a. Sample z∼N(0,I)\mathbf{z} \sim \mathcal{N}(0, \mathbf{I})z∼N(0,I) if t>1t > 1t>1, otherwise z=0\mathbf{z} = 0z=0. b. Predict the noise ϵθ(xt,t)\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t)ϵθ​(xt​,t) using the trained network. c. Compute the denoised sample xt−1\mathbf{x}_{t-1}xt−1​ using the reverse transition formula which incorporates the predicted noise: xt−1=1αt(xt−βt1−αˉtϵθ(xt,t))+σtz \mathbf{x}_{t-1} = \frac{1}{\sqrt{\alpha_t}} \left( \mathbf{x}_t - \frac{\beta_t}{\sqrt{1-\bar{\alpha}_t}} \boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) \right) + \sigma_t \mathbf{z} xt−1​=αt​​1​(xt​−1−αˉt​​βt​​ϵθ​(xt​,t))+σt​z (where σt\sigma_tσt​ is the fixed standard deviation, e.g., βt\sqrt{\beta_t}βt​​ or β~t\sqrt{\tilde{\beta}_t}β~​t​​).
  3. The final result x0\mathbf{x}_0x0​ is the generated sample.

DDPMs provide a solid foundation for understanding modern diffusion-based generative modeling. Their ability to generate high-fidelity samples, particularly in image synthesis, stems from this carefully defined noising process and the learned denoising network trained via the intuitive noise-prediction objective. Subsequent sections will explore variations like score-based interpretations and techniques to improve sampling efficiency and control.

  • Deep Unsupervised Learning using Nonequilibrium Thermodynamics, Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, Surya Ganguli, 2015 Proceedings of the 32nd International Conference on Machine Learning (ICML), Vol. 37 DOI: 10.48550/arXiv.1503.03585 - This earlier work presented the theoretical foundation for diffusion probabilistic models, laying the groundwork for subsequent advancements like DDPMs.

© 2026 ApX Machine Learning