NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Improving Contrastive Learning by Visualizing Feature Transformation

Rui Zhu, Bingchen Zhao, Jingen Liu, Zhenglong Sun, Chang Wen Chen

Abstract

Self-supervised contrastive learning typically relies on image-level augmentations to learn representations. However, these methods often lack interpretability regarding the feature space. This paper introduces a visualization tool to track similarity scores during training, revealing that "harder" positives are crucial for performance. Based on this, we propose Feature Transformation (FT), which extrapolates positive features and interpolates negative ones. FT consistently improves performance across various benchmarks and downstream tasks.

Introduction

Contrastive learning aims to pull positive pairs closer and push negative pairs apart. Current state-of-the-art methods rely heavily on human-designed image augmentations. While effective, these augmentations are "blind" to the model's internal feature representations. This work seeks to bridge this gap by visualizing the learning process and manipulating features directly to improve robustness and diversity.

Methods: Feature Transformation (FT)

The authors propose moving beyond pixel-level augmentations to feature-level manipulations. The core of the approach is the Feature Transformation (FT) process, which is integrated into the standard contrastive learning pipeline.

The Feature Transformation process integrated into the contrastive learning pipeline.
  1. Positive Extrapolation: By extrapolating positive feature vectors, the model is presented with "harder" positives. This forces the encoder to learn more robust, view-invariant representations.
  2. Negative Interpolation: To increase the diversity of the negative sample queue, random interpolation is performed between existing negative features. This fills the gaps in the discrete feature distribution, providing a continuous synthetic distribution for better discrimination.
  3. Dimension-level Mixing: These transformations are extended to individual dimensions of the feature vectors, further increasing the complexity of the training signal.

Key Insights from Visualization

A novel visualization tool was developed to plot the mean and variance of cosine similarity scores. This "X-ray" of training revealed a counter-intuitive finding: models that perform better often have lower similarity scores for positive pairs during training.

Visualization of the transition from easy positives to hard positives and its impact on performance.
  • Harder Positives = Better Features: High momentum coefficients (e.g., $m=0.99$) lead to lower positive scores but better final solutions. "Easy" positives do not challenge the model sufficiently.
  • Diversity over Quantity: Simply increasing queue size has diminishing returns. Interpolation creates a more effective, continuous distribution of negatives.
  • Stability: Feature Transformation helps maintain a stable gradient landscape, preventing the volatile distributions often seen before model collapse.

Results and Conclusion

The Feature Transformation method is "plug-and-play" and was tested on ImageNet and various downstream tasks like object detection on MS COCO. FT improved ImageNet-100 accuracy by 6.0% over the MoCo baseline and 2.0% on ImageNet-1K over MoCoV2. Furthermore, it showed superior transferability in object detection tasks, demonstrating that the learned features are more generalizable and less biased.

Future work includes exploring non-linear feature manipulations and further refining visualization tools to demystify the self-supervised learning process.

Summary updated

BibTeX
@inproceedings{zhu2021improving,
  author = {Rui Zhu and Bingchen Zhao and Jingen Liu and Zhenglong Sun and Chang Wen Chen},
  title = {{Improving Contrastive Learning by Visualizing Feature Transformation}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.01014},
}
Figure