Course contents

Generative Models / Diffusion Models

Diffusion Models

Forward noising, reverse denoising and the learning objective behind diffusion models.

Prerequisites

Probability · Gaussian distributions · Neural networks

Diffusion models define an easy forward process that gradually corrupts data and learn a reverse process that reconstructs samples from noise.

Forward process

With a variance schedule βt\beta_t and αt=1−βt\alpha_t=1-\beta_t, the Markov transition is

q(xt∣xt−1)=N(αtxt−1, βtI).q(x_t\mid x_{t-1}) = \mathcal{N}(\sqrt{\alpha_t}x_{t-1},\,\beta_t I).

The useful closed form is

xt=αˉtx0+1−αˉt ϵ,ϵ∼N(0,I),x_t = \sqrt{\bar\alpha_t}x_0 + \sqrt{1-\bar\alpha_t}\,\epsilon, \qquad \epsilon \sim \mathcal{N}(0,I),

where αˉt=∏s=1tαs\bar\alpha_t=\prod_{s=1}^{t}\alpha_s. It lets us sample any noisy level directly without simulating every earlier step.

Learning to denoise

A common objective trains a network ϵθ(xt,t)\epsilon_\theta(x_t,t) to predict the injected noise:

Lsimple=Ex0,t,ϵ[∥ϵ−ϵθ(xt,t)∥22].\mathcal{L}_{\mathrm{simple}} = \mathbb{E}_{x_0,t,\epsilon} \left[\lVert \epsilon - \epsilon_\theta(x_t,t) \rVert_2^2\right].

At generation time, repeated reverse updates transform Gaussian noise into a sample. Faster samplers reduce the number of evaluations by changing the numerical path while retaining the learned field.

Evaluation is multi-dimensional

No single metric fully describes a generative model. Fidelity, diversity, prompt adherence, memorization, failure severity and human preference answer different questions. Hallucination analysis should therefore make its definition of “error” explicit before choosing a statistic.