Skip to main content
QUICK REVIEW

[Paper Review] Rethinking InfoNCE: How Many Negative Samples Do You Need?

Chuhan Wu, Fangzhao Wu|arXiv (Cornell University)|May 27, 2021
Domain Adaptation and Few-Shot LearningComputer Science14 citations
TL;DR

This paper proposes a semi-quantitative theoretical framework to estimate the optimal negative sampling ratio $K$ for InfoNCE loss in contrastive learning, accounting for label noise. It introduces a training effectiveness function to measure sample informativeness and derives an adaptive negative sampling (ANS) method that dynamically adjusts $K$ during training, outperforming fixed-$K$ strategies across multiple real-world tasks.

ABSTRACT

InfoNCE loss is a widely used loss function for contrastive model training. It aims to estimate the mutual information between a pair of variables by discriminating between each positive pair and its associated $K$ negative pairs. It is proved that when the sample labels are clean, the lower bound of mutual information estimation is tighter when more negative samples are incorporated, which usually yields better model performance. However, in many real-world tasks the labels often contain noise, and incorporating too many noisy negative samples for model training may be suboptimal. In this paper, we study how many negative samples are optimal for InfoNCE in different scenarios via a semi-quantitative theoretical framework. More specifically, we first propose a probabilistic model to analyze the influence of the negative sampling ratio $K$ on training sample informativeness. Then, we design a training effectiveness function to measure the overall influence of training samples on model learning based on their informativeness. We estimate the optimal negative sampling ratio using the $K$ value that maximizes the training effectiveness function. Based on our framework, we further propose an adaptive negative sampling method that can dynamically adjust the negative sampling ratio to improve InfoNCE based model training. Extensive experiments on different real-world datasets show our framework can accurately predict the optimal negative sampling ratio in different tasks, and our proposed adaptive negative sampling method can achieve better performance than the commonly used fixed negative sampling ratio strategy.

Motivation & Objective

  • To address the challenge of selecting an optimal negative sampling ratio $K$ in InfoNCE when training data contains label noise.
  • To develop a theoretical framework that quantifies the influence of $K$ on training sample informativeness under noisy labels.
  • To design a training effectiveness function that measures the overall impact of training samples on model learning.
  • To propose an adaptive negative sampling (ANS) method that dynamically adjusts $K$ based on training stage characteristics.
  • To empirically validate the framework’s accuracy in predicting optimal $K$ and the effectiveness of ANS across diverse real-world datasets.

Proposed method

  • Proposes a probabilistic model to analyze how negative sampling ratio $K$ affects the informativeness of training samples, especially under label noise.
  • Introduces a training effectiveness function that aggregates sample informativeness to evaluate the overall contribution of training samples to model learning.
  • Estimates the optimal $K$ as the value that maximizes the training effectiveness function, derived from empirical AUC curves under $K=1$.
  • Develops an adaptive negative sampling (ANS) method that adjusts $K$ dynamically across training stages, with a turning point at 10% of training steps.
  • Empirically tunes the turning point in ANS based on validation performance, though it is currently not automatically selected.
  • Applies the framework to real-world datasets in recommendation and NLP, comparing ANS against fixed-$K$ baselines.

Experimental results

Research questions

  • RQ1What is the optimal negative sampling ratio $K$ for InfoNCE when training labels are noisy?
  • RQ2How does the informativeness of training samples vary with different values of $K$ under label noise?
  • RQ3Can a semi-quantitative framework accurately predict the optimal $K$ for different tasks and data qualities?
  • RQ4Does dynamically adjusting $K$ during training improve model performance compared to fixed-$K$ strategies?
  • RQ5How does the training effectiveness function correlate with actual model performance across different training stages?

Key findings

  • The proposed framework accurately predicts the optimal negative sampling ratio $K$ for various real-world tasks, outperforming default fixed-$K$ choices.
  • The adaptive negative sampling (ANS) method consistently achieves better performance than static negative sampling strategies on news recommendation and title-body matching tasks.
  • On the news recommendation task, ANS improves AUC and nDCG@10 across multiple baselines, including NRMS, LSTUR, and NAML.
  • On the news title-body matching task, ANS achieves higher AUC and HR@5 than fixed-$K$ baselines using Siamese Transformer and its CNN/LSTM variants.
  • The optimal $K$ is often small at the beginning and end of training, with a peak in the middle, suggesting dynamic adjustment is beneficial.
  • The framework requires initial training with $K=1$ to estimate key parameters, but this step is necessary for accurate $K$ prediction.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.