Abstract
Contrastive self-supervised learning (SSL) typically produces dense, deterministic representations. We introduce Stochastic Contrastive Learning (StochCon), which integrates prescribed latent variable distributions, such as Bernoulli and Gaussian, into the SimCLR framework. This approach yields highly compressed and interpretable representations while improving downstream fine-tuning performance on major vision benchmarks like CIFAR10 and ImageNet.
Introduction
State-of-the-art contrastive SSL models, such as SimCLR and BYOL, have significantly narrowed the performance gap with fully supervised models. However, these models typically map inputs to deterministic, continuous feature vectors, lacking the ability to infer latent variables—a capability central to generative models like Variational Autoencoders (VAEs). Latent variable models are highly desirable as they allow for uncertainty attribution, task-specific data compression, and the generation of interpretable, discrete representations. StochCon addresses the challenge of injecting these probability distributions into large-scale contrastive SSL without compromising competitive performance.
Methods
StochCon modifies the standard SimCLR framework by introducing an asymmetric stochastic bottleneck. While standard SimCLR maximizes similarity between two augmented views of an image, StochCon forces the representation of one branch through a pathwise differentiable distribution.
The architecture outputs the natural parameters of a distribution (e.g., mean and variance), from which a latent variable $z'$ is sampled. The authors explored two primary distributions:
- Isotropic-Gaussian: Utilizes the standard reparameterization trick. To prevent variance collapse, the network estimates the variance of the opposing view's representation.
- Gumbel-Bernoulli: Uses a continuous relaxation to allow backpropagation through discrete binary variables.
The latent variable can be projected into a lower-dimensional bottleneck (e.g., $d=64$) before being upsampled for the contrastive loss. This mechanism encourages the model to learn a compressed representation that retains essential information for the contrastive task.
Results and Insights
Experiments conducted on CIFAR10 and ImageNet demonstrate that adding stochasticity improves fine-tuning performance.
Performance Benchmarks
StochCon (Bernoulli) achieves superior fine-tuned accuracy compared to standard SimCLR:
- CIFAR10 (ResNet50): 96.42% vs. 94.35% (SimCLR) and 95.00% (Supervised).
- ImageNet (ResNet50): 77.49% vs. 76.37% (SimCLR).
- ImageNet (ResNet200): 80.24% vs. 79.82% (SimCLR).
Compression and Interpretability
The use of Bernoulli latent variables enables extreme data compression. The authors report a 588x reduction in representation size when using binary outputs compared to standard floats. Furthermore, these discrete features are highly efficient; on CIFAR10, a Random Forest required only 11 binary feature units from a 64-dimensional latent space to achieve high classification accuracy. The model also demonstrates high capacity utilization, maximizing information entropy by using available bits effectively (e.g., 50% zeros and 50% ones in a 512-dimensional bottleneck).
Conclusion
StochCon successfully integrates stochastic latent variables into contrastive SSL, providing a path toward more interpretable and compressed representations without sacrificing performance. While the frozen linear probe performance of the Bernoulli variant currently lags slightly behind the Gaussian version—likely due to temperature annealing schedules—the gains in fine-tuning accuracy are significant. Future research may explore alternative distributions, such as pathwise Beta distributions or non-parametric latent variables like normalizing flows, to further enhance the richness of SSL representations.
Summary updated