Negatives-Dominant Contrastive Learning for Generalization in Imbalanced Domains

Meng Cao, Jiexi Liu, Songcan Chen

TL;DR

This paper tackles the challenging problem of Imbalanced Domain Generalization (IDG) by proposing a novel theoretical framework and a corresponding contrastive learning method (NDCL). NDCL effectively mitigates both domain and label shifts, particularly in scenarios with long-tailed data distributions, by focusing on negative samples to enhance decision boundary separation and improve generalization to unseen domains.

What Problem Does This Paper Address?

Real-world machine learning applications often suffer from two key challenges: domain shift (data distributions vary across different sources) and label shift (class distributions are imbalanced and vary across domains). When these shifts are entangled, especially in Imbalanced Domain Generalization (IDG) scenarios with long-tailed data, models struggle to generalize. Existing methods often focus on aligning domain-invariant features, which can be insufficient when label distributions are highly imbalanced. This imbalance can lead to majority classes dominating the learning process, biasing decision boundaries and hindering performance on minority classes. The paper aims to address this by providing a theoretical understanding of IDG and proposing a method that directly tackles the decision boundary issues arising from these entangled shifts.

Methods

The core of the paper's contribution lies in its novel approach to contrastive learning for IDG.

  • Theoretical Foundation: The authors first establish a generalization bound for IDG that explicitly accounts for posterior discrepancy and decision margin, going beyond traditional domain generalization bounds that primarily focus on input distribution alignment. This theoretical insight guides their method development.
  • Negative-Dominant Contrastive Learning (NDCL): This is the proposed technical solution. NDCL operates in the prediction space and comprises three key objectives:
  • Negative-Dominant Contrastive Loss ($L_{con}$): This loss function prioritizes pushing apart negative samples (samples from different classes) from each other. By emphasizing negatives, it amplifies gradient signals for minority classes, preventing them from being overwhelmed by majority classes and thus enhancing inter-class decision boundary separation.
  • Class-wise Re-weighted Cross-Entropy Loss ($L_{ce}$): This loss encourages intra-class compactness by adaptively re-weighting samples, giving more importance to harder examples within a class.
  • Prediction-Central Alignment Strategy ($L_{const}$): This objective enforces posterior consistency across domains by aligning prediction prototypes, rather than individual samples, which helps mitigate biases from sample proportions.
  • Hard Negative Mining: To further improve the effectiveness of negative samples, NDCL employs a hard negative mining strategy, focusing on more ambiguous and informative negative instances.

Datasets

The paper evaluates NDCL on three standard domain generalization benchmarks:

  • VLCS: Consists of four datasets (VOC2007, LabelMe, Caltech, SUN09) with 5 object categories.
  • PACS: A more challenging dataset with four diverse domains (Photo, Art painting, Cartoon, Sketch) and 7 object categories, featuring significant domain shifts.
  • OfficeHome: A challenging benchmark with 65 categories across four domains (Art, Clipart, Product, Real-World), exhibiting substantial domain discrepancies and category imbalance.

The authors also introduce new challenging settings for these benchmarks: TotalHeavyTail (consistent long-tailed distributions) and Duality (heterogeneous label shifts with imbalanced domain sizes), in addition to the GINIDG setting.

Key Insights and Ideas

  • Posterior Discrepancy and Decision Margin are Crucial for IDG: The paper's theoretical analysis reveals that simply aligning input distributions is insufficient for IDG. The interplay of posterior discrepancy and decision margin is key to achieving generalization in imbalanced domains.
  • Leveraging Negatives for Minority Class Support: By focusing contrastive learning on negative samples, NDCL effectively amplifies signals for minority classes, preventing them from being overshadowed by majority classes. This is a departure from methods that primarily focus on positive sample similarity.
  • Domain Alignment Can Be Detrimental in IDG: The experiments show that standard domain alignment strategies can sometimes worsen performance in IDG scenarios, as majority classes can dominate the alignment process and lead to mismatches.
  • Theoretical Insights Directly Inform Method Design: The generalization bound derived by the authors directly motivates the design choices in NDCL, particularly the emphasis on negative samples and posterior consistency.

Key Results

  • State-of-the-Art Performance: NDCL consistently achieves the best overall accuracy across various benchmarks and settings, outperforming 21 strong comparison methods.
  • Robustness on Minority Classes: NDCL demonstrates superior performance on minority and few-shot classes, where traditional domain generalization methods often struggle. For instance, on PACS, it achieves the second-best few-shot accuracy.
  • Improved Margin and Reduced Posterior Discrepancy: Empirical analysis (Fig. 4, Tab. 11) shows that NDCL achieves larger margins and lower posterior discrepancies, which are directly correlated with higher target-domain accuracy.
  • Efficiency: NDCL exhibits a moderate training cost, comparable to or better than many existing IDG methods, while achieving superior performance.

Limitations and Future Work

  • Domain Prior Alignment: The paper acknowledges that while NDCL indirectly mitigates domain prior discrepancy through governed decision boundaries, explicitly modeling domain priors remains challenging under severe imbalance due to potential ill-posedness in representation alignment.
  • Future Directions: The authors suggest integrating causality-inspired mechanisms to disentangle underlying factors and offer a promising path toward more generalizable models. They also note that future work could explore further improvements by focusing on the interplay of domain-specific imbalance and representation learning.

Summary updated

BibTeX
@inproceedings{cao2026negatives,
  author = {Meng Cao and Jiexi Liu and Songcan Chen},
  title = {{Negatives-Dominant Contrastive Learning for Generalization in Imbalanced Domains}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=Cez36tiWXz},
}
Figure