diffusion model image generation

**Diffusion Models** are the **generative AI architecture that creates images (and other data) by learning to reverse a gradual noise-addition process — training a neural network to iteratively denoise random Gaussian noise step-by-step until a coherent image emerges, achieving state-of-the-art image quality and diversity that surpassed GANs while providing stable training and controllable generation**. **The Forward and Reverse Process** - **Forward Process (Fixed)**: Starting from a training image x₀, gradually add Gaussian noise over T steps until the image becomes pure noise x_T ~ N(0,I). Each step: x_t = √(α_t)·x_{t-1} + √(1-α_t)·ε, where α_t is a scheduled noise level and ε ~ N(0,I). After enough steps, all information about the original image is destroyed. - **Reverse Process (Learned)**: A neural network ε_θ(x_t, t) is trained to predict the noise ε added at step t. Starting from pure noise x_T, the model iteratively removes predicted noise: x_{t-1} = f(x_t, ε_θ(x_t, t)). After T denoising steps, a clean image x₀ emerges. **Training Objective** The loss is remarkably simple: L = E[||ε - ε_θ(x_t, t)||²] — just predict the noise. The model is trained on random timesteps t with random noise ε, learning to denoise at every noise level. No adversarial training, no mode collapse, no training instability. **Latent Diffusion (Stable Diffusion)** Running diffusion in pixel space at high resolution (512×512×3) is expensive. Latent Diffusion Models (LDMs) first compress images to a lower-dimensional latent space using a pretrained VAE encoder (512×512 → 64×64×4), run the diffusion process in latent space, then decode back to pixel space. This reduces computation by ~50x while maintaining visual quality. **Architecture** The denoiser ε_θ is typically a U-Net with: - Residual blocks at multiple spatial resolutions - Self-attention layers at low-resolution stages (capturing global structure) - Cross-attention layers that condition on text embeddings (CLIP or T5) - Timestep embedding injected via AdaLN (adaptive layer norm) or addition Recent models (DiT, PixArt-α) replace U-Net with a plain Vision Transformer backbone with equivalent or superior quality. **Conditioning and Control** - **Text Conditioning**: Text embeddings from CLIP or T5 are injected via cross-attention. The model learns to generate images matching text descriptions. - **Classifier-Free Guidance (CFG)**: During inference, the model generates both a conditional and unconditional prediction. The final output amplifies the conditional signal: ε_guided = ε_uncond + w·(ε_cond − ε_uncond). Higher guidance weight w produces images more strongly aligned with the text at the cost of diversity. Diffusion Models are **the generative architecture that achieved photorealistic image synthesis by embracing noise** — learning that the path from noise to image, taken one small denoising step at a time, is far easier to learn than trying to generate the image in a single shot.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account