Interview Preparation
Diffusion · Flow Matching · SDE Score
Brief notes prepared for technical interviews
DDPM / DDIMClassifier-Free GuidanceFlow Matching / Rectified FlowSDE Score ModelsDiffusion Transformer
← Back to Archives

These notes cover the modern continuous-time generative-modeling family — denoising diffusion, the score-based SDE viewpoint, classifier-free guidance, and the flow-matching reformulation that unifies them. The handwritten pages at the end derive the SDE / score-model / sampler / solver mechanics in detail.

Denoising Diffusion

Diffusion intro

DDPM (Denoising Diffusion Probabilistic Models)

DDPM

\[q(x_t \mid x_0) = \mathcal{N}(x_t; \sqrt{\bar{\alpha}_t}\, x_0, \, (1 - \bar{\alpha}_t) I)\] \[q(x_{t-1} \mid x_t, x_0) \approx p_\theta(x_{t-1} \mid x_t)\]

DDIM (Denoising Diffusion Implicit Models)

DDIM (page 50 portion)

DDIM (page 51 portion)

Classifier-Free Guidance (CFG)

Classifier-Free Guidance

How it works

Score Function

Score Function

\[s(x) = \nabla_x \log p(x)\]

Tweedie’s Formula

Tweedie's Formula — posterior mean estimation (page 52 top)

Flow Matching

Flow Matching intro

Normalizing Flow

Normalizing Flow (handwritten)

Continuous Normalizing Flow (CNF)

Continuous Normalizing Flow (handwritten)

Flow Matching Objective

Flow Matching objective (handwritten)

\[\mathcal{L}_{\text{FM}} = \mathbb{E}_{t, x \sim p_t} \| v_\theta(x, t) - u_t(x) \|^2\]

Conditional Flow Matching (CFM)

Conditional Flow Matching (handwritten)

Rectified Flow

Rectified Flow (handwritten)

Diffusion Transformer (DiT)

Diffusion Transformer (handwritten)

SDE-based Score Model

SDE-based Score Model (handwritten)

Forward process

\[dx = f(x, t)\, dt + g(t)\, dW_t, \quad dW_t \sim \mathcal{N}(0, \Sigma)\]

Reverse-time SDE

\[dx = \left[ f(x, t) - g(t)^2 s_\theta(x, t) \right] dt + g(t)\, d\bar{W}_t\]

Probability Flow ODE

\[\frac{dx}{dt} = f(x, t) - \frac{1}{2} g(t)^2 s_\theta(x, t)\]

VP-SDE (Variance Preserving)

VE-SDE (Variance Exploding)

Prediction Targets

Prediction Targets & Noise Scheduler (handwritten)

\[x_t = \sqrt{\bar{\alpha}_t}\, x_0 + \sqrt{1 - \bar{\alpha}_t}\, \epsilon, \quad \epsilon \sim \mathcal{N}(0, I)\]

Noise Scheduler

Noise Scheduler (handwritten — SNR / cosine schedule)

Sampler & Solver

Sampler

Sampler (handwritten)

Solver

Solver (handwritten — Euler, Euler-Maruyama, higher-order, PLMS, DPM-Solver)

1st-order solvers (Euler family)

Higher-order solvers

Practical notes

ADM, Diffusion Likelihood & Efficient DiT

ADM (Diffusion Models Beat GANs)

ADM (Diffusion Models Beat GANs)

Diffusion Likelihood

Diffusion Likelihood (handwritten)

Efficient DiT — Flash Attention & KV Cache

Flash Attention / KV Cache (handwritten)

Flash Attention

KV Cache