This is the implementation of our paper titled SemPOI-RL: Reinforcement Learning with Semantic Alignment for Cross-City POI Recommendation.
We have released the travel behavior dataset Foursquare and Yelp which are generated based on the Foursquare and Yelp dataset. You can run the model with these out-of-town data provided in the respective folder. The data is the same as SPOT-Trip model.
If you want to use text data, you need to prepare the text data first. You can run the following command to prepare the text data:
cd ./code
python prepare_prompts.py --dataset_name Foursquare --batch_size 4Or you can directly use our provided text data in the ./dataset folder.
We use the Qwen3-8B as our LLM model and Qwen3-Embedding-4B as our text embedding model. You can download the model from Hugging Face. Make sure you have access to the model. After downloading, place the model in the ./LLMs folder.
We provide the code for SFT training. You can change your dataset directory in rl.py. Run the following command to train the SFT model:
python rl.py --sft --dataset_name Foursquare --sft_run_name Foursquare_SFT_v1Add lora configs in main.py and simply run the following command to train:
python main.py --dataset_name Foursquare --mode train --st_module --use_llm --use_lora --hidden_size 256 --llm_embedding_dim 256 --num_semantic_parts 8 --lambda_diversity 0.1 --mask_ratio 0.75If you want to train the model with RL, you can run the following command:
python rl.py --dataset_name Foursquare --lora_config "$your_sft_lora_config"If you want to run the whole model for final results, open "./code/eval.py" file add modify the lora_path and model_*.xhr. Run the following command:
cd ./code
python eval.py --dataset_name Foursquare --st_module --use_llm --use_lora --lora_path "$sft_lora_path" --lora_path2 "$rl_lora_path" --hidden_size 256 --llm_embedding_dim 256 --num_semantic_parts 8 --lambda_diversity 0.1 --mask_ratio 0.75