Deep learning models are notoriously "lazy." If a dataset contains a simple feature that correlates with the target label—even if that feature is irrelevant in the real world—the model will likely latch onto it. For example, if most "cows" in a training set are photographed on green grass, the model might learn that "green background = cow," failing miserably when it encounters a cow on a beach. This phenomenon is known as dataset bias or spurious correlation.
While contrastive learning (which teaches models to pull similar images together and push different ones apart) is generally more robust than standard cross-entropy, it isn't immune to these biases. Existing methods often fail in "highly biased" scenarios where the shortcut is much easier to learn than the actual object features.
This paper introduces a margin-based framework for supervised contrastive learning that prevents models from falling into these traps. By introducing a novel loss function ($\epsilon$-SupInfoNCE) and a distribution-matching regularizer (FairKL), the authors achieve state-of-the-art performance on datasets where spurious correlations typically lead models astray.
The "Collapse" Trap in Contrastive Learning
The authors identify a specific mathematical reason why current contrastive losses (like SupCon) struggle with biased data: they contain a "latent" non-contrastive constraint. Standard SupCon tries to force all positive samples to collapse to a single point in the representation space. In a biased dataset, the easiest way for the network to make samples identical is to focus on the most prominent shared feature—which is often the bias (e.g., the background color). Ironically, this makes the model more biased.
Methods: Margins and Distribution Matching
To tackle this problem, the authors propose two main innovations:
1. $\epsilon$-SupInfoNCE
The authors re-derive supervised contrastive learning from an "$\epsilon$-margin" perspective. By adding a margin ($\epsilon$) into the loss function, they gain finer control over the minimal distance between positive and negative samples in the representation space.
Instead of forcing all positives to collapse into a single point, the margin allows positive samples to maintain a healthy variance within a bounded region. This provides a tighter approximation of the Mutual Information between the anchor and its positives, leading to more robust representations even on standard, non-biased datasets.
2. FairKL Regularization
To explicitly handle bias, the authors propose FairKL. This loss term looks at the distribution of distances between an anchor and its "bias-aligned" positives (those sharing the same bias, like a cow on grass) versus "bias-conflicting" positives (like a cow on a beach).
A key insight of the paper is that simply matching the average distance of these samples isn't enough. If the variances differ, the model can still distinguish between them and exploit the bias. FairKL uses Kullback–Leibler divergence to match both the mean and the variance of these distance distributions. This ensures the model treats bias-aligned and bias-conflicting samples identically, effectively neutralizing the bias.
Key Results
The researchers validated their approach on generic vision benchmarks (CIFAR-10, CIFAR-100, ImageNet-100) as well as heavily biased datasets (Biased-MNIST, Corrupted-CIFAR10, bFFHQ, and ImageNet-A).
- Extreme Bias Robustness: On Biased-MNIST, in the most extreme bias setting ($\rho=0.999$), standard Cross-Entropy achieves only 11.8% accuracy on unbiased test data. The proposed $\epsilon$-SupInfoNCE + FairKL reaches 90.51%, significantly outperforming prior debiasing methods like EnD (59.5%) and BiasBal (76.8%).
- Generic Performance Improvements: Even on standard datasets without explicit biases, $\epsilon$-SupInfoNCE improved top-1 accuracy over standard SupCon (e.g., +1.31% on ImageNet-100), proving that the margin-based approach is a fundamentally better way to structure contrastive learning.
- Real-World Generalization: On ImageNet-A (a dataset of "natural adversarial examples" that break most models by relying on background textures rather than object shapes), their method achieved state-of-the-art results, showing it generalizes well to complex, real-world distribution shifts.
Limitations and Future Work
While highly effective, the approach has a few limitations:
- Knowledge of Bias: FairKL requires knowing the bias attribute (e.g., "this is the background color") or using a separate "bias-capturing" model to estimate it. While the authors show this works with a BagNet-18 as a bias-proxy, it adds complexity to the training pipeline.
- Hyperparameter Tuning: The method introduces new hyperparameters, most notably the margin $\epsilon$. While the authors provide guidance, finding the optimal margin for a brand-new dataset might require empirical searching.
- Computational Scale: Due to resource constraints, the authors evaluated on ImageNet-100 rather than the full ImageNet-1k dataset, though the strong results suggest the method scales well.
Summary updated