Skip to content

yjw1029/Efficient-FedRec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Efficient-FedRec

Python implementation for our paper "Efficient-FedRec: Efficient Federated Learning Frameworkfor Privacy-Preserving News Recommendation" in EMNLP 2021.

Introduction

Directly applying federated learning on news recommendation models will lead to high computation and communication cost on user side. In this work, we propose Efficient-FedRec, in which we dicompose the news recommendation model into a large news model maintained on server and a light-weight user model computed on the user side. Experiments on two public dataset show the effectiveness of our method.

Environment

Requirments

numpy
torch==1.9.1
transformers==4.12.5
tqdm
sklearn
wandb

Getting Started

  • Download datasets
cd raw
chmod +x download.sh
./download.sh mind .
./download.sh adressa .
  • Preprocess datasets
cd preprocess
# modify adressa to mind format
python adressa_raw.py

# preprocess mind dataset
python news_process.py --data mind
python user_process.py --data mind

# preprocess adressa dataset
python news_process.py --data adressa
python user_process.py --data adressa
  • Run experiments
# You may need to configure your wandb account first
cd src
python main.py --data mind
# get prediction result of the best checkpoint and submit on condalab
python main.py --data mind --mode predict

# train on adressa
python main.py --data adressa --max_train_steps 500 --validation_step 10 --bert_type NbAiLab/nb-bert-base
# test on adressa
python main.py --data adressa --mode test --bert_type NbAiLab/nb-bert-base

Results

MIND

Wandb result on MIND dataset Zip the prediction.txt file and upload to MIND competition. Test result is

Adressa

Wandb result on Adressa dataset. Test result is

test auc: 0.7980, mrr: 0.4637, ndcg5: 0.4852, ndcg10: 0.5497

Citing

If you want to cite Efficient-Fedrec in your papers (much appreciated!), you can cite it as follows:

@inproceedings{yi-etal-2021-efficient,
    title = "Efficient-{F}ed{R}ec: Efficient Federated Learning Framework for Privacy-Preserving News Recommendation",
    author = "Yi, Jingwei  and
      Wu, Fangzhao  and
      Wu, Chuhan  and
      Liu, Ruixuan  and
      Sun, Guangzhong  and
      Xie, Xing",
    booktitle = "EMNLP",
    year = "2021",
    pages = "2814--2824"
}

About

Efficient-FedRec: Efficient Federated Learning Framework for Privacy-Preserving News Recommendation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published