Probabilistic Contrastive Loss for Self-Supervised Learning

Shen Li, Jianqing Xu, Bryan HooiarXiv 2021

Introduction

Contrastive learning has become the cornerstone of self-supervised representation learning, powering state-of-the-art models like SimCLR and MoCo. These frameworks operate by pulling "positive" pairs (different augmentations of the same image) together and pushing "negative" pairs (different images) apart on a hypersphere. However, a significant limitation of current methods is their deterministic nature: they treat every augmented view as equally informative. This paper proposes a shift toward probabilistic contrastive loss, introducing a mechanism for models to quantify uncertainty for every view of an image.

Methodology: From Deterministic to Probabilistic

The authors bridge the gap between deterministic contrastive loss and probabilistic modeling through three primary innovations:

  1. Reinterpreting Temperature: In standard contrastive loss, a temperature hyperparameter ($\tau$) scales the similarity between features. The authors demonstrate that $\tau$ can be mathematically reinterpreted as the inverse square of the hypersphere's radius ($r = \sqrt{1/\tau}$), providing a physical grounding for the scaling factor.
  2. Probabilistic Embeddings: Instead of representing an image as a single point vector, the model represents it as a distribution on the hypersphere using the von Mises-Fisher (vMF) distribution. Often described as the "Gaussian of the sphere," the vMF distribution allows the model to output both a mean direction ($\mu$) and a concentration parameter ($\kappa$), which serves as a measure of confidence.
  3. Mutual Likelihood Score (MLS): The traditional dot product similarity is replaced by the Mutual Likelihood Score $s(x_i, x_j)$. This derived measure calculates the likelihood that two distributions overlap, integrating both the spatial alignment of the features and the model's confidence in those features.
Figure 1: Architecture for probabilistic contrastive learning. The encoder outputs both a feature embedding $\mu_i$ and a confidence value $\kappa_i$ for each augmented view.

As shown in Figure 1, the encoder is modified to produce a dual output. This allows the model to distinguish between high-quality views (e.g., a clear crop of an object) and low-quality views (e.g., a blurry background patch).

Theoretical Insights: The Similarity Landscape

The introduction of the confidence parameter $\kappa$ creates a dynamic similarity landscape that mimics human-like reasoning. This is characterized by two key behaviors:

  • Confidence as a Safety Valve: When a data augmentation produces an uninformative view—such as a patch of grass or a blurry edge—the model can assign it a low $\kappa$ value. This high uncertainty prevents noisy samples from significantly impacting the learned representations, effectively "downweighting" them during training.
  • Human-like Disagreement: The behavior of the similarity function $s$ changes based on the alignment ($\cos \theta$) between views. If two views are well-aligned, increasing confidence increases the similarity score. However, if two views point in different directions (low $\cos \theta$), high confidence actually decreases the similarity score.
Figure 5: The similarity landscape for low alignment ($\cos \theta = 0.3$). As confidence ($\kappa$) increases for disagreeing views, the similarity score $s$ decreases, reflecting a penalty for certain but conflicting predictions.

As illustrated in Figure 5, when views disagree ($\cos \theta = 0.3$), the similarity surface slopes downward as confidence increases. This mimics a logical scenario where two experts who are both certain but completely disagree are considered to have less "similar" views than two experts who are merely guessing.

Discussion and Future Work

While this paper provides a rigorous mathematical grounding for probabilistic contrastive loss, it remains a work in progress. The current derivation successfully integrates uncertainty quantification into a closed-form loss function, but several challenges remain:

  • Empirical Validation: The paper currently lacks quantitative results on standard benchmarks like ImageNet. Future work must determine if this theoretical advantage translates to improved top-1 accuracy on downstream tasks.
  • Computational Complexity: Calculating the Mutual Likelihood Score involves Bessel functions, which are more computationally intensive than standard dot products. Efficient implementation will be critical for scaling this method to large datasets.

Despite these hurdles, the proposed framework offers a promising new perspective for "uncertainty-aware" representation learning, potentially making self-supervised models more robust to the noise inherent in automated data augmentation.

Summary updated

BibTeX
@misc{li2021probabilistic,
  author = {Shen Li and Jianqing Xu and Bryan Hooi},
  title = {{Probabilistic Contrastive Loss for Self-Supervised Learning}},
  year = {2021},
  eprint = {2112.01642},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.01642},
}
Figure