Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere

Tongzhou Wang, Phillip Isola
5/20/2020
2,773 citations
cs.LGcs.CVstat.ML
contrastive-ssl

Official code: ssnl/align_uniform (470 stars, Python, MIT, last commit 2022-07-16).

Abstract

Contrastive representation learning has been outstandingly successful in practice. In this work, we identify two key properties related to the contrastive loss: (1) alignment (closeness) of features from positive pairs, and (2) uniformity of the induced distribution of the (normalized) features on the hypersphere.

Show full abstract

We prove that, asymptotically, the contrastive loss optimizes these properties, and analyze their positive effects on downstream tasks. Empirically, we introduce an optimizable metric to quantify each property. Extensive experiments on standard vision and language datasets confirm the strong agreement between both metrics and downstream task performance. Remarkably, directly optimizing for these two metrics leads to representations with comparable or better performance at downstream tasks than contrastive learning. Project Page: https://tongzhouwang.info/hypersphere Code: https://github.com/SsnL/align_uniform , https://github.com/SsnL/moco_align_uniform

View on arXivView PDF

Code Implementations(1)

ssnl/align_uniformOfficial100%
MIT

Open source code for paper "Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere" ICML 2020

47037PythonMay 17, 20204 years agoMIT

Similar Papers

Cite this paper

@article{wang2020understanding,
  title  = {Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere},
  author = {Tongzhou Wang and Phillip Isola},
  year   = {2020},
  eprint = {2005.10242},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2005.10242}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2005.10242.svg)](https://codeofpaper.com/paper/2005.10242)

Discussion