mlgenerate.comVisual Generative ML
All Models/image/DDPM Diffusion

Denoising Diffusion Probabilistic Models (DDPM)

Diffusion2020 · UC Berkeley (Ho et al.)

Iterative Gaussian score denoising reversing a Markov corruption chain

Execution Paradigm:Iterative Reverse Denoising Sampling (O(K) Forward Passes)
Iterative Denoising Sequence (Full Canvas Parallel per Step)
Interactive Stage (INFERENCE)Canvas is 100% random Gaussian white noise.
DDPM Reverse Denoising SamplingNoise Factor: 100%

Starting from random Gaussian white noise, the neural network predicts and subtracts the noise component over iterative steps.

Simulated 8×8 Latent Patch (x_t)
Signal √ᾱ_t: 0%Noise √(1 - ᾱ_t): 100%
State Equation & Score Function
x_{t-1} = μ_θ(x_t, t) + σ_t · z
Loss: L_simple = ||ε - ε_θ(x_t, t)||^2
Forward Pass:O(K) Iterative Steps
Network Architecture:U-Net or Diffusion Transformer (DiT)
Step 1 of 3

1. Sample Pure Gaussian White Noise x_T

Draw initial state x_T ~ 𝒩(0, I) from standard normal distribution. At this point, the canvas contains zero discernible structural signal.

💡 Takeaway: The generator begins completely unconstrained in the high-dimensional noise space.

Active Tensor Dimensions & Memory Shapes

x_T[B, C, H, W]
Initial white noise canvas
sample_ddpm_reverse.py
1
def sample_ddpm(model, shape, T):
2
x = torch.randn(shape) # x_T pure Gaussian white noise
3
for t in reversed(range(1, T + 1)):
4
t_tensor = torch.full((shape[0],), t, dtype=torch.long)
5
eps_pred = model(x, t_tensor)
6
z = torch.randn_like(x) if t > 1 else 0
7
x = compute_x_prev(x, eps_pred, t, z) # Denoise 1 step
8
return x # x_0 clean image
Click code line to jump to corresponding stepPyTorch Reference
Why This Architecture Matters

Overcame the training instability and mode collapse of GANs, serving as the foundational mathematical engine behind Stable Diffusion, Midjourney, and DALL-E 2/3.

Runtime Complexity & Bottlenecks

Training Objective:Simplified L_simple MSE Loss: 𝔼_{t, x_0, ε}[ ||ε - ε_θ(x_t, t)||^2 ]

Inference Bottleneck:O(K) full-image U-Net forward passes (typically 20–1000 steps)