Paper Breakdowns  /  CLIP
Paper 14~7 min readOpenAI · 2021
Paper Breakdown

CLIP,
explained.

Vision models and language models each lived in their own universe, unable to talk. This 2021 paper built a shared one — a single map where a photo of a golden retriever and the words "a photo of a dog" land in the same neighborhood. That bridge between pixels and language is what lets you type a sentence and get back a picture.

Video breakdown
The animated walkthrough is in production.
Read the full breakdown below in the meantime ↓
01

Two separate worlds

Before CLIP, a vision model was trained on a fixed list of labels — say, the 1,000 categories of ImageNet — and could only ever recognize those. Ask it about anything outside its list and it was helpless. Worse, building it meant an army of humans hand-labeling millions of images into rigid buckets.

Meanwhile language models understood rich, open-ended text. The two never met. What if a model could learn about images the way a person browsing the web does — from pictures paired with the captions people wrote for them?

02

The idea: one shared space

CLIP — Contrastive Language-Image Pre-training — trains two encoders at once: one that turns an image into a vector, one that turns text into a vector. The goal is to align them so that a picture and its matching description land at nearly the same spot in a single shared embedding space.

Once images and words live on the same map, you can measure how well any picture matches any sentence just by checking how close their vectors are. Pixels and language become directly comparable.

03

How: contrastive learning at scale

Take a batch of image-caption pairs. Embed every image and every caption. Now train so each image is closest to its own caption and far from every other caption in the batch — pull the true pairs together, push the impostors apart.

Match each image to its caption (diagonal = correct pairs)
"a dog"
"a car"
"a tree"
🐕 image
·
·
🚗 image
·
·
🌳 image
·
·

Done across 400 million image-caption pairs scraped from the web — natural-language supervision, no hand-labeling — the two encoders converge into one aligned space. The scale of that freely-available data is what made it work.

The objective is precise. For a batch of N pairs, embed the images and captions, L2-normalize, and form the N×N cosine-similarity matrix scaled by a learned temperature. The correct match for row i is column i — the diagonal — so it's just cross-entropy, run both directions:

S = (I·Tᵀ)·e^τ  ·  loss = ½·[ CE(S, diag) + CE(Sᵀ, diag) ]  — every off-diagonal pair is a negative

One batch of N pairs supplies N positives and N²−N negatives for free — which is why a huge batch is part of the recipe.

Pull the true pair together, push all N−1 impostors in the row apart, symmetrically for columns. That's the entire training signal — and the runnable version below builds the matrix, computes the loss, and does zero-shot classification with it.

04

The payoff: zero-shot classification

Here's the trick that stunned people. Because CLIP compares images to text, you can classify an image into categories it was never trained on — just describe them. Want to tell cats from dogs? Embed the phrases "a photo of a cat" and "a photo of a dog," embed the image, and pick whichever text is closest.

Worth knowing

CLIP matched the accuracy of a fully supervised ImageNet-trained ResNet-50 without training on a single ImageNet label — recognizing the classes purely from their text descriptions. Change the label set by just typing new words.

05

Why it mattered

CLIP was remarkably robust and general: it held up across dozens of datasets and unusual image styles where narrow supervised models fell apart, because it learned from the messy diversity of the whole internet rather than one curated dataset.

LabelsNew categories
Supervised vision modelFixed list, hand-labeledNeeds retraining
CLIPAny text you writeJust describe them
06

Why it still matters

CLIP became the connective tissue of multimodal AI. Text-to-image models lean on it to steer generation — measuring how well an emerging image matches the prompt, so a diffusion model can be nudged toward your words. It powers multimodal search ("find photos that look like this sentence"), content moderation, and image captioning, and its contrastive recipe seeded a wave of vision-language models.

Its lasting idea is simple and profound: put different kinds of data into one shared space and comparison becomes trivial. Once images and words share a map, the boundary between seeing and reading starts to dissolve.

RUN IT YOURSELF

Build the contrastive matrix and classify zero-shot

CLIP's training signal is one similarity matrix, and its magic trick is what you can do with it afterward. This embeds three images and three captions in a shared space, builds the N×N cosine matrix (watch the diagonal dominate), and computes the symmetric contrastive loss — tiny when captions are aligned, huge when they're shuffled. Then the payoff: zero-shot classification, picking an image's label by nearest text, with no training on those labels. Change the embeddings and re-run.

CPython · WebAssembly
Frequently asked

Quick answers

What is CLIP?

A 2021 OpenAI model that trains an image encoder and a text encoder together on ~400M image-caption pairs, placing pictures and their descriptions in one shared vector space so they're directly comparable.

What is contrastive learning here?

For a batch of image-text pairs, pull each image toward its true caption and push it from all others — repeated at scale, this aligns the two encoders into one space.

What is zero-shot classification?

Classifying an image by comparing it to text labels you write ("a photo of a cat"), so CLIP recognizes categories it was never explicitly trained on.

How does it relate to text-to-image?

CLIP measures how well an image matches a prompt in one shared space; text-to-image models use that signal to steer diffusion generation toward the words.

Why train on internet captions?

It replaces expensive fixed labels with 400M freely available image-caption pairs — natural-language supervision that generalizes far more broadly.

Finished this one? 0 / 101 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns

Cite this page

Reference it in your work, paper or an AI's context window.

APASingh, S. (2026). CLIP. Vibe Engines. https://vibeengines.com/paper/clip
MLASingh, Saurabh. “CLIP.” Vibe Engines, 2026, vibeengines.com/paper/clip.
BibTeX
@online{vibeengines-clip,
  author       = {Singh, Saurabh},
  title        = {CLIP},
  year         = {2026},
  organization = {Vibe Engines},
  url          = {https://vibeengines.com/paper/clip}
}