Papers · 2021 · Reading: 27 min, plus 12 in closed details.
Paper · ICML 2021 · arXiv 2103.00020

Learning Transferable Visual Models From Natural Language Supervision (CLIP)

Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever
OpenAI · February 2021 (arXiv v1 26 February 2021)

In one line: Contrastive pretraining on 400M web image-text pairs yields a shared embedding space where text builds zero-shot classifiers; the largest model (ViT-L/14 at 336px) matches the original supervised ResNet-50 on ImageNet zero-shot (76.2%), and zero-shot CLIP closes up to 75% of the accuracy gap under natural distribution shift.

76.2% zero-shot ImageNet top-1
ViT-L/14@336px, no ImageNet training images
the original supervised ResNet-50's level; 11.5% for Visual N-Grams · Table 1
4x faster to the same zero-shot accuracy
matching pairs instead of predicting the caption's words
and 3x more from bag of words over a captioning Transformer: about 12x in all, at one ResNet-50 scale · Figure 2
77.1% on ImageNet-A
zero-shot CLIP, against 2.7% for a ResNet-101
both score 76.2% on ImageNet; the gap to the shifted sets shrinks by up to 75% · Figure 13

Verdict: Believe the method and the headline numbers: they come from released models that later work has re-run widely, and open reproductions matched them. Read "contrastive is 4x more efficient than predicting the words" and "robust because zero-shot" as findings at the paper's scale and on its data: later work traced the robustness mainly to the diversity of the training data, and found captioning competitive for learning representations once data and compute are matched. How much of this to believe

The idea in one sentence: train an image encoder and a text encoder on 400 million web image-caption pairs only to pick which caption in a batch belongs to which image; the shared space this builds turns any list of class names, written as sentences, into a classifier, and zero-shot it matches a supervised ResNet-50 on ImageNet (76.2%) and is far more robust to distribution shift.

One shared space, used twice: learn it by matching pairs, then classify by matching sentences. The figure is the paper's Figure 1 in 3D, run by this page's toy CLIP (Run a tiny CLIP) on four pairs from its toy web; drag it to turn it.

  1. A batch of pairs. Four pictures from the toy web and the captions they came with: . The paper's batch is 32,768 pairs.
  2. Two encoders, one space. An image encoder and a text encoder each turn their input into 32 numbers (the paper: 512 to 1,024), L2-normalised, in the same space. Bars standing up are positive numbers; bars hanging below, negative.
  3. Score every pair. Each image embedding meets each caption embedding on the glass plate: cosine similarity times the learned scale, an N × N grid of logits with the true pairs on the diagonal.
  4. The loss: the diagonal up, the rest down. A softmax along each row (each image picks its caption) and down each column (each caption picks its image); the symmetric cross-entropy pushes the diagonal (the true pairs, green) up and the rest down, in every row and every column. The bars are the two softmaxes averaged; the toy's loss on this batch is (ln 4 = 1.386 at chance).
  5. Test: write each class as a sentence. No class list is fixed at training time. Write each class as "a photo of a {class}.", embed the sentences once with the text encoder, and they become the columns.
  6. Give the new image the closest sentence. Its embedding against the six sentence embeddings: cosine times the scale, then a softmax over the classes; the largest wins, here .

After the paper's Figure 1, redrawn (the paper is under arXiv's non-exclusive licence, not CC BY, so no image of the original). Every bar is the shipped toy CLIP's output on these pictures and sentences.

You need: a ViT or ResNet image encoder (ViT) and softmax cross-entropy. InfoNCE in general is on Contrastive and self-supervised learning; CLIP and SigLIP as today's vision encoders (losses, data, zero-shot, failures) on Vision encoders; this page is the paper. New terms: zero-shot transfer (scoring a dataset the model never trained on, classes given only as text); prompt (the sentence a class name is put into); linear probe (a logistic regression on frozen features); temperature (the learned scale on the similarities); effective robustness (accuracy under distribution shift above what ImageNet accuracy predicts); WIT (the paper's 400M-pair dataset).

Problem

§1 Introduction

In 2021 the best vision systems were trained to predict a fixed set of categories: the 1,000 ImageNet classes, or 18,291 for the largest weakly supervised work. Any concept outside the list needs new labelled data and a new output head; and the static softmax classifier has no way to produce a new answer (§1).

NLP had already left this behind: task-agnostic pre-training on raw web text let GPT-3 transfer zero-shot to new tasks (§1). In vision, the best zero-shot result, Visual N-Grams, reached 11.5% on ImageNet, against 88.4% for the state of the art and 50% for classic pre-deep-learning methods (§1).

Earlier work on learning images from text (§1)

NLP's task-agnostic pre-training on raw web text, with "text-to-text" as the interface, let GPT-3 transfer zero-shot to new tasks with little or no task-specific data (§1). Vision still pre-trained on crowd-labelled ImageNet. Learning images from text was not new (Mori et al. 1999 to VirTex, ICMLM and ConVIRT in 2020), but these were proofs of concept trained for accelerator days on one to two hundred thousand images, while the weakly supervised models that worked trained for accelerator years on millions to billions (§1).

The question: does supervision from natural language, at web scale, give visual representations that transfer, and can it replace the static softmax head with classifiers written in words?

Idea

§2.1, Figure 1

Train an image encoder and a text encoder together so that each image lands next to its own caption in one shared embedding space. Training never asks the model to name anything; it asks which caption, out of a batch, belongs to which image. At test time, the text encoder turns class names into a classifier: write each class as a sentence, embed it, and pick the sentence closest to the image (Figure 1).

Two advantages over labels and over self-supervision: text needs no labelling format, so it scales by collecting what is already on the internet; and it connects the representation to language, which is what makes zero-shot transfer possible (§2.1).

What the paper calls this family (§2.1)

The authors call the family "learning from natural language supervision": earlier papers used the same idea but described it as unsupervised, self-supervised, weakly supervised or supervised (§2.1).

Data: 400 million pairs from the web

§2.2

Existing image-text datasets were too small (MS-COCO and Visual Genome, about 100,000 photos each) or too noisy: YFCC100M has 100 million, but titles such as "20160716_113957.JPG"; keeping only English natural-language titles or descriptions shrinks it six times, to 15 million, about the size of ImageNet (§2.2).

So the authors built WIT (WebImageText): 400 million (image, text) pairs from public internet sources, searched with 500,000 queries and capped at 20,000 pairs per query so that common concepts do not swamp rare ones (§2.2). WIT was never released (model card); how later work rebuilt and filtered such data (LAION, DataComp, MetaCLIP, DFN) is on Vision encoders.

How the 500,000 queries were chosen (§2.2)

To cover many visual concepts, they searched for pairs whose text contains one of 500,000 queries: every word that occurs at least 100 times in English Wikipedia, plus high-PMI bigrams, the names of Wikipedia articles above a search volume, and all WordNet synsets not already included. Results are roughly class-balanced by keeping at most 20,000 pairs per query. The total word count is similar to GPT-2's WebText (§2.2, footnote 1).

The objective: match pairs, do not write captions

§2.3, Figures 2 and 3

Training cost decided the method. The best vision systems of the day used 19 GPU-years (ResNeXt101-32x48d) or 33 TPUv3 core-years (Noisy Student EfficientNet-L2) to learn just 1,000 classes, so learning an open set of concepts from text "seems daunting" (§2.3). The first attempt, like VirTex, trained an image CNN and a text Transformer from scratch to generate each image's caption. It scaled badly.

Three objectives, the same ResNet-50 image encoder, the same data. Which reaches a given zero-shot ImageNet accuracy with the fewest training images?
On the toy, captioning is slowest, as in the paper; bag-of-words prediction keeps up with contrastive, unlike the paper's 4×

Answer the question on the left before you look. The toy curves are measured: four objectives trained on this page's toy web of 120,000 pairs, one run each (details in Run a tiny CLIP). The paper's curves are not redrawn: the method forbids reading values off a plot, and Figure 2 prints none.

The figure runs four pairs of the toy web through the objective CLIP replaced and through CLIP's own. The predictive model must spell out each caption word by word, choosing from the whole vocabulary each time, including the filler words no picture can explain. The contrastive model only has to pick its pair out of the batch, in both directions. Pick one, then follow its steps.

  1. Encode the images. The image encoder (the glass plate stands for its weights) maps each picture to a 32-number embedding (the paper: 512 to 1,024), L2-normalised.
  2. Encode the captions. The text encoder maps each whole caption to an embedding in the same space. It reads "look at this" and "today so cool" too, but nothing asks it to reproduce them.
  3. Score every pair. Cosine similarity times the learned scale: 16 logits for 4 pairs, while the paper scores 32,768² ≈ 1.07 billion per step. The true pairs sit on the diagonal.
  4. Each image picks its caption. A softmax along each row, then cross-entropy with the true caption as the target: the model only has to tell these four captions apart. Image-side loss: .
  5. Each caption picks its image; average the two. A softmax down each column, the same cross-entropy (caption side: ), and the mean of both, against ln 4 = 1.386 at chance: Figure 3's symmetric loss. Nothing here depends on how many ways the caption could have been phrased.

The shipped toy CLIP's real embeddings, logits and softmaxes on these four pairs; the captioner's bits come from the toy captioning run's training log (Run a tiny CLIP).

Given a batch of N pairs, CLIP predicts which of the N × N possible pairings actually occurred. Both encoders map into the shared space through a linear projection; the embeddings are L2-normalised; their cosine similarities, scaled by a learned temperature, form an N × N matrix of logits; and a symmetric cross-entropy asks each image to pick its own caption and each caption its own image, averaging the two losses. The N real pairs are pushed together and the N² − N wrong ones apart (§2.3). This is the multi-class N-pair loss of Sohn (2016), popularised as InfoNCE by Oord et al. (2018) and applied to medical image-text pairs by ConVIRT (§2.3); InfoNCE and its temperature in general are taught on Contrastive and self-supervised learning, and how the batch size and temperature behave in CLIP-style training on Vision encoders.


The paper's Figure 3, transcribed. The comments are the paper's; hover over or tap a line of code to see its value on the toy batch below.

Try: this is one real batch of eight pairs through the toy CLIP. Move the temperature, or swap two captions, and watch the loss. With N pairs a model that knows nothing scores ln N: ln 8 = 2.08 here, and ln 32,768 = for the paper's batch.

The slider runs from 1 to 100 on a log scale. The temperature starts at the equivalent of 0.07 (a scale of 1 / 0.07 = ) and is learned, as a log-parameterised scalar, with logits clipped at 100 to prevent training instability (§2.3, §2.5); the toy learned . Cells are the logits; rows are images, columns captions; the diagonal is the true pairing.

Five simplifications against ConVIRT (§2.3)

Because the dataset is so large, overfitting is not a worry and the recipe is simpler than ConVIRT's (§2.3):

  • From scratch. Neither encoder is initialised from ImageNet or from a pre-trained language model.
  • Linear projections. No non-linear projection head (Bachman et al., then SimCLR); the authors saw no difference in training efficiency and speculate the non-linear head is co-adapted with image-only self-supervised methods.
  • No text sampling. ConVIRT's text transformation tu, which samples one sentence, is removed, since many WIT texts are a single sentence.
  • One augmentation. A random square crop from resized images.
  • Learned temperature, so it need not be tuned as a hyperparameter.

Encoders and training

§2.4, §2.5, Appendix F

Encoders. Two image families, a modified ResNet-50 with attention pooling and the Vision Transformer, and a GPT-2-style text Transformer of 63M parameters whose [EOS] activation is the text feature; each is followed by a linear projection into the shared space (§2.4).

The encoders in detail (§2.4), with the text-encoder recount

Image encoders. Two families (§2.4). A ResNet-50 modified with the ResNet-D improvements, antialiased rect-2 blur pooling, and attention pooling in place of global average pooling: one layer of Transformer-style multi-head QKV attention whose query is the global average-pooled representation. And the Vision Transformer, followed closely, with one extra LayerNorm on the combined patch and position embeddings before the Transformer and a slightly different initialisation (the ViT page explains the architecture).

Text encoder. A GPT-2-style Transformer: 63M parameters, 12 layers, 512 wide, 8 heads, over a lower-cased byte-pair encoding with a 49,152 vocabulary and sequences capped at 76 tokens. The text is bracketed by [SOS] and [EOS]; the top layer's activation at [EOS], layer-normalised and linearly projected, is the text feature. Self-attention is masked (causal), to keep open initialising from a language model or adding a language-modelling loss, which the paper leaves to future work (§2.4). Recounted: 12 blocks plus embeddings give with that vocabulary and with Table 18's 49,408; both round to 63M (tables tab).

Scaling. ResNets grow EfficientNet-style, but with compute split equally across width, depth and resolution rather than a tuned ratio; the text encoder only grows in width, in proportion to the ResNet's width, because performance was less sensitive to text capacity (§2.4).

Training in one line: eight models (five ResNets, three ViTs), 32 epochs, a batch of 32,768, 12 to 18 days on 256 to 592 V100s for the largest; "CLIP" in the results means ViT-L/14 fine-tuned one more epoch at 336 pixels.

The training details (§2.5, Appendix F)
  • Eight models: ResNet-50, ResNet-101, RN50x4, RN50x16 and RN50x64 (about 4, 16 and 64 times a ResNet-50's compute), and ViT-B/32, ViT-B/16 and ViT-L/14.
  • 32 epochs; Adam with decoupled weight decay (0.2) on everything that is not a gain or bias; cosine learning-rate decay after 2,000 warm-up iterations. Hyperparameters were tuned by grid search, random search and hand on a ResNet-50 trained for one epoch, then adapted heuristically for the larger models.
  • A minibatch of 32,768. Mixed precision, gradient checkpointing, half-precision Adam statistics and half-precision stochastically rounded text-encoder weights save memory; each GPU computes only the similarities its local batch needs.
  • RN50x64 took 18 days on 592 V100s ( GPU-days); ViT-L/14 took 12 days on 256 (). ViT-L/14 then trained one more epoch at 336 pixels, as FixRes does: ViT-L/14@336px, the model the paper calls "CLIP" unless it says otherwise.

Zero-shot transfer: a classifier written in words

§3.1.1 to §3.1.3

"Zero-shot" here means transfer to unseen datasets, not only unseen categories, as a measure of what a model has learned to do (§3.1.1).

Zero-shot, as the paper defines it (§3.1.1)

In computer vision "zero-shot" usually means recognising unseen object categories. The paper uses it more broadly: transfer to unseen datasets, as a proxy for unseen tasks, and as a measure of what a model has learned to do rather than of its representation (§3.1.1). On datasets such as CIFAR-10, whose "real" task is unclear, it is closer to a test of robustness to distribution shift. The inspiration is GPT-1 and GPT-2's zero-shot task learning (§3.1.1).

The recipe reuses the training task. Embed the image; embed every class name with the text encoder; take cosine similarities, scale by the temperature and apply a softmax. That is a multinomial logistic regression with L2-normalised inputs and weights, no bias and temperature scaling, in which the text encoder is a hypernetwork producing the classifier's weights from text. The classifier is computed once per dataset and cached, so its cost is amortised over every prediction. Seen this way, every training step optimises a randomly made proxy dataset with 32,768 classes, one example each (§3.1.2). Zero-shot classification with today's encoders, measured on real images, is on Vision encoders.

The figure builds one with the toy CLIP, against the fixed softmax head a supervised model has. Adding a class to the supervised head means new labelled data and retraining; adding one to CLIP's means writing a sentence.

  1. Embed the image. The image encoder and projection give one unit vector: 32 numbers, drawn in front.
  2. Write each class as a sentence. "a photo of a {class}": the class names become text that looks like a caption. Six of the toy's 36 colour-and-shape classes.
  3. The text encoder writes the classifier. Each sentence's embedding becomes one row of a linear classifier (the glass plate), its 32 numbers lined up with the image's: the text encoder is a hypernetwork that generates the weights (§3.1.2).
  4. Cosine × scale, then softmax. Exactly the training-time score, over the classes instead of a batch: the image streams into every row, more densely where the probability is higher, and the largest lifts. The true class is the first row: .
  5. Ask a new question by writing it. "small" or "big"? Two new sentences, and the classifier exists as soon as the text encoder has run: . No labelled example, no retraining.

Zero-shot: the shipped toy CLIP's real embeddings and probabilities for one test photo. Supervised head: drawn, not run; the toy ships no such head, so its rows are an unlabelled plate and its scores are not shown.

Against Visual N-Grams, the only prior zero-shot result on standard datasets: 11.5% to 76.2% on ImageNet (top-5 95%, matching Inception-V4), 72.4% to 98.4% on aYahoo (a cut in errors; the paper says 95%), 23.0% to 58.5% on SUN (Table 1). The authors call this context, not a fair comparison: 10× the data, nearly 100× the compute per prediction, probably over 1,000× the training compute. A CLIP ResNet-50 trained on YFCC100M itself matched Visual N-Grams' ImageNet result within one V100 GPU-day, from scratch (§3.1.3). The evaluation then grows to over 30 datasets and more than 50 systems (Appendix A).

Prompt engineering and ensembling

§3.1.4, Figure 4

A bare class name is a poor sentence: it can be ambiguous (ImageNet's construction cranes and flying cranes; a "boxer" in Oxford Pets is a dog) and WIT's text is rarely one word. "A photo of a {label}." alone adds 1.3% on ImageNet; ensembling 80 prompts in embedding space (averaged text embeddings, so the ensemble costs the same as one classifier) adds another 3.5%. Across 36 datasets prompt engineering and ensembling add almost 5 points on average, about what four times the compute buys with bare names (§3.1.4, Figure 4).

The paper's account of prompts in full (§3.1.4)

Datasets treat class names as an afterthought: most store numeric ids and a file mapping them to English, and Flowers102 and GTSRB did not appear to ship that mapping at all (§3.1.4; Alec "learned much more about flower species and German traffic signs ... than he originally anticipated", footnote 2). Two problems follow:

  • Polysemy. A bare name has no context: ImageNet has both construction cranes and cranes that fly, and in Oxford-IIIT Pets "boxer" is a dog breed that a text encoder could read as an athlete.
  • Distribution gap. In WIT the text is rarely a single word, so "A photo of a {label}." is a better default; it alone adds 1.3% on ImageNet.

Task-specific prompts help further: "A photo of a {label}, a type of pet." on Oxford-IIIT Pets, the type of food on Food101 and of aircraft on FGVC Aircraft, quotes around the text or number for OCR, and "a satellite photo of a {label}." for satellite images. Ensembling many prompts ("A photo of a big {label}", "A photo of a small {label}") is done in embedding space, not probability space, so the averaged text embeddings are cached and the ensemble costs the same as one classifier. On ImageNet 80 prompts add another 3.5%, so engineering plus ensembling add almost 5% (§3.1.4). Across 36 datasets the gain is almost 5 points on average, about what four times the compute buys with bare names (Figure 4).

The toy, honestly: prompt engineering barely matters there

How good is zero-shot CLIP?

§3.1.5, Figures 5 to 9

Against a supervised baseline. A fully supervised logistic regression on the canonical ResNet-50's features, across 27 datasets: zero-shot CLIP wins on 16, ImageNet included (Figure 5). The bars are recomputed from Tables 10 and 11; hover for the numbers.

Where it wins and where it loses, by kind of task
  • Fine-grained: a wide spread. Stanford Cars and Food101 gain over 20 points; Flowers102 and FGVC Aircraft lose over 10; Oxford Pets and Birdsnap are close. The authors suspect varying amounts of per-task supervision in WIT against ImageNet (§3.1.5).
  • General objects (ImageNet, CIFAR-10 and 100, STL10, Pascal VOC 2007): similar, with a slight edge to CLIP in every case; 99.3% on STL10 appears to be a new state of the art with no training examples.
  • Actions in video: +14.5 on Kinetics700 and +7.7 on UCF101, perhaps because language supervises verbs while ImageNet supervises nouns.
  • Weak on specialised, complex or abstract tasks: satellite images (EuroSAT, RESISC45), lymph-node tumours (PatchCamelyon), counting (CLEVRCounts), German traffic signs (GTSRB), distance to the nearest car (KITTI). Non-expert humans do several of these well; the authors doubt zero-shot is even a meaningful test for tasks nobody has prior experience of.
Zero-shot CLIP minus a ResNet-50 linear probe, 27 datasets

Fit a logistic regression on CLIP's own features with k labelled ImageNet examples per class. How large must k be to match zero-shot CLIP?
A written class name is worth from under one to 184 labelled examples, depending on the dataset

Answer the question on the left before you look. Figure 7's printed labels: labelled examples per class a linear probe on CLIP's features needs to match zero-shot CLIP.

Headroom. Since the zero-shot classifier is also linear, a fully supervised linear probe on the same features roughly bounds it. Zero-shot sits 10 to 25 points below on most datasets; the two correlate at 0.82, and only on 5 datasets is the gap 3 points or less (Figure 8). Recomputed from Tables 10 and 11: correlation , datasets within 3 points, median gap points (tables tab).

Scaling. Average zero-shot error of the five ResNet CLIPs over 39 evaluations on 36 datasets follows a log-log linear trend in compute across a 44× range (6.1 to 265.9 GFLOPs: ×), like the GPT family's; individual evaluations are much noisier, and the authors cannot tell run-to-run variance from genuinely non-monotonic tasks (Figure 9).

Representation learning: linear probes

§3.2, Figures 10 to 12

The usual test of a representation: a linear classifier on frozen features, 66 models on 27 datasets (§3.2).

Why linear probes, and the protocol (§3.2, Appendix A.3)

A linear classifier on frozen features is preferred to fine-tuning because fine-tuning can mask failures, because it mirrors the zero-shot classifier, and because 66 models on 27 datasets is already 1,782 evaluations (§3.2). The probe is scikit-learn's L-BFGS logistic regression, its L2 strength searched over 10⁻⁶ to 10⁶ on validation splits (Appendix A.3).

  • On the 12 datasets of Kornblith et al., chosen first to limit selection bias: small CLIPs (ResNet-50 and 101) beat ImageNet-1k ResNets but lose to ImageNet-21k ones (BiT-M) and to EfficientNets of similar compute. CLIP scales well: RN50x64 slightly beats the best existing model, Noisy Student EfficientNet-L2, on score and compute. CLIP ViTs are about 3× more compute-efficient than CLIP ResNets, echoing the ViT paper. The best model, ViT-L/14@336px, beats the best existing model by 2.6% on average (Figure 10; recomputed points).
All 27 datasets, and per dataset against the best ImageNet model (Figures 10 to 12)
  • On all 27, which add geo-localisation, OCR, facial emotion and action recognition: every CLIP model beats every other system on compute efficiency, and the margin grows to 5% (recomputed points). Self-supervised systems also look better here: SimCLRv2 loses to BiT-M on the 12 but wins on the 27, a sign that the 12 lean toward ImageNet-like tasks (§3.2).
  • Per dataset, CLIP's features beat Noisy Student EfficientNet-L2 on 21 of 27 (Figure 11; recomputed 21 against the L2-475 row). The biggest gains are OCR (SST2, Hateful Memes), geo-localisation and scenes (Country211, SUN397), video activity (Kinetics700, UCF101), cars and traffic signs: +14.7 on GTSRB may reflect ImageNet's single label for all traffic and street signs. The EfficientNet wins on ImageNet, its own training set, slightly on low-resolution CIFAR (CLIP lacks scale augmentation), and on PatchCamelyon and CLEVRCounts, where both are weak (§3.2).
  • On both suites, CLIP's transfer scores are higher than other models' at the same ImageNet accuracy, suggesting ImageNet-trained representations are "somewhat overfit to their task" (Figure 12).
More tasks from Appendix E: retrieval, OCR, video, geo-localisation
  • Retrieval, the task CLIP pre-trains for: zero-shot CLIP matches or beats every prior zero-shot result on Flickr30k and MSCOCO and is competitive with the best fine-tuned Flickr30k text retrieval (R@1 88.0 against 88.7); fine-tuned systems win clearly on MSCOCO. Prepending "a photo of" adds 1 to 2 points of R@1 (Table 13).
  • OCR: strong where text is rendered words (Hateful Memes, rendered SST-2, where a linear probe gets 80.5%, on par with a GloVe bag-of-words baseline at 80%); weak on digits: 51% on full-number SVHN, and zero-shot MNIST below logistic regression on raw pixels (Table 14).
  • Action recognition: a linear probe on single centre frames matches the best prior UCF101 result; zero-shot Kinetics-700 is within 1% of a fully supervised I3D trained on 545,000 videos; RareAct improves 10 points over the prior state of the art (Table 15).
  • Geo-localisation on IM2GPS by nearest neighbour over 1 million reference images: similar to several task-specific models, not to the state of the art; not zero-shot (Table 17).

Robustness to natural distribution shift

§3.3, Figures 13 to 15

On 7 natural distribution shifts collected by Taori et al. (2020), ImageNet models' accuracy rises predictably with their ImageNet accuracy, and a ResNet-101 makes 5 times as many mistakes as on ImageNet's validation set. Effective robustness is accuracy under shift above that trend (§3.3).

The seven shifts, and relative robustness (§3.3)

ImageNet models "exceeded human performance" on its test set in 2015 yet keep failing on new benchmarks, plausibly because they exploit correlations that hold only in their training distribution. Taori et al. (2020) measured them on 7 natural shifts (ImageNetV2, ImageNet Sketch, Youtube-BB, ImageNet-Vid, ObjectNet, ImageNet Adversarial, ImageNet Rendition): shifted accuracy rises predictably with ImageNet accuracy, linearly in logit space. Relative robustness is any improvement under shift (§3.3).

A ResNet-101 trained on ImageNet and zero-shot CLIP both score 76.2% on ImageNet. On ImageNet-A, adversarially filtered natural images, the ResNet-101 scores 2.7%. CLIP?
Same ImageNet score, very different under shift: zero-shot CLIP against a ResNet-101

Answer the question on the left before you look. Figure 13's printed table: both models at 76.2% on ImageNet, then on the five shifted sets the figure prints.

Is training on ImageNet the cause? A zero-shot model cannot exploit correlations specific to a distribution it never trained on (though it can exploit ones shared between pre-training and test, footnote 4). The authors test it from the other side: adapting CLIP to ImageNet with an L2-regularised logistic regression adds 9.2% on ImageNet, to 85.4%, tying the 2018 state of the art and worth "roughly 3 years" of progress, yet average accuracy under shift slightly decreases (Figure 14). Only ImageNetV2, built the way ImageNet was, gains; ImageNet-R loses 4.7, ObjectNet 3.8, Sketch 2.8, ImageNet-A 1.9; Youtube-BB and ImageNet-Vid barely move (§3.3).

Custom classifiers, and few-shot in between (Figures 14 and 15)

Custom classifiers are a robustness tool too. Youtube-BB and ImageNet-Vid use super-classes of ImageNet's, which an ImageNet model must handle by max-pooling sub-classes (its "person" pools baseball player, bridegroom and scuba diver). CLIP just embeds each dataset's own class names: average effective robustness rises 5%, concentrated on a few datasets, and even ObjectNet gains 2.3% from its creators' names (§3.3).

Few-shot sits in between. On the best CLIP's features, 0-, 1-, 2-, 4- up to 128-shot and fully supervised classifiers show effective robustness that fades as more ImageNet data is used, mostly though not entirely gone when fully supervised; at equal ImageNet accuracy zero-shot is more robust than few-shot. "High effective robustness seems to result from minimizing the amount of distribution specific training data", at a cost in dataset-specific accuracy (Figure 15). The authors stop short of a cause: the large, diverse data or language supervision could also explain it, and they ask the authors of the JFT and Instagram models to run the same test (§3.3).

The toy runs the paper's test, and a later paper's

Humans, data overlap, and bias

§4, §5, §7
Against humans on Oxford-IIIT Pets (§4)

Five people labelled each of the 3,669 test images of Oxford-IIIT Pets with one of 37 cat and dog breeds (or "I don't know"), with no examples, then with one and two examples per breed, and no internet search (§4). High accuracy on STL-10 (94%) and on attention-check images (97 to 100%) suggests the workers were trying.

Humans go from 54% to 76% with a single example per class, and a second adds almost nothing; the gain is almost entirely on images they were unsure of, so humans "know what they don't know". CLIP's few-shot methods do the opposite: its accuracy drops from zero-shot to a linear probe with one example. The authors read this as room for algorithms that use prior knowledge the way people do (Table 2, §4). The hardest categories for CLIP are also hardest for humans, probably because of label noise and out-of-distribution images (Figure 16).

Did the evaluation sets leak into the 400 million pairs? (§5)

Rather than de-duplicate before training, which requires knowing every future evaluation, the authors measure overlap afterwards (§5):

  1. A purpose-built near-duplicate detector (a ResNet-50 trained with the same InfoNCE loss to match an image to augmented copies of itself, temperature fixed at 0.07, because CLIP's own embedding is too semantic: two different soccer balls look identical to it) splits each evaluation set into Overlap and Clean by a hand-tuned, high-precision threshold (Appendix C).
  2. Zero-shot RN50x64 accuracy on All minus Clean is the inflation due to contamination.
  3. A one-sided binomial test of Overlap against Clean, and 99.5% Clopper-Pearson intervals.

Of 35 datasets, 9 have no detected overlap (MNIST, CLEVR and GTSRB are synthetic or specialised; ObjectNet and Hateful Memes postdate WIT). Median overlap is 2.2%, mean 3.2%. Overall accuracy moves by more than 0.1% on only 7 datasets, 2 of them significant after Bonferroni correction; the largest gain is 0.6% on Birdsnap (12.1% overlap). Country211 overlaps most, 21.5%, because it was built from YFCC100M, part of WIT, yet gains only 0.2%: the captions rarely mention the location (§5, Figure 17). Caveats the authors give: the detector's recall cannot be checked over 400M images, and Overlap and Clean may differ in difficulty (Kinetics-700's "overlaps" are mostly black transition frames, hence an apparent 20% drop). Mahajan et al. and Kolesnikov et al. found similar rates and small effects, and Kolesnikov et al. found de-duplicating first made little difference (§5).

Bias, surveillance and class design (§7)

Because anyone can "roll their own classifier" by writing classes, how classes are designed shapes both accuracy and harm (§7). The probes, which the authors call preliminary:

  • FairFace. A linear probe on CLIP beats FairFace's own model and an Instagram-pretrained ResNeXt on most race, gender and age tests; gender accuracy is above 95% for every race group (Table 3, Table 5). The authors stress that benchmark accuracy is not fairness, and that higher accuracy on under-represented groups can be used to justify deployments that harm them (§7.1).
  • Denigration. With "animal", "gorilla", "chimpanzee", "orangutan", "thief", "criminal" and "suspicious person" added to the classes, 4.9% of 10,000 FairFace images (CI 4.6 to 5.4%) were classified as non-human; images of Black people about 14% (12.6 to 16.4%), all other groups under 8%; people aged 0 to 20 most often, at 14%. 16.5% of men against 9.8% of women landed in crime classes, about 18% of under-20s. Adding a "child" class drastically reduced both for under-20s (Table 6, Table 7).
  • Members of Congress. 100% gender accuracy; but at a 0.5% label threshold "nanny" and "housekeeper" appear for women and "prisoner" and "mobster" for men; with the labels of commercial vision APIs, hair and appearance words go to women, "executive" and "doctor" to men, much as Schwemmer et al. found for Google Cloud Vision (Figure 18).
  • Surveillance. On 515 CCTV images from 12 sequences, coarse scene classification is 91.8% top-1, falling to 51.1% when one "close" caption is added (it picks the close one 40.7% of the time); detecting small objects is near random. Zero-shot celebrity identification: 59.2% top-1 among 100 names, 43.3% among 1,000 (Table 8). The authors judge the appeal for surveillance low where supervised systems exist, but note CLIP lowers the skill needed for niche uses (§7.2). OpenAI's model card puts any deployed use, and surveillance and facial recognition in all cases, out of scope (model card).

Limitations the authors list

§6
  • Far from the state of the art. Zero-shot CLIP is on average only competitive with a linear probe on ResNet-50, itself well below the best results; the authors estimate about 1,000× more compute would be needed to reach the state of the art with this recipe, "infeasible to train with current hardware", so efficiency has to improve.
  • Weak tasks. Fine-grained classes (car models, flower species, aircraft variants), abstract or systematic tasks such as counting, and novel tasks like distance to the nearest car can be near chance.
  • Truly out-of-distribution data. 88% on MNIST handwritten digits, beaten by logistic regression on raw pixels; retrieval finds almost nothing MNIST-like in WIT. CLIP sidesteps brittle generalisation by hoping everything is in distribution, an assumption MNIST breaks.
  • Fixed choices. It can only choose among the concepts it is given, unlike a captioner; joint contrastive and generative training is suggested as a fix.
  • Data efficiency. 12.8 billion images over 32 epochs would take 405 years at one per second (recomputed: 400M × 32 ÷ seconds per year = years).
  • Methodology. Full validation sets were queried repeatedly during development, "unrealistic for true zero-shot scenarios"; and the 27-dataset suite is "somewhat haphazardly assembled" and "undeniably co-adapted with the development and capabilities of CLIP". A benchmark designed for zero-shot transfer would help.
  • Social biases from uncurated web pairs (section 7), and concepts that are hard to specify in text; the zero-to-few-shot drop is the opposite of human learning (§6).

Why it matters beyond the paper

CLIP made images and text directly comparable in one space, where a classifier is just text. That made classification open-vocabulary, brought prompt engineering into vision and recentred robustness evaluation on zero-shot transfer. It is in most of today's multimodal stack:

  • Vision towers for language models. LLaVA connects "the pre-trained CLIP visual encoder ViT-L/14" to an LLM (LLaVA); InternVL scales the vision side to 6 billion parameters, aligned "using web-scale image-text data" (InternVL); Qwen-VL adds a visual receptor to its language model (Qwen-VL).
  • Generation. Stable Diffusion conditions its U-Net on "the (non-pooled) text embeddings of a CLIP ViT-L/14 text encoder" (CompVis README) through cross-attention layers (LDM; see the Latent Diffusion page); DALL-E 2 (unCLIP) generates a CLIP image embedding from a caption, then decodes it (unCLIP); CLIPScore rates captions without references (CLIPScore); CLIP-score guidance of generators is also common practice (not separately sourced here).
  • Data curation. LAION-400M and LAION-5B were filtered by CLIP similarity (LAION-400M, LAION-5B); DataComp and Data Filtering Networks made such filtering a research problem in itself, so CLIP-style models now curate the data their successors train on (DataComp, DFN; the curation methods and their measured gains are on Vision encoders).
  • Successors. ALIGN, OpenCLIP, EVA-CLIP, MetaCLIP and the SigLIP line, which replaces the batch softmax with a per-pair sigmoid (SigLIP); step through them in Then and now.
    The successors, each with its source

    ALIGN (Google, noisier data at a larger scale than "similar": 1.8B alt-text pairs, 4.5 times WIT, with minimal filtering; 76.4% zero-shot ImageNet, ALIGN), OpenCLIP's open reproductions and contrastive scaling laws (Cherti et al.), EVA-CLIP (EVA-CLIP), MetaCLIP (MetaCLIP), and the SigLIP line (2023), which replaces the batch softmax with a per-pair sigmoid to decouple the loss from the batch size (SigLIP); SigLIP 2 (2025) adds captioning and self-supervised losses.

  • Retrieval. The paper anticipates image search "given text, or relevant text given an image" (§7); LAION-400M was released with "their CLIP embeddings and kNN indices that allow efficient similarity search" (LAION-400M).
Usage claims carried over from the old page (dated; unconfirmed, checked 2 October 2026)
  • The old version of this page also traced "the lineage behind frontier multimodal models" to CLIP towers; closed models do not document their encoders, so that is unconfirmed.
  • It called SigLIP 2 "today's default open vision tower", a claim about usage this page has not checked.
  • That cross-modal search became "a commodity capability in vector databases", as the old version of this page put it, is unconfirmed here.

Connections

How much of this to believe

What holds up.

  • The headline numbers are reproducible by anyone, because the weights were released: 76.2% zero-shot ImageNet is a measurement on a 50,000-image test set (a binomial standard error of about √(0.76 × 0.24 / 50,000) ≈ 0.19 points), and open reproductions on public data reached and passed it: OpenCLIP's ViT-H/14 on LAION-2B scores 78.0% (OpenCLIP), DataComp-1B trains a ViT-L/14 to 79.2% with "the same training procedure and compute" (DataComp), and MetaCLIP's re-creation of WIT's curation beats WIT at ViT-B (70.8% against 68.3%) (MetaCLIP).
  • The linear-probe comparison is as fair as such studies get: one protocol, the same L2 search, every model's public weights, and the 12-dataset suite reported first to limit selection bias (§3.2). Recomputing from Tables 10 and 11 reproduces 16 of 27 wins (Figure 5), 21 of 27 (Figure 11), the 2.6-point margin, and a correlation of 0.81 against the printed 0.82 (tables tab).
  • Contamination is measured, not assumed, with significance tests, and is small (§5).
  • The authors state most weaknesses themselves: the Visual N-Grams comparison is "not a direct methods comparison", validation sets were queried during development, the 27-dataset suite is co-adapted with CLIP (§3.1.3, §6). That counts in their favour.

What to read with care.

  • "Contrastive is 4× more efficient" is one comparison at one scale. Figure 2 is single runs of a ResNet-50 up to 400M images processed (one of the 32 epochs), scored on zero-shot ImageNet, a metric on which contrastive models are known to scale better; it has no error bars. Later, with data, compute and capacity matched, captioners gave vision encoders "competitive with contrastively pretrained encoders" on classification and better on vision-language tasks, while still lagging on zero-shot classification with a gap that "becomes smaller with increasing scale" (CapPa, 2023).
  • "Robust because zero-shot" is the authors' hypothesis, and they say so. A controlled follow-up tested five causes (data size, training distribution, language at training, language at test, the contrastive loss) and found "the more diverse training distribution is the main cause", the others contributing little (Fang et al., 2022). The toy above shows the same split. The fine-tuning result also depends on the method: ensembling the weights of the zero-shot and fine-tuned models "provides large accuracy improvements under distribution shift, while preserving high accuracy on the target distribution" (WiSE-FT, 2021).
  • Prompt engineering may be partly tuned to the test. The paper does not say how the 80 ImageNet prompts and the per-dataset templates were chosen, and it says full validation sets were queried repeatedly during development (§6); some of the "almost 5 points" may be selection on the evaluation distribution.
  • "Matches ResNet-50" compares unlike things: zero-shot from the largest CLIP (ViT-L/14@336px, 12 days on 256 V100s plus a 336-pixel epoch) against the 2015 ResNet-50; at matched architecture CLIP's zero-shot RN50 scores 59.6% (Table 11). The paper says this; summaries often do not.
  • Single runs throughout. No seeds or intervals for the training runs; the authors note individual zero-shot evaluations are noisy and cannot separate run-to-run variance from real effects (Figure 9).
  • Not a compositional model. Contrastive training on web data rewards bag-of-words shortcuts; CLIP-like models "blunder when linking objects to their attributes" and lack order sensitivity (Yuksekgonul et al., 2022). The toy shows a version of this: its bag-of-words text encoder beat its Transformer. Minimal-pair failures (binding, counting, typographic attacks) measured on today's encoders are on Vision encoders.
Small inconsistencies in the paper's own numbers
  • Small inconsistencies in the paper's own numbers: Figure 5 disagrees with Tables 10 and 11 on KITTI (−34.0 against −45.2) and UCF101 (+7.7 against +5.7); Figure 13 and Table 16 differ on ImageNet-A (77.1, 77.2); §2.4 gives a 49,152 vocabulary and Table 18 49,408; Table 9 lists Food-101 with 102 classes; the 3.8-point ObjectNet drop only matches Table 16 after removing the 2.3 points from ObjectNet's own class names (tables tab). None changes a conclusion.

Verdict: believe the method and the measurements; they have been re-run more than almost any vision result. Treat the efficiency ratio as a 2021, ResNet-50-scale finding, and the robustness story as a statement about diverse data rather than about language or zero-shot inference.

What it takes to use this

  • Code and licence. openai/CLIP releases the model code and weights under the MIT licence; not the training code and not WIT, which OpenAI said it will not release (model card). OpenAI's model card scopes the models to research and calls any deployed use "currently out of scope". For training, OpenCLIP is the open implementation, with models trained on LAION and DataComp data.
  • Budget. The paper's largest runs took 3,072 (ViT-L/14) and 10,656 (RN50x64) V100-days at a batch of 32,768 (§2.5); the contrastive loss wants a big batch because the batch supplies the negatives, the reason SigLIP introduced a per-pair loss that "performs better at smaller batch sizes" (SigLIP). Most users never train one: they download a checkpoint.
  • When it pays off. Zero-shot or few-shot classification and retrieval over everyday web concepts; a frozen feature extractor; a filter for image-text data; a vision tower for a language model.
  • When it buys little. Specialised imagery (satellite, medical, traffic signs), counting and spatial relations, fine-grained categories rare on the web, and text in handwriting: there a supervised model or fine-tuning wins (section 6). Expect results to move with how classes are worded, and test the class design, as the bias probes show (§7.1).