All models

CLIP

OpenAI's CLIP: an image tower and a text tower trained to match 400 million captions to their images.

Multimodal · 964 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (13 KB)

Open in a new tab

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

Family
CLIP
Parameters
151.3M
Operations
964
Framework
PyTorch
Recurrent
No
Published
ICML 2021
Cited by
56,822 (as of 5 October 2026)
Authors
Alec Radford, Jong Wook Kim, Chris Hallacy and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m14428
Graph hash
733551003f37205592f3dff5a692754f4066f862a965a77f538c473a3f47f9ef
Skeleton hash
c8b9a0e246a7bb440a89aafb82f869aece5772c2a5a78a729eceb6db4a3d1f41
Architecture hash
a42b28769554deff7bc38c49e1d5e830e638361f837500345b48de51fb4980ac
Diagram SHA-256
bb9ed1d7eff9189fb147a977a926728885f944eb4e88af5197049b7e74983bef
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

About this model's family

CLIP learns image representations from scratch by predicting which caption goes with which image, over a dataset of 400 million image and text pairs collected from the internet. The point is to escape the fixed set of predetermined object categories that standard computer vision systems are trained to predict, a restriction that needs new labeled data for every new visual concept. After pre-training, natural language is used to reference learned visual concepts, or describe new ones, enabling zero-shot transfer to downstream tasks.

Given a batch of N image and text pairs, CLIP is trained to predict which of the N by N possible pairings across the batch actually occurred. The members traced here use the ViT-B/32 configuration: a ViT-B/32 Transformer as the image encoder and a masked self-attention Transformer as the text encoder, trained to maximize the similarity of image and text pairs via a contrastive loss. The original implementation had two variants, one with a ResNet image encoder and one with a Vision Transformer.

The paper trained a series of 5 ResNets and 3 Vision Transformers. The Vision Transformers were a ViT-B/32, a ViT-B/16, and a ViT-L/14, all trained for 32 epochs. The model's output is an image-text similarity score per candidate text, and its softmax gives the label probabilities, which is the zero-shot classification the traced members perform.

Benchmarked on over 30 existing computer vision datasets spanning OCR, action recognition in videos, geo-localization and fine-grained object classification, the model transfers non-trivially to most tasks. It matches the accuracy of the original ResNet-50 on ImageNet zero-shot without using any of the 1.28 million training examples that ResNet-50 was trained on. Code and pre-trained model weights are released in the OpenAI CLIP repository.

Key idea. Contrastive pre-training on 400 million web image and text pairs yields image representations that natural language can steer to new tasks zero-shot.

  • clip
  • Contrastive Language-Image Pre-training
  • CLIPModel
  • openai clip
  • clip-vit-base-patch32
  • ViT-B/32
  • zero-shot image classification
  • image-text similarity
  • open_clip

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{radford2021learningtransferablevisualmodels,
      title={Learning Transferable Visual Models From Natural Language Supervision}, 
      author={Alec Radford and Jong Wook Kim and Chris Hallacy and Aditya Ramesh and Gabriel Goh and Sandhini Agarwal and Girish Sastry and Amanda Askell and Pamela Mishkin and Jack Clark and Gretchen Krueger and Ilya Sutskever},
      year={2021},
      eprint={2103.00020},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2103.00020}, 
}