We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Generative Models step 5 of 11
DDPM Noise Schedule
Implement the linear beta schedule used in Denoising Diffusion Probabilistic Models (DDPM).
Background
Diffusion models learn to reverse a gradual noising process. The forward process
adds Gaussian noise in small steps controlled by a noise schedule — a sequence
of variance values beta_1, ..., beta_T.
The linear schedule (Ho et al. 2020) spaces these values evenly:
betas = linspace(beta_start, beta_end, T)
From the betas we derive alpha_bar, the cumulative signal-preservation factor:
alpha_bar[t] = prod(1 - betas[0:t+1])
alpha_bar[t] tells you how much of the original signal remains after t steps of
noising. At t=0 it is close to 1 (little noise added); by t=T-1 it is small
(mostly noise).
Algorithm
betas = linspace(beta_start, beta_end, num_steps)
alphas = 1 - betas
alpha_bar = cumprod(alphas) # cumulative product along T
return stack([betas, alpha_bar], dim=0) # shape (2, T)
Reference
Ho et al., “Denoising Diffusion Probabilistic Models” (2020).
Inputs / Output
-
num_steps: intT— number of diffusion timesteps (e.g., 1000). -
beta_start: float — starting variance (default1e-4). -
beta_end: float — ending variance (default0.02).
Output: shape (2, T) tensor — row 0 is betas, row 1 is alpha_bar.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.