Understanding Contrastive Learning through Variational Analysis and Neural Network Optimization Perspectives
Jeff Calder, Wonjun Lee
TL;DR
This work analyzes SimCLR through a variational lens and neural-network optimization dynamics, revealing that minimizing the NT-Xent loss alone can yield invariant minimizers independent of the data distribution, while the training dynamics of neural networks inject information about the data geometry into the latent space. By formulating a generalized loss with a neural-kernel perspective and studying a one-hidden-layer network, the authors show how cluster structure can persist during training and how gradient flow, especially under infinite-width limits, can emphasize or suppress contributions from different clusters. The results connect theoretical optimality conditions with practical training dynamics, explaining why contrastive learning often yields meaningful embeddings despite potential ill-posedness of the objective. These insights offer a principled view of when and how contrastive methods uncover latent structure and suggest directions for rigorously analyzing training dynamics in mean-field and infinite-width regimes.
Abstract
The SimCLR method for contrastive learning of invariant visual representations has become extensively used in supervised, semi-supervised, and unsupervised settings, due to its ability to uncover patterns and structures in image data that are not directly present in the pixel representations. However, the reason for this success is not well-explained, since it is not guaranteed by invariance alone. In this paper, we conduct a mathematical analysis of the SimCLR method with the goal of better understanding the geometric properties of the learned latent distribution. Our findings reveal two things: (1) the SimCLR loss alone is not sufficient to select a good minimizer -- there are minimizers that give trivial latent distributions, even when the original data is highly clustered -- and (2) in order to understand the success of contrastive learning methods like SimCLR, it is necessary to analyze the neural network training dynamics induced by minimizing a contrastive learning loss. Our preliminary analysis for a one-hidden layer neural network shows that clustering structure can present itself for a substantial period of time during training, even if it eventually converges to a trivial minimizer. To substantiate our theoretical insights, we present numerical results that confirm our theoretical predictions.
