Diffusion Models: A Frontier-Lab Interview Deep Dive

Why this exists. Diffusion is the dominant paradigm for image, video, and 3D generation, and it's increasingly applied beyond. Interviewers probe: forward/reverse processes, why we predict noise, classifier-free guidance, latent vs pixel-space diffusion, flow matching. This document covers the math without the dense Bayesian notation.


1. The big picture

A diffusion model has two processes:

Forward (fixed): progressively add noise to data over steps, transforming (data) into (pure Gaussian noise).

Reverse (learned): progressively denoise, starting from (pure noise) and producing (data sample).

The model learns the reverse process. At sampling time, run the reverse process with a fresh random Gaussian; you get a fresh sample from the learned data distribution.

Why this works: the forward process has a simple form (add Gaussian noise; tractable mathematically). The reverse process — which is what generates data — can be learned by training the model to undo each forward step.


2. The forward process

At each step, mix with Gaussian noise of variance . Iterate steps. follows a schedule (linear, cosine, etc.) — typically small early, larger later.

Closed form

A key property: you can sample directly from without iterating:

where and . So:

This direct sampling is critical: during training, you don't need to iterate the forward process — you sample a random and a random and compute directly.

Variance schedule

Linear: linearly interpolated from to over steps. Original DDPM choice.

Cosine (Nichol & Dhariwal 2021): . Smoother decay; better for high-resolution images.

Variance-preserving (VP) vs variance-exploding (VE): different parameterizations of the diffusion process. VP keeps near 1; VE lets it grow. VP (DDPM-style) is the more common choice.


3. The reverse process

We want to learn . The true posterior is also Gaussian (Bayes on the forward Markov chain), with mean derivable in terms of and . The training trick: parameterize the model to predict either , (the noise), or the score (gradient of log-density).

Predicting noise (the standard choice)

DDPM (Ho et al. 2020) parameterizes the reverse mean as:

where is the model's prediction of the noise that was added to get to .

The training loss simplifies dramatically:

MSE between predicted and actual noise. That's the entire training objective.

Why predict noise specifically?

Mathematically equivalent options:

  • Predict directly.
  • Predict .
  • Predict the score (Tweedie's formula).

Empirically, predicting works best because:

  • The target has constant scale (normalized).
  • Loss is well-conditioned across all timesteps.
  • Easier to train than prediction (which needs to span full data range).

Score matching connection

Predicting is equivalent to predicting the score (gradient of log density):

So diffusion models are score-based generative models — they learn to follow gradients of log-density. This is the Song & Ermon line of work; DDPM (Ho et al.) and score-matching (Song & Ermon) are equivalent up to parameterization.


4. Sampling

Once trained, sample from by running the reverse process:

  1. Start with .
  2. For from down to :
    • Predict noise: .
    • Compute mean: .
    • Add Gaussian noise: .
  3. Return .

For , this is 1000 model forward passes per sample. Slow.

DDIM: deterministic sampling with fewer steps

DDIM (Song et al. 2021) reformulates the reverse process to be deterministic and to allow skipping steps:

Same model, different sampling. With DDIM you can sample in 50–100 steps with quality comparable to 1000-step DDPM. Standard for production diffusion.

Even faster sampling

  • DPM-Solver, DPM-Solver++ (Lu et al.): ODE/SDE solvers that exploit the structure of the diffusion ODE. ~20 steps with strong quality.
  • Consistency Models (Song et al. 2023): distill diffusion into a model that goes from noise to data in 1–2 steps. Sacrifices some quality for speed.
  • Rectified Flow / Flow Matching: learn a straighter trajectory; sample in fewer steps.

The active research direction is reducing sampling steps from 1000 to 1–4 while preserving quality.


5. The ELBO and the loss derivation

For interview-grade understanding (often asked):

The ELBO for diffusion models:

After algebra (dropping irrelevant constants), each KL term reduces to:

DDPM uses the simplified loss (drop the prefactor):

Empirically, the simplified loss works better than the weighted ELBO. The prefactor would over-weight some timesteps.


6. Classifier-free guidance (CFG)

A critical technique for conditional generation (text-to-image, etc.).

Setup

The model is trained jointly:

  • Conditional: where is the conditioning (e.g., text embedding).
  • Unconditional: — replace with a null embedding 10–20% of the time during training.

At sampling

Combine the two predictions:

is the guidance scale (typically 1.5–7.5). means no guidance (just use conditional). amplifies the conditional signal.

Why this works

The difference is a direction that "points toward the condition" in score space. Amplifying it pushes the sample more strongly toward the condition.

Trade-offs

  • High : stronger adherence to condition, but may produce overexposed / oversaturated images. Sample diversity drops.
  • Low : more diverse samples, weaker adherence to condition.
  • Stable Diffusion typically uses .

CFG is ubiquitous in text-to-image. Almost every paper since 2022 uses it.

Classifier guidance (older)

The original conditioning method (Dhariwal & Nichol 2021): use a separate classifier's gradient to push samples toward the condition. Replaced by CFG which doesn't need a separate classifier.


7. Latent diffusion (Stable Diffusion)

The problem

Pixel-space diffusion is expensive. A 512×512 RGB image has 786K pixels. Forward/reverse passes through a UNet on this is slow.

The fix

Latent diffusion (Rombach et al. 2022, Stable Diffusion):

  1. Encode image to a smaller latent via a pretrained autoencoder (4–8x downsampling).
  2. Run diffusion in the latent space (much smaller, faster).
  3. Decode back to pixels at the end.

Why it works

  • Most "perceptual" content (textures, semantics) is captured in the latent.
  • Diffusion in latent space is 4–8x cheaper.
  • Final image quality limited by the VAE's reconstruction quality, but in practice this is fine.

Stable Diffusion family

SD 1.x, SD 2.x, SDXL, SD 3 — all latent diffusion. Differences: VAE quality, UNet vs Transformer (DiT), training data, conditioning model (CLIP vs T5), schedules.


8. Architecture: UNet vs DiT

UNet (DDPM, Stable Diffusion 1.x/2.x)

Convolutional U-shape with skip connections. Down-sampling encoder + up-sampling decoder. Cross-attention layers for conditioning. Standard for diffusion until ~2023.

DiT (Diffusion Transformer, Peebles & Xie 2022)

Replace the UNet with a transformer over image patches. Same idea as ViT. Better scaling properties; SD 3, FLUX use DiT.

Why DiT wins at scale

Transformers scale predictably with parameters and data. Convolutional UNets have hand-crafted inductive biases that limit scalability. As diffusion models grow, DiT-style architectures dominate.


9. Flow Matching and Rectified Flow (recent)

A reformulation of diffusion that's becoming dominant:

Learn a velocity field that transforms noise → data along a continuous path.

Key ideas:

  • Straighter paths: flow matching produces ODEs with straighter trajectories than diffusion. Fewer sampling steps for equivalent quality.
  • Simpler training: the loss is similar to noise prediction but conceptually cleaner.
  • Same model in practice: the trained network is equivalent to a diffusion network, but the training objective and sampling are different.

Used in Stable Diffusion 3, FLUX, recent video models. Likely to replace pure diffusion as the dominant paradigm.


10. Conditioning

Diffusion models are conditioned in many ways:

Text (CLIP / T5)

Embed text prompt with CLIP or T5; inject into UNet/DiT via cross-attention. Modern models often use multiple text encoders combined.

Image (image conditioning)

For image-to-image, inpainting, super-resolution: concatenate noisy latent with condition image latent at every step.

ControlNet

Add an auxiliary network that processes structural conditions (depth, segmentation, edges) and injects them via additional cross-attention. Lightweight; widely used for spatial control.

LoRA / DreamBooth

Fine-tune diffusion models on small datasets to add new concepts (a person, a style). LoRA-style updates dominate for personalization.


11. Diffusion in NLP

Mostly research-stage. Pure diffusion for text is hard because:

  • Text is discrete; diffusion is naturally continuous.
  • Workarounds: diffuse in embedding space, or use special discrete diffusion processes.

Recent: SEDD (Score Entropy Discrete Diffusion), Diffusion-LM. Promising but not at frontier-LLM scale yet.

For text generation, autoregressive models still dominate.


12. Common interview gotchas

GotchaStrong answer
"Why predict noise instead of ?"MSE loss is well-conditioned across timesteps. targets have constant scale; targets span full data range.
"Is diffusion training computationally expensive?"Each step: one forward pass on a noisy image. Many steps over time but each is parallelizable. Comparable to other generative models.
"Why is sampling slow?"Need many denoising steps (1000 for DDPM, 50–100 for DDIM). Recent: consistency models can do it in 1–4 steps.
"What's CFG?"Combine conditional and unconditional predictions during sampling; amplify the conditional direction. Standard for text-to-image.
"Why latent diffusion?"Diffuse in compressed latent space (via VAE encoder), much cheaper than pixel space. Stable Diffusion innovation.
"DiT vs UNet?"DiT (transformer) scales better than UNet (conv). Modern flagship models use DiT.
"What's flow matching?"Reformulation with straighter trajectories; fewer sampling steps. Used in SD3, FLUX. Likely to replace pure diffusion.
"Diffusion vs GANs?"Diffusion: stable training, no mode collapse, slower sampling. GANs: fast sampling, harder training, mode collapse. Diffusion has won.
"Is diffusion an MLE?"Approximately, via the ELBO. Simplified loss is not exactly MLE but works better empirically.

13. The 10 most-asked diffusion interview questions

  1. What's the forward process? Add Gaussian noise over steps. Closed-form: .
  2. What's the reverse process? Learned denoising. Predict noise and use it to compute for .
  3. Why predict noise not data? Better-conditioned loss; constant scale across timesteps.
  4. What's DDIM? Deterministic sampler that allows fewer steps (50–100 vs 1000). Same trained model.
  5. What's classifier-free guidance? Train conditional + unconditional jointly; combine at sampling: . Standard for text-to-image.
  6. Why latent diffusion? Diffuse in compressed latent space; 4–8x cheaper than pixel space.
  7. DiT vs UNet? DiT (transformer) scales better; modern flagship models use it.
  8. What's flow matching? Reformulation with straighter paths; fewer sampling steps. Likely future of diffusion.
  9. What's the ELBO for diffusion? Sum of KL terms across timesteps. Simplified MSE loss works better empirically.
  10. Connection between score matching and diffusion? Equivalent. Predicting predicting . Diffusion models are score-based generative models.

14. Drill plan

  1. Memorize the closed-form .
  2. Memorize the simplified DDPM loss: MSE on noise prediction.
  3. Know CFG: train cond+uncond, combine at sampling.
  4. Know latent diffusion's role (Stable Diffusion).
  5. Know DiT and flow matching as the modern direction.
  6. Drill INTERVIEW_GRILL.md.

15. Further reading

  • Sohl-Dickstein et al., "Deep Unsupervised Learning using Nonequilibrium Thermodynamics" (2015) — original diffusion idea.
  • Ho, Jain, Abbeel, "Denoising Diffusion Probabilistic Models" (DDPM, 2020).
  • Song & Ermon, "Generative Modeling by Estimating Gradients of the Data Distribution" (score-based, 2019).
  • Song et al., "Denoising Diffusion Implicit Models" (DDIM, 2021).
  • Dhariwal & Nichol, "Diffusion Models Beat GANs on Image Synthesis" (classifier guidance, 2021).
  • Ho & Salimans, "Classifier-Free Diffusion Guidance" (2022).
  • Rombach et al., "High-Resolution Image Synthesis with Latent Diffusion Models" (Stable Diffusion, 2022).
  • Peebles & Xie, "Scalable Diffusion Models with Transformers" (DiT, 2023).
  • Lipman et al., "Flow Matching for Generative Modeling" (2023).
  • Liu et al., "Rectified Flow" (2022).