https://github.com/applied-machine-learning-lab/llm4msr
https://github.com/applied-machine-learning-lab/llm4msr
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/applied-machine-learning-lab/llm4msr
- Owner: Applied-Machine-Learning-Lab
- Created: 2024-10-17T09:57:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-19T04:08:58.000Z (over 1 year ago)
- Last Synced: 2025-06-20T04:38:16.674Z (9 months ago)
- Size: 10.7 MB
- Stars: 6
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LLM4MSR: An Effective Efficient Interpretable LLM-Enhanced Paradigm for Multi-Scenario Recommendation
The implement code of LLM4MSR. Take **STAR** as backbone model and **Amazon** dataset as the illustration example.
**Preparation**
1. Install requirement packages of [ChatGLM2-6B](https://huggingface.co/THUDM/chatglm2-6b) by running:
**'pip install protobuf transformers==4.30.2 cpm_kernels torch>=2.0 gradio mdtex2html sentencepiece accelerate'**
2. Download the [ChatGLM2-6B](https://huggingface.co/THUDM/chatglm2-6b) model from hugging face and test by running the demo on it.
3. Modify the original source code of function of sample(beam=1) in 'lib/python3.9/site-packages/transformers/generation/utils' to output the last hidden state in order to get rid of **cuda out of memory** error.
4. Combine the file 'amazon_user_prompt_part_1.csv' and 'amazon_user_prompt_part_2.csv' into 'amazon_user_prompt.csv' in dataset folder.
**Step 1: Multi-Scenario Knowledge Reasoning**
Run the code 'produce_llm_dict_domain.py' and 'produce_llm_dict_user.py', which take about **<2 days** for all the 24752 users on single GPU.
**Step 2: Multi-Level Knowledge Fusion**
Run the following command:
**'python multi_amazon.py'**
and you can see the AUC and Logloss results on all scenarios (**Remember** to search for the learning rate, which is sensitive).