← AI Terminology

CLIP - Contrastive Language-Image Pretraining

CLIP stands for Contrastive Language-Image Pretraining: a model from OpenAI (2021) trained to align images and text in a shared embedding space by learning that matching image-caption pairs should be close and non-matching pairs should be far apart.

It enables zero-shot image classification and powers image generation systems like DALL-E.
Why It Matters in AI
CLIP demonstrated that training on 400M image-text pairs from the web produces a visual model that generalises remarkably without any task-specific labelling — you can classify images into new categories just by describing them in text. It became the visual backbone of DALL-E, Stable Diffusion, and most multimodal models, and introduced contrastive learning as a dominant pre-training paradigm for vision.
Key Points
Aspect Description
Zero-shot Classify images by comparing to text descriptions: `P(y
Limitations Weaker on fine-grained distinctions (specific dog breeds); biased toward web-scraped text style
Architecture Dual encoder: image encoder (ViT or ResNet) + text encoder (Transformer) — embeddings matched
Open variants OpenCLIP (LAION), SigLIP (Google), MetaCLIP — open-source alternatives with larger training data
Role in gen AI CLIP score guides DALL-E / Stable Diffusion — used to filter and rank generated images
Training signal Contrastive: maximise cosine similarity of (image, caption) pairs; minimise mismatched pairs
Simple Analogy
CLIP learns to match photos to their captions by studying 400 million photo-caption pairs — like a student who memorises which images go with which descriptions until they understand visual concepts deeply enough to identify new ones from a text description alone.
Common Usage Examples
  • from transformers import CLIPModel; model.get_image_features(pixel_values) — extract image embeddings
  • Zero-shot classification: compare image embedding to ["a cat", "a dog", "a bird"] text embeddings
  • Stable Diffusion uses CLIP text encoder to convert prompts into conditioning vectors
  • CLIP-guided diffusion: use CLIP score as a loss to steer image generation toward a text prompt
  • open_clip.create_model_and_transforms('ViT-H-14', pretrained='laion2b_s32b_b79k') — OpenCLIP
Summary
In short: CLIP learned to match images with text by contrasting 400M web pairs — enabling zero-shot visual classification and powering the text-to-image generation revolution.