AI engineering glossary · NLP embeddings

What is in-batch negatives?

In-batch negatives: A cheap way to get negative examples in contrastive training: for each pair in a batch, treat the positives of all the other pairs in the same batch as its negatives. Larger batches give more negatives per pair at no extra encoding cost.

Level: advancedTopic: NLP embeddings

In-batch negatives: an example

A batch of 64 question-answer pairs gives each question 63 negative answers for free.

Related terms

More NLP embeddings terms

Where you learn it

In-batch negatives is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.