揭示InfoNCE损失在相似性搜索中的泛化机制
Similarity search generalisation in contrastive learning with InfoNCE loss
- 提出基于Gâteaux导数的连续性边界,分析负样本数对泛化的影响
- 证明负样本数越大,泛化误差越小,收敛速度为O(1/k)
- 适用于研究对比学习泛化性、优化负样本数量的研究者
对比学习中嵌入模型的核心应用是相似性搜索。针对最常用的对比学习损失函数InfoNCE,本文表明:当使用k个负样本时,其总体风险与一个期望交叉熵之间的差距为O(1/k),该交叉熵衡量了利用学习到的嵌入函数对未见数据进行softmax相似性搜索,与理想情况下基于正样本生成器隐含相似性进行搜索之间的偏差。这一结果补充了现有在k→∞极限下以互信息或嵌入对齐与均匀性解释InfoNCE的理论框架。为量化泛化性能,本文引入一种新的连续性边界,通过Gâteaux微分推导得出。该边界保留了损失函数中负样本平均结构,并包含可调节的“逆温度”参数以反映算法温度。对于参数化的利普希茨嵌入函数,该分析简洁证明了InfoNCE损失中负样本平均效应会随k增长而稳定泛化误差。
原文摘要 · Abstract (English)
Similarity search is a primary application of embedding models trained by contrastive learning. For one of the most popular contrastive learning loss functions, InfoNCE, we show that the population risk with $k$ negative samples is $O(1/k)$ close to an expected cross-entropy which quantifies deviation between i) a softmax similarity search over unseen data using the learned embedding function, and ii) an idealised softmax search over the same data but using similarity implicitly represented in the positive sample generator. This complements existing interpretations of InfoNCE in the $k\to\infty$ limit which are phrased in terms of mutual information, and alignment versus uniformity in embeddings. To quantify generalisation performance, we introduce a new continuity bound for the InfoNCE loss, obtained via Gâteaux differentiation. The bound preserves the structure of averaging over negative samples present in the loss function and features an ``inverse temperature'' parameter which can be tuned to account for the algorithmic temperature. For embedding functions which are Lipschitz in a parameter, this yields a simple demonstration that the averaging effect of $k$ negative samples in the InfoNCE loss carries over to stabilisation of the generalisation error as $k$ grows.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。