TL;DR
BaCon (Balanced Feature-Level Contrastive Learning) tackles the "double whammy" of class imbalance and limited labels in semi-supervised learning. By directly regularizing the feature embedding space rather than just reweighting samples, it achieves state-of-the-art accuracy and shows remarkable robustness even in extreme "long-tail" scenarios.
What Problem Does This Paper Address?
Deep learning models thrive on massive, balanced, labeled datasets. In the real world, however, we usually face two hurdles: Semi-supervised Learning (SSL), where most data is unlabeled, and Class Imbalance, where a few "head" classes have many samples while "tail" classes have very few.
Existing Class Imbalanced SSL (CISSL) methods mostly work at the instance level—they try to reweight or resample specific data points. The authors argue this is insufficient. Because the model's backbone is naturally biased toward majority classes, the gradients it receives are skewed. Even clever tricks like auxiliary classifiers can't fully correct this if the underlying feature representations are fundamentally "clumped" or poorly separated for minority classes.
Methods
BaCon is designed as a "plug-in" component for existing SSL frameworks (like FixMatch or ABC). It introduces a novel contrastive loss that shapes the feature space directly through three key mechanisms:
- Global Positive Anchors: Instead of comparing individual samples, BaCon maintains a memory bank to calculate class-wise feature centers. Every sample is "pulled" toward its respective class center in the embedding space.
- Reliable Negative Selection (RNS): Contrastive learning needs "negative" samples to push away from. In imbalanced SSL, picking negatives is risky because pseudo-labels are often wrong. RNS uses a high-confidence threshold and a ranking mechanism to ensure the model only pushes away from samples that are truly likely to belong to different classes.
- Balanced Temperature Adjusting (BTA): This is the "secret sauce" for imbalance. The authors realized that feature centers for tail classes are less reliable because they are averaged over fewer samples. BTA dynamically adjusts the "temperature" (the strength of the attraction/repulsion) based on class size and training progress, preventing the model from over-fitting to noisy tail-class centers early on.
Datasets
The authors evaluated BaCon on "Long-Tail" (LT) versions of standard benchmarks, where class distributions follow an exponential decay:
- CIFAR10-LT & CIFAR100-LT: Standard image classification tasks modified for extreme imbalance.
- SVHN-LT: Street View House Numbers, a digit recognition task.
- STL10-LT: A dataset specifically designed for SSL, where the unlabeled data distribution might differ from the labeled data.
Key Insights and Ideas
- Representation is King: The authors proved that if you freeze a model with a balanced feature representation, even a simple classifier trained on imbalanced data performs significantly better (+6.12% accuracy). This confirms that the bottleneck in CISSL is the feature extractor itself.
- Contrastive Learning as a Balancer: By forcing the model to map features to distinct, equidistant class centers, BaCon naturally counteracts the tendency of majority classes to "collapse" the feature space.
- Dynamic Adaptation: The use of BTA (Figure 3) shows that "one size fits all" hyperparameters don't work for imbalanced data. Tail classes need a gentler learning curve to avoid drifting toward noisy anchors.
Key Results
BaCon consistently outperformed state-of-the-art methods across all benchmarks:
- CIFAR10-LT: Achieved 84.46% accuracy, surpassing the previous best (CoSSL) by 0.37% and the instance-level ABC by 1.21%.
- CIFAR100-LT: Reached 57.96%, a 0.63% improvement over CoSSL.
- Robustness: In extreme tests where the unlabeled data distribution was the inverse of the labeled data (a nightmare scenario for most SSL models), BaCon maintained high accuracy while competitors saw performance drops of over 10%.
Qualitatively, t-SNE visualizations (Figure 4) show that BaCon produces much cleaner, more separable clusters for all classes compared to standard FixMatch or ABC.
Limitations and Future Work
While BaCon is powerful, the paper notes a few areas for further exploration:
- Warmup Period: The method requires a "warmup" phase to populate the memory bank with reliable features before the contrastive loss is activated.
- Computational Overhead: Maintaining a memory bank and calculating class centers adds some memory and compute cost, though the authors suggest it is manageable on modern GPUs (like the RTX 3090 used in the study).
- Prior Knowledge: Like many CISSL methods, it assumes we know the imbalance ratio of the labeled data, which might not always be perfectly clear in the wild.
Summary updated