Back to Multimodal Mind Map
中文·English
👁️ MultimodalID: latent-diffusion

Latent Diffusion (LDM)

潜空间扩散 (LDM)
🎯Core Definition
Latent Diffusion Models (LDM) run the DDPM process in a VAE latent space instead of pixel space, then decode back. An image xRH×W×3x \in \mathbb{R}^{H \times W \times 3} is compressed by the VAE encoder into zRh×w×cz \in \mathbb{R}^{h \times w \times c}; Stable Diffusion uses 8×8\times spatial downsampling: a 512×512512\times 512 image becomes a 64×64×464\times 64\times 4 latent (c=4c=4). Denoising happens entirely on zz:
📌Overview
zt=αˉtz0+1αˉtϵ,L=E[ϵϵθ(zt,t,c)2]z_t = \sqrt{\bar\alpha_t}\,z_0 + \sqrt{1-\bar\alpha_t}\,\epsilon,\qquad \mathcal{L} = \mathbb{E}\left[\Vert \epsilon - \epsilon_\theta(z_t, t, c)\Vert^2\right]
📌Overview
The condition cc (e.g. CLIP text embeddings) is injected into the U-Net/DiT middle layers via cross-attention; after sampling, z0z_0 is mapped back by VAEdec\mathrm{VAE}_{dec}. The full training loss combines three terms: latent diffusion reconstruction + perceptual loss (LPIPS) + adversarial/GAN loss, with mild KL regularization, balancing pixel fidelity and perceptual quality. Architecture evolution: SD1/2 use U-Net (self-attention + cross-attention + timestep embedding); SD3/Flux use MMDiT (a mixed text-image DiT with patchify and AdaLN-zero for timestep/text conditioning).
💡Use Cases
the backbone of the Stable Diffusion family and most text-to-image/text-to-video models; interview favorites — “why diffuse in latent space instead of pixel space?” and “how much compute does 8× downsampling save?”.
Key Problems Solved
pixel-space diffusion is computationally intractable above 256×256256\times256 — attention and feature maps grow quadratically with resolution; the 8×8\times spatial reduction cuts feature-map area to 1/641/64, lowering training/sampling compute by roughly two orders of magnitude, while the decoder restores visual detail, the encoder absorbs semantic compression, and conditions (text, ControlNet) plug into the latent space uniformly.
🎯5 High-Frequency Exam Points
1
Why does Stable Diffusion diffuse in VAE latent space instead of pixel space; how much compute does 8× downsampling save?
2
Which terms make up the LDM training loss, and why add perceptual and adversarial losses?
3
How is text conditioning injected into the latent diffusion network; where does cross-attention sit in U-Net/DiT?
4
Key structural differences between SD1/2 U-Net and SD3/Flux MMDiT?
5
Tradeoffs of latent vs pixel-space diffusion in training speed, memory and image quality?
📖 In-depth Guide:📄 diffusion-models
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Latent Diffusion (LDM)"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardClassifier-Free GuidanceNext CardSampler Acceleration (DDIM/DPM-Solver/LCM)

🔗 More Multimodal Knowledge Cards

ASR (Whisper)Audio RepresentationCLIP ApplicationsCLIP Two-Tower Architecture