Dissecting Supervised Contrastive Learning
arXiv:2102.08817
Abstract
Minimizing cross-entropy over the softmax scores of a linear map composed with a high-capacity encoder is arguably the most popular choice for training neural networks on supervised learning tasks. However, recent works show that one can directly optimize the encoder instead, to obtain equally (or even more) discriminative representations via a supervised variant of a contrastive objective. In this work, we address the question whether there are fundamental differences in the sought-for representation geometry in the output space of the encoder at minimal loss. Specifically, we prove, under mild assumptions, that both losses attain their minimum once the representations of each class collapse to the vertices of a regular simplex, inscribed in a hypersphere. We provide empirical evidence that this configuration is attained in practice and that reaching a close-to-optimal state typically indicates good generalization performance. Yet, the two losses show remarkably different optimization behavior. The number of iterations required to perfectly fit to data scales superlinearly with the amount of randomly flipped labels for the supervised contrastive loss. This is in contrast to the approximately linear scaling previously reported for networks trained with cross-entropy.
v4 updates: - updated appendix section S1.3 - this includes fixing an oversight in the proofs (Lemma 1 missed an equality condition, which now appears in Lemma 2) - improved figure quality
References in corpus (9)
- Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift
- Improved Baselines with Momentum Contrastive Learning
- Data-Efficient Image Recognition with Contrastive Predictive Coding
- Contrastive Representation Learning: A Framework and Review
- Prevalence of Neural Collapse during the terminal phase of deep learning training
- Characterizing Implicit Bias in Terms of Optimization Geometry
- Hyperspherical Prototype Networks
- Analyzing and Improving Representations with the Soft Nearest Neighbor Loss
- Convergence of Gradient Descent on Separable Data