This repository provides the implementation for ACL 2025 Findings paper "iAgent: LLM Agent as a Shield between User and Recommender Systems".
The traditional recommendation ecosystem primarily focuses on designing sophisticated models to enhance ranking performance, thereby increasing platform benefits. However, these models often neglect the importance of user-driven instructions and put users under the direct control of recommender systems.
In contrast, iAgent introduces an individualized, instruction-aware agent for each user, generating re-ranking results based on user instructions. The memory of the agent is influenced solely by the individual user, providing personalized services without external biases.
- New Datasets and Problem: To establish benchmarks for the new user-agent-platform paradigm, we created four recommendation datasets featuring user-driven instructions, collectively named InstructRec. These datasets were constructed from existing resources such as Amazon, Goodreads, and Yelp. We introduce an Instruction-aware Agent (iAgent) that learns user interests based on provided free-text instructions while leveraging external knowledge as a domain expert. Unlike constrained instructions in CRS and Webshop, the free-text instructions in InstructRec allow users to express their needs beyond product attributes.
Model | Instruction Awareness | Instruction Type | Dialogue Interaction | Dynamic Interest | Learning from Feedback | External Knowledge |
---|---|---|---|---|---|---|
SR | ❌ | N/A | N/A | ❌ | ❌ | ❌ |
CRS | ✅ | Fixed | Multiple Turns | ✅ | ❌ | ❌ |
RecAgent | ❌ | N/A | N/A | ❌ | ❌ | ✅ |
Ours | ✅ | Flexible | 0, 1, or Multiple Turns | ✅ | ✅ | ✅ |
- 🚀 Agent Learning from Individual Feedback: We introduce the Individual Instruction-aware Agent (i2Agent), which incorporates a dynamic memory mechanism featuring a profile generator and dynamic extractor to further explore user interests. The profile generator maintains a user-specific profile using historical information and feedback, while the dynamic extractor captures evolving profiles based on real-time instructions. Unlike existing recommendation models, i2Agent is designed specifically for individual users, ensuring that the interests of less-active users are protected and unaffected by other users.
conda create --name iagent python=3.9
pip install -r requirements.txt
- Create a data directory:
mkdir data/
cd data/
- Download InstructRec Dataset.
gdown $urls$
You need to get your OpenAI API key from https://platform.openai.com/api-keys. Then set up your OpenAI API key as an environment variable
export OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
- in InstructRec - Amazon Books Dataset
python main_iagent_mp.py --dataset "amazon" --domain "books" --agent_type "static"
- in InstructRec - Amazon Movietv Dataset
python main_iagent_mp.py --dataset "amazon" --domain "movietv" --agent_type "static"
- in InstructRec - GoodReads Dataset
python main_iagent_mp.py --dataset "good" --domain "reads" --agent_type "static"
- in InstructRec - Yelp Dataset
python main_iagent_mp.py --dataset "yelp" --domain "yelp" --agent_type "static"
- in InstructRec - Amazon Books Dataset
python main_iagent_mp.py --dataset "amazon" --domain "books" --agent_type "dynamic"
- in InstructRec - Amazon Movietv Dataset
python main_iagent_mp.py --dataset "amazon" --domain "movietv" --agent_type "dynamic"
- in InstructRec - GoodReads Dataset
python main_iagent_mp.py --dataset "good" --domain "reads" --agent_type "dynamic"
- in InstructRec - Yelp Dataset
python main_iagent_mp.py --dataset "yelp" --domain "yelp" --agent_type "dynamic"
If you found the codes useful, please cite our paper.
@inproceedings{xu2025iagent,
title = {iAgent: LLM Agent as a Shield between User and Recommender Systems},
author = {Xu, Wujiang and Shi, Yunxiao and Liang, Zujie and Ning, Xuying and Mei, Kai and Wang, Kun and Zhu, Xi and Xu, Min and Zhang, Yongfeng},
booktitle = {Findings of the Association for Computational Linguistics ACL 2025},
year = {2025}
}