Abstract
Supervised Contrastive (SupCon) learning is a powerful paradigm for classification, yet its heavy reliance on multi-view data augmentations imposes significant computational costs. We introduce Self-Contrastive (SelfCon) learning, a novel single-view framework that leverages a multi-exit architecture to generate diverse feature representations from a single input image. By contrasting features from intermediate sub-networks with final backbone outputs, SelfCon achieves superior accuracy while cutting memory and training time by roughly half compared to SupCon. Our approach demonstrates exceptional transferability across various downstream tasks, including fine-grained recognition and semantic segmentation.
The Computational Bottleneck of Contrastive Learning
Standard Cross-Entropy (CE) loss, while ubiquitous, often leads to models with high generalization error. Supervised Contrastive (SupCon) learning mitigates this by structuring the representation space such that same-class samples are clustered and different-class samples are separated. However, SupCon's "multi-viewed" requirement—needing multiple augmented versions of every image per batch—doubles the pixel-level processing, leading to massive overhead in memory and time. The central challenge is achieving these contrastive benefits without the associated computational burden.
Self-Contrastive (SelfCon) Methodology
To eliminate the need for redundant data augmentation, SelfCon shifts the "view" generation from the input space to the architectural space. It employs a multi-exit framework where a sub-network (an early exit branch) is attached to an intermediate layer of the backbone.
Instead of augmenting the input image, SelfCon augments the architecture. It passes a single image through the network and contrasts the final output of the backbone with the output of the intermediate sub-network. Because these layers process data at different depths, they provide naturally distinct "views" of the same image in the feature space.
Theoretical analysis shows that the SelfCon loss maximizes the lower bound of the label-conditional mutual information (MI) between the intermediate and final features. This forces the network to retain class-relevant information throughout its entire depth.
Key Insights and Performance
SelfCon treats sub-networks as feature-space augmentations, effectively providing "positive pairs" without altering input pixels. This approach offers several advantages:
- Mitigating Vanishing Gradients: Calculating contrastive loss at an intermediate layer injects strong gradient signals earlier in the network.
- Efficiency Gains: On ImageNet using a ResNet-50, SelfCon requires only 59% of the memory and 48% of the training time compared to standard SupCon.
- Accuracy Improvements: Despite being cheaper to train, SelfCon improves ImageNet top-1 accuracy by +0.6% over SupCon.
- Free Ensemble: The dual-classifier structure (sub-network + backbone) allows for an ensemble during inference, yielding a +3.0% gain over standard Cross-Entropy and a +1.5% gain over SupCon on ImageNet.
Transferability and Future Work
Encoders pre-trained with SelfCon learn highly generalizable representations. When transferred to downstream tasks, SelfCon outperformed SupCon by up to +6.8% on fine-grained classification and +4.4% on semantic segmentation.
While the current framework struggles in purely unsupervised settings due to potential representation collapse, it represents a major step toward efficient, domain-agnostic contrastive learning. Future work may explore auxiliary networks as substitutes for data augmentation in domains where standard pixel transformations are not applicable.
Summary updated