Adaptive Multi-head Contrastive Learning

Lei Wang, Piotr Koniusz, Tom Gedeon, Liang Zheng

Introduction

Contrastive learning (CL) has emerged as a powerful paradigm for self-supervised representation learning. The core objective is to ensure that different "views" of the same image (positive pairs) have similar embeddings, while views of distinct images (negative pairs) are pushed apart. To learn robust, invariant features, researchers typically employ aggressive data augmentations like extreme cropping, color jittering, and blurring.

However, this leads to the Augmentation Paradox: heavy augmentation can make two views of the same image appear entirely different, or conversely, make views of different images look deceptively similar. Standard CL methods struggle with this because they rely on a single projection head and a fixed global temperature ((\tau)), which fails to account for the varying levels of uncertainty introduced by these transformations.

The AMCL Framework

To address these limitations, we propose Adaptive Multi-head Contrastive Learning (AMCL). This framework introduces two fundamental architectural shifts designed to handle complex similarity patterns more effectively.

Comparison of standard contrastive learning architecture with the proposed AMCL framework using single (C=1) and multiple (C=3) heads.

1. Multiple Projection Heads

Instead of a single MLP projection head, AMCL utilizes (C) independent heads. Each head produces its own set of features, allowing the model to capture complementary aspects of an image—for instance, one head might focus on global shape while another captures local textures. This multi-view approach prevents the model from collapsing into a single, potentially noisy mode of similarity.

2. Learnable Pair-Adaptive Temperature

Rather than applying a fixed scaling factor to every comparison, AMCL learns a unique temperature for every pair of images. A small shared MLP calculates these temperatures based on the features themselves. This mechanism allows the model to "down-weight" pairs it is uncertain about. If a positive pair looks highly dissimilar due to extreme augmentation, the adaptive temperature prevents that pair from providing a damaging gradient to the backbone, effectively treating temperature as a measure of aleatoric uncertainty.

Addressing the Augmentation Paradox

The primary strength of AMCL lies in its ability to maintain separability between positive and negative distributions even under heavy augmentation. As shown in the figure below, standard methods see significant overlap in similarity scores as the number of augmentations increases. AMCL effectively pushes these distributions apart, leading to more discriminative features.

Visual examples of the augmentation paradox and histograms showing how AMCL improves similarity score separability as augmentation complexity increases.

Key Results and Performance

AMCL was integrated into several major self-supervised learning frameworks, including SimCLR, MoCo, and Barlow Twins, across various backbones (ResNet, ViT).

  • Consistent Accuracy Gains: On CIFAR-100, AMCL provided an average accuracy boost of 4.58% across different methods. On ImageNet-1K with a ViT-L backbone, it achieved 73.9% top-1 accuracy.
  • Downstream Transfer: The benefits extend to complex tasks like object detection and instance segmentation on COCO, where AMCL-pre-trained models showed improvements of up to +4.1 AP.
  • Computational Efficiency: Despite the addition of multiple heads, the overhead is minimal. For a ResNet-50 model, AMCL adds only about 1.1M parameters and 0.3 GFLOPs, representing a marginal 5% increase in computational cost.

Conclusion

Adaptive Multi-head Contrastive Learning provides a robust solution to the challenges posed by aggressive data augmentation. By replacing rigid architectural components with flexible, adaptive ones—multiple heads and pair-specific temperatures—AMCL achieves superior feature representations with negligible extra cost. Future work will explore deeper integration with Masked Image Modeling (MIM) to further refine how models handle observation noise in self-supervised settings.

Summary updated

BibTeX
@inproceedings{wang2024adaptive,
  author = {Lei Wang and Piotr Koniusz and Tom Gedeon and Liang Zheng},
  title = {{Adaptive Multi-head Contrastive Learning}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72890-7\_25},
}
Figure