Understanding Contrastive Learning Through the Lens of Margins
Not on the map. Why?
Abstract (arXiv)
Contrastive learning, along with its variations, has been a highly effective self-supervised learning method across diverse domains. Contrastive learning measures the distance between representations using cosine similarity and uses cross-entropy for representation learning. Within the same framework of cosine-similarity-based representation learning, margins have played a significant role in enhancing face and speaker recognition tasks. Interestingly, despite the shared reliance on the same similarity metrics and objective functions, contrastive learning has not actively adopted margins. Furthermore, decision-boundary-based explanations are the only ones that have been used to explain the effect of margins in contrastive learning. In this work, we propose a new perspective to understand the role of margins based on gradient analysis. Based on the new perspective, we analyze how margins affect gradients of contrastive learning and separate the effect into more elemental levels. We separately analyze each and provide possible directions for improving contrastive learning. Our experimental results demonstrate that emphasizing positive samples and scaling gradients depending on positive sample angles and logits are the keys to improving the generalization performance of contrastive learning in both seen and unseen datasets, and other factors can only marginally improve performance.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 34 of its 42 references that are in the map. First posted on arXiv 20 Jun 2023.
Builds on
34 of 42 references.
References · 34
- 2015Deep Residual Learning for Image Recognitioncited by 51,809
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 11,979
- 2014ImageNet Large Scale Visual Recognition Challengecited by 8,441
- 2018Representation Learning with Contrastive Predictive Codingcited by 7,662
- 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,482
- 2020Bootstrap your own latent: A new approach to self-supervised Learningcited by 4,712
- 2013Distributed Representations of Words and Phrases and their Compositionalitycited by 3,462
- 2020Exploring Simple Siamese Representation Learningcited by 2,853
- 2020Unsupervised Learning of Visual Features by Contrasting Cluster Assignmentscited by 2,845
- 2021HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Unitscited by 2,301
22 more
- 2020Improved Baselines with Momentum Contrastive Learningcited by 2,282
- 2018Unsupervised Feature Learning via Non-Parametric Instance-level Discriminationcited by 1,838
- 2021An Empirical Study of Training Self-Supervised Vision Transformerscited by 1,610
- 2016Context Encoders: Feature Learning by Inpaintingcited by 1,424
- 2020Big Self-Supervised Models are Strong Semi-Supervised Learnerscited by 1,375
- 2015Unsupervised Visual Representation Learning by Context Predictioncited by 1,062
- 2018CosFace: Large Margin Cosine Loss for Deep Face Recognitioncited by 968
- 2017In Defense of the Triplet Loss for Person Re-Identificationcited by 784
- 2020ECAPA-TDNN: Emphasized Channel Attention, Propagation and Aggregation in TDNN Based Speaker Verificationcited by 606
- 2020Understanding the Behaviour of Contrastive Losscited by 397
- 2022AdaFace: Quality Adaptive Margin for Face Recognitioncited by 390
- 2020Debiased Contrastive Learningcited by 354
- 2021MagFace: A Universal Representation for Face Recognition and Quality Assessmentcited by 332
- 2020CurricularFace: Adaptive Curriculum Learning Loss for Deep Face Recognitioncited by 320
- 2021Provable Guarantees for Self-Supervised Deep Learning with Spectral Contrastive Losscited by 311
- 2021ElasticFace: Elastic Margin Loss for Deep Face Recognitioncited by 143
- 2020Learning Diverse and Discriminative Representations via the Principle of Maximal Coding Rate Reductioncited by 141
- 2019AdaCos: Adaptively Scaling Cosine Logits for Effectively Learning Deep Face Representationscited by 83
- 2021ReSSL: Relational Self-Supervised Learning with Weak Augmentationcited by 83
- 2022Rethinking Minimal Sufficient Representation in Contrastive Learningcited by 67
- 2022Incorporating Bias-aware Margins into Contrastive Loss for Collaborative Filteringcited by 29
- 2022Marginal Contrastive Correspondence for Guided Image Generationcited by 19
Built on by
Citing papers per year: 2024: 1; 2025: 2.
3 papers.
- 2025CLOC: Contrastive Learning for Ordinal Classification with Multi-Margin N-pair Losscited by 11
- 2025Unmasking Puppeteers: Leveraging Biometric Leakage to Expose Impersonation in AI-Based Videoconferencingcited by 2
- 2024Train Once for All: A Transitional Approach for Efficient Aspect Sentiment Triplet Extractioncited by 0
- 2025Unmasking Puppeteers: Leveraging Biometric Leakage to Expose Impersonation in AI-Based Videoconferencing3 Oct 2025
- 2025CLOC: Contrastive Learning for Ordinal Classification with Multi-Margin N-pair Loss22 Apr 2025
- 2024Train Once for All: A Transitional Approach for Efficient Aspect Sentiment Triplet Extraction29 Nov 2024