Definition
Contrastive learning is a representation-learning technique that teaches a model to produce useful vectors by comparison: it pulls positive pairs (data that belong together) closer in the embedding space while pushing negative pairs (distinct data) apart. Because it needs only the notion of which items match, rather than human-applied class labels, it is a leading form of self-supervised learning.
Positive and Negative Pairs
Positive pairs are typically two augmented views of the same item, for example the same image after cropping and after rotation. Negative pairs are the representations of every other item in the batch. The model learns an encoder that maps both views of a positive pair to nearby points while keeping them far from the negatives. SimCLR, a landmark framework, builds positive pairs through random augmentation, encodes them, projects them, and applies a contrastive loss; for a batch of N images, each positive pair is contrasted against 2(N-1) negatives.
Why It Matters Locally
Contrastive learning lets you pre-train strong feature extractors on your own unlabeled data, no annotation budget required. The resulting embeddings power downstream tasks like search and classification, all on hardware you own.
Contrastive learning is a flavor of self-supervised learning, and the geometry it shapes is often measured with cosine similarity.
In Simple Terms
Contrastive learning is a representation-learning technique that teaches a model to produce useful vectors by comparison: it pulls positive pairs (data that belong together) closer…
