This repository contains the source code of the paper "Source Inference Attacks in Federated Learning" for evaluating source inference attacks in federated learning (FL).
We use the FedAvg algorithm (https://arxiv.org/abs/1602.05629) which is the first and perhaps the most widely used FL algorithm to train the FL models. We investigate two factors in FedAvg influencing the source inference attack performance.
You can run the following code to implement the source inference attacks. The datasets provided in this rep are Synthetic
and MNIST
datasets. For the MNIST
dataset, it will automatically be downloaded. For Synthetic
dataset, please first run the following code to generate it:
python generate_synthetic.py
You can try different --alpha
(data distribution), --num_users
(number of parties), --local_ep
(number of local epochs) to see how the attack performance changes. For Synthetic
dataset, we set --model=mlp
. For MNIST
dataset, we set --model=cnn
.
python main_fed.py --dataset=Synthetic --model=mlp --alpha=1 --num_users=10 --local_ep=5