# What is Contrastive learning? Definition and meaning

Trains an encoder so that two views of the same item land close in embedding space while different items land far apart.

## Definition

**Contrastive learning**: Trains an encoder so that two views of the same item land close in embedding space while different items land far apart.

In short: Learning embeddings by pulling similar items together and pushing others apart.

## When it is used

Representation learning, retrieval and similarity search, and class-aware embeddings for tables and images.

## Learn more

The full guide to **[Contrastive learning](/tools/contrastive-learning)** explains how it works, when to use it and how it compares with the alternatives, with examples. The [glossary](/glossary) lists every term on the site from A to Z.

Previous term: [Continued pre-training](/glossary/continued-pre-training) · Next term: [ControlNet](/glossary/controlnet)
