Source-linked AI summary

Recommender AI Agent: Integrating Large Language Models for Interactive Recommendations

Xu Huang, Jianxun Lian, Yuxuan Lei, Jing Yao, Defu Lian, Xing Xie

arXiv:2308.16505v3cs.IRcs.AI

TL;DR

Conversational product discovery calls for systems that can respond to diverse user inquiries and intents. InteRecAgent connects LLMs with traditional recommenders through tools and a supporting workflow; experiments across three public datasets demonstrate effectiveness, particularly in domains less covered by world knowledge.

  • Problem

    Conversational product discovery creates a need for recommendation systems that can understand and respond to diverse user inquiries and intents.

    Source: §1 · p. 1
  • Method

    InteRecAgent connects LLMs to traditional recommenders through querying, retrieval, and ranking tools, supported by a shared candidate bus and plan-first execution.

    Source: §1 · p. 2, Candidate Bus · p. 4, §3.3 · p. 5
  • Results

    Across three public datasets, InteRecAgent demonstrates effectiveness, with significant advantages in domains less covered by world knowledge.

    Source: §1 · p. 2
  • Takeaways & Limitations

    Traditional recommender models can be transformed into interactive systems by harnessing LLMs.

    Source: §5 · p. 10

Abstract

from arXiv · show

Recommender models excel at providing domain-specific item recommendations by leveraging extensive user behavior data. Despite their ability to act as lightweight domain experts, they struggle to perform versatile tasks such as providing explanations and engaging in conversations. On the other hand, large language models (LLMs) represent a significant step towards artificial general intelligence, showcasing remarkable capabilities in instruction comprehension, commonsense reasoning, and human interaction. However, LLMs lack the knowledge of domain-specific item catalogs and behavioral patterns, particularly in areas that diverge from general world knowledge, such as online e-commerce. Finetuning LLMs for each domain is neither economic nor efficient. In this paper, we bridge the gap between recommender models and LLMs, combining their respective strengths to create a versatile and interactive recommender system. We introduce an efficient framework called \textbf{InteRecAgent}, which employs LLMs as the brain and recommender models as tools. We first outline a minimal set of essential tools required to transform LLMs into InteRecAgent. We then propose an efficient workflow within InteRecAgent for task execution, incorporating key components such as memory components, dynamic demonstration-augmented task planning, and reflection. InteRecAgent enables traditional recommender systems, such as those ID-based matrix factorization models, to become interactive systems with a natural language interface through the integration of LLMs. Experimental results on several public datasets show that InteRecAgent achieves satisfying performance as a conversational recommender system, outperforming general-purpose LLMs. The source code of InteRecAgent is released at https://aka.ms/recagent.

1 Introduction

InteRecAgent combines LLMs with traditional recommendation models to support interactive recommendations, addressing LLMs’ gaps in domain-specific behavior, private data, and newly released items. It adds specialized tools, memory, planning, and reflection, and introduces RecLlama as a smaller agent brain.

1 Introduction

  • As users increasingly seek products through conversational interfaces, recommender systems need to understand and respond effectively to diverse inquiries and intents.LLMs’ contextual understanding, language generation, and reasoning offer a way to make recommendation interactions more natural.Source: §1 · p. 1
  • LLMs can miss fine-grained domain behavior, private-domain knowledge, and newly released items, motivating their combination with in-domain models for recommendation.Fine-tuning with up-to-date data can be prohibitively expensive.Source: §1 · p. 1
  • InteRecAgent connects LLMs with traditional recommendation models through querying, retrieval, and ranking tools, using a shared candidate bus and short- and long-term user profiles.The shared candidate bus stores intermediate states to avoid passing large item lists through prompts, while user profiles track preferences and history for personalized ranking.Source: §1 · p. 2
  • InteRecAgent plans all tool calls before execution, retrieves demonstrations matching user intent to guide plans, and uses reflection to detect errors and retry unsatisfactory tasks.The plan-first strategy is intended to lower LLM inference costs, and reflection returns execution to the initial state before a repeated plan-and-execution cycle.Source: §1 · p. 2
  • Experiments on three public datasets demonstrate InteRecAgent’s effectiveness, especially in domains less covered by world knowledge; RecLlama also surpasses several larger models as an agent brain.RecLlama is a 7-billion-parameter LLaMA 2 model fine-tuned on an imitation dataset of tool-plan generations from GPT-4-powered agent–simulator interactions.Source: §1 · p. 2

2 Related Work

Related work divides conversational recommender systems into attribute-based question-answering and open-ended conversation, and reviews LLM capabilities and agent mechanisms. The authors position their work as the first exploration of the LLM-plus-tools paradigm in recommender systems.

2.1 Conversational Recommender System

  • Attribute-based CRS seeks recommendations in few rounds by refining user interests through item-attribute questions, with attribute selection and exploration–exploitation as key challenges (Mirzadeh, Ricci, and Bansal 2005; Zhang et al. 2018; Christakopoulou, Radlinski, and Hofmann 2016; Xie et al. 2021).The paper distinguishes this approach from open-ended CRS, which handles free-format conversational data (Gao et al. 2021).Source: §2.1 · p. 2
  • Open-ended CRS progressed from pretrained language models for conversation understanding and response generation to methods using external knowledge, but struggles with complex inquiries and seamless communication (Li et al. 2018; Penha and Hauff 2020; Chen et al. 2019; Wang, Su, and Chen 2022; Wang et al. 2022b).The paper identifies LLMs as an opportunity to address these limitations and improve the user experience.Source: §2.1 · p. 2

2.2 Enhancing LLMs

3 Methodologies

InteRecAgent combines an LLM’s conversational abilities with recommender tools for domain-specific knowledge, coordinating tool use through candidate and user-profile memory, plan-first execution, reflection, and optional small-model fine-tuning.

3.1 The Overall Framework

  • InteRecAgent uses an LLM as a conversational brain and recommender tools for item queries, candidate retrieval, and preference-aware ranking.SQL handles item-information queries and explicit hard conditions, while item-to-item latent-embedding matching addresses soft conditions; rankers use user profiles to score candidates. The framework also targets challenges with long tool outputs and incorrect tool use.Source: §3.1 · p. 3

Candidate Bus

  • The Candidate Bus stores current candidates separately from prompts and lets tools filter and pass them sequentially.It initializes with all items by default, but a memory-initialization tool can set user-specified candidates; a tracker records each tool’s name, input, and output for reflection.Source: Candidate Bus · p. 4

User Profile

  • User profiles track likes, dislikes, and current expectations, combining long-term preferences with recent dialogue context for tool invocation.When dialogue exceeds the input window, the previous segment’s profile is merged into long-term memory, while short-term memory comes from the most recent conversations in the prompt.Source: User Profile · p. 4

3.3 Plan-first Execution with Dynamic

  • Plan-first execution separates planning from tool calls, using dynamically selected demonstrations to guide plans; for N steps, it uses 2 API calls versus N+1 for ReAct.Demonstrations are intent–plan pairs: the authors seed about 20 examples, then use input-first and output-first LLM generation to expand them, retaining output-first examples whose generated plans are consistent.Source: §3.3 · p. 5, Table 1 · p. 5

3.4 Reflection

  • An actor–critic reflection mechanism has the critic assess the actor’s plan, tool outputs, and response, prompting replanning when execution or response is judged unreasonable.The actor handles planning and response generation, while the critic evaluates them; the authors describe this cooperation as improving robustness, error correction, and tool use.Source: §3.4 · pp. 5–6

3.5 Tool Learning with Small Language Models

  • RecLlama distills GPT-4’s tool-planning ability into a fine-tuned 7B-parameter Llama using instruction–plan pairs generated from conversations and varied scenarios.The dataset contains 16,183 samples: 13,525 from simulated conversations and 2,658 from a second method using 30 crafted dialogues; training data uses Steam and MovieLens, excluding Beauty.Source: §3.5 · p. 6

4 Experiments · 4.1 Experimental Setup

The experiments assess InteRecAgent through simulated multi-turn dialogues and one-turn recommendation, using three recommendation datasets, multiple baselines, task-specific metrics, and a specified tool configuration.

Evaluation Strategies.

  • GPT-4 simulates users by conditioning role-play on interaction history, withholding the last item as the next-interest target for multi-turn evaluation.The default session-wise setting limits access to the current dialogue and clears memory when the user succeeds or fails; its short conversations do not activate long-term memory.Source: Evaluation Strategies · p. 6
  • Two extended-dialogue strategies evaluate lifelong memory: LONG-CHAT extends interaction, while LONG-CONTEXT loads synthesized multi-day histories into memory.LONG-CHAT alternates history sharing, target details, and casual chat, with casual conversation every five rounds; mentioning the target ends it successfully. Baseline histories in LONG-CONTEXT are truncated when exceeding the LLM window.Source: Evaluation Strategies · pp. 6–7
  • One-turn evaluation tests retrieval and candidate ranking from a GPT-4-generated dialogue, using only session-wise interactions with long-term memory deactivated.The recommendation agent is asked either to provide k recommendations or rank supplied candidates; the protocol follows Re-Dial settings (Li et al. 2018).Source: Evaluation Strategies · p. 7
  • Experiments use Steam, MovieLens, and Amazon Beauty with leave-one-out splits; testing samples include 1,000 user-simulator, 500 one-turn, and 100 lifelong instances.Training of all tools uses training and validation sets; the smaller lifelong sample reflects the cost of long conversations.Source: Evaluation Strategies · p. 7

Baselines.

  • Baselines include Random and Popularity, LLaMA-2 and Vicuna models, GPT-3.5 and GPT-4, and Chat-Rec with GPT-3.5 or GPT-4.Chat-Rec retrieves candidates with text-embedding-ada-002 before an LLM processes them.Source: Baselines · p. 7

Metrics.

  • Evaluation emphasizes recommendation performance, measuring simulated-dialogue Hit@k and average turns (AT@k), plus one-turn retrieval Recall@k and ranking NDCG@k.Unsuccessful simulated recommendations count as k + 1 turns when calculating AT.Source: Metrics · p. 7

Implementation Details.

  • GPT-4 handles intent parsing and planning; SQL, ItemCF, and SASRec provide information querying, item retrieval, and ranking, respectively.Dynamic demonstration selection uses sentence-transformers with ChromaDB; settings include 3 demonstrations, up to 1,000 hard-condition candidates, and soft-condition retrieval cut to the top 5%.Source: Implementation Details · p. 8

4.2 Evaluation with User Simulator

In session-wise evaluation, InteRecAgent outperforms other LLMs on hit rate and average turns across three datasets; in lifelong conversations, long-term memory further improves its performance. Results also highlight the value of recommender tools in private domains such as Amazon Beauty.

Session-wise setting.

  • InteRecAgent surpasses other LLMs in hit rate and average turns across all three datasets in the session-wise setting.The results characterize its recommendations as more accurate and efficient than those of general LLMs.Source: Session-wise setting · p. 8
  • Larger LLMs generally perform better, but Llama2-7B and Llama2-13B both perform extremely poorly on Beauty.GPT-3.5 and GPT-4, with parameter sizes exceeding 100B, significantly outperform Llama2 and Vicuna-v1.5 13B models in nearly all cases; 13B models almost always surpass 7B models.Source: Session-wise setting · p. 8
  • In Amazon Beauty, complex professional item names cause most LLMs to hallucinate and lose performance, underscoring recommender agents’ value in private domains.The passage describes Beauty as more private than gaming or movies, with more items that are not well covered by common world knowledge or are new.Source: Session-wise setting · p. 8
  • Chat-Rec outperforms GPT-3.5 and GPT-4 in Beauty but trails InteRecAgent, and its single-tool design cannot handle multifaceted item-detail or intricate-criteria queries.Chat-Rec uses a text-embedding retrieval tool as a simplified version of InteRecAgent.Source: Session-wise setting · p. 8

Lifelong conversation setting.

  • Adding long-term memory improves InteRecAgent under both LONG-CHAT and LONG-CONTEXT, while the version without memory outperforms GPT-4 across all datasets.LONG-CHAT permits up to 50 dialogue rounds with the user simulator; the authors attribute the memory gains to better capture of user preferences during lifelong interactions.Source: Lifelong conversation setting · p. 8, Table 3 · p. 8, Table 4 · p. 8

4.3 Evaluation with One-Turn Recommendation

InteRecAgent outperforms all baselines in one-turn retrieval and ranking, while retaining high accuracy on Amazon Beauty. The evaluation uses Recall@5 for retrieval and NDCG@20 for ranking.

4.3 Evaluation with One-Turn Recommendation

  • Retrieval uses k=5 and Recall@5; ranking uses 19 randomly sampled negatives plus one positive item and NDCG@20, while Chat-Rec ranking results are omitted.Without embedding-based candidate retrieval, Chat-Rec degenerates into GPTs.Source: §4.3 · p. 9
  • InteRecAgent outperforms all baselines, and retains high accuracy on Amazon Beauty despite LLMs’ severe setback there.The authors attribute this to the effectiveness of their tool-augmented framework and its superiority in the private domain.Source: §4.3 · p. 9
  • Some LLMs underperform random and popularity methods in ranking, particularly on Amazon, primarily because they fail to follow ranking instructions and produce out-of-scope items.The authors link this behavior to LLM uncertainty, especially in smaller models.Source: §4.3 · p. 9

4.4 Comparions of Different LLMs as the Brain

The section compares LLMs used as InteRecAgent’s brain, finding that RecLlama is particularly effective at planning and generalizes to Amazon Beauty despite being trained on movie and game samples.

4.4 Comparions of Different LLMs as the Brain

  • The section compares different LLMs in InteRecAgent; GPT-4 was used in previous experiments, RecLlama is a fine-tuned 7B model, and ToolLlaMA2-7B is evaluated with two instruction formats.The ToolLlaMA2-7B variants use the original instructions and instructions realigned to ToolLlaMA’s format, denoted T-LlaMA(O) and T-LlaMA(A), respectively, because ToolLlaMA and RecLlama use differing data formats.Source: §4.4 · p. 9
  • RecLlama crafts plans effectively, surpasses Textdavinci-003, and generalizes from movie and game training to Amazon Beauty, while slightly lagging its GPT-4 teacher.The paper describes the GPT-4 performance gap as expected because RecLlama is distilled from GPT-4.Source: §4.4 · p. 9
  • GPT-3.5 underperforms Text-davinci-003 on this task despite its broader general capabilities.Source: §4.4 · p. 9
  • LlaMA-2-7B and ToolLlaMA-2-7B (Qin et al. 2023b) struggle to produce structured plans; ToolLlaMA excels more at API calls than discerning intent and planning recommendations.Source: §4.4 · p. 9

4.5 Ablation Study

Removing any of the three mechanisms reduced performance, with reflection’s removal having the greatest impact.

4.5 Ablation Study

  • Removing any mechanism reduced performance, and removing reflection had the largest impact because reflection corrects tool-input format errors and tool misuse.The ablations were evaluated in the user simulator setting using hit rate and average turns.Source: §4.5 · pp. 9–10
  • Removing plan-first or dynamic demonstrations caused only a slight performance decrease, with outcomes still surpassing most baselines.Source: §4.5 · p. 10
  • In Steam, removing plan-first raised API calls from an average 2.78 to 4.51 per turn and added approximately 10–20 seconds of latency.Source: §4.5 · p. 10

4.6 Case Study

The case studies show that InteRecAgent combines GPT-4’s conversational abilities with in-domain data and tools, producing more accurate responses in chit-chat, gaming, and e-commerce scenarios.

4.6 Case Study

  • In chit-chat, InteRecAgent retains GPT-4’s capabilities while querying domain-specific data, such as product counts, for more accurate information.Source: §4.6 · p. 10
  • For complex game requests, InteRecAgent follows user conditions and recommends RimWorld, the next game in the user’s history, while GPT-4 misidentifies 3D game Northgard as 2D.The passage attributes InteRecAgent’s inclusion of RimWorld to its superior ranking performance.Source: §4.6 · p. 10
  • In e-commerce, GPT-4 hallucinates products unavailable on Amazon, whereas InteRecAgent uses in-domain tools to respond more accurately to user requirements.Source: §4.6 · p. 10

5 Conclusion

InteRecAgent combines LLMs with traditional recommender models to create interactive recommendation systems, using interconnected tools and enhanced agent components; experiments show superior performance to general-purpose LLMs.

5 Conclusion

  • InteRecAgent outperforms general-purpose LLMs in experiments by combining recommender models’ strengths with LLMs.The framework aims to support personalized, interactive recommendations across domains.Source: §5 · p. 10
  • Its information query, retrieval, and ranking tools dynamically connect within a task-execution framework to handle complex user inquiries.The paper presents these as fundamental tools for transforming traditional recommender models into interactive systems.Source: §5 · p. 10
  • InteRecAgent enhances memory, task planning, and tool learning to adapt LLM-based agents to recommendation tasks.Source: §5 · p. 10

A Dataset

The evaluation uses Steam, MovieLens, and Amazon Beauty, with datasets filtered for in-domain tool training and some one-turn conversation samples excluded by OpenAI policy.

A Dataset

  • Experiments evaluate methods on Steam, MovieLens, and Amazon Beauty.The filtered-dataset statistics are presented in Table A1.Source: A Dataset · p. 13, Table A1 · p. 13
  • For in-domain tool training, users and items with fewer than 5 interactions are removed using the conventional k-core strategy.This filtering applies to the soft condition item retrieval and ranking tools.Source: A Dataset · p. 13
  • OpenAI policy filtering leaves fewer than 500 samples for the one-turn conversation experiments.Source: A Dataset · p. 13

B Prompts

Appendix B documents the prompts used across InteRecAgent components, including task descriptions, tools, reflection, demonstration generation, user simulation, and one-turn conversation generation.

B Prompts

  • Appendix B shares the prompts used in different InteRecAgent components.Source: B Prompts · p. 13

B.2 Tool Descriptions

  • InteRecAgent uses one SQL query tool, two retrieval tools, one ranking tool, and auxiliary tools for storing candidates and fetching final items from memory.Their descriptions appear in Figures C2–C5.Source: §B.2 · p. 13, Figure C2 · p. 15, Figure C3 · p. 15

B.3 Reflection

B.4 Demonstration Generation

  • Demonstrations pair user intents with plans: input-first and output-first strategies differ in their intent-generation prompts, while plan generation uses a separate prompt.The prompts are shown in Figures C7, C8, and C11.Source: §B.4 · p. 13, Figure C7 · p. 16, Figure C8 · p. 17

B.5 User Simulator

  • Figure 4 illustrates the prompt that instructs the LLM to act as a user.Source: §B.5 · p. 13

B.6 One-Turn Conversation Generation

B.1 Task Descriptions

Loading 2308.16505v3…