Implementation for Data Watermarking for Sequential Recommender Systems, KDD'25.
Tested on Python==3.7.16 and PyTorch==1.13.1.
An example to train SASRec on ML-1M with watermark length 3 and insert ratio 0.01:
python train.py --device cuda:0 --dataset_code ml-1m --model_code sas --pattern_len 3 --n_watermarks 0.01 --method dataset
python test_watermark_acc.py --device cuda:0 --dataset_code ml-1m --model_code sas --pattern_len 3 --n_watermarks 0.01 --method datasetChange the --dataset_code into "beauty" or "steam" for the corresponding datasets, and change the --model_code into "bert" or "narm" for the corresponding models.
Please check the results in the "experiments" folder.
ML-1M:
python train.py --device cuda:0 --dataset_code ml-1m --model_code sas --pattern_len 10 --cn 10 --method user
python test_watermark_acc.py --device cuda:0 --dataset_code ml-1m --model_code sas --pattern_len 10 --cn 10 --method userBeauty:
python train.py --device cuda:0 --dataset_code beauty --model_code sas --pattern_len 20 --cn 10 --method user
python test_watermark_acc.py --device cuda:0 --dataset_code beauty --model_code sas --pattern_len 20 --cn 10 --method userSteam:
python train.py --device cuda:0 --dataset_code steam --model_code sas --pattern_len 10 --cn 10 --method user
python test_watermark_acc.py --device cuda:0 --dataset_code steam --model_code sas --pattern_len 10 --cn 10 --method userChange the --model_code into "bert" or "narm" for the corresponding models.
Please check the results in the "experiments" folder.
Please cite the following paper if you use our methods in your research:
@article{zhang2024data,
title={Data Watermarking for Sequential Recommender Systems},
author={Zhang, Sixiao and Long, Cheng and Yuan, Wei and Chen, Hongxu and Yin, Hongzhi},
journal={arXiv preprint arXiv:2411.12989},
year={2024}
}