Introduction
Standard contrastive learning has proven highly effective at mapping complex data, such as images, into simple latent vectors that capture their essential features. Recent theoretical work has even shown that contrastive learning objectives, like the popular InfoNCE loss, can "invert" the generative process to find the true latent vectors. However, most existing theory assumes a deterministic and injective world—meaning one latent vector produces exactly one unique image.
In reality, real-world observations are fraught with inherent ambiguities. An image might be motion-blurred, low-resolution, or merely a 2D snapshot of a 3D object. Consequently, a single observation could have been generated by multiple different "true" latents. This inherent ambiguity is known as aleatoric uncertainty. When a standard model is forced to map an ambiguous image to a single point in latent space, it discards crucial information about this uncertainty. This paper introduces MCInfoNCE, a probabilistic loss function that trains encoders to map inputs to distributions rather than points, mathematically recovering the true underlying uncertainty of the data.
Probabilistic Contrastive Learning
To tackle the challenge of recovering the full probabilistic "posterior"—the range of possible latents that could have created an observation—the authors propose a framework called Probabilistic Contrastive Learning. Instead of a standard encoder that outputs a deterministic vector $f(x)$, the proposed encoder predicts the parameters of a probability distribution. Specifically, it outputs the parameters of a von Mises-Fisher (vMF) distribution, which can be conceptualized as a Gaussian distribution wrapped around a hypersphere.
The encoder yields two key components:
- A mean direction, indicating the most likely location of the latent.
- A concentration parameter $\kappa$, representing the model's certainty.
The model is trained using the MCInfoNCE Loss, a Monte-Carlo adaptation of the standard InfoNCE objective. Rather than comparing deterministic points, MCInfoNCE samples from the predicted distributions and minimizes the expected loss. The core theoretical contribution of the paper is a proof demonstrating that minimizing MCInfoNCE is equivalent to matching the model's "expected positivity" to the ground truth. This guarantees that the model recovers both the correct latent location and the correct level of uncertainty, up to a simple rotation of the latent space.
Key Insights and Experimental Validation
A profound insight from this work is that uncertainty is identifiable without explicit labels. By simply observing which images are "similar" to each other in a contrastive setup, the model mathematically deduces the ambiguity of an input. Furthermore, the method is remarkably robust to misspecification; even if the true data distribution is Gaussian or Laplace, an encoder predicting vMF distributions still captures the correct ranking of uncertainty.
The authors validated their approach across three distinct setups:
- Controlled Synthetic Environment: Using Multi-Layer Perceptrons (MLPs) to generate data with known latent posteriors, the model successfully recovered the exact mathematical ground truth. It achieved a rank correlation of 0.99 for true latent locations and 0.82 for true uncertainty levels.
- CIFAR-10H: On this specialized dataset where 50 different humans labeled every image, the human "disagreement" served as a proxy for real-world aleatoric uncertainty. The model’s predicted uncertainty ($\kappa$) correlated strongly with this human annotator disagreement.
- Deteriorated CIFAR: By artificially inducing uncertainty through random crops of varying sizes, the model successfully detected that smaller crops (containing less information) should result in higher uncertainty.
Because the model outputs a distribution, it enables credible intervals for retrieval (Bayesian retrieval). Instead of standard top-K matching, users can query all images falling within a 95% confidence zone. For a clear image, this returns highly specific matches; for a blurry image, it returns a broader mix of classes, visually representing the model's confusion. Additionally, by "abstaining" from predictions where the model reports high uncertainty, accuracy (Recall@1) on the remaining data monotonically improves.
Limitations and Future Directions
While highly effective, the approach has a few limitations. First, performance drops in very high-dimensional latent spaces ($D \ge 40$). The authors attribute this to the difficulty of "negative mining" in high dimensions rather than a fundamental flaw in the loss function. Second, the current framework assumes a unimodal posterior. In cases where an image is truly multi-modal (e.g., an ambiguous digit that could be either a 6 or a 9), extending the method to mixture models would be necessary. Finally, sampling points for the Monte-Carlo estimator adds computational overhead, though the authors note that the bias diminishes quickly, and using as few as 16 to 32 samples is often sufficient for reliable uncertainty estimates in practice.
Summary updated