Equations · Ho, Jain and Abbeel, “Denoising Diffusion Probabilistic Models” (2020), building on Sohl-Dickstein et al. (2015)
The diffusion forward (noising) process, explained
A diffusion model is trained to undo a fixed noising process. This is that process: over steps (1000 in DDPM), a data point is shrunk slightly and has a little Gaussian noise added, until it is pure noise. The second formula jumps straight to any step in one draw.
Term by term
The clean data (say, an image) and its noised version after steps. The subscript is the step number.
The distribution of the next noisier version given the current one. names the fixed forward process; is used for the learned reverse one.
A Gaussian density in , with the mean and covariance after the semicolon.
The noise variance added at step : the noise schedule. DDPM raises it linearly from to .
The previous step, shrunk slightly, so the total variance stays near 1 instead of growing.
Covariance times the identity: independent noise of the same size in every pixel.
The product of all the shrink factors so far (the paper writes ). It falls from near 1 to near 0 as goes to : the fraction of signal variance left.
Bar (mean) · Alpha · Product
A small worked example
If , then with . A pixel with value and drawn noise becomes .
In code
import numpy as np
betas = np.linspace(1e-4, 0.02, 1000) # DDPM's linear schedule
alpha_bar = np.cumprod(1 - betas)
def q_sample(x0, t, rng):
eps = rng.standard_normal(x0.shape)
return np.sqrt(alpha_bar[t]) * x0 + np.sqrt(1 - alpha_bar[t]) * eps, epsEvery symbol in it
Other equations
- Scaled dot-product attention
- Softmax
- Cross-entropy loss
- Adam update
- Layer normalization
- RMSNorm
- The ELBO
- KL divergence
- Backpropagation through one layer
- LoRA
- GELU
- Dropout
- Batch normalization
- Rotary position embedding (RoPE)
- Multi-head attention
- PPO clipped objective
- DPO loss
- Policy gradient (REINFORCE)
- Bellman equation
- Q-learning update
- InfoNCE contrastive loss
- DDPM simplified loss
- VAE reparameterization trick
- GAN minimax objective
- AdamW
- Cosine learning-rate schedule
- Perplexity
- Logistic regression
- Normal equation (linear regression)
- Singular value decomposition (SVD)
- Principal component analysis (PCA)