TL;DR
DALL-E 2 (the paper calls its full system unCLIP) generates an image from a text caption in two stages. A prior turns the caption into a CLIP image embedding, a compact summary of what the picture should contain, and a diffusion decoder turns that summary into pixels. Splitting the job this way gave more varied images at almost the same photorealism as the strongest text-to-image model of the time.
Builds on: Learning Transferable Visual Models From Natural Language Supervision (CLIP), Denoising Diffusion Probabilistic Models (DDPM), Classifier-Free Guidance · Leads to: Latent Diffusion Model (a related design that also runs diffusion on a learned code, but in a different space)
Why it mattered
Within a year of the paper, text-to-image generation moved from research demos to public products. The DALL-E 2 Preview ran as a public service in 2022, and the same two-stage idea of "plan a semantic code, then render it" shaped later image systems. The paper also showed a practical fact that became standard: a diffusion model that is conditioned on a good embedding can produce many different pictures for the same meaning, and guidance can raise quality without flattening that variety.
The problem
Before this work, the best text-to-image systems faced a trade-off. Guidance, the trick of pushing a diffusion model harder toward its condition, made samples sharper and closer to the caption, but it also made them more alike. Two samples from the same caption often looked nearly identical after strong guidance, because the model's samples collapsed toward a single most-typical picture.
The CLIP model, from Learning Transferable Visual Models From Natural Language Supervision (CLIP), had already learned an image encoder and a text encoder that put matching image and caption pairs close together. Its image embeddings were robust, and they carried semantics and style. But CLIP can only read images. Nothing in it writes an image. The paper asks: can we run CLIP's image side backwards, so that a caption can be turned into the image embedding and then into pixels?
How it works
Think of the pipeline as two rooms. In the first room, a caption goes in and a list of numbers comes out. In the second room, that list goes in and a picture comes out.
- Start with a caption. Take the caption, for example "a corgi wearing a red scarf in the snow." A frozen CLIP text encoder reads it and produces a text embedding, a vector of 1,024 numbers in the paper's setting.
- The prior proposes an image embedding. The prior is a model that takes the caption and produces a plausible CLIP image embedding for a picture matching that caption. The paper tries two prior designs: an autoregressive one and a diffusion one. The diffusion prior is the better of the two, so we follow it here.
- Pick the better of two candidates. The diffusion prior draws two candidate embeddings. The one with the larger dot product against the caption's text embedding (a vector in the same space, produced by the CLIP text encoder) is kept. Suppose candidate A scores 0.31 and candidate B scores 0.27. A is kept, because it agrees more with the caption.
- The decoder paints from the embedding. The decoder is a diffusion model. It starts from pure noise at 64 by 64 pixels and removes noise over many steps. At each step it is given the CLIP image embedding, so the denoising keeps pulling the picture toward the content the embedding describes.
- Upsample twice. The 64 by 64 image goes through one upsampler to 256 by 256, and a second upsampler takes it to 1024 by 1024. Each upsampler is a diffusion model that adds detail while staying faithful to its input.
- Output. The 1024 by 1024 image is the result.
Check: the two upsamplers each multiply the side length by 4, and . The prior has no pixels to look at; it only ever sees captions and embeddings.
The reason for the detour through an embedding is the same idea that makes the paper useful. The embedding holds the scene's meaning, such as objects, style and layout, and leaves out fine details that do not matter for the meaning. Once the meaning is fixed by the prior, the decoder can sample many different renderings of it. Varying the decoder's noise gives varied images with the same content. This is the source of the diversity gain reported in the paper.
The math
The whole model is one factorisation of the probability of an image given a caption . Let be the CLIP image embedding of . Because is a deterministic function of , the image and its embedding carry the same information, so
The first equality holds because is a function of , so "the picture " and "the picture together with its embedding" are the same event. The second is the chain rule of probability. In words: the probability of a picture given a caption equals the probability of an embedding given the caption, times the probability of the picture given that embedding.
Step 2 in symbols: the prior
The prior models . The paper uses a decoder-only Transformer for the diffusion prior. It is trained to predict the clean embedding from a noisy version at diffusion time , with the caption as context. The loss is a mean squared error:
Here is the number of diffusion steps, is the distribution of the noisy embedding at step , and is the network with parameters . The expectation averages over random steps and random noise. Predicting directly, rather than the noise, was a choice the authors found worked better for this prior.
Step 3 in symbols: the selection rule
The prior draws two samples and . The one kept is
where is the CLIP text embedding of the caption and is the dot product (multiply matching entries, then add). In the toy example above, , so .
Step 4 in symbols: the decoder
The decoder models with a diffusion model. It is trained with the standard denoising objective of Denoising Diffusion Probabilistic Models (DDPM), with the CLIP embedding added to the timestep signal and passed as four extra context tokens. Classifier-free guidance is trained in by replacing the embedding with a null value on 10 percent of training examples and dropping the caption on 50 percent. At sampling time, the guidance scale combines the two predictions. Here is the noisy image at diffusion step . Writing for the noise the network predicts when conditioned on (the CLIP embedding and caption), and for the null condition, the guided prediction is
as described in Classifier-Free Guidance. A larger pushes the picture harder toward the condition.
Step 5 in symbols: the upsamplers
Write , and for the images at the three resolutions. Each upsampler is a conditional diffusion model that generates the larger image from the smaller one, so the decoder's output is refined in two stages:
Each arrow multiplies the side length by 4, as in Example 2 below.
Worked examples
Suppose a caption has two possible embeddings with prior probabilities and . Each embedding leads to a decoder that yields a given image with probability and .
- Multiply the first pair: . This is the probability that the sampled embedding is and the image is .
- Multiply the second pair: .
- Add them, since the two embeddings are separate cases: .
- The result, , is the probability the full pipeline outputs for this caption. Interpretation: most of the mass comes from the more likely embedding, but the less likely one still contributes.
The decoder makes a 64 by 64 image. The paper then uses two upsampler diffusion models.
- The first upsampler takes 64 by 64 to 256 by 256. The side length is multiplied by .
- The second upsampler takes 256 by 256 to 1024 by 1024. The side length is multiplied by .
- The total factor on each side is , and the pixel count grows by times, from pixels to pixels.
- Interpretation: most of the meaning is fixed at 64 by 64. The upsamplers add detail and work mainly from the low-resolution image they are given.
Suppose a team runs the decoder 4 times on one fixed embedding, using 4 different noise seeds. Each run produces an image. In the paper's framing, the embedding is "frozen" and only the noise changes. If the 4 images share the same subject, pose and palette but differ in small textures and background details, is the system behaving as the paper predicts, and why does the guidance scale matter?
Answer: Yes. The embedding fixes the high-level meaning (subject, pose, colours), while the decoder's noise decides the small details, so the prediction holds. The guidance scale matters because it pushes each sample harder toward the condition. A larger tends to sharpen images and make them closer to the embedding, but it can also make samples alike. The paper's point is that with the prior in front, the embedding already carries the meaning, so the samples can stay varied in their details even when guidance is strong.
Results
The main claims, with the paper's numbers:
- Zero-shot FID on MS-COCO at 256 by 256. The diffusion-prior unCLIP reached 10.39, versus 12.24 for GLIDE (lower is better). FID measures how close the sample distribution is to real images, so a lower score is better, though it says nothing about whether a single image matches its caption.
- Human evaluations against GLIDE. Raters chose between paired images. The unCLIP diffusion prior won 48.9 percent of photorealism comparisons, a near tie with GLIDE, which was slightly preferred. It won 45.3 percent of caption-similarity comparisons, so GLIDE was slightly better there. It won 70.5 percent of diversity comparisons, a clear advantage.
- Why the prior matters. The paper compares the full stack with a decoder fed the CLIP text embedding directly. The prior step, which turns the caption into an image embedding first, is what the authors credit for the gains in the comparison.
Limits, stated by the authors. unCLIP binds attributes to objects less well than GLIDE, so a prompt asking for two cubes with two different colours often mixes them up. It struggles to render legible text. Complex scenes lose detail because the base decoder works at 64 by 64. The paper also discusses the risks of more realistic generation, including deception, and points to a separate deployment analysis.
Reading guide
The paper is read in this order. Each section names the lessons it needs.
- Introduction. Needs Learning Transferable Visual Models From Natural Language Supervision (CLIP) for the idea of a shared image-text space, and Diffusion Model for the generative framework.
- Method: the decoder. Needs Denoising Diffusion Probabilistic Models (DDPM) for the denoising training, U-Net for the image architecture family, and Classifier-Free Guidance for the guidance trick. Skim Transposed Convolution only if the upsampling architecture is unfamiliar.
- Method: the prior. Needs Transformer with a causal mask for the autoregressive prior, and Autoregressive Model for that prior. The diffusion prior uses the same denoising ideas as the decoder.
- Image manipulations. Needs Representation Learning and Dot Product. These sections show that editing an embedding changes the picture in controlled ways.
- Results. Needs Mean Squared Error for the loss and Contrastive Learning for the CLIP training that produced the embeddings.
- Limitations. No new prerequisites. Read it with the Results section above.
Check yourself
QuestionWhy does the decoder's conditioning on the CLIP embedding help diversity, and what is held fixed when the noise changes?Show answer
The CLIP embedding fixes the high-level meaning of the image: its subjects, style and layout. Different noise seeds give different renderings of that meaning, so the non-essential details vary while the content stays the same.
QuestionA prior assigns probability 0.2 to embedding and 0.8 to for some caption. The decoder gives an image probability 0.5 given and 0.25 given . What is ?Show answer
Use the chain rule and sum over the two embeddings: . So .
QuestionWhy did the authors pick the diffusion prior over the autoregressive prior?Show answer
The diffusion prior works on the continuous CLIP embedding directly, so it needs no compression or discretisation step, and the paper found it the stronger of the two priors on its evaluation.
QuestionWhy does unCLIP struggle to bind colours to objects, even though its images are diverse and realistic?Show answer
The CLIP image embedding does not explicitly record which attribute belongs to which object. The decoder then reconstructs an image from an embedding in which attributes and objects can be mixed up. The paper hypothesises that this is the cause, and it is the reason for the gap with GLIDE on that prompt type.
Sources
- Ramesh, A., Dhariwal, P., Nichol, A., Chu, C., Chen, M. (2022). Hierarchical Text-Conditional Image Generation with CLIP Latents. https://arxiv.org/abs/2204.06125
- Radford, A. et al. (2021). Learning Transferable Visual Models From Natural Language Supervision. https://arxiv.org/abs/2103.00020
- Ho, J., Jain, A., Abbeel, P. (2020). Denoising Diffusion Probabilistic Models. https://arxiv.org/abs/2006.11239
- Ho, J., Salimans, T. (2022). Classifier-Free Diffusion Guidance. https://arxiv.org/abs/2207.12598