Introduction
In deep learning, classification has traditionally relied on the Cross-Entropy (CE) Loss. While CE provides essential probabilistic outputs for uncertainty estimation and model calibration, it is often fragile and prone to overfitting, particularly when data is scarce or noisy. Conversely, Supervised Contrastive (SupCon) Loss has emerged as a robust alternative for representation learning by pulling similar samples together and pushing dissimilar ones apart. However, SupCon lacks a natural probabilistic interpretation and typically requires a two-stage training process.
This paper introduces ESupCon (Extended Supervised Contrastive loss), a novel objective function that unifies these two paradigms. By treating classifier weights as "prototypes" within the embedding space, ESupCon achieves the robustness of contrastive learning while maintaining the probabilistic clarity of cross-entropy in a single, unified training step.
Bridging the Gap: The ESupCon Approach
The authors propose a geometric and probabilistic unification of contrastive and cross-entropy losses through two primary mechanisms:
- Joint Prototype Learning: The weights of the final linear layer are treated as class prototypes (anchors) within the same embedding space as the data samples. By maximizing similarity between a sample and its corresponding prototype, the model learns a geometric representation where prototypes act as class centroids.
- Extended Contrastive Formulation: In standard SupCon, an image only contrasts against other images in a batch. ESupCon extends this by forcing images to contrast against both other samples and the class prototypes simultaneously.
Mathematically, the authors demonstrate that ESupCon serves as a smooth approximation of the maximum of the CE and SupCon losses. This ensures the model satisfies the requirements of both discriminative classification and robust representation learning.
Experimental Evaluation
The researchers evaluated ESupCon against standard benchmarks including CIFAR-10, CIFAR-100, Tiny ImageNet, and Caltech256. To test the limits of the proposed method, they focused on three "stress" scenarios:
- Low-Sample Regimes: Training with very few images per class.
- Imbalanced Data: Scenarios where some classes have significantly more data than others.
- Noisy Labels: Training sets containing intentionally mislabeled samples.
Results and Discussion
ESupCon demonstrated significant performance gains over traditional methods, particularly in challenging environments.
Superior Robustness in Low-Data Regimes
One of the most striking results occurred in the low-sample scenario. As shown in the table below, on CIFAR-10 with only 2,000 samples (N=2K), ESupCon achieved 74.08% accuracy, dwarfing the 28.02% achieved by standard Cross-Entropy. This suggests that the "power of pairs"—the increased number of comparisons between samples and prototypes—provides a critical regularizing effect when data is sparse.
Handling Noise and Imbalance
In experiments with 50% noisy labels, ESupCon maintained higher accuracy than CE, indicating it is less prone to memorizing incorrect labels. The contrastive nature of the loss keeps the embedding space organized even when individual labels are unreliable. Furthermore, the method consistently matched or exceeded state-of-the-art performance in fully-supervised settings across all tested datasets.
Conclusion and Future Work
ESupCon successfully bridges the gap between contrastive representation learning and probabilistic classification. By integrating class prototypes into the contrastive framework, the model gains a geometric understanding of classes that translates to superior robustness in low-data and noisy environments.
Future research may explore the application of ESupCon to modern architectures like Vision Transformers (ViTs) and its effectiveness in more complex downstream tasks such as object detection, segmentation, and out-of-distribution (OOD) detection.
Summary updated