Self-Damaging Contrastive Learning

Ziyu Jiang, Tianlong Chen, Bobak J. Mortazavi, Zhangyang Wang

Overview

Self-Damaging Contrastive Learning (SDCLR) is a novel framework designed to make unsupervised representation learning robust to imbalanced, "long-tailed" data. By contrasting a model with its own pruned version, the system automatically identifies and prioritizes rare or difficult samples without requiring any class labels. This approach leads to more balanced and accurate feature representations, bridging the gap between idealized benchmark datasets and messy real-world data.

The Challenge of Long-Tailed Data

In real-world applications, data rarely follows the neat, balanced distributions found in standard research benchmarks. Instead, most natural datasets exhibit a "long-tail" distribution: a few categories are extremely common (the "head"), while the vast majority are rare (the "tail").

While contrastive learning (CL) has revolutionized unsupervised training, standard CL methods are highly susceptible to this imbalance. They tend to over-represent the feature attributes of frequent "head" classes, leaving the "tail" classes poorly modeled. This vulnerability makes it difficult to deploy these models for downstream tasks like few-shot learning or specialized domain classification (e.g., medical imaging), where data is naturally skewed.

Existing solutions for imbalanced data typically rely on class labels to re-sample or re-weight the training data. However, in an unsupervised setting, these labels are unavailable. The core challenge SDCLR addresses is how to "re-balance" the learning process without knowing which sample belongs to which class.

The SDCLR Approach: Enter the "Self-Competitor"

The central innovation of SDCLR is the introduction of a "self-competitor" model. Instead of the standard approach—where two augmented views of an image are fed through the exact same network—SDCLR utilizes a two-branch architecture:

  1. The Target Model: A standard, dense neural network.
  2. The Self-Competitor: A sparse version of the target model, created by pruning (removing) the weights with the smallest magnitudes.
The SDCLR framework contrasts a dense target model with a pruned self-competitor to identify and prioritize poorly memorized long-tail samples.

The two branches share weights for their non-pruned parameters but maintain independent Batch Normalization layers. During training, the system contrasts the features produced by both branches.

The term "Self-Damaging" stems from this network pruning. Pruning acts as a form of selective "brain damage" that disproportionately impairs the model's ability to recognize rare or difficult samples. By contrasting the dense model with its damaged counterpart, the framework amplifies the loss for these forgotten tail samples, effectively forcing the model to pay closer attention to them.

Key Insights and Mechanisms

  • Pruning as a Discovery Tool: Traditionally, pruning is used post-training to make models smaller and faster. SDCLR repurposes pruning as a diagnostic tool during training to spot which samples the model has not yet fully mastered.
  • Implicit Re-balancing: Because pruning degrades the representation of tail samples more severely than head samples, the feature discrepancy between the two branches is largest for the tail. This naturally increases their weight in the contrastive loss, achieving re-balancing without explicit labels.
  • Dynamic Co-evolution: The pruning mask is not static; it is "lazy-updated" every epoch. This allows the self-competitor to evolve alongside the target model, continuously identifying new difficult samples as training progresses.
As training progresses, the framework increasingly identifies "minor" (tail) samples as easily forgotten, dynamically adjusting focus.

Performance and Results

The authors evaluated SDCLR across several imbalanced benchmarks, including long-tailed versions of CIFAR-10, CIFAR-100, and ImageNet. SDCLR consistently outperformed standard contrastive methods across all settings:

  • Accuracy Boost: On CIFAR-100-LT, SDCLR improved linear separability performance by 8.37% over standard SimCLR.
  • Improved Balancedness: The framework significantly reduced the performance gap between "Many" (head) and "Few" (tail) classes, indicating a much more balanced feature space.
  • Few-Shot Success: In few-shot scenarios (using only 1% of labels for fine-tuning), SDCLR demonstrated a clear advantage, particularly for tail classes where data is most scarce.
  • Generalization: SDCLR also improved performance on balanced datasets, suggesting that the self-damaging mechanism helps the model handle hidden imbalances, such as varying sample difficulty or ambiguity.

Future Directions

While SDCLR is a powerful, plug-and-play addition to contrastive learning, it introduces slight computational overhead due to the two-branch forward passes. Future research may explore more sophisticated structured pruning techniques, extend the concept to other contrastive frameworks (like MoCo or BYOL), and investigate its efficacy on complex real-world imbalances like multi-label attribute skew.

Summary updated

BibTeX
@inproceedings{jiang2021self,
  author = {Ziyu Jiang and Tianlong Chen and Bobak J. Mortazavi and Zhangyang Wang},
  title = {{Self-Damaging Contrastive Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=6WJfSEjl5iM},
}
Figure