Diffusion Model
Mô hình Khuếch tán (Diffusion Model)
A class of generative AI models that learn to create images (or audio/video) by reversing a process of adding noise to training data.
Diffusion models are the dominant architecture behind modern image generators like Midjourney, DALL-E 3, Stable Diffusion, and Adobe Firefly. They work by learning to reverse a "noising" process.
**How they work (intuitive)**
*Forward process*: Take a real image and gradually add Gaussian noise over many steps until it's pure random noise.
*Reverse process*: Train a neural network to predict and remove that noise, step by step, going from random noise back toward a clean image.
At inference time, you start from random noise and run the reverse process guided by your text prompt. The model iteratively denoises the image, and after 20–100 steps, a coherent image emerges.
**Text conditioning**
The text prompt is encoded (often via CLIP, a model trained on image-text pairs) and injected into each denoising step via cross-attention. The model learns which visual features correlate with which text concepts. This is why prompt phrasing dramatically affects output.
**Latent diffusion**
Stable Diffusion and most modern models operate in "latent space" — a compressed representation of images — rather than pixel space. This makes inference much faster and more memory-efficient. A decoder then maps the latent back to pixels.
**Compared to GANs**
Generative Adversarial Networks (GANs) — the prior dominant approach — were faster but prone to mode collapse and training instability. Diffusion models are slower (many denoising steps) but more stable to train and produce higher-quality, more diverse outputs.
**Pitfalls**
Inference is slow compared to other generation methods. Controlling specific details (exact face, exact composition) is difficult without specialized techniques like ControlNet or inpainting. Diffusion models can reproduce training data, raising copyright concerns.