arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2105.13003cs.LGcs.IR
收藏

重新思考InfoNCE:您需要多少阴性样本?

Rethinking InfoNCE: How Many Negative Samples Do You Need?

Tsinghua University(清华大学);Microsoft Research Asia(微软亚洲研究院)

Chuhan Wu, Fangzhao Wu, Yongfeng Huang

摘要:

InfoNCE损失是一种广泛用于对比模型训练的损失函数。它的目的是估计一对变量之间的互信息之间的每一个积极的对和相关的$K$负对之间的区别。证明了在样本标签干净的情况下,当包含更多的负样本时,互信息估计的下界更紧,这通常会产生更好的模型性能。然而,在许多现实任务中,标签通常包含噪声,并且为模型训练引入太多噪声负样本可能是次优的。在本文中,我们研究了多少负样本是最佳的InfoNCE在不同的情况下,通过半定量的理论框架。更具体地说,我们首先提出了一个概率模型来分析负采样率$K$对训练样本信息量的影响。然后,我们设计了一个训练有效性函数来衡量训练样本对模型学习的整体影响,基于它们的信息量。我们使用使训练有效性函数最大化的$K$值来估计最佳负采样率。基于我们的框架,我们进一步提出了一种自适应负采样方法,可以动态调整负采样率,以改善基于InfoNCE的模型训练。在不同真实数据集上的大量实验表明,该框架能够准确预测不同任务下的最佳负采样率,并且所提出的自适应负采样方法比常用的固定负采样率策略具有更好的性能。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑