English

Not All Semantics are Created Equal: Contrastive Self-supervised Learning with Automatic Temperature Individualization

Machine Learning 2023-05-23 v1 Artificial Intelligence Optimization and Control Machine Learning

Abstract

In this paper, we aim to optimize a contrastive loss with individualized temperatures in a principled and systematic manner for self-supervised learning. The common practice of using a global temperature parameter τ\tau ignores the fact that ``not all semantics are created equal", meaning that different anchor data may have different numbers of samples with similar semantics, especially when data exhibits long-tails. First, we propose a new robust contrastive loss inspired by distributionally robust optimization (DRO), providing us an intuition about the effect of τ\tau and a mechanism for automatic temperature individualization. Then, we propose an efficient stochastic algorithm for optimizing the robust contrastive loss with a provable convergence guarantee without using large mini-batch sizes. Theoretical and experimental results show that our algorithm automatically learns a suitable τ\tau for each sample. Specifically, samples with frequent semantics use large temperatures to keep local semantic structures, while samples with rare semantics use small temperatures to induce more separable features. Our method not only outperforms prior strong baselines (e.g., SimCLR, CLIP) on unimodal and bimodal datasets with larger improvements on imbalanced data but also is less sensitive to hyper-parameters. To our best knowledge, this is the first methodical approach to optimizing a contrastive loss with individualized temperatures.

Keywords

Cite

@article{arxiv.2305.11965,
  title  = {Not All Semantics are Created Equal: Contrastive Self-supervised Learning with Automatic Temperature Individualization},
  author = {Zi-Hao Qiu and Quanqi Hu and Zhuoning Yuan and Denny Zhou and Lijun Zhang and Tianbao Yang},
  journal= {arXiv preprint arXiv:2305.11965},
  year   = {2023}
}

Comments

33 pages, 11 figures, accepted by ICML2023

R2 v1 2026-06-28T10:39:41.205Z