PriorTransformer
The unCLIP diffusion prior: a transformer that maps a text caption to a CLIP image embedding.
Diffusion and generative · 541 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 1B
- Operations
- 541
- Framework
- PyTorch
- Recurrent
- No
- Published
- 2022
- Cited by
- 10,659 (as of 22 November 2026)
- Authors
- Aditya Ramesh, Prafulla Dhariwal, Alex Nichol and others
- Source
- diffusers 0.38.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m2273
- Graph hash
- 7b5276153d2cc446d9feb71dcff7d520466879607f3612638a03ea8cded849da
- Skeleton hash
- 247e097baabef7654727b1551a372899d27f43bb7d14b7efe03d539238ef989b
- Architecture hash
- 2aa91a80dbe9455fa8903c171903e9461e0f6f589d6d4bd6eb21da3d88a04b4a
- Diagram SHA-256
- f2f00fd47c512ea966d540d1a5c013274ca4fee791407e74295097526cfe0a37
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
This is the diffusion prior from unCLIP, the first stage of a two-stage text-to-image model: it generates a CLIP image embedding from a text caption, and a separate decoder then renders an image from that embedding. In the paper's description it is a decoder-only Transformer with a causal attention mask that reads, in order, the encoded text, the CLIP text embedding, a diffusion timestep embedding, the noised CLIP image embedding and one final embedding whose output becomes the prediction. Rather than predicting noise, the prior is trained to predict the unnoised embedding directly with a mean-squared error loss.
The paper's argument for this extra stage is that explicitly generating image representations improves image diversity with minimal loss in photorealism and caption similarity. The authors tried both autoregressive and diffusion priors and found the diffusion version computationally more efficient, producing higher-quality samples. Compared with other zero-shot models, unCLIP reached an FID of 10.39 on MS-COCO when sampling with the diffusion prior. One quirk of the recipe: at sampling time the model draws two candidate embeddings and keeps the one with the higher dot product against the CLIP text embedding. To reuse hyperparameters tuned for diffusion noise schedules on images, the CLIP embedding inputs are scaled by 17.2.
The design travelled: Karlo is a text-conditional image generation model based on OpenAI's unCLIP architecture. Kandinsky 2.2 likewise is a text-conditional diffusion model based on unCLIP and latent diffusion, composed of a transformer-based image prior model, a unet diffusion model, and a decoder. The trained image prior model is then used to generate CLIP image embeddings for input text prompts. The Kandinsky paper's ablation is a cautionary footnote: the best CLIP score and human-evaluation score came from the diffusion prior, but the best FID came from a plain linear prior. In Kandinsky 2.1 that diffusion mapping transformer has 20 layers, 32 heads and a hidden size of 2048.
Key idea. A prior that generates a CLIP image embedding given a text caption, paired with a decoder that generates an image conditioned on the image embedding. Explicitly generating image representations improves image diversity with minimal loss in photorealism and caption similarity.
- unCLIP prior
- PriorTransformer
- Kandinsky prior
- Kandinsky 2.2 prior
- Karlo prior
- DALL-E 2 diffusion prior
- diffusion prior
- CLIP image embedding
- text-to-image
- unCLIP
- Kandinsky
- Karlo
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{ramesh2022hierarchicaltextconditionalimagegeneration,
title={Hierarchical Text-Conditional Image Generation with CLIP Latents},
author={Aditya Ramesh and Prafulla Dhariwal and Alex Nichol and Casey Chu and Mark Chen},
year={2022},
eprint={2204.06125},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2204.06125},
}