R ec M ind: Large Language Model Powered Agent For Recommendation (2024)

Abstract: While the recommendation system (RS) has advanced significantly through deep learning, current RS approaches usually train and fine-tune models on task-specific datasets, limiting their generalizability to new recommendation tasks and their ability to leverage external knowledge due to model scale and data size constraints. Thus, we designed an LLM-powered autonomous recommender agent, RecMind, which is capable of leveraging external knowledge, utilizing tools with careful planning to provide zero-shot personalized recommendations. We propose a Self-Inspiring algorithm to improve the planning ability. At each intermediate step, the LLM “self-inspires” to consider all previously explored states to plan for the next step. This mechanism greatly improves the model’s ability to comprehend and utilize historical information in planning for recommendation. We evaluate RecMind’s performance in various recommendation scenarios. Our experiment shows that RecMind outperforms existing zero/few-shot LLM-based recommendation baseline methods in various tasks and achieves comparable performance to a fully trained recommendation model P5.

## introduction the recommender system (rs) plays a key role in search engines, e-commerce, and various other internet platforms. an rs analyzes the historical interactions between users and items to recommend potential items @xcite . the rs has been enhanced by deep neural networks (dnns) to more effectively learn the representations of users, items, and sequential behaviors @xcite @xcite . however, most existing dnn-based methods (e.g., cnn and lstm) and pre-trained language models (e.g., bert) cannot sufficiently capture textual knowledge about users and items due to limitations in model scale and data size. besides, most existing rs methods have been designed for specific tasks and are inadequate in generalizing to unseen recommendation tasks @xcite . recent advances in large language models (llms), such as gpt-3 @xcite , @xcite , llama @xcite , llama-2 @xcite , and palm-2 @xcite have demonstrated remarkable results in a wide range of tasks, which have motivated the research of leveraging llms for recommendation to mitigate the aforementioned challenges @xcite @xcite . however, existing studies primarily rely on knowledge stored within the model's weights, neglecting the potential benefits of leveraging external tools to access real-time information and external knowledge @xcite . furthermore, the reasoning ability of llms is not fully utilized for recommendation, resulting in suboptimal predictions due to the intricate nature of recommendation-related tasks @xcite . to better utilize the strong reasoning and toolusing abilities of llms, we design a recommendation agent, recmind that leverages an llmpowered api as its intellectual core and incorporates a few key components. the first key component is planning which enables the agent to break complex recommendation tasks into manageable steps for efficient handling of complex situations. each step of planning involves thought, action, and observation (see figure 1 for examples and section 3 for details). the agent is also equipped with memory consisting of personalized memory and world knowledge, each accessible through specific tools. the tools enhance the agent's functionality on top of the llm, such as retrieving relevant knowledge, or assisting with the reasoning process. to further enhance the planning ability of the agent, we propose a new planning algorithm self-inspiring (si). at each intermediate planning step, the agent "self-inspires" to consider all previously explored paths for the next planning. unlike existing chain-of-thoughts (cot) @xcite and tree-of-thoughts (tot) @xcite , which discards states (thoughts) in previously explored paths when generating a new state, si retains all previous states from all history paths when generating new state. si is inspired by the intuition that all historical states can provide useful information for better planning. figure 1 provides an example of tot and si, showing that si achieves a more accurate rating than tot due to better planning. to the best of our knowledge, this is the first public research work on an llm-powered autonomous agent for recommendation. the main contributions of our work are: ## architecture as shown in figure 2 , recmind consists of key components: llm-powered api such as chatgpt to drive the overall reasoning, planning which breaks down a task into smaller sub-tasks for stepby-step planning, memory which provides the agent with the capability to retain and recall information over extended periods, and tools for obtaining relevant extra information from memory that is missing from the model weights and aiding the reasoning. we introduce the key components planning, memory, and tools for recmind in the subsequent parts. planning planning helps llm agents decompose tasks into smaller, manageable subgoals for handling complex tasks. consider the setting where the goal is to generate the final result y given problem x via an llm agent parameterized by θ. the traditional input-output method gives the result by y ∼ p θ (y|x). with planning, recmind generates the result y ∼ p θ (y|planing(x)), where planing(x) is a set of prompts that decomposes problem x into a series sub-tasks that is composed of thought h, action a, and observation o. figure 1 provides examples of planning, including thoughts, actions, and observations. we first review existing popular reasoning methods, such as cot and tot, which we have explored for recmind. then, we present the proposed si algorithm. all these planning methods can be viewed as traversing through a latent reasoning tree, as shown in figure 3 . we find the discarded historical states from previously explored branches such as s @xcite t+1 from branch z (1) usually contain helpful information for rec-mind to generate a better state compared with only considering the final path of tot. thus, we propose self-inspiring (si) as shown in figure 3(b) and algorithm 1, a new planning method for rec-mind. si inspires itself into exploring an alternative reasoning branch, while retaining all previous states. at m-th path and step t, si generates the next step of planning by considering all previous paths, i.e., s (m) t+1 ∼ p θ (s t+1 |z (1) , ..., z (m) ). after exploring n paths, the recmind obtains the final result y ∼ p θ (x, z (1) , ..., z (n) ). figure 3 provides an example to illustrate the key difference between tot and si. in tot (figure 3(a) ), the new state n (2) at the second path is generated by only considering state n -1. the state n (1) is discarded. however, in si (figure 3(b) ), the new state n (2) is generated based on both n -1 and n (1). the mechanism of si makes it possible for the algorithm 1: self-inspiring planning require: problem x, the current planning path @xmath0, ..., z (m-1) , s ## experiments we evaluate the performance of the recmind agent in various recommendation scenarios, including rating prediction, sequential recommendation, direct recommendation, explanation generation, and review summarization. first, we provide an overview of the datasets and evaluation metrics in section 4.1 and section 4.2. subsequently, we present the experimental settings and results of recmind on each recommendation task in section 4.3 and section 4.4. next, we study the domain transfer capability of recmind in section 4.5 and how recmind performs with different foundation llms 4.6. in the end, we further explore how the performance of si in general reasoning tasks in 4.7 and the running time of recmind based on si compared to tot. the comparison on running time deferred to section b.3 of the supplementary shows that rec-mind based on si takes less inference time than the existing state-of-the-art diverse reasoning method tot.