Abstract
A prominent technique for self-supervised representation learning has been to contrast semantically similar and dissimilar pairs of samples. Without access to labels, dissimilar (negative) points are typically taken to be randomly sampled datapoints, implicitly accepting that these points may, in reality, actually have the same label. Perhaps unsurprisingly, we observe that sampling negative examples from truly different labels improves performance, in a synthetic setting where labels are available. Motivated by this observation, we develop a debiased contrastive objective that corrects for the sampling of same-label datapoints, even without knowledge of the true labels. Empirically, the proposed objective consistently outperforms the state-of-the-art for representation learning in vision, language, and reinforcement learning benchmarks. Theoretically, we establish generalization bounds for the downstream classification task.
Introduction
Contrastive learning has become a dominant force in self-supervised learning. The standard approach involves creating multiple "views" of a single image (positives) and contrasting them against a set of random images from the dataset (negatives). The goal is to learn a representation space where positives are pulled together and negatives are pushed apart. However, this recipe contains a hidden flaw: sampling bias.
The Sampling Bias Problem
In a typical unsupervised setting, we lack labels. When we sample "negative" examples for an anchor image, we simply select random images from the dataset. This leads to a non-negligible chance that a chosen negative is actually semantically similar to the anchor—a "false negative."
As illustrated in Figure 1, these false negatives create a "tug-of-war" effect where the model is simultaneously told to group similar images together and treat them as different entities. This bias significantly hampers representation quality compared to an ideal scenario where only true negatives are sampled.
Proposed Method: Debiased Contrastive Loss
To address this, we introduce a Debiased Contrastive Loss. Instead of accepting the biased empirical estimate, we derive a mathematical correction to approximate the true negative distribution. By modeling the data as a mixture of positive (same class) and negative (different class) distributions, we can express the desired negative term using only observable quantities: the unlabeled data and the positive augmentations.
This approach is elegant in its simplicity, requiring only a rough estimate of the class prior (the probability that two random samples belong to the same class). It can be implemented with just a few lines of code in existing frameworks like SimCLR.
Key Results
The debiased objective consistently outperforms standard contrastive methods across vision, language, and reinforcement learning benchmarks.
In computer vision, the debiased loss improved STL10 top-1 accuracy by 4.26%. As shown in Figure 4, the method is robust across different negative sample sizes and benefits significantly from using multiple positive views ($M > 1$), which stabilizes the correction term. In NLP, it improved sentence embeddings on downstream classification tasks, and in RL, it achieved higher scores with lower variance than the state-of-the-art CURL baseline in the DeepMind control suite.
Conclusion and Future Work
Debiased contrastive learning identifies and corrects a fundamental flaw in unsupervised representation learning. By mathematically accounting for false negatives, we achieve significant performance gains without requiring labels. Future work may explore applying this debiasing to extreme long-tail distributions or using small amounts of labeled data to further refine the class prior estimate.
Summary updated