Pull together, push apart
The previous lesson ended on the collapse problem: making two views of an image agree, on its own, lets the model cheat by mapping everything to a constant. Contrastive learning blocks that cheat with a second force.
The idea has two parts working against each other. For a given image, its two augmented views form a positive pair, and their embeddings are pulled together. Every other image in the batch is a negative, and its embedding is pushed apart from the anchor. Attraction alone would collapse; repulsion alone would scatter meaninglessly. Together they carve out a representation where each image sits near its own augmentations and far from everything else. This push-and-pull is the entire mechanism, and it was the first approach to make joint-embedding SSL competitive with supervised pretraining.

