Contrastive Learning Is Spectral Clustering On Similarity Graph

Yifan Zhang,Zhi-Hao Tan,Jingqin Yang,Yang Yuan
DOI: https://doi.org/10.48550/arXiv.2303.15103
2023-03-27
Abstract:Contrastive learning is a powerful self-supervised learning method, but we have a limited theoretical understanding of how it works and why it works. In this paper, we prove that contrastive learning with the standard InfoNCE loss is equivalent to spectral clustering on the similarity graph. Using this equivalence as the building block, we extend our analysis to the CLIP model and rigorously characterize how similar multi-modal objects are embedded together. Motivated by our theoretical insights, we introduce the Kernel-InfoNCE loss, incorporating mixtures of kernel functions that outperform the standard Gaussian kernel on several vision datasets. The code is available at https://github.com/yifanzhang-pro/Kernel-InfoNCE.
Computer Science,Mathematics
What problem does this paper attempt to address?