English

Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere

Machine Learning 2022-08-17 v9 Computer Vision and Pattern Recognition Machine Learning

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. 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

Keywords

Cite

@article{arxiv.2005.10242,
  title  = {Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere},
  author = {Tongzhou Wang and Phillip Isola},
  journal= {arXiv preprint arXiv:2005.10242},
  year   = {2022}
}

Comments

International Conference on Machine Learning (ICML), 2020

R2 v1 2026-06-23T15:41:46.046Z