Contrastive Learning with Complex Heterogeneity

Lecheng Zheng, Jinjun Xiong, Yada Zhu, Jingrui He

Abstract

Contrastive learning has emerged as a dominant paradigm in self-supervised representation learning. However, standard approaches often struggle with "complex heterogeneity"—data characterized by multiple views and multiple labels. This paper presents HeroCon, a framework that introduces intelligent re-weighting mechanisms for both unsupervised and supervised contrastive losses. By mitigating the "false negative" problem and leveraging label similarity via Hamming distance, HeroCon achieves superior performance across diverse datasets, demonstrating particular robustness to noise and effectiveness in multi-label scenarios.

Introduction: The False Negative Problem

The core principle of contrastive learning involves pulling "positive" pairs together in a latent space while repelling "negative" pairs. While effective, this "vanilla" approach suffers from a critical flaw: the false negative problem. In standard setups, any sample other than the anchor's augmented version is treated as a negative. This leads to scenarios where semantically similar samples (e.g., two different breeds of dogs) are aggressively pushed apart, confusing the model and degrading representation quality.

Conceptual overview of contrastive learning. HeroCon addresses the 'false negative' problem where similar samples (e.g., different dog breeds) are incorrectly repelled.

This challenge is exacerbated in real-world data featuring complex heterogeneity, such as multi-view inputs (e.g., image and text pairs) and multi-label outputs (e.g., images with numerous descriptive tags).

The HeroCon Framework

To address these issues, the authors propose HeroCon (Heterogeneous Contrastive Learning), which incorporates two novel weighted loss functions:

1. Weighted Unsupervised Contrastive Loss ($L_u$)

Rather than assigning uniform weights to all negative pairs, HeroCon utilizes a projection layer to estimate latent similarity. If a negative sample is found to be highly similar to the anchor, its weight in the loss function is automatically reduced. This "soft filtering" prevents the model from repelling semantically related samples, effectively leveraging unlabeled data without the noise of random negative sampling.

2. Weighted Supervised Contrastive Loss ($L_s$)

Traditional supervised contrastive learning (SupCon) typically requires samples to share identical label sets. This is impractical for multi-label datasets where samples may share some, but not all, attributes. HeroCon employs Hamming distance to quantify label similarity. Samples sharing a high proportion of labels are pulled together more strongly than those with minimal overlap, allowing the model to learn from a spectrum of partial similarities.

Theoretical analysis confirms that these weighted losses provide lower bounds for the Mutual Information between different views and label sets, ensuring that the model converges toward optimal representations.

Experimental Evaluation

HeroCon was evaluated on four datasets with varying degrees of heterogeneity:

  • Noisy MNIST (N-MNIST): Single-view, multi-class handwritten digits with Gaussian noise.
  • Scene: Single-view, multi-label images of natural environments.
  • X-ray Microbeam (XRMB): Multi-view, multi-class acoustic and articulatory data.
  • CelebA: Multi-view, multi-label large-scale face attributes.

Key Results and Discussion

HeroCon consistently outperformed state-of-the-art baselines, including Info-NCE, SupCon, and specialized multi-view models like CMC.

Performance and Multi-label Mastery

On the Scene dataset, HeroCon improved the F1 score by approximately 2.2% over standard Info-NCE. Its advantage was even more pronounced on the complex CelebA dataset, where it achieved an F1 score of 0.5907, significantly higher than SupCon’s 0.5527. This demonstrates HeroCon's ability to navigate sparse label spaces where exact matches are rare.

Noise Robustness

A key strength of the framework is its stability under adverse conditions. In tests using N-MNIST, HeroCon remained robust even as pixel contamination reached 100%.

Performance comparison on N-MNIST across varying noise levels. HeroCon maintains stability even under high contamination compared to unsupervised variants.

As shown in the experimental results, while unsupervised variants experienced sharp performance declines as noise increased, HeroCon's weighted mechanisms allowed it to maintain high accuracy by effectively filtering out noisy "negatives."

Conclusion

HeroCon provides a robust solution for contrastive learning in the presence of complex heterogeneity. By replacing rigid "all-or-nothing" comparisons with weighted similarities, the framework mitigates the false negative problem and excels in multi-label environments. Future work will focus on reducing the $O(n^2)$ computational complexity associated with negative set similarity calculations to better support web-scale applications.

Summary updated

BibTeX
@inproceedings{zheng2022contrastive,
  author = {Lecheng Zheng and Jinjun Xiong and Yada Zhu and Jingrui He},
  title = {{Contrastive Learning with Complex Heterogeneity}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2022},
  doi = {10.1145/3534678.3539311},
}
Figure