Abstract
This paper introduces Generalized Contrastive Loss (GCL), a unified mathematical framework that bridges supervised metric learning and unsupervised contrastive learning. By utilizing a fourth-order affinity tensor, GCL enables a single model to learn from labeled, unlabeled, or mixed datasets. Applied to speaker recognition, GCL achieves state-of-the-art results in semi-supervised settings, demonstrating significant performance gains particularly in low-label regimes.
Introduction
Deep learning typically relies on two distinct paradigms: supervised learning, which requires extensive manual labeling, and unsupervised learning, which leverages large-scale raw data. In speaker recognition—the task of verifying a speaker's identity from voice clips—integrating these two approaches has been challenging. Supervised methods like triplet loss are effective but label-hungry, while unsupervised methods like SimCLR do not inherently utilize available labels.
This research addresses this gap by proposing a unified framework that seamlessly handles varying ratios of labeled to unlabeled data without altering the underlying loss function.
Generalized Contrastive Loss (GCL)
The core innovation is the Generalized Contrastive Loss (GCL). Standard contrastive learning pulls "positive" pairs together and pushes "negative" pairs apart. GCL formalizes this through a fourth-order affinity tensor ($\alpha$):
- Positive $\alpha$: Encourages similarity between representations.
- Negative $\alpha$: Pushes representations apart.
- Zero $\alpha$: Ignores the relationship.
By configuring this tensor, GCL can generalize several prominent loss functions, including Prototypical Episode Loss, NT-Xent (SimCLR), and margin-based losses like ArcFace. For semi-supervised learning, the model processes a mini-batch containing both labeled ($B_0$) and unlabeled ($B_1$) samples. The affinity tensor manages relationships across all pairs (labeled-labeled, unlabeled-unlabeled, and cross-pairs), allowing the model to learn from the entire data distribution simultaneously.
Experimental Setup
The framework was evaluated on the VoxCeleb dataset, a benchmark for speaker recognition.
- Training: VoxCeleb2 (dev) with over 1 million utterances from ~6,000 speakers.
- Evaluation: VoxCeleb1 (test) consisting of 37,000 enrollment-test pairs.
- Implementation: A standard ResNet18 architecture was used, with data augmentation (noise, music, reverberation) via the Kaldi toolkit to enhance robustness.
Key Results and Insights
GCL demonstrates that supervised and unsupervised contrastive learning are ends of the same spectrum. A major advantage is that GCL is a drop-in loss function requiring no architectural changes.
The framework is exceptionally effective in low-label scenarios. As shown in the performance analysis, adding unlabeled data via GCL significantly reduces the Equal Error Rate (EER) compared to purely supervised baselines when only a few labeled speakers are available.
In specific benchmarks:
- Semi-Supervised: GCL achieved an EER of 6.01%, outperforming self-supervised embedding baselines (6.31%).
- Unsupervised: GCL reached an EER of 15.26%, significantly beating cross-modal audio-visual baselines (20.09%) despite using only audio data.
- Supervised: GCL performed competitively (2.56% EER), though specialized losses like AM-Softmax (1.81%) still hold an edge in fully labeled scenarios.
Conclusion and Future Work
While GCL provides a powerful unified framework, a performance gap remains compared to specialized supervised losses. Future work may involve fine-tuning GCL-trained models with these specialized losses or adopting more advanced architectures like ECAPA-TDNN. Additionally, exploring the scalability of GCL with massive unlabeled datasets remains a promising direction for achieving even higher recognition accuracy.
Summary updated