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

更快且内存高效的序列推荐模型训练方法用于大规模目录

Faster and Memory-Efficient Training of Sequential Recommendation Models for Large Catalogs

MWS AI;Applied AI;Sber AI Lab(Sber AI 实验室);IVI;Sber

Maxim Zhelnin, Dmitry Redko, Daniil Volkov, Anna Volodkevich, Petr Sokerin, Valeriy Shevchenko, Egor Shvetsov, Alexey Vasilev, Darya Denisova, Ruslan Izmailov, Alexey Zaytsev

AI总结:

本文提出了一种更高效的序列推荐模型训练方法,通过减少内存消耗和提高计算效率,以适应大规模目录的训练需求。

摘要:

基于变压器架构的序列推荐(SR)在现实应用中被广泛采用,其中SR模型需要频繁重新训练以适应不断变化的用户偏好。然而,训练基于变压器的SR模型往往面临高计算成本,这与对大量物品目录进行评分有关,通常超过数千个物品。这主要是由于使用交叉熵损失(CE loss),其中峰值内存消耗与目录大小、批量大小和序列长度成比例。认识到这一点,推荐系统领域的从业者通常通过将交叉熵(CE)损失与负采样相结合来解决内存消耗问题,从而减少最终层的显式内存需求。然而,少量的负样本会降低模型性能,而我们证明,在我们的工作中,增加负样本数量和批量大小进一步提高模型性能,但迅速超过工业显卡的容量(~40Gb)。在本工作中,我们介绍了CCE-方法,该方法提供了具有负采样的CE损失的GPU高效实现。我们的方法将训练速度提高了一倍,同时将内存消耗减少了超过10倍。利用使用CCE-进行模型训练所获得的内存节省,可以实现比使用原始PyTorch实现的损失函数训练的模型在具有大规模物品目录的数据集上更高的准确性。最后,我们分析了关键的内存相关超参数,并强调了这些因素之间需要微妙平衡的必要性。我们证明,同时扩大负样本数量和批量大小可以得到更好的结果,而不是只最大化其中一个。为了进一步推广CCE-,我们发布了一个Triton内核,高效地实现了所提出的方法。

英文摘要:

Sequential recommendations (SR) with transformer-based architectures are widely adopted in real-world applications, where SR models require frequent retraining to adapt to ever-changing user preferences. However, training transformer-based SR models often encounters a high computational cost associated with scoring extensive item catalogs, often exceeding thousands of items. This occurs mainly due to the use of cross-entropy loss, where peak memory scales proportionally to catalog size, batch size, and sequence length. Recognizing this, practitioners in the field of recommendation systems typically address memory consumption by integrating the cross-entropy (CE) loss with negative sampling, thereby reducing the explicit memory demands of the final layer. However, a small number of negative samples would degrade model performance, and as we demonstrate in our work, increasing the number of negative samples and the batch size further improves the model's performance, but rapidly starts to exceed industrial GPUs' size (~40Gb). In this work, we introduce the CCE- method, which offers a GPU-efficient implementation of the CE loss with negative sampling. Our method accelerates training by up to two times while reducing memory consumption by more than 10 times. Leveraging the memory savings afforded by using CCE- for model training, it becomes feasible to enhance its accuracy on datasets with a large item catalog compared to those trained with original PyTorch-implemented loss functions. Finally, we perform an analysis of key memory-related hyperparameters and highlight the necessity of a delicate balance among these factors. We demonstrate that scaling both the number of negative samples and batch size leads to better results rather than maximizing only one of them. To facilitate further adoption of CCE-, we release a Triton kernel that efficiently implements the proposed method.

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

↑