What Is Contrastive Learning?
Contrastive learning is a self-supervised training technique that teaches models to create useful data representations by pulling similar examples closer together and pushing dissimilar examples apart in an embedding space.
How Contrastive Learning Works
In contrastive learning, the model is trained on pairs or groups of examples and must learn which are similar and which are different. For instance, two augmented versions of the same image should map to nearby vectors, while different images should map to distant vectors. This approach produces powerful, general-purpose representations without requiring labeled data. OpenAI's CLIP model used contrastive learning to align text and image representations, enabling zero-shot image classification. Contrastive learning is foundational to modern embedding models, search systems, and multimodal AI.
Real-World Examples
CLIP learning to associate images and text descriptions by training on 400 million image-text pairs with contrastive loss
A facial recognition system learning that different photos of the same person should have similar embeddings
A music recommendation engine using contrastive learning to group songs with similar vibes in embedding space