In search, a model can compare a query with a relevant item and with an item that looks similar but is not a good answer. Training on those contrasts helps it distinguish real matches from superficial overlap.
The method is only as useful as its examples and evaluation. Poorly chosen pairs may teach the model the wrong distinction, while a strong offline result still needs testing in live retrieval.
ELI5
Contrastive learning teaches by showing what belongs together and what does not. The AI learns to notice differences that matter for the task.
For example, a shopper searching for puppy food should be matched with puppy food, not a dog toy that merely shares the word dog. Comparing those examples can improve search.
What does contrastive learning compare?
It compares examples that should match with examples that should not, so the model can learn a useful boundary between them.
Is contrastive learning only used for shopping search?
No. It can be used in many tasks involving similarity, including finding related text, images, or other items.

