Guide

LLMs generate text one token at a time, from left to right. Images, video and speech use related ideas, such as likelihoods, latent spaces and transformers. The dominant image stack today is diffusion, not next-pixel prediction. This topic places the families side by side, builds diffusion from first principles, then covers latent diffusion, video and speech, and why image inference costs so differently from chat.

Engineers who only know LLM decoding often underestimate image latency ("it's just another forward pass") or overestimate the difficulty ("we need a GAN expert"). After this topic you should be able to explain how diffusion is trained, why latents help, what guidance does, and how step count trades off against quality.

Concepts in this topic

Read in this order. Each page builds on the one before it.

StepConceptWhat it answers
1Families of generative modelsWhat are the main ways to model images, and what does each cost?
2How diffusion learns to denoiseWhat does a diffusion model learn, and how is it trained?
3Latent diffusion, guidance and conditioningHow do you make it fast, and how do you steer it toward a prompt?
4Fewer steps, samplers and distillationHow do you cut the number of denoising steps?
5Diffusion inference costWhy does serving an image model differ from serving an LLM?
6Speech and video generationHow do audio codecs and video models change the picture?

Common mistakes across the topic

  • Underestimating image latency. A diffusion image runs the whole network many times, not once per token.
  • Judging image quality by the training loss. Loss shows that training works. It does not show that the images are good. Compare samples on your own prompts.
  • Assuming LLM serving tricks transfer unchanged. Batching and caching ideas differ for denoisers. See the inference cost page.

The score-based view (optional)

Another way to read diffusion is that the network estimates the score, which is the gradient of the log density of the noisy data. Denoising score matching connects that view to noise prediction. Samplers then follow dynamics that move toward high-density regions. You can use DDPM well without this view. It helps when you read papers that use "score" or "velocity" language.

Evaluating and shipping

Image quality has several dimensions, so no single metric is enough. FID and CLIPScore-style metrics measure distribution match and prompt alignment. Human preference raters are the most trusted signal, and LLM judges are noisy. For a product, always test on your own prompt distribution, since academic benchmarks transfer poorly to a specific brand style.

Generators can produce non-consensual or deceptive content. Production systems add prompt filters, classifiers on the outputs, provenance watermarks where required, and rate limits. These are product and policy layers around the sampler. They are not part of the diffusion loss.

Key takeaways

  • Diffusion and flow models lead on image and video quality today, while GANs remain in niches that need one fast pass.
  • Diffusion learns to reverse a gradual noising process. The standard training objective predicts the added noise.
  • Latent diffusion with classifier-free guidance made high-resolution text-to-image practical.
  • Diffusion inference is multi-step and compute-bound. LLM decoding is sequential and memory-bound.

Further learning

Welch Labs and 3Blue1Brown give a visual introduction to diffusion and text-to-image models. It is the best warm-up:

But how do AI images and videos actually work? | Guest video by Welch Labs3Blue1Brown

Outlier's walkthrough covers the DDPM math, if you want the equations after the visuals:

Diffusion Models | Paper Explanation | Math ExplainedOutlier
What are Diffusion Models? (Lilian Weng)[Updated on 2021-09-19: Highly recommend this blog post on score-based generative modeling by Yang Song (author of several key papers in the references)]. [Updated on 2022-08-27: Added classifier-free guidance, GLIDE,…lilianweng.github.io Denoising Diffusion Probabilistic ModelsWe present high quality image synthesis results using diffusion probabilistic models, a class of latent variable models inspired by considerations from nonequilibrium thermodynamics. Our best results are obtained by t…arXiv.org