The problem: every new category costs an annotation campaign
Before 2021, training a computer vision model meant painstakingly assembling a labeled dataset. Want to recognize 1,000 object categories? You need thousands of hand-annotated images for each one. ImageNet, the benchmark dataset, holds 1.28 million training images across 1,000 classes. A colossal effort, and still limited: your model recognizes those 1,000 classes and nothing else. Adding a 1,001st category means going back to annotate.
CLIP inverts that logic. CLIP stands for Contrastive Language–Image Pre-training. Instead of rigid labels chosen up front, CLIP uses free-form text as its supervision: 400 million image-text pairs scraped from the web (a photo and its caption, say). No army of annotators needed, the supervision already exists, lying around all over the internet.
Learning Transferable Visual Models From Natural Language Supervision (Radford et al., 2021)Rather than learning 1,000 fixed categories, CLIP learns to place images and sentences on a single map, so that a photo of a cat lands next to the sentence "a photo of a cat." Classifying an unfamiliar image then needs no training at all: you just check which of your candidate descriptions it sits closest to on that map. The model no longer has to memorize each object, it can, in effect, read the label.
The architecture: two encoders producing comparable vectors

Two encoders, trained together
An encoder is a neural network that takes an input and emits a list of numbers, a vector. CLIP runs two of them, trained simultaneously:
- the image encoder: a Vision Transformer (a transformer applied to images, almost always abbreviated ViT) or a Residual Network (ResNet), turning each image into a vector;
- the text encoder: an ordinary transformer, turning each sentence into a vector.
The crucial point: the two vectors have the same number of components and live in the same space, which is what makes comparing them meaningful. Picture a huge conceptual map: a photo of a cat and the sentence "a photo of a cat" end up in the same neighborhood. A mountain photo and "a snowy mountain landscape" do too.
This confusion is common and expensive, especially when reading a technical description. The two encoders are learned parameters: their weights are tuned during training, then frozen. The vectors they produce are computed activations: they depend on whichever image or sentence you submit right now, and do not exist beforehand. A shipped CLIP model is nothing but the two sets of weights; the vectors get recomputed on every query. Saying "CLIP stores one vector per class" only makes sense if you add that this is a cache computed once, not a parameter of the model.
Contrastive learning: pull the right pairs together, push the rest apart
"Contrastive" is not a metaphor, it is the exact mechanism. Take a batch of image-text pairs pulled from the web. Each pair is correct by construction: the image and its caption belong together. Now shuffle, and form every possible combination:
- : correct pair, pull the two vectors together;
- : incorrect pair, push them apart;
- : incorrect pair, push apart;
- : correct pair, pull together.
In a batch of pairs you get correct matches to pull together and incorrect ones to push apart. It is a matching game: show the model images and captions in scrambled order and have it work out which caption goes with which image. "Push" and "pull" cash out concretely as adjustments to the weights of both encoders, in the direction that raises the similarity of good pairs and lowers that of bad ones.
One detail that matters: the incorrect pairs are not manufactured on purpose, they are simply the other pairs in the batch. The bigger the batch, the more wrong answers to rule out, the harder the task, and the richer the learning signal. That is why CLIP was trained with enormous batches: the paper reports a batch size of 32,768.
The formula, and what it says
For a given image, the loss is:
Symbol by symbol:
- and : the vectors for image number and its own caption, the correct pair.
- : the cosine similarity between two vectors, a number between and measuring whether they point the same way. = same direction, = unrelated directions. Detail in norms and distances.
- : the temperature. It divides every similarity before they are compared. A low temperature widens the gaps and makes the model decisive; a high one flattens them. In CLIP the temperature is not hand-tuned, it is one more learned parameter, adjusted during training alongside the encoder weights.
- : the sum over all texts in the batch, the correct caption included.
- and : the exponential and the logarithm, which turn similarities into probabilities and then into a quantity to minimize. Plumbing, not ideas, you can skip them.
Read back as one sentence: the loss is small when the similarity between the image and its true caption dominates the similarities between that image and every other caption in the batch. The same thing is done symmetrically the other way round (for each text, against every image in the batch) and the two are added.
Classifying with no examples: zero-shot
Zero-shot means literally zero examples: the model is asked to handle a category without ever having been shown a single labeled example of it, and with no retraining. Its counterpart is few-shot, a handful of examples.
How you actually classify an image
To sort an image into one of categories of your choosing, including categories that existed nowhere during training:
- write one sentence per category: "a photo of a [category]";
- run the sentences through the text encoder, giving vectors;
- run the image through the image encoder, giving 1 vector;
- compute the cosine similarity between the image vector and each of the text vectors;
- the category whose sentence is most similar wins.
No retraining, no weight updates. All the work happened during pre-training: building a space in which images and sentences are comparable.
How you word the sentence matters
The phrasing of the candidate sentences changes the results:
- "a photo of a cat" beats "cat", a little context helps, because web captions are sentences, not isolated words;
- "a photo of a cat, a type of pet animal" does better still;
- ensembling: averaging the vectors of several phrasings of the same concept improves the result further.
This is not a footnote. It shows that the model is not classifying "categories" at all, it is comparing sentences, and the quality of the sentence is part of the system.
The paper's abstract states the central claim: the best CLIP model matches the accuracy of the original ResNet-50 on ImageNet zero-shot, without using any of that dataset's 1.28 million training images. The corresponding figure, reported in the paper for the ViT-L/14 at 336 pixels variant, is 76.2% top-1 accuracy, "top-1" meaning the single highest-scoring answer is the right one. For scale, the same table gives 11.5% for the best prior attempt at zero-shot ImageNet classification.
Note what the number does not say: it applies to one specific model variant, at one specific resolution, with a tuned set of candidate sentences. See how to read a benchmark score.
Why CLIP still matters
The visual front end of vision-language models
CLIP was the reference image encoder for much of the open vision-language model (VLM) ecosystem: LLaVA builds on CLIP ViT-L/14, InternVL derived its own variant (InternViT). SigLIP (below) now competes for that slot in newer models. The principle is unchanged, and spelled out in Vision-Language Models: you bolt an image encoder onto a language model.
Searching images with words
Because images and sentences inhabit the same space, text-to-image search becomes trivial: encode "a sunset over the ocean," retrieve the nearest image vectors. No task-specific training. This is the machinery behind natural-language search in photo libraries.
Guiding image generation
- DALL·E 2 uses CLIP to encode the user's text.
- Stable Diffusion uses CLIP's text encoder (via OpenCLIP).
- The CLIP score became a common metric for how well a generated image matches its prompt: encode both, take the cosine similarity.
Transfer learning
CLIP's representations reuse well on new tasks with few examples: freeze the encoder, train a small classifier on top. See transfer learning in vision.
The successors
SigLIP (Google)
Sigmoid Loss for Language–Image Pre-training. SigLIP replaces CLIP's loss, which normalizes across the whole batch, with a pairwise sigmoid loss: each (image, text) couple is judged on its own (do these two belong together, yes or no) with no need to know the similarities of the entire batch. The consequence stated in the paper's abstract: batch size decouples from the loss, which makes small batches work better, and past roughly 32,000 the returns on growing the batch fall off quickly.
Sigmoid Loss for Language Image Pre-Training (Zhai et al., 2023)The same paper reports 84.5% zero-shot ImageNet accuracy, but for a variant called SigLiT, which starts from an already pre-trained, frozen image encoder. It is therefore not comparable to CLIP's figure above, which trains from scratch.
OpenCLIP
An open reproduction of CLIP by LAION (Large-scale Artificial Intelligence Open Network), with models trained on much larger public datasets (LAION-2B, DataComp). This is what put vision-language representations within reach outside the large labs, and it is the variant found inside Stable Diffusion.
EVA-CLIP
Aims to cut CLIP's training cost through input masking and assorted architectural optimizations. The authors claim comparable performance for cheaper training; we have not verified the speedup factor, so check the paper before relying on it.
DINOv2 (Meta)
An alternative approach with no text at all. DINOv2 learns from images alone, by self-supervision: the training signal comes from comparing two different views of the same image, not from a caption. It yields visual features complementary to CLIP's, with a different target: fine-grained spatial understanding rather than high-level semantics.
DINOv2: Learning Robust Visual Features without Supervision (Oquab et al., 2023)CLIP answers "what is this?" well, classification, text search, anything that requires naming. DINOv2 does better on "where is it?" and "what texture?", segmentation, point correspondence between images. To attach vision to a language model, a CLIP- or SigLIP-style encoder is the usual pick; for fine segmentation, DINOv2 is often preferred.
The limits
Web biases, inherited as-is
CLIP absorbs whatever its 400 million pairs contain: visual stereotypes, underrepresentation of some cultures, and spurious correlations, two things that often co-occur on the web end up linked in the vector space even with no real relationship. If the web massively associates "doctor" with images of men, CLIP will reproduce that association.
One vector per image, so no geometry
CLIP collapses a whole image into a single global vector, which flattens positional information. It grasps "there is a cat and a dog" but stumbles on "the cat is to the left of the dog." The same limitation explains why it counts objects poorly.
CLIP can say "there is a cat in this image," not "the cat is bottom-left, next to the vase." Locating or cutting out requires other models: YOLO (You Only Look Once) for detection, SAM (Segment Anything Model) for segmentation, or CLIP extensions such as OWL-ViT for zero-shot detection and CLIPSeg for segmentation.
Perspective
CLIP is among the most reused contributions of the decade. Its fingerprints are on vision-language models, image search engines, and image generators. What it contributes is one transferable idea, and that is what makes it interesting from an intellectual-property standpoint: training two encoders to emit comparable vectors is enough to bridge two modalities, and nothing requires those modalities to be image and text. The same template has since been applied to audio, video, molecules, and time series.
1. A CLIP model is delivered to a customer. What exactly does the shipped file contain?
2. How does CLIP classify an image into a category it never saw labeled during training?
3. During contrastive training, where do the incorrect image-text pairs that the model learns to push apart come from?
4. CLIP easily recognizes a cat and a dog in an image, yet stumbles on « the cat is to the left of the dog ». Why?