← Open Source
LehengTHU

Agent4Rec

[SIGIR 2024 perspective] The implementation of paper "On Generative Agents in Recommendation".

Model DevelopmentEnvironmentsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
504
Stars
62
Forks
+1
This week
3
Contributors
Created 2023-10-12 · Updated 2026-10-13 · #18223 today
Top developers
chenyuxin1999LehengTHUleolee99

LehengTHU/Agent4Rec is ranked 18,223 with 504 stars.

Same-category comparison

LehengTHU/Agent4Rec is ranked 18,223 among these 8 peers; KaiyangZhou/pytorch-vsumm-reinforce is ranked 18,222.

Same-category comparison
NameRankMetrics
rwightman/posenet-python18,215
Language:
Python
Stars:
505
Forks:
181
Description:
A Python port of Google TensorFlow.js PoseNet (Real-time Human Pose Estimation).
umfieldrobotics/OceanSim18,218
Language:
Python
Stars:
505
Forks:
76
Description:
[IROS 2025] OceanSim: A GPU-Accelerated Underwater Robot Perception Simulation Framework.
Bartzi/stn-ocr18,220
Language:
Python
Stars:
504
Forks:
134
Description:
Code for the paper STN-OCR: A single Neural Network for Text Detection and Text Recognition.
KaiyangZhou/pytorch-vsumm-reinforce18,222
Language:
Python
Stars:
504
Forks:
152
Description:
Unsupervised video summarization with deep reinforcement learning (AAAI'18).
cre185/InstantSfM18,231
Language:
Python
Stars:
504
Forks:
37
Description:
Official code for paper "InstantSfM: Towards GPU-Native SfM for the Deep Learning Era".
griegler/octnet18,234
Language:
C++
Stars:
504
Forks:
103
Description:
OctNet: Learning Deep 3D Representations at High Resolutions.
ibaiGorordo/pyKinectAzure18,237
Language:
Python
Stars:
504
Forks:
122
Description:
Python library to run Kinect Azure DK SDK functions.
jedld/tensor_stream18,238
Language:
Ruby
Stars:
504
Forks:
16
Description:
A ground-up and standalone reimplementation of TensorFlow for ruby. Comes with a pure ruby and OpenCL opcode evaluator.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryEnvironments
KeywordsAgent sandbox, Datasets, Deep Research, Recommender system
Stars504
Forks62
Contributors3
Created date2023-10-12
Updated date2026-10-13
Stars in 1 day0
Stars in 7 days1
Rank18,223
Previous rank17,977
Rank change-246
7-day stars rank11,605
Previous 7-day stars rank11,653
7-day stars rank change48
Total stars rank19,240
Previous total stars rank19,215
Total stars rank change-25
README summary

These agents are initialized from the MovieLens-1M dataset, embodying varied social traits and preferences. Each agent interacts with personalized movie recommendations in a page-by-page manner and undertakes various actions such as watching, rating, evaluating, exiting, and interviewing. With Agent4Rec, we would like to explore the potential of LLM-empowered generative agents in simulating the behavior of genuine, independent humans in recommendation environments. 📋 Catalogue Catalogue Preparations Simulation Quick Start Explore Various Recommender Settings See the result Simulation Cost

⚙️ Preparations Step 1. txt Set up a virtualenv and install the pytorch manually. After that, install all the dependencies listed in the file by running the following command: Our experiments have been tested on **Python 3. 10 may lead to some bugs in the package 'reckit'. Set up necessary environments Make sure you are in the directory of (where can be found), and run the following code. The command will install necessary tools for accelerating recommender evaluation. ⌛️ Simulation Make sure

you are in the **main directory** (where can be found). Export your OpenAI API key first: Replace \ with **your own OpenAI API key**. Quick Start By running the following command, you will start a toy simulation with **3 agents**. The response of agents to recommended items will be printed in the terminal. This simulation will take around **3 minutes** to finish. Explore Various Recommender Settings Agent4Rec supports various recommendation systems and different simulation configurations. By running this code, you will

start a simulation named with 10 agents, each agent will browse max to 5 pages with 4 items on a single page. The recommender used in this example is Matrix Factorization (short for MF). And the experiment will be executed in parallel model to speed up the simulation. You can choose the employed recommender by modifying in the command. You can replace with the following supported recommenders: : Randomly recommend items to users. : Randomly recommend popular items to users. : Pretrained Matrix

Factorization model with BPR loss. : Pretrained LightGCN model with BPR loss. As for the command in Section Explore Various Recommender Settings, the results will be saved in directory. All the interaction history of agent 0 is documented in 💰 Simulation Cost 🛎️ Note that all the experiments are powered by ChatGPT-3. 5, and a complete simulation involving 1000 users would cost approximately $16.

Frequently asked questions

How many stars and forks are recorded?

LehengTHU/Agent4Rec has 504 stars and 62 forks.

What is the repository rank?

LehengTHU/Agent4Rec is ranked 18,223.

What language and category are recorded?

LehengTHU/Agent4Rec has 504 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

LehengTHU/Agent4Rec is compared with KaiyangZhou/pytorch-vsumm-reinforce, ranked 18,222 with 504 stars.

README

On Generative Agents in Recommendation

Agent4Rec, a recommender system simulator with 1,000 LLM-empowered generative agents. These agents are initialized from the MovieLens-1M dataset, embodying varied social traits and preferences. Each agent interacts with personalized movie recommendations in a page-by-page manner and undertakes various actions such as watching, rating, evaluating, exiting, and interviewing. With Agent4Rec, we would like to explore the potential of LLM-empowered generative agents in simulating the behavior of genuine, independent humans in recommendation environments.

📋 Catalogue

⚙️ Preparations

Step 1. Install requirements.txt

Set up a virtualenv and install the pytorch manually. After that, install all the dependencies listed in the requirements.txt file by running the following command:

pip install -r requirements.txt

Our experiments have been tested on Python 3.9.12 with PyTorch 1.13.1+cu117. Python version over 3.10 may lead to some bugs in the package 'reckit'.

Step 2. Set up necessary environments

Make sure you are in the directory of recommenders/ (where setup.py can be found), and run the following code.

python setup.py build_ext --inplace

The command will install necessary tools for accelerating recommender evaluation.

⌛️ Simulation

Make sure you are in the main directory (where main.py can be found).

Export your OpenAI API key first:

export OPENAI_API_KEY=

Replace \ with your own OpenAI API key.

Quick Start

By running the following command, you will start a toy simulation with 3 agents.

python main.py

The response of agents to recommended items will be printed in the terminal. This simulation will take around 3 minutes to finish.

Explore Various Recommender Settings

Agent4Rec supports various recommendation systems and different simulation configurations.

python main.py --simulation_name MyExp --modeltype MF --n_avatars 10 --max_pages 5 --items_per_page 4 --execution_mode parallel

By running this code, you will start a simulation named MyExp with 10 agents, each agent will browse max to 5 pages with 4 items on a single page. The recommender used in this example is Matrix Factorization (short for MF). And the experiment will be executed in parallel model to speed up the simulation.

You can choose the employed recommender by modifying --modeltype in the command. You can replace `` with the following supported recommenders:

  • Random: Randomly recommend items to users.
  • Pop: Randomly recommend popular items to users.
  • MF: Pretrained Matrix Factorization model with BPR loss.
  • MultVAE: Pretrained MultVAE model.
  • LightGCN: Pretrained LightGCN model with BPR loss.

See the Results

The results of the simulation will be saved in storage/ml-1m// directory. As for the command in Section Explore Various Recommender Settings, the results will be saved in storage/ml-1m/MyExp directory. All the interaction history of agent 0 is documented in storage/ml-1m/MF/MyExp/running_logs/0.txt

💰 Simulation Cost

🛎️ Note that all the experiments are powered by ChatGPT-3.5, and a complete simulation involving 1000 users would cost approximately $16. ($0.016/User)

Nearby in the ranking
Similar items