[论文解读] Rethinking InfoNCE: How Many Negative Samples Do You Need?
本文提出了一种半定量理论框架,用于估计对比学习中InfoNCE损失的最优负采样比例 $K$,并考虑了标签噪声的影响。该框架引入了一个训练有效性函数以衡量样本的丰富性,并推导出一种自适应负采样(ANS)方法,可在训练过程中动态调整 $K$,在多个真实世界任务中优于固定$K$策略。
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.
研究动机与目标
- 为解决在训练数据包含标签噪声时,InfoNCE中选择最优负采样比例 $K$ 的挑战。
- 开发一个理论框架,量化 $K$ 在标签噪声条件下对训练样本丰富性的影响。
- 设计一个训练有效性函数,用以衡量训练样本对模型学习的整体影响。
- 提出一种自适应负采样(ANS)方法,根据训练阶段特征动态调整 $K$。
- 通过实证方法验证该框架在预测最优 $K$ 方面的准确性,以及ANS在多样化真实世界数据集上的有效性。
提出的方法
- 提出一个概率模型,分析负采样比例 $K$ 如何影响训练样本的丰富性,尤其是在存在标签噪声的情况下。
- 引入一个训练有效性函数,聚合样本丰富性以评估训练样本对模型学习的整体贡献。
- 将最优 $K$ 估计为使训练有效性函数最大化的值,该值基于 $K=1$ 条件下的经验AUC曲线推导得出。
- 开发一种自适应负采样(ANS)方法,根据训练阶段动态调整 $K$,转折点设定在训练步数的10%处。
- 通过验证性能对ANS的转折点进行实证调优,尽管目前尚未实现自动选择。
- 将该框架应用于推荐和自然语言处理领域的实际数据集,并与固定$K$基线方法进行比较。
实验结果
研究问题
- RQ1当训练标签存在噪声时,InfoNCE的最优负采样比例 $K$ 是多少?
- RQ2在标签噪声条件下,不同 $K$ 值下训练样本的丰富性如何变化?
- RQ3半定量框架能否准确预测不同任务和数据质量下的最优 $K$?
- RQ4在训练过程中动态调整 $K$ 是否优于固定$K$策略,从而提升模型性能?
- RQ5训练有效性函数与不同训练阶段的实际模型性能之间是否存在相关性?
主要发现
- 所提出的框架能准确预测多种真实世界任务的最优负采样比例 $K$,优于默认的固定$K$选择。
- 自适应负采样(ANS)方法在新闻推荐和标题-正文匹配任务中,始终优于静态负采样策略。
- 在新闻推荐任务中,ANS在多个基线模型(包括NRMS、LSTUR和NAML)上均提升了AUC和nDCG@10。
- 在新闻标题-正文匹配任务中,ANS使用Siamese Transformer及其CNN/LSTM变体,相比固定$K$基线,取得了更高的AUC和HR@5。
- 最优 $K$ 通常在训练初期和末期较小,而在中间阶段达到峰值,表明动态调整具有优势。
- 该框架需要先以 $K=1$ 进行初始训练以估计关键参数,但此步骤对于准确预测 $K$ 是必要的。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。