/FLAME

Primary LanguagePythonMIT LicenseMIT

FLAME: Differentially Private Federated Learning in the Shuffle Model

This repository contains the code and experiments for the 2021AAAI paper FLAME: Differentially Private Federated Learning in the Shuffle Model

Setup

Dependencies

  • install dependencies and activate the virtural environment
conda env create -f ShuffleFL.yaml
conda activate ShuffleFL
  • set up the jupyter notebook kernel before plotting figures in it
python -m ipykernel install --user --name ShuffleFL --display-name ShuffleFL
  • get the privacy budget for evaluations in Figure 5
python get_budget.py

Dataset

The MNIST is pre-processed with the basic procedure of standardization. We partition 60,000 samples into 6,000 subsets of 10 samples, with one subset corresponding to a user’s device. 6,000 devices are grouped into 6 batches with size 1,000 (m = 1, 000). Run the following command to generate train and test data:

python generate_data.py

The layout the data folder should be:

| data
----| openml
---- ----| api
---- ----| data
----| train 
---- ----| train.json
----| test
---- ----| test.json
| generate_data.py
| README.md
| ...

Run

  • NP-FL: non-private baseline
python main.py  --optimizer='npsgd'
  • DP-FL: differentially private baseline (without local privacy)
python main.py  --optimizer='dpsgd'\
                --epsilon=0.237926\
                --delta=5e-6\
                --norm=0.886\
                --mechanism='gaussian'
  • LDP-FL: locally differentially private baseline
python main.py  --optimizer='ldpsgd'\
                --epsilon=0.237926\
                --delta=5e-6\
                --norm=0.01\
                --mechanism='gaussian'
  • SS-Simple
python main.py  --optimizer='v1sgd'\
                --epsilon=0.01\
                --norm=0.01\
                --mp_rate=3\
                --mechanism='laplace'
  • SS-Double
python main.py  --optimizer='v2sgd'\
                --epsilon=0.5\
                --norm=0.01\
                --rate=50\
                --mp_rate=3\
                --mechanism='laplace'
  • SS-Topk
python main.py  --optimizer='v3sgd'\
                --epsilon=0.5\
                --norm=0.01\
                --rate=50\
                --mp_rate=3\
                --mechanism='laplace'
  • DP-FL with comparable central DP level when the amplification of subsampling is not counted in FLAME
python main.py  --optimizer='dpsgd'\
                --epsilon=20.5352544\
                --delta=5e-6\
                --norm=0.886\
                --mechanism='guassian'

References

@article{liu2020flame,
      title={FLAME: Differentially Private Federated Learning in the Shuffle Model}, 
      author={Ruixuan Liu and Yang Cao and Hong Chen and Ruoyang Guo and Masatoshi Yoshikawa},
      journal={arXiv preprint arXiv:2009.08063},
      year={2020}
}

We refer to this repo contributed by the following paper for the numerical evaluation:

@inproceedings{balle_privacy_2019,
  title={The privacy blanket of the shuffle model},
  author={Balle, Borja and Bell, James and Gasc{\'o}n, Adri{\`a} and Nissim, Kobbi},
  booktitle={Annual International Cryptology Conference},
  pages={638--667},
  year={2019},
  organization={Springer}
}