# Latent diffusion (2021)

> Run diffusion in a compressed latent space instead of on pixels, and steer it with text through cross-attention.

Page: https://mralbu.github.io/ai-datasets/p/latent-diffusion

## Key facts

- Title: High-Resolution Image Synthesis with Latent Diffusion Models
- Authors: Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, Björn Ommer
- Venue: CVPR 2022
- Category: Vision
- Paper: https://www.alphaxiv.org/abs/2112.10752

## Why it matters

Pixel-space diffusion needed hundreds of GPU-days. Working in latents made high-resolution diffusion affordable, and the same team's Stable Diffusion, a latent diffusion model trained on LAION-5B, was released openly in 2022 and put text-to-image generation on ordinary GPUs.

## The idea

First train an autoencoder that compresses images by a factor of 4 to 8 per side while keeping what matters to the eye. Then train the diffusion model on those small latents, not on pixels. Cross-attention layers let text, class labels or layouts condition the denoiser.

## The result

Class-conditional FID 3.60 on ImageNet, CelebA-HQ faces at FID 5.11, and text-to-image FID 12.6 on COCO with a model trained on LAION-400M, at a fraction of the compute of pixel-space diffusion.

## The data

- [ImageNet (ILSVRC) (2009)](https://mralbu.github.io/ai-datasets/d/imagenet.md): 1.28 million photos across 1,000 classes, the dataset behind the deep learning boom.
- [MS COCO (2014)](https://mralbu.github.io/ai-datasets/d/coco.md): 330k everyday scenes with 1.5M labeled objects in 80 categories.
- [CelebA (2015)](https://mralbu.github.io/ai-datasets/d/celeba.md): 202,599 celebrity face photos, each tagged with 40 yes/no attributes.

## Builds on

- [DDPM (2020)](https://mralbu.github.io/ai-datasets/p/ddpm.md)
- [VAE (2013)](https://mralbu.github.io/ai-datasets/p/vae.md)

## Part of

- [Generative image models](https://mralbu.github.io/ai-datasets/t/generative-images.md) (step 5 of 5)
