Introduction
Contrastive representation learning has seen significant success in single-label classification through frameworks like Supervised Contrastive Learning (SupCon). In these settings, samples sharing the same label are treated as "positives" and pulled together in the embedding space, while those with different labels are "negatives" and pushed apart. However, real-world data is often multi-label (MLC), where an instance (e.g., an image) can belong to multiple categories simultaneously.
In MLC, defining a "positive" sample is non-trivial. Two common naive approaches exist:
- The "ALL" approach: Only samples with identical label sets are considered positives. This is overly restrictive and leads to data sparsity in large label spaces.
- The "ANY" approach: Any overlap in labels defines a positive pair. This is noisy, as it treats a sample sharing one minor label the same as one sharing nearly all labels.
The MulSupCon Framework
To address these limitations, we propose MulSupCon (Multi-Label Supervised Contrastive Learning). Instead of a binary positive/negative classification, MulSupCon introduces a more nuanced weighting scheme based on label overlap.
Decomposed Positive Sets
MulSupCon moves away from a single positive set per anchor. Instead, it treats each label in the anchor's label set independently. For an anchor with labels $\mathcal{L} = \{l_1, l_2, \dots, l_k\}$, the model constructs $k$ separate positive sets, one for each label $l_i$.
Weighted Contrastive Loss
The final loss is a summation over these class-specific contrastive losses. This formulation implicitly weights samples: a sample sharing multiple labels with the anchor will appear in multiple positive sets, contributing more significantly to the gradient than a sample sharing only one label.
Gradient Alignment
Gradient analysis reveals that this loss pushes the anchor's embedding toward the "mean representation" of each of its constituent classes. This prevents representation collapse and ensures that the model captures the distinct features of every label present, even for rare classes that might otherwise be overshadowed in an "ANY" approach.
Experimental Evaluation
MulSupCon was evaluated across diverse benchmarks, including image datasets (MS-COCO, NUS-WIDE, Objects365) and non-image datasets (Bookmarks, Delicious, etc.).
Key Results
- Performance Gains: On MS-COCO, MulSupCon achieved a mean Average Precision (mAP) of 0.672 in linear probing, significantly outperforming the "ALL" (0.636) and "ANY" (0.564) baselines.
- Robust Generalization: Models pre-trained with MulSupCon on NUS-WIDE showed superior transfer performance on PASCAL-VOC (0.750 mAP) compared to standard Binary Cross Entropy (BCE) training (0.661 mAP).
- Implicit Weighting: The method effectively leverages label correlations without requiring manual hyperparameter tuning for overlap importance. By decoupling samples from labels and focusing on sample-to-sample correlations, MulSupCon learns more robust and reusable features.
Conclusion and Future Work
MulSupCon successfully bridges the gap between contrastive learning and multi-label complexities. While it introduces some computational overhead due to multiple forward passes per anchor, the gains in representation quality and generalization are substantial. Future work may explore integrating this approach with Graph Convolutional Networks (GCNs) to explicitly model hierarchical label dependencies alongside contrastive sample relationships.
Summary updated