This is the official implementation for the paper: "Enhancing Time Awareness in Generative Recommendation".
GRUT (Generative Recommender Using Time awareness) is a novel generative recommendation system that effectively captures hidden user preferences via various temporal signals. It is built on top of GRAM (ACL'25), extending its semantic-aware multi-granular late fusion with time-aware prompting and trend-aware inference. The repository ships both pipelines, so GRAM and GRUT can be trained and evaluated side-by-side from a single codebase.
- 📄 Paper: ACL Anthology | arXiv
- 🎨 Presentation: Poster | Slides
- 📝 Blog Post: Korean
- Python: 3.9+
- PyTorch: 1.11.0
- Transformers: 4.26.0
- CUDA: 11.3
- Clone the repository
git clone https://github.com/skleee/GRUT.git
cd GRUT- Create conda environment
conda create -n grut python=3.9
conda activate grut- Install dependencies
# Install general dependencies
pip install -r requirements.txt
# Install PyTorch with CUDA support
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 \
--extra-index-url https://download.pytorch.org/whl/cu113We evaluate GRUT on 4 datasets from two domains:
- Product reviews from Amazon with rich metadata
- Beauty: Cosmetics and personal care products
- Toys: Children's toys and gaming products
- Sports: Sports equipment and outdoor gear
- Yelp: Local business reviews and ratings
- Amazon Review: Official Dataset
- Yelp: Official Dataset
- Preprocessed Data: Available in
rec_datasets/directory
For more details on the dataset structure, please refer to README.md in the rec_datasets/ directory.
Execute the training scripts located in the command/ folder. Each script bakes in the paper-final hyperparameters for its dataset:
# Amazon Beauty dataset
bash train_grut_beauty.sh
# Amazon Toys dataset
bash train_grut_toys.sh
# Amazon Sports dataset
bash train_grut_sports.sh
# Yelp dataset
bash train_grut_yelp.shGRUT's trend-aware reranking is a two-step inference workflow.
- Tune the trend mixing weight λ on the validation set
bash test_grut_tune_valid.sh -d Beauty -e 30 -g 0 -c <CHECKPOINT_DIR>This grid-searches λ ∈ {0.1, 0.2, …, 1.0}. The first λ runs full beam search and caches the predictions to disk; subsequent λ values reuse the cache and only redo the (fast) score-adjustment step. Pick the λ that maximizes validation NDCG@5.
- Final test evaluation with the chosen λ
bash test_grut_test.sh -d Beauty -e 30 -g 0 -l 0.3 -c <CHECKPOINT_DIR>-l 0.3 is the chosen λ. Test-set predictions are cached for reuse.
<CHECKPOINT_DIR> points to the directory containing model_rec_phase_1_epoch_<EPOCH>.pt, e.g. log/Beauty/<run_id>/id_0_rec_30/.
This work builds upon several open-source projects:
- GRAM: Generative Recommendation via Semantic-aware Multi-granular Late Fusion
- IDGenRec: Generative recommendation framework
- OpenP5: Open-source P5 implementation
- FiD: Fusion-in-Decoder architecture
If you find this work helpful, please consider citing our paper:
@inproceedings{lee2025grut,
title = {Enhancing Time Awareness in Generative Recommendation},
author = {Sunkyung Lee and Seongmin Park and Jonghyo Kim and Mincheol Yoon and Jongwuk Lee},
booktitle = {Findings of the Association for Computational Linguistics: EMNLP 2025},
pages = {23917--23933},
year = {2025},
url = {https://aclanthology.org/2025.findings-emnlp.1300/}
}