Skip to content

AI Glossary · Concepts

What is Contrastive Learning?

Contrastive Learning

Contrastive learning is a way of training AI models by teaching them which examples are similar and which are different, so related items end up close together in the model's internal representation.

· Chain of Thought

  • 2 sources

Imagine showing a model two photos of the same dog, one cropped and one recolored, and telling it “these match,” then showing it a photo of a cat and saying “this one doesn’t.” Repeated millions of times, the model learns features that capture what makes images alike. The same idea works across types of data: OpenAI’s CLIP learned to match images with their captions from hundreds of millions of image-text pairs found online.

Because the “match” pairs can often be created automatically, for example by cropping the same image two ways, contrastive learning is a common form of self-supervised learning that needs little hand-labeled data.

Why it matters

Contrastive training is behind many embedding models that power semantic search, recommendations and retrieval for AI assistants, where the goal is to find items that mean the same thing even when the words differ.

No published Chain of Thought episode discusses contrastive learning directly yet, so this entry relies on the papers below.

Embeddings are the representations contrastive learning produces. Self-supervised learning is the broader training approach.

Sources