MSL: Not All Tokens Are What You Need for Tuning LLM as a Recommender

Abstract

Large language models (LLMs), known for their comprehension capabilities and extensive knowledge, have been increasingly applied to recommendation systems (RS). Given the fundamental gap between the mechanism of LLMs and the requirement of RS, researchers have focused on fine-tuning LLMs with recommendation-specific data to enhance their performance. Language Modeling Loss (LML), originally designed for language generation tasks, is commonly adopted. However, we identify two critical limitations of LML: 1) it exhibits significant divergence from the recommendation objective; 2) it erroneously treats all fictitious item descriptions as negative samples, introducing misleading training signals. To address these limitations, we propose a novel Masked Softmax Loss (MSL) tailored for fine-tuning LLMs on recommendation. MSL improves LML by identifying and masking invalid tokens that could lead to fictitious item descriptions during loss computation. This strategy can effectively avoid the interference from erroneous negative signals and ensure well alignment with the recommendation objective supported by theoretical guarantees. During implementation, we identify a potential challenge related to gradient vanishing of MSL. To overcome this, we further introduce the temperature coefficient and propose an Adaptive Temperature Strategy (ATS) that adaptively adjusts the temperature without requiring extensive hyperparameter tuning. Extensive experiments conducted on four public datasets further validate the effectiveness of MSL, achieving an average improvement of 42.24% in NDCG@10. The code is available at https://github.com/WANGBohaO-jpg/MSL.

Publication
In Proceedings of the 47th International ACM SIGIR Conference on Research and Development in Information Retrieval
Bohao Wang
Bohao Wang
Student

I am a third-year Ph.D. student, and my supervisors are Prof. Chun Chen, Prof. Can Wang, and Prof. Jiawei Chen.

Jiawei Chen
Jiawei Chen
陈佳伟 研究员
Yan Feng
Yan Feng
冯雁 副教授
Chun Chen
Chun Chen
陈纯 院士
Can Wang
Can Wang
王灿 教授