Why do latent diffusion? Walk me through the components of a Stable-Diffusion-style system.
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Because pixel-space diffusion wastes compute on imperceptible detail. A 512×512 RGB image is ~786k values, and the denoising network runs 20-50+ times per generation over all of them. Latent diffusion first trains a VAE that compresses the image ~8× per side into a 64×64×4 latent - ~48× fewer values - and runs the entire diffusion process in that latent space. The perceptual compression (VAE) and semantic generation (diffusion) are cleanly separated: the VAE handles "what makes textures look real," diffusion handles "what makes scenes make sense." That factorisation is what brought image generation from cluster-scale to consumer-GPU-scale, and it's the reason the original paper is titled around high-resolution synthesis.
Full worked answer with diagram
Because pixel-space diffusion wastes compute on imperceptible detail. A 512×512 RGB image is ~786k values, and the denoising network runs 20-50+ times per generation over all of them. Latent diffusion first trains a VAE that compresses the image ~8× per side into a 64×64×4 latent - ~48× fewer values - and runs the entire diffusion process in that latent space. The perceptual compression (VAE) and semantic generation (diffusion) are cleanly separated: the VAE handles "what makes textures look real," diffusion handles "what makes scenes make sense." That factorisation is what brought image generation from cluster-scale to consumer-GPU-scale, and it's the reason the original paper is titled around high-resolution synthesis.
Components of the full system:
- VAE encoder/decoder - image ↔ latent. Only the decoder runs at generation time (once, at the end).
- Denoising network - historically a U-Net with attention; modern systems (SD3, Flux) use a DiT (diffusion transformer), which scales better and follows the same scaling-law playbook as LLMs. Newer models also swap DDPM-style noise prediction for rectified flow / flow matching objectives - straighter denoising trajectories, fewer sampling steps.
- Text encoder(s) - CLIP text towers and/or T5; embeddings enter the denoiser via cross-attention. T5's inclusion is a big reason newer models render text in images and follow long prompts better.
- Sampler/scheduler - the numerical integrator that steps from noise to latent; choice trades step count against quality.
- Classifier-free guidance at sampling time to sharpen prompt adherence.
Going further: follow-up territory
Worth volunteering: the VAE is a quality ceiling - anything it can't reconstruct (historically: small faces, fine text) no amount of diffusion quality can recover, which is why later models upgraded to higher-channel latents (e.g. 16-channel in SD3-class models).
Worth sketching. Laying out the four components shows where the loop is and, more usefully, that the VAE decoder runs exactly once at the end.
flowchart LR
A["Prompt"] --> B["Text encoders<br/>CLIP and/or T5"]
C["Noise in a 64x64x4 latent"] --> D["Denoiser<br/>U-Net or DiT"]
B -->|"cross-attention"| D
D -->|"20-50 sampler steps<br/>all inside latent space"| E["Clean latent"]
E --> F["VAE decoder, runs once"]
F --> G["512x512 image"]
What a good answer covers
- Because pixel-space diffusion wastes compute on imperceptible detail
- A 512×512 RGB image is ~786k values, and the denoising network runs 20-50+ times per generation over all…
- Latent diffusion first trains a VAE that compresses the image ~8× per side into a 64×64×4 latent - ~48×…
- The perceptual compression (VAE) and semantic generation (diffusion) are cleanly separated
- VAE encoder/decoder - image ↔ latent
Key terms: Latent diffusion · VAE · VAE encoder/decoder · Denoising network · DiT · rectified flow / flow matching · Text encoder(s) · Sampler/scheduler · Classifier-free guidance
In the glossary: Diffusion · Latent diffusion · VAE · DiT · Flow matching · CLIP
Interviewer follow-ups to expect
Why 4 (or 16) latent channels rather than compressing harder?
What does moving from U-Net to DiT buy?
Where does ControlNet-style conditioning hook into this architecture?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep