A Theoretical Framework for Preventing Class Collapse in Supervised Contrastive Learning

Chungpa Lee, Jeongheon Oh, Kibok Lee, Jy-yong Sohn

Abstract

Supervised contrastive learning (SupCL) has emerged as a prominent approach in representation learning, leveraging both supervised and self-supervised losses. However, achieving an optimal balance between these losses is challenging; failing to do so can lead to class collapse, reducing discrimination among individual embeddings in the same class. In this paper, we present theoretically grounded guidelines for SupCL to prevent class collapse in learned representations. Specifically, we introduce the Simplex-to-Simplex Embedding Model (SSEM), a theoretical framework that models various embedding structures, including all embeddings that minimize the supervised contrastive loss. Through SSEM, we analyze how hyperparameters affect learned representations, offering practical guidelines for hyperparameter selection to mitigate the risk of class collapse. Our theoretical findings are supported by empirical results across synthetic and real-world datasets.

Introduction

Supervised Contrastive Learning (SupCL) is a powerful paradigm that leverages both data augmentations (self-supervision) and class labels (supervision) to learn robust representations. However, a persistent challenge in SupCL is class collapse: a state where all embeddings within a single class converge to the exact same point in the embedding space. While this minimizes training loss, it eliminates the intra-class diversity necessary for high-performance transfer learning. If all images of a class collapse to one vector, the model loses the nuanced features (like breed or color) essential for downstream tasks.

This paper introduces the Simplex-to-Simplex Embedding Model (SSEM), a theoretical framework that characterizes the geometric structure of optimal SupCL embeddings and provides practical guidelines for hyperparameter selection to prevent collapse.

The Simplex-to-Simplex Embedding Model (SSEM)

The core contribution of this work is the SSEM, which models optimal embeddings as a spectrum between two geometric extremes. At one end is the $(m-1)$-simplex Equiangular Tight Frame (ETF), where classes are collapsed to single points. At the other is the $(nm-1)$-simplex ETF, where every instance is equally distant from all others.

The SSEM framework models the transition of embeddings from a collapsed state (a) to a diverse state (b, c) using the parameter $\delta$.

The authors mathematically prove that any set of embeddings minimizing the SupCL loss must follow this SSEM structure. The transition between these states is controlled by a parameter $\delta$. When $\delta = 0$, class collapse occurs. The goal for practitioners is to select hyperparameters that ensure $\delta > 0$, maintaining a "Goldilocks" level of within-class diversity.

Hyperparameter Guidelines and Empirical Validation

By analyzing the SSEM, the authors derive a closed-form condition (Theorem 2) relating the loss-weighting coefficient ($\alpha$) and the temperature parameter ($\tau$). This condition defines a boundary in the hyperparameter space beyond which class collapse is inevitable. If the self-supervised weight ($\alpha$) is too low relative to the temperature ($\tau$), the supervised component dominates, leading to total collapse.

Heatmaps showing the alignment between theoretical predictions and experimental results for within-class variance across different $\alpha$ and $\tau$ values. The dashed red line indicates the theoretical collapse boundary.

Empirical validation on synthetic data and real-world datasets like CIFAR-10 and ImageNet-100 confirms these theoretical findings. The experiments show that within-class variance is a reliable proxy for representation quality. Total collapse (zero variance) and total spread (maximum variance) both lead to suboptimal downstream performance. On ImageNet-100, the best transfer performance across 12 downstream tasks consistently occurred at moderate variance levels (e.g., $\alpha \approx 0.5$).

Key Insights for Practitioners

  • Temperature Sensitivity: Lower temperatures ($\tau \approx 0.1$) are generally safer and allow for a wider range of $\alpha$ values that avoid collapse.
  • Variance as a Proxy: Within-class variance is a reliable indicator of transfer learning success. A moderate variance state is often superior to pure self-supervision or pure supervision.
  • Superiority over Variants: Properly tuned standard SupCL formulations can outperform specialized "anti-collapse" losses like $L_{spread}$.

Conclusion and Future Work

The SSEM framework provides a rigorous mathematical foundation for understanding and controlling the geometry of embeddings in SupCL. While the current theory assumes a sufficiently large embedding dimension and uniform data distribution, it offers immediate practical value for hyperparameter tuning. Future research may extend this model to handle long-tailed datasets and the specific training dynamics of different neural architectures.

Summary updated

BibTeX
@inproceedings{lee2025theoretical,
  author = {Chungpa Lee and Jeongheon Oh and Kibok Lee and Jy-yong Sohn},
  title = {{A Theoretical Framework for Preventing Class Collapse in Supervised Contrastive Learning}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2025},
  url = {https://openreview.net/forum?id=ElvhiUFA02},
}
Figure