Intriguing Properties of Contrastive Losses

Ting Chen, Lala Li

Abstract

We study three intriguing properties of contrastive learning. First, we generalize the standard contrastive loss to a broader family of losses, and we find that various instantiations of the generalized loss perform similarly under the presence of a multi-layer non-linear projection head. Second, we study if instance-based contrastive learning (with a global image representation) can learn well on images with multiple objects present. We find that meaningful hierarchical local features can be learned despite the fact that these objectives operate on global instance-level features. Finally, we study the phenomenon of feature suppression among competing features shared across augmented views, such as "color distribution" vs "object class". We construct datasets with explicit and controllable competing features, and show that, for contrastive learning, a few bits of easy-to-learn shared features can suppress, and even fully prevent, the learning of other sets of competing features. In scenarios where there are multiple objects in an image, the dominant object would suppress the learning of smaller objects. Existing contrastive learning methods critically rely on data augmentation to favor certain sets of features over others, and could suffer from learning saturation for scenarios where existing augmentations cannot fully address the feature suppression. This poses open challenges to existing contrastive learning techniques.

Introduction

Contrastive learning frameworks like SimCLR and MoCo have significantly advanced self-supervised vision. However, the underlying mechanics—specifically why certain loss formulations work better than others and why specific augmentations are indispensable—remain partially understood. This paper investigates three key areas: the sensitivity of models to specific loss formulations, the ability of global objectives to learn local features, and the bottleneck of feature suppression.

Loss Invariance and the Projection Head

Standard contrastive learning typically relies on the NT-Xent loss, which encourages representations to align on a hypersphere. The authors decompose this loss into two components: Alignment (similarity between views) and Distribution Matching (spreading representations according to a prior). By utilizing Sliced Wasserstein Distance (SWD), the researchers tested whether matching different prior distributions (e.g., Gaussian, Hypercube) affected performance.

Top-1 accuracy across different loss formulations and datasets. Note how performance converges as the projection head depth increases to 3 layers.

The results indicate that the specific mathematical form of the loss is less critical than the architecture of the projection head. As the non-linear projection head becomes deeper (3+ layers), the performance differences between various loss formulations (SWD vs. NT-Xent) largely disappear, achieving nearly identical Top-1 accuracy on ImageNet (~71%).

Global Objectives, Local Features

A common concern in contrastive learning is whether a single global vector can represent complex scenes with multiple objects. To test this, the authors developed the MultiDigits dataset, featuring multiple MNIST digits on a single canvas.

Examples from the MultiDigits dataset, showing random and grid-based placement of multiple digits.

Surprisingly, models trained with global instance-level losses naturally learn hierarchical local features. K-means clustering on intermediate layers revealed that the model groups pixels into edges, then parts, and finally full objects. On MultiDigits, SimCLR maintained high accuracy (~98-99%) even with 8 or more digits present, performing on par with supervised models.

The "Easy Feature" Trap: Feature Suppression

The most significant finding of the study is the phenomenon of feature suppression. Contrastive models are prone to learning the "easiest" shared information between two augmented views. If a simple feature—such as a specific color distribution or a few bits of shared random noise—is sufficient to satisfy the distribution matching objective, the model stops learning more complex, useful features like object shapes.

In experiments using the RandBit dataset, the authors found that adding just 15 bits of shared random information caused the model to ignore visual content entirely, dropping accuracy to near-random levels. This explains why color jittering is a critical augmentation: it breaks the "easy" color-based link, forcing the model to seek out harder, more robust features.

Conclusion

While contrastive learning is robust to loss variations and capable of learning local hierarchies from global signals, it is highly susceptible to feature suppression. This "saturation" occurs when easy-to-learn features satisfy the objective, preventing the model from discovering more difficult but valuable representations. Future work may need to look toward generative objectives, which appear more robust to such suppression, to overcome these inherent bottlenecks in self-supervised learning.

Summary updated

Abstract

We study three intriguing properties of contrastive learning. First, we generalize the standard contrastive loss to a broader family of losses, and we find that various instantiations of the generalized loss perform similarly under the presence of a multi-layer non-linear projection head. Second, we study if instance-based contrastive learning (with a global image representation) can learn well on images with multiple objects present. We find that meaningful hierarchical local features can be learned despite the fact that these objectives operate on global instance-level features. Finally, we study the phenomenon of feature suppression among competing features shared across augmented views, such as "color distribution" vs "object class". We construct datasets with explicit and controllable competing features, and show that, for contrastive learning, a few bits of easy-to-learn shared features can suppress, and even fully prevent, the learning of other sets of competing features. In scenarios where there are multiple objects in an image, the dominant object would suppress the learning of smaller objects. Existing contrastive learning methods critically rely on data augmentation to favor certain sets of features over others, and could suffer from learning saturation for scenarios where existing augmentations cannot fully address the feature suppression. This poses open challenges to existing contrastive learning techniques.
BibTeX
@inproceedings{chen2021intriguing,
  author = {Ting Chen and Lala Li},
  title = {{Intriguing Properties of Contrastive Losses}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=rYhBGWYm6AU},
}

Loading related content...

Figure