Perfectly Balanced: Improving Transfer and Robustness of Supervised Contrastive Learning

Mayee F. Chen, Daniel Y. Fu, Avanika Narayan, Michael Zhang, Zhao Song +2 more
4/15/2022
stat.MLcs.LG
contrastive-ssl

Official code: HazyResearch/thanos-code (31 stars, Python, Apache-2.0, last commit 2022-07-13).

Abstract

An ideal learned representation should display transferability and robustness. Supervised contrastive learning (SupCon) is a promising method for training accurate models, but produces representations that do not capture these properties due to class collapse -- when all points in a class map to the same representation.

Show full abstract

Recent work suggests that "spreading out" these representations improves them, but the precise mechanism is poorly understood. We argue that creating spread alone is insufficient for better representations, since spread is invariant to permutations within classes. Instead, both the correct degree of spread and a mechanism for breaking this invariance are necessary. We first prove that adding a weighted class-conditional InfoNCE loss to SupCon controls the degree of spread. Next, we study three mechanisms to break permutation invariance: using a constrained encoder, adding a class-conditional autoencoder, and using data augmentation. We show that the latter two encourage clustering of latent subclasses under more realistic conditions than the former. Using these insights, we show that adding a properly-weighted class-conditional InfoNCE loss and a class-conditional autoencoder to SupCon achieves 11.1 points of lift on coarse-to-fine transfer across 5 standard datasets and 4.7 points on worst-group robustness on 3 datasets, setting state-of-the-art on CelebA by 11.5 points.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Code release for the paper Perfectly Balanced: Improving Transfer and Robustness of Supervised Contrastive Learning

314Python, MakefileApr 18, 20224 years agoApache-2.0

Similar Papers

Cite this paper

@article{chen2022perfectly,
  title  = {Perfectly Balanced: Improving Transfer and Robustness of Supervised Contrastive Learning},
  author = {Mayee F. Chen and Daniel Y. Fu and Avanika Narayan and Michael Zhang and Zhao Song and Kayvon Fatahalian and Christopher Ré},
  year   = {2022},
  eprint = {2204.07596},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2204.07596}
}

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/2204.07596.svg)](https://codeofpaper.com/paper/2204.07596)

Discussion