Contrastive learning has emerged as a dominant paradigm in self-supervised learning, enabling models to learn robust representations by maximizing similarity between positive pairs and minimizing it for negative ones. While empirical success is widespread, the theoretical underpinnings of the standard InfoNCE loss have remained elusive. This paper provides a formal proof that InfoNCE is equivalent to performing spectral clustering on a similarity graph defined by data augmentations.
The Theoretical Bridge
The authors establish a connection between contrastive learning and graph theory by treating the similarity graph ($\pi$) and the embedding Gram matrix ($K_Z$) as Markov Random Fields (MRFs). They demonstrate that minimizing the InfoNCE objective is equivalent to minimizing the cross-entropy between these two distributions.
This equivalence reveals that the "attraction" and "repulsion" terms in InfoNCE mirror the Laplacian operator used in spectral clustering. Furthermore, the similarity in contrastive learning is fundamentally defined by the augmentation process; the probability of two images originating from the same source defines the edge weights in the graph being clustered.
Methodology: MRFs and Graph Sampling
A key challenge in this analysis is the computational difficulty of comparing large similarity matrices directly. The authors address this by decomposing the similarity graph into subgraphs through MRF sampling.
As illustrated above, the similarity graph $\pi$ can be viewed as a distribution over possible subgraphs. This perspective allows the authors to prove that the standard loss function used in practice—without the modifications suggested by previous theoretical works—is already performing spectral clustering "under the hood."
Kernel-InfoNCE: Principled Improvements
Leveraging these insights, the authors propose Kernel-InfoNCE. By applying the Maximum Entropy Principle, they argue that exponential kernels are the most natural choice for this framework. They introduce a mixture of Gaussian and Laplacian kernels to better capture local similarity structures.
Empirical evaluations on CIFAR-10, CIFAR-100, and TinyImageNet demonstrate consistent improvements. For instance, on CIFAR-100, the "Simple Sum Kernel" achieved 68.62% accuracy, significantly outperforming the standard SimCLR baseline of 66.29%. Additionally, the authors extend their analysis to multi-modal models like CLIP, showing it performs generalized spectral clustering on a bipartite graph of image-text pairs.
Conclusion
By unifying contrastive learning with spectral clustering, this work provides a solid theoretical foundation for self-supervised learning. It explains the success of existing methods like SimCLR and CLIP while offering a principled path forward through kernel selection and graph-theoretic insights. Future work may involve searching for specialized kernels for specific tasks and scaling these insights to massive multi-modal datasets.
Summary updated