Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Hierarchical Text-Conditional Image Generation with CLIP Latents

unCLIP generates images by first predicting CLIP image embeddings

  • Problem Guidance makes text-to-image samples more photorealistic but less diverse, so models trade one for the other. Generating a single image directly from a caption gives no easy way around this trade-off.
  • Method unCLIP first uses a prior to turn a caption into a CLIP image embedding. A diffusion decoder then renders an image from that embedding, so one embedding can yield several different images.
  • Results unCLIP with the diffusion prior scored a zero-shot FID of 10.39 on MS-COCO, compared to 12.24 for GLIDE.

Why guidance trades diversity for fidelity

Their best samples depend on guidance, which raises fidelity, meaning photorealism for images, at the cost of diversity. For a text-to-image generator, that trade-off means sharper images can come with a narrower range of outputs for the same caption.

CLIP offers a different starting point, because its image embeddings are robust to distribution shift and work zero-shot. The question is whether generating the CLIP image representation first can raise diversity while photorealism and caption similarity hold up.

Generating a CLIP embedding before the image

unCLIP splits generation into two stages: a prior maps a caption to a CLIP image embedding, and a diffusion decoder renders an image from that embedding. The embedding carries the semantic content, and the decoder fills in the details the embedding leaves out. Because the decoder is non-deterministic, one embedding can yield several different images, which is how the design targets diversity.

The authors explain the diversity gain by saying that the scene's semantics are fixed in the CLIP embedding, so decoder guidance can't collapse them. Formally, the image distribution is factored through the embedding, as follows. \[ P(x \mid y) = P(x, z_i \mid y) = P(x \mid z_i, y)\,P(z_i \mid y) \] The first step holds because the image fixes its embedding, and the second is the chain rule.

Sampling the embedding from the prior and then the image from the decoder therefore draws from the true conditional distribution.

How the diffusion decoder uses the embedding

The decoder starts from the GLIDE architecture and feeds the CLIP image embedding in two ways. The embedding is added to the timestep embedding, and it is also projected into four extra context tokens appended to the GLIDE text encoder outputs. The GLIDE text pathway is kept in case it can learn language aspects CLIP misses, such as variable binding, though the authors find it helps little here.

During training the CLIP embedding is set to zero 10% of the time, and the caption is dropped 50% of the time, which enables classifier-free guidance at sampling. High resolution comes from two upsamplers, one taking 64×64 images to 256×256 and another taking those to 1024×1024. The upsamplers train on corrupted conditioning images, with Gaussian blur for the first stage and a BSR degradation for the second, so they tolerate imperfect inputs.

The upsamplers train on random crops one-fourth the target size and use only spatial convolutions. The authors found no benefit from conditioning the upsamplers on the caption, so they stay unconditional.

Two priors for the image embedding

The autoregressive prior needs a short discrete sequence, so the authors first compress the CLIP image embedding with PCA. Keeping 319 of the 1,024 principal components preserves nearly all the information, with under 1% average mean-squared reconstruction error. Each retained dimension is quantized into 1,024 buckets, and a causal Transformer predicts the resulting sequence conditioned on the caption.

Predicting this sequence cuts the number of tokens predicted at inference threefold.

The caption and the CLIP text embedding are prefixed to the sequence, and a token holding the quantized dot product of text and image embeddings tells the model how well the caption fits. At sampling time the dot product is drawn from the top half of its distribution, since higher values match captions that describe the image better. The authors swept percentiles of 50%, 70%, 85% and 95% and found 50% best in all experiments.

The diffusion prior works on the continuous embedding directly, with a decoder-only Transformer under a causal mask. Its input sequence holds the encoded text, the CLIP text embedding, a timestep embedding, the noised image embedding and a final output token. Rather than predicting the noise, the model predicts the unnoised embedding, trained with a mean-squared error loss.

\[ L_{\text{prior}} = \mathbb{E}_{t \sim [1,T],\; z_i^{(t)} \sim q_t}\left[\left\| f_\theta(z_i^{(t)}, t, y) - z_i \right\|^2\right] \] At sampling time it draws two candidate embeddings and keeps the one with the higher dot product with the text embedding, in place of conditioning on that dot product.

Is the prior needed at all?

Conditioning the decoder on the caption alone is possible, but it underperforms a model trained that way, which the authors identify with GLIDE. Feeding the CLIP text embedding to the decoder as if it were an image embedding also works zero-shot, as earlier work observed.

The authors trained two small models and compared a decoder on CLIP text embeddings, a small unCLIP stack, and text embeddings fed zero-shot to the unCLIP decoder. On a test set these scored FIDs of 9.16, 7.99 and 16.55, so the full unCLIP stack came out ahead. Humans preferred the full stack 57.0%± 3.1% of the time for photorealism and 53.1%± 3.1% for caption similarity.

These are small models with swept sampling settings, so they serve as an early check before the full human study.

Human judgments against GLIDE

The authors ran pairwise human comparisons on photorealism, caption similarity and diversity, each with a third option for not being sure. The first two follow earlier protocols, while diversity uses two 4×4 grids of samples for the same caption, drawn from 1,000 MS-COCO validation captions. Before the human runs, a CLIP linear probe trained as a proxy for photorealism judgments was used to sweep hyperparameters, which were then fixed.

With the diffusion prior, photorealism reached 48.9% ± 3.1% and caption similarity 45.3% ± 3.0%, compared to 47.1% ± 3.1% and 41.1% ± 3.0% with the AR prior.

Diversity is the clearer result: unCLIP with the diffusion prior was preferred 70.5% ± 2.8% of the time, compared to 62.6% ± 3.0% with the AR prior. The authors read this as a benefit of generating the embedding first, and they note the diffusion prior does better than the AR prior in these comparisons in general.

Guidance and the diversity trade-off

When guidance scale rises for both models, GLIDE's camera angle, color and size converge. unCLIP keeps its scene semantics, because the embedding is fixed and only the decoder's guidance changes.

The authors also sweep decoder guidance and measure MS-COCO zero-shot FID, holding the prior's guidance fixed. Guidance raises unCLIP's FID much less than GLIDE's. FID penalizes non-diverse generations, so the authors read the smaller rise as evidence that guidance costs unCLIP less diversity.

In the human study, GLIDE at guidance scale 2.0 came very close to unCLIP on photorealism and caption similarity. Its samples were still less diverse, so matching unCLIP on fidelity costs GLIDE its variety.

Zero-shot FID on MS-COCO

At 256×256 with decoder guidance scale 1.25, unCLIP with the diffusion prior scored a zero-shot FID of 10.39, compared to 12.24 for GLIDE. The AR prior scored 10.63, so the diffusion prior leads by a small margin on this metric. Among the zero-shot methods in the comparison, the authors report a new state of the art at 10.39.

unCLIP was not trained on the MS-COCO training set, yet it generalizes to the validation set zero-shot, as GLIDE and DALL-E do. The table also gives a filtered FID column, where the diffusion prior scored 10.87. This rests on one benchmark and one metric, so the margin over the AR prior is small.

Aesthetic quality and recall

The authors generated 512 artistic captions with GPT-3 and produced four images per prompt, averaging over a batch of 2048 images. A CLIP linear probe trained on the AVA dataset scores each image for predicted aesthetic judgment. For unCLIP only the decoder is guided, since the authors found that guiding the prior hurt results.

Guidance improves aesthetic quality for both GLIDE and unCLIP. Recall is computed against the training dataset, and guiding unCLIP does not decrease it while aesthetic quality rises. These aesthetic scores come from an automated probe rather than human raters, so they show what the probe prefers.

What the bipartite latent allows

An input image is encoded as a pair: its CLIP image embedding z_i, and a DDIM latent x_T obtained by DDIM inversion with the decoder conditioned on z_i. The embedding describes what CLIP recognizes, while the latent holds the residual detail the decoder needs to rebuild the image. With η equal to 0 the decoder reconstructs the image, and with η greater than 0 it produces variations that stay centered on the original.

Interpolation rotates between two CLIP embeddings by spherical interpolation while the DDIM latent is fixed to a random sample. Text diffs move the image embedding toward the normalized difference of two CLIP text embeddings, with θ rising linearly from 0 to a maximum typically in [0.25, 0.50]. The base DDIM noise stays fixed along the trajectory, so the layout is kept while the edit applies.

Examples include turning a photo of a cat into an anime drawing and turning a winter landscape into a fall one.

The authors test typographic attacks, where overlaid text makes CLIP name the written object, to see what the decoder shows. In the paper's example an apple is misclassified as an iPod. The decoder still produced apples even when the predicted probability for Granny Smith was near zero, and it never produced iPods despite a high probability for that label.

Reconstructions from increasing PCA dimensions, from 20 up to 320, show that early dimensions carry coarse semantics. Later dimensions encode finer shapes and the exact form of objects. The AR prior is trained to predict these components in this order, so the same reconstructions also show what it models.

Limitations

unCLIP binds attributes to objects less well than GLIDE, and it struggles more in a prompt with two cubes of different colors. Decoder reconstructions often swap attributes between objects, and the authors hypothesize that the CLIP embedding doesn't explicitly bind attributes to objects.

unCLIP also struggles to render coherent text. The authors suggest the CLIP embedding may not precisely encode spelling, and the BPE encoding hides spelling from the model.

Complex scenes lack detail, which the authors attribute to generating a 64×64 base image before upsampling. The authors expect a higher base resolution to help, at extra training and inference cost, but the paper doesn't test this. The authors also note that unCLIP's performance gains raise its risk profile over GLIDE, since generated images are harder to tell from authentic ones.

Paper info

Authors
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, Mark Chen
Venue
arXiv · Preprint
First published
2022-4-13
Added
2026-11-11
Updated
2022-4-13
Version
v1
arXiv
2204.06125
Category
cs.CV
Original paper terms
CC BY 4.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, Mark Chen (2022). Hierarchical Text-Conditional Image Generation with CLIP Latents. arXiv:2204.06125v1. https://arxiv.org/abs/2204.06125v1

BibTeX
@misc{ramesh2022hierarchical,
  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},
  url = {https://arxiv.org/abs/2204.06125v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up