Aligning Large Language Models with Recommendation Knowledge (2024)

Abstract: Large language models (LLMs) have recently been used as backbones for recommender systems. However, their performance often lags behind conventional methods in standard tasks like retrieval. We attribute this to a mismatch between LLMs’ knowledge and the knowledge crucial for effective recommendations. While LLMs excel at natural language reasoning, they cannot model complex user-item interactions inherent in recommendation tasks. We propose bridging the knowledge gap and equipping LLMs with recommendation-specific knowledge to address this. Operations such as Masked Item Modeling (MIM) and Bayesian Personalized Ranking (BPR) have found success in conventional recommender systems. Inspired by this, we simulate these operations through natural language to generate auxiliary-task data samples that encode item correlations and user preferences. Fine-tuning LLMs on such auxiliary-task data samples and incorporating more informative recommendation-task data samples facilitates the injection of recommendation-specific knowledge into LLMs. Extensive experiments across retrieval, ranking, and rating prediction tasks on LLMs such as FLAN-T5-Base and FLAN-T5-XL show the effectiveness of our technique in domains such as Amazon Toys & Games, Beauty, and Sports & Outdoors. Notably, our method outperforms conventional and LLM-based baselines, including the current SOTA, by significant margins in retrieval, showcasing its potential for enhancing recommendation quality.

## introduction large language models (llms) exhibit strong generalization abilities through zero-shot learning, incontext learning @xcite , fine-tuning, and instruction tuning @xcite . encouraged by this, recent studies explore the use of llms as backbones in recommendation @xcite @xcite . despite their great potential, llms are inferior to supervised recommenders @xcite in recommendation tasks such as rating-prediction under zero-shot and few-shot in-context learning settings @xcite . we hypothesize that this stems from a gap between llms' knowledge and recommendation knowledge: llms are proficient at natural language reasoning, while recommendation involves modeling complex user-item interactions. in this work, we propose to mitigate this gap by fine-tuning llms with data samples that encode recommendation knowledge. recent works @xcite @xcite show that certain recommendation knowledge can be introduced into llms through instruction tuning. as shown in figure 1 (a), their training data samples, which we refer to as recommendation-task data samples, primarily help llms understand the recommendation tasks by providing instructions on what to do (e.g., "pick an item for the user from the following candidates."). in terms of modeling the target recommendation domain, however, they present raw user and item features for personalization (e.g., the user's id or the ids of the items they recently interacted with), which are insufficient for llms to fully comprehend the target domain. considering the aforementioned limitations of using llms as recommenders, we propose a novel approach to generate additional fine-tuning data samples for llms that effectively encode recommendation knowledge, particularly focusing on item correlations within the target domain. we refer to these generated data samples as auxiliarytask data samples, as they are used as auxiliary tasks in addition to the recommendations tasks. while developing the auxiliary tasks, our key inspiration comes from the classical operations that are typically used to train conventional recommender systems, namely, masked item modeling (mim) @xcite and bayesian personalized ranking (bpr) @xcite . our key innovation lies in converting the mim and bpr tasks into natural language tasks that can be used to train the llms. we also incorporate the masked language modeling (mlm) @xcite task for the user's past interactions to supplement the mim task with fine-grained item correlations. our contributions can be summarized as follows: llms for recommendation. llms have recently been explored for recommendation tasks due to their ability to understand, generate, and reason with natural language. several studies focus on incorporating llms' natural language capabilities into existing recommendation techniques. e.g., @xcite encode item contents (title, description, etc.) with bert @xcite , which enables learning semantically informed embeddings even for zeroshot items. moreover, pre-trained llm backbones have also been used for recommendation through zero-shot learning @xcite , in-context learning @xcite , fine tuning @xcite , and instruction tuning @xcite @xcite . besides helping classic recommendation tasks, llms also enable novel recommendation use cases. geng et al. 2022 leverage llms to explain the recommendation results. gao et al. 2023; wang and lim 2023 utilize gpt-3 (brown et al., 2020) for conversational recommendation. christakopoulou et al. 2023 extract persistent user interests with llms for deeper user understanding. carranza et al. 2023 generate private synthetic representations of the original data with llms for privacy-preserving recommendation. recommendation as instruction-following. the success of instruction tuning, i.e., fine-tune on data described via instructions @xcite , has inspired attempts that instructiontune llm backbones for recommendation tasks. geng et al. 2022 formalize various recommendation tasks as natural language instructions and fine-tune a unified recommender with t5 (raffel et al., 2020) backbone. zhang et al. 2023 further supplement the tuning data with user preferences/intentions deduced by gpt-3.5 foot_0 to accommodate instructions of free forms. bao et al. 2023 explore instruction tuning llms with limited data. in contrast to the existing studies, our work focuses on introducing new recommendation knowledge into llms, which we believe is the key for improving recommenders with llm backbones. we create auxiliary tasks that improve the recommendation tasks, including retrieval, ranking, and rating prediction. our proposed recommendation-task and auxiliary-task data samples include raw user purchase sequences in addition to natural language instructions. these data samples supplement each other in encoding the target recommendation domain knowledge. we experiment under restricted settings. compared to the previous studies @xcite , we consider larger candidate pools (e.g., our retrieval and ranking experiments consider the entire dataset and 99 hard negatives, respectively). unlike bao et al. 2023, we fully train all models to maximize their performances. ## methodology we propose designing data samples that encode recommendation knowledge to align llms with the target recommendation domain. sections 3.1 and 3.2 discuss our auxiliary-task and recommendationtask data, respectively. section 3.3 introduces a simple multi-task learning framework that we use to fine-tune llms. ## experiments we evaluate the proposed method and compare it with conventional as well as llm-based recommenders. we aim to answer the following research questions: rq1. can our method introduce knowledge into llms from new recommendation domains? rq2. how does our model perform compared to the conventional as well as llm-based recommenders in retrieval, ranking, and rating prediction? rq3. how beneficial are the individual proposed tasks? rq4. what's the effect of varying the size of the backbone llm? ## conclusion we propose to align llms with the recommendation domain by fine-tuning with data samples that encode recommendation knowledge. we propose auxiliary-task data samples that encode item correlations contained in users' preferences. we further design recommendation-task data samples that are more informative than ones in existing studies. experiments on retrieval, ranking, and rating prediction show that our method effectively introduces recommendation knowledge into flan-t5-base/xl from three domains. our method greatly outperforms both conventional and llm-based baselines in retrieval, achieving the new sota.