Type a sentence, get a picture. AI image generators like Stable Diffusion, DALL-E, and Midjourney feel like magic — but under the hood they’re doing something surprisingly counterintuitive: they remove noise. Here’s how diffusion models actually work.

The core idea: learn to denoise

Diffusion models are built on a two-direction process.

Forward (training): take a real image and gradually add random Gaussian noise, step by step, until it’s indistinguishable from television static. Do this for millions of images, and you have a dataset of “slightly noisier / slightly cleaner” pairs.

Reverse (generation): train a neural network to predict and remove the noise at each step. Once it can do that, you can start from pure random noise and run the denoiser repeatedly — each step nudging the static a little closer to a real image — until a coherent picture emerges. This is the insight from the foundational paper, Denoising Diffusion Probabilistic Models.

It’s like watching a photo develop out of grain, except the model is inventing the photo as it clarifies it.

Adding text: how prompts steer the image

Pure denoising gives you a plausible image, not the one you asked for. Text-to-image models fix this by conditioning every denoising step on a representation of your prompt — a text embedding (often from a model like CLIP). At each step, the network doesn’t just ask “what’s a plausible image here?” but “what’s a plausible image that matches ‘a red fox in the snow, cinematic lighting’?”

That conditioning is woven into the denoiser via cross-attention, so the words continuously guide the picture as it forms.

Latent diffusion: the efficiency breakthrough

Running this process on full-resolution pixels is enormously expensive. The key practical advance — from High-Resolution Image Synthesis with Latent Diffusion Models, the paper behind Stable Diffusion — was to do the diffusion in a compressed latent space instead.

An autoencoder squashes images into a much smaller representation; diffusion happens there; then a decoder expands the result back to a full image. Same idea, a fraction of the compute. This is what made high-quality image generation cheap enough to run on consumer GPUs and put it in everyone’s hands.

Guidance: how closely it follows the prompt

There’s a control knob called classifier-free guidance (arXiv:2207.12598) that sets how strongly the image adheres to your text. Turn it up and the model follows the prompt more literally; turn it too high and images get oversaturated or lose variety. It’s the central tension in image generation: prompt adherence versus diversity and naturalness. Most tools tune this for you, but it’s why the same prompt can feel “too literal” or “too loose” depending on settings.

The trade-offs that matter

  • Speed: classic diffusion needs many denoising steps, making generation slow. Newer sampling methods and distilled models cut this dramatically, but it’s still more compute than a text reply.
  • Control: precise layout, exact text in the image, and consistent characters remain genuinely hard, which is why tools add features like inpainting, ControlNet, and reference images.
  • Cost: image and video generation are far heavier than text, which shapes how products price and queue them.

The honest picture

Diffusion models don’t “understand” images the way you do — they’ve learned an extraordinarily detailed statistical sense of what images look like, and they sculpt noise into samples from that learned distribution, steered by your words. That’s why they’re brilliant at style and texture yet historically stumbled on hands, faces in crowds, and legible text.

For where this fits in the bigger multimodal picture, see our multimodal AI interview questions, and our AI tools directory tracks the image and video generators built on these ideas.