[Paper Review] Correct-N-Contrast: A Contrastive Approach for Improving Robustness to Spurious Correlations
This paper proposes Correct-n-Contrast (CnC), a contrastive learning method that improves robustness to spurious correlations without requiring spurious attribute or group labels. By leveraging predictions from a pre-trained ERM model to identify same-class, different-spurious-feature samples, CnC uses contrastive learning to align representations of these samples while separating inter-class, same-spurious-feature pairs, achieving state-of-the-art worst-group accuracy with a 3.6% average absolute lift on benchmarks.
Spurious correlations pose a major challenge for robust machine learning. Models trained with empirical risk minimization (ERM) may learn to rely on correlations between class labels and spurious attributes, leading to poor performance on data groups without these correlations. This is particularly challenging to address when spurious attribute labels are unavailable. To improve worst-group performance on spuriously correlated data without training attribute labels, we propose Correct-N-Contrast (CNC), a contrastive approach to directly learn representations robust to spurious correlations. As ERM models can be good spurious attribute predictors, CNC works by (1) using a trained ERM model's outputs to identify samples with the same class but dissimilar spurious features, and (2) training a robust model with contrastive learning to learn similar representations for same-class samples. To support CNC, we introduce new connections between worst-group error and a representation alignment loss that CNC aims to minimize. We empirically observe that worst-group error closely tracks with alignment loss, and prove that the alignment loss over a class helps upper-bound the class's worst-group vs. average error gap. On popular benchmarks, CNC reduces alignment loss drastically, and achieves state-of-the-art worst-group accuracy by 3.6% average absolute lift. CNC is also competitive with oracle methods that require group labels.
Motivation & Objective
- To improve worst-group generalization in machine learning models without requiring labeled spurious attributes or group identities.
- To address the limitation of existing methods that rely on oracle group labels or fail to directly optimize for representation alignment.
- To develop a contrastive learning framework that explicitly encourages models to rely on class-discriminative features rather than spurious attributes.
- To theoretically and empirically link representation alignment with worst-group error reduction, providing a new optimization objective for robustness.
Proposed method
- Train an initial ERM model to predict class labels and use its outputs to infer spurious attribute patterns indirectly.
- Use the ERM model’s predictions to sample hard positives: same-class, different-prediction samples to encourage representation alignment.
- Use hard negatives: different-class, same-ERM-prediction samples to enforce inter-class separation in representation space.
- Apply contrastive learning with a momentum encoder to jointly optimize for intra-class alignment and inter-class separation.
- Introduce a novel sampling strategy that prioritizes ambiguous or spurious-correlation cases to improve robustness.
- The method minimizes a representation alignment loss that upper-bounds the worst-group vs. average error gap per class.
Experimental results
Research questions
- RQ1Can representation alignment—measured by proximity of same-class, different-spurious-feature samples in embedding space—be used as a proxy to reduce worst-group error?
- RQ2Does a contrastive learning approach that leverages ERM model predictions to define hard positives and negatives improve robustness without access to spurious attribute labels?
- RQ3How does the alignment loss relate to worst-group generalization, and can it be used to upper-bound the worst-group vs. average error gap?
- RQ4Can CnC outperform existing self-supervised and group-agnostic robust learning methods in terms of worst-group accuracy on benchmarks with strong spurious correlations?
Key findings
- CnC reduces alignment loss by a significant margin across all evaluated benchmarks, indicating improved representation robustness.
- The worst-group error closely tracks the alignment loss, validating the proposed link between representation alignment and robustness.
- CnC achieves a 3.6% average absolute lift in worst-group accuracy over ERM and state-of-the-art baselines on standard benchmarks.
- CnC outperforms oracle methods that require group labels in several settings, demonstrating its effectiveness without supervision on spurious attributes.
- UMAP visualizations show that CnC representations depend only on class labels and not on spurious attributes, unlike ERM and Jtt.
- GradCAM visualizations confirm that CnC models attend primarily to class-relevant features (e.g., bird body, hair), while ERM models focus on spurious backgrounds or attributes.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.