Index Ai Academy
Glossary · Phase 5 · Transformers

Contrastive learning

Training that pulls the embeddings of matching pairs (like a question and its answer) together and pushes mismatched pairs apart.

A plain encoder doesn't make a good embedding model straight away. It's trained further with contrastive learning. The model sees pairs that belong together, such as a question and its answer. Training pulls their vectors closer. It pushes the vectors of unrelated texts apart. The result is an embedding model like the ones used for semantic search and RAG.

Try it now

The difference comes down to who can see what.

Learn it properly

Encoders and embedding models · BERT-style models and where they fit. About 30 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write