Skip to content

This is the official implementation of the ICML2024 paper "Recovering Labels from Local Updates in Federated Learning".

Notifications You must be signed in to change notification settings

CityChan/Recovering-Label-from-Update

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recovering-Label-from-Update

This is the official implementation of the ICML2024 paper "Recovering Labels from Local Updates in Federated Learning".

Requirements

This code is implemented in Pytorch and Cuda. We ran all experiments in the virtual environment created by Conda. For installing the virtual environment:

conda create -n RLU python=3.8
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

Dataset Preparing:

After unzipping, place them in data/ directory

Project Structure

  • option.py: this file contains configuartions for all schemes.
  • DataSampling.py: this file is relevant to data partions for federated learning
  • models.py: this file define models for different experiments. Please change the activation functions if needed.
  • utils.py: general utilization
  • llg.py: this is adapted from the attack scheme LLG
  • ./client: for each method, we defined adaptive client objects. We currently only release FedAvg and FedProx. FedDyn and Scaffold will be soon.
  • ./client/client_utils.py: utilization for the attacking schemes

Run Attacks:

For SVHN with multiple local epochs with FedAvg

python main.py --scheme iRLG --local_epoch 10 --dataset SVHN --momentum 0.0 --alpha 0.5 --batch_size 32 --model lenet5 --hidden 400
python main.py --scheme RLU --local_epoch 10 --dataset SVHN --momentum 0.0 --alpha 0.5 --batch_size 32 --model lenet5 --hidden 400
python main.py --scheme LLGp --local_epoch 10 --dataset SVHN --momentum 0.0 --alpha 0.5 --batch_size 32 --model lenet5 --hidden 400
python main.py --scheme ZLGp --local_epoch 10 --dataset SVHN --momentum 0.0 --alpha 0.5 --batch_size 32 --model lenet5 --hidden 400

For CIFAR10 with multiple local epochs with FedAvg

python main.py --scheme iRLG --local_epoch 10 --dataset CIFAR10 --momentum 0.0 --alpha 0.5 --batch_size 64 --model vgg16 --hidden 512
python main.py --scheme RLU --local_epoch 10 --dataset CIFAR10 --momentum 0.0 --alpha 0.5 --batch_size 64 --model vgg16 --hidden 512
python main.py --scheme LLGp --local_epoch 10 --dataset CIFAR10 --momentum 0.0 --alpha 0.5 --batch_size 64 --model vgg16 --hidden 512
python main.py --scheme ZLGp --local_epoch 10 --dataset CIFAR10 --momentum 0.0 --alpha 0.5 --batch_size 64 --model vgg16 --hidden 512

For CIFAR100 with multiple local epochs with FedAvg

python main.py --scheme iRLG --local_epoch 10 --dataset CIFAR100 --n_classes 100 --momentum 0.0 --alpha 0.1 --batch_size 256 --model vgg16 --hidden 512
python main.py --scheme RLU --local_epoch 10 --dataset CIFAR100 --n_classes 100 --momentum 0.0 --alpha 0.1 --batch_size 256 --model vgg16 --hidden 512
python main.py --scheme LLGp --local_epoch 10 --dataset CIFAR100 --n_classes 100 --momentum 0.0 --alpha 0.1 --batch_size 256 --model vgg16 --hidden 512
python main.py --scheme ZLGp --local_epoch 10 --dataset CIFAR100 --n_classes 100 --momentum 0.0 --alpha 0.1 --batch_size 256 --model vgg16 --hidden 512

For SVHN with multiple local epochs with FedProx

python main.py --scheme iRLG --local_epoch 10 --dataset SVHN --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.5 --batch_size 32 --model lenet5 --hidden 400
python main.py --scheme RLU --local_epoch 10 --dataset SVHN --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.5 --batch_size 32 --model lenet5 --hidden 400
python main.py --scheme LLGp --local_epoch 10 --dataset SVHN --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.5 --batch_size 32 --model lenet5 --hidden 400
python main.py --scheme ZLGp --local_epoch 10 --dataset SVHN --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.5 --batch_size 32 --model lenet5 --hidden 400

For CIFAR10 with multiple local epochs with FedProx

python main.py --scheme iRLG --local_epoch 10 --dataset CIFAR10 --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.5 --batch_size 64 --model vgg16 --hidden 512
python main.py --scheme RLU --local_epoch 10 --dataset CIFAR10 --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.5 --batch_size 64 --model vgg16 --hidden 512
python main.py --scheme LLGp --local_epoch 10 --dataset CIFAR10 --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.5 --batch_size 64 --model vgg16 --hidden 512
python main.py --scheme ZLGp --local_epoch 10 --dataset CIFAR10 --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.5 --batch_size 64 --model vgg16 --hidden 512

For CIFAR100 with multiple local epochs with FedProx

python main.py --scheme iRLG --local_epoch 10 --dataset CIFAR100 --n_classes 100 --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.1 --batch_size 256 --model vgg16 --hidden 512
python main.py --scheme RLU --local_epoch 10 --dataset CIFAR100 --n_classes 100 --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.1 --batch_size 256 --model vgg16 --hidden 512
python main.py --scheme LLGp --local_epoch 10 --dataset CIFAR100 --n_classes 100 --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.1 --batch_size 256 --model vgg16 --hidden 512
python main.py --scheme ZLGp --local_epoch 10 --dataset CIFAR100 --n_classes 100 --momentum 0.0 --fl_scheme fedprox --mu 0.5 --alpha 0.1 --batch_size 256 --model vgg16 --hidden 512

Citeation

Please cite our paper, if you happen to use this code:

@inproceedings{
chen2024recovering,
title={Recovering Labels from Local Updates in Federated Learning},
author={Huancheng Chen and Haris Vikalo},
booktitle={Forty-first International Conference on Machine Learning},
year={2024},
url={https://openreview.net/forum?id=E41gvBG4s6}
}

About

This is the official implementation of the ICML2024 paper "Recovering Labels from Local Updates in Federated Learning".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published