修正采样Softmax的偏差问题,提升大规模推荐系统的检索精度。
Correcting the LogQ Correction: Revisiting Sampled Softmax for Large-Scale Retrieval
- 重新推导logQ修正公式,指出原方法忽略正样本固定出现的特性。
- 提出新修正公式,引入可解释的样本权重,反映模型当前不确定性。
- 在公开与私有数据集上均优于标准logQ修正,适合工业级推荐系统使用。
双塔神经网络是推荐系统中检索阶段的常用架构。这类模型通常在全量物品库上使用Softmax损失进行训练,但在网页规模场景下,物品库过大导致完整Softmax不可行。一种常见解决方案是采样Softmax,通过少量采样负例近似完整Softmax。业界广泛采用的一种方法是使用批次内负例,即从当前小批量中抽取负例。然而,这会引入偏差:频繁出现在批次中的热门物品被惩罚更重。为缓解此问题,一种流行的技术称为logQ修正,在训练时对logits减去物品在批次中的概率对数。该方法基于梯度偏差分析,结合重要性采样,两次使用批次分布作为提议分布。尽管提升了模型质量,但未完全消除偏差。本文重新审视logQ修正的推导,发现其忽略了一个微妙但关键的细节:分母中的正样本并非蒙特卡洛采样,而是以概率1始终存在。我们提出一个改进的修正公式,准确考虑这一事实。值得注意的是,新损失引入了可解释的样本权重,反映当前参数下误分类的概率。我们在公共和私有数据集上评估该方法,结果表明其一致优于标准logQ修正。
原文摘要 · Abstract (English)
Two-tower neural networks are a popular architecture for the retrieval stage in recommender systems. These models are typically trained with a softmax loss over the item catalog. However, in web-scale settings, the item catalog is often prohibitively large, making full softmax infeasible. A common solution is sampled softmax, which approximates the full softmax using a small number of sampled negatives. One practical and widely adopted approach is to use in-batch negatives, where negatives are drawn from items in the current mini-batch. However, this introduces a bias: items that appear more frequently in the batch (i.e., popular items) are penalized more heavily. To mitigate this issue, a popular industry technique known as logQ correction adjusts the logits during training by subtracting the log-probability of an item appearing in the batch. This correction is derived by analyzing the bias in the gradient and applying importance sampling, effectively twice, using the in-batch distribution as a proposal distribution. While this approach improves model quality, it does not fully eliminate the bias. In this work, we revisit the derivation of logQ correction and show that it overlooks a subtle but important detail: the positive item in the denominator is not Monte Carlo-sampled - it is always present with probability 1. We propose a refined correction formula that accounts for this. Notably, our loss introduces an interpretable sample weight that reflects the model's uncertainty - the probability of misclassification under the current parameters. We evaluate our method on both public and proprietary datasets, demonstrating consistent improvements over the standard logQ correction.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。