On the Similarities of Embeddings in Contrastive Learning

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Lee, Chungpa, Lim, Sehee, Lee, Kibok, Sohn, Jy-yong
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915390626463744
author Lee, Chungpa
Lim, Sehee
Lee, Kibok
Sohn, Jy-yong
author_facet Lee, Chungpa
Lim, Sehee
Lee, Kibok
Sohn, Jy-yong
contents Contrastive learning operates on a simple yet effective principle: Embeddings of positive pairs are pulled together, while those of negative pairs are pushed apart. In this paper, we propose a unified framework for understanding contrastive learning through the lens of cosine similarity, and present two key theoretical insights derived from this framework. First, in full-batch settings, we show that perfect alignment of positive pairs is unattainable when negative-pair similarities fall below a threshold, and this misalignment can be mitigated by incorporating within-view negative pairs into the objective. Second, in mini-batch settings, smaller batch sizes induce stronger separation among negative pairs in the embedding space, i.e., higher variance in their similarities, which in turn degrades the quality of learned representations compared to full-batch settings. To address this, we propose an auxiliary loss that reduces the variance of negative-pair similarities in mini-batch settings. Empirical results show that incorporating the proposed loss improves performance in small-batch settings.
format Preprint
id arxiv_https___arxiv_org_abs_2506_09781
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle On the Similarities of Embeddings in Contrastive Learning
Lee, Chungpa
Lim, Sehee
Lee, Kibok
Sohn, Jy-yong
Machine Learning
Contrastive learning operates on a simple yet effective principle: Embeddings of positive pairs are pulled together, while those of negative pairs are pushed apart. In this paper, we propose a unified framework for understanding contrastive learning through the lens of cosine similarity, and present two key theoretical insights derived from this framework. First, in full-batch settings, we show that perfect alignment of positive pairs is unattainable when negative-pair similarities fall below a threshold, and this misalignment can be mitigated by incorporating within-view negative pairs into the objective. Second, in mini-batch settings, smaller batch sizes induce stronger separation among negative pairs in the embedding space, i.e., higher variance in their similarities, which in turn degrades the quality of learned representations compared to full-batch settings. To address this, we propose an auxiliary loss that reduces the variance of negative-pair similarities in mini-batch settings. Empirical results show that incorporating the proposed loss improves performance in small-batch settings.
title On the Similarities of Embeddings in Contrastive Learning
topic Machine Learning
url https://arxiv.org/abs/2506.09781