This is the implementation of the paper "Large Language Models Enhanced Sequential Recommendation for Long-tail User and Item".
To ease the configuration of the environment, I list versions of my hardware and software equipments:
You can conda install the environment.yml
or pip install the requirements.txt
to configure the environment.
You can preprocess the dataset and get the LLMs embedding according to the following steps:
/data/<yelp/fashion/beauty>/raw/
. The Yelp dataset can be obtained from https://www.yelp.com/dataset. The fashion and beauty datasets can be obtained from https://cseweb.ucsd.edu/~jmcauley/datasets.html#amazon_reviews.data/data_process.py
to filter cold-start users and items. After the procedure, you will get the id file /data/<yelp/fashion/beauty>/hdanled/id_map.json
and the interaction file /data/<yelp/fashion/beauty>/handled/inter_seq.txt
.data/convert_inter.ipynb
./data/<yelp/fashion/beauty>/get_item_embedding.ipynb
and /data/<yelp/fashion/beauty>/get_user_embedding.ipynb
. After the running, you will get the LLMs item embedding file /data/<yelp/fashion/beauty>/handled/itm_emb_np.pkl
and LLMs user embedding file /data/<yelp/fashion/beauty>/handled/usr_emb_np.pkl
.data/pca.ipynb
to get the dimension-reduced LLMs item embedding for initialization, i.e., /data/<yelp/fashion/beauty>/handled/pca64_itm_emb_np.pkl
.data/retrieval_users.ipynb
to get the similar user set for each user. The output file in this step is sim_user_100.pkl
In conclusion, the prerequisite files to run the code are as follows: inter.txt
, itm_emb_np.pkl
, usr_emb_np.pkl
, pca64_itm_emb_np.pkl
and sim_user_100.pkl
.
⭐️ To ease the reproducibility of our paper, we also upload all preprocessed files to this link.
bash experiments/yelp.bash
bash experiments/fashion.bash
bash experiments/beauty.bash
log/
. The checkpoint will be saved in the folder saved/
.If the code and the paper are useful for you, it is appreciable to cite our paper:
@article{liu2024large,
title={Large Language Models Enhanced Sequential Recommendation for Long-tail User and Item},
author={Liu, Qidong and Wu, Xian and Zhao, Xiangyu and Wang, Yejing and Zhang, Zijian and Tian, Feng and Zheng, Yefeng},
journal={arXiv preprint arXiv:2405.20646},
year={2024}
}