Exploring Balanced Feature Spaces for Representation Learning

Bingyi Kang, Yu Li, Sa Xie, Zehuan Yuan, Jiashi FengICLR 2021

TL;DR

While supervised learning struggles with "long-tailed" datasets where some classes are rare, self-supervised contrastive learning is surprisingly robust to data imbalance. This paper introduces $k$-positive contrastive learning (KCL), a method that leverages this robustness to create "balanced feature spaces," significantly improving performance on long-tailed recognition and downstream tasks like object detection.

What Problem Does This Paper Address?

In the pristine world of benchmark datasets like ImageNet, classes are artificially balanced. In the real world, data follows a "long-tail" distribution: a few "head" classes have thousands of examples (e.g., "person," "car"), while many "tail" classes have only a handful (e.g., specific species of rare birds).

Standard supervised learning (using Cross-Entropy loss) fails miserably here. It creates a biased feature space where the majority classes "crowd out" the minority ones, leading to poor accuracy on rare classes. The authors set out to answer a fundamental question: Does self-supervised learning (SSL) suffer from the same imbalance issues? If not, can we use SSL principles to build better models for the messy, imbalanced real world?

Methods

The authors first analyze the "balancedness" of feature spaces. They define a metric, $\beta(V)$, which measures how uniformly different classes can be linearly separated. They discover that unsupervised contrastive learning (like MoCo) naturally produces a balanced feature space, even when trained on heavily imbalanced data.

Feature space comparison showing how KCL maintains balance compared to CE loss.

To capitalize on this, they propose $k$-positive contrastive learning (KCL).

  • The Standard Way: Contrastive learning usually compares an image to its own augmented version (the positive) and many other random images (the negatives).
  • The KCL Way: It uses class labels to pick $k$ different instances from the same class as positives.
  • The Secret Sauce: Crucially, KCL uses the same number ($k$) of positive samples for every class, regardless of whether that class is frequent or rare. This prevents the "head" classes from dominating the learning process, effectively forcing the model to treat every class as equally important in the feature space.

Datasets

The researchers tested their approach across several challenging scenarios:

  • Long-Tailed Benchmarks: ImageNet-LT and iNaturalist 2018 (a naturally imbalanced dataset of species).
  • Controlled Imbalance: They created a series of datasets (LT0 to LT) derived from ImageNet, gradually increasing the "skewness" to see exactly when different methods break down.
  • Generalization Tasks: Places365 (for cross-domain evaluation), PASCAL VOC, and MS COCO (for object detection and segmentation).

Key Insights and Ideas

  • SSL is an Imbalance Shield: Unsupervised contrastive learning is remarkably stable. While supervised accuracy drops sharply as a dataset becomes more imbalanced, SSL performance remains nearly flat.
  • Balancedness = Generalization: The authors found a strong positive correlation between how "balanced" a feature space is and how well it generalizes to new, unseen classes (Out-of-Distribution). A model that doesn't over-focus on "head" classes is more flexible when it encounters something entirely new.
Performance and balancedness comparison between Cross-Entropy (CE) and Contrastive Learning (CL) across varying imbalance levels.
  • Labels can be a Double-Edged Sword: In supervised learning, labels provide semantic meaning but introduce distribution bias. KCL acts as a bridge, using labels to gain semantic discriminativeness while using the contrastive framework to maintain the structural "fairness" of the feature space.

Key Results

  • State-of-the-Art on Long-Tail: On ImageNet-LT, KCL achieved 51.5% accuracy, outperforming the previous best supervised methods (like cRT at 47.3%).
  • iNaturalist Success: On the massive iNaturalist 2018 dataset, KCL reached 68.6% Top-1 accuracy, a significant jump over the 66.3% achieved by BBN.
  • Better Downstream Performance: When used as a pre-training method for object detection on COCO, KCL-trained models outperformed both standard supervised models and MoCo, showing that "balanced" features are better for complex tasks like bounding-box localization.
  • OOD Robustness: In "Split-independent" tests (recognizing classes the model never saw during training), KCL beat standard supervised learning by 7.8% (58.1% vs 50.3%).

Limitations and Future Work

The authors acknowledge that their balancedness metric $\beta(V)$, while useful, is a first attempt and could potentially be "hacked" or improved. Furthermore, while KCL is highly effective, it does require labels during the representation learning phase.

Future research could explore how to achieve this level of balancedness in a truly unsupervised way when labels aren't available at all. There is also a call for more theoretical work to explain why the contrastive loss is so inherently robust to the Zipfian distributions found in nature.

Summary updated

BibTeX
@inproceedings{kang2021exploring,
  author = {Bingyi Kang and Yu Li and Sa Xie and Zehuan Yuan and Jiashi Feng},
  title = {{Exploring Balanced Feature Spaces for Representation Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=OqtLIabPTit},
}
Figure