Federated Learning via Meta-Variational Dropout (Official Code)

April 22, 2024 · View on GitHub

This repository contains the official PyTorch code for the paper: Federated Learning via Meta-Variational Dropout published in NeurIPS 2023.

Requirement

  • Python >= 3.7.4
  • CUDA >= 10.0 supported GPU
  • Anaconda

:rocket: Getting Started

Setup Environment

pip install -r environment.yml
conda activate metavd

:bar_chart: Training and Testing

Running Experiments

python main.py --model <model-name> --dataset <dataset-name> <other-options>

EX) Run Cifar10 Experiment with MetaVD

python main.py --model nvdpgaus --dataset cifar10

EX) Run Cifar100 Experiment with MetaVD and Heterogeneity level of α=5.0\alpha = 5.0

python main.py --model nvdpgaus --dataset cifar100 --alpha 5.0

:gear: Options

We currently support following models and datasets options.

Supported Models

Model NameFlagDescription
FedAvgfedavgFederated Averaging
FedAvg + FinetuningfedavgperPersonalized Federated Learning
FedAvg + MetaVDfedavgnvdpgausqFederated Averaging with MetaVD (proposed in this work)
FedAvg + SNIPfedavgsnipFederated Averaging with SNIP
FedProxfedproxFederated Proximal Optimization
FedBEfedbeFederated Learning with Bayesian Ensemble
ReptilereptileFederated Learning with Reptile
Reptile + VDvdgausqReptile with VD
Reptile + EnsembleVDvdgausemqReptile with EnsembleVD
Reptile + MetaVDnvdpgausqReptile with MetaVD (proposed in this work)
Reptile + SNIPreptilesnipReptile with SNIP
MAMLmamlFederated Learning with Model-Agnostic Meta-Learning
MAML + MetaVDmamlgausqMAML with MetaVD (proposed in this work)
MAML + SNIPmamlsnipMAML with SNIP
PerFedAvgperfedavgHF-MAML with SNIP
PerFedAvg + MetaVDperfedavgnvdpgausqHF-MAML with MetaVD (proposed in this work)
PerFedAvg + SNIPperfedavgsnipHF-MAML with SNIP

Supported Datasets

Dataset NameFlagDescription
FemnistfemnistFederated EMNIST dataset
CelebacelebaCelebA dataset
MNISTmnistMNIST dataset
Cifar10cifar10CIFAR10 dataset
Cifar100cifar100CIFAR100 dataset
EMNISTemnistExtended MNIST dataset
FMNISTfmnistFashion MNIST dataset

Please see the arg parser in main.py file to enable other options.

Other details of parameters

For all datasets, we set the number of rounds (num_rounds) to 1000 to ensure sufficient convergence following conventions. The batch size (local_bs) was set to 64, and local steps (local_epochs) was set to 5. Personalization was executed with a batch size (adaptation_bs) of 64 and a 1-step update.

For all methods, we investigated the server learning rate and local SGD learning rate within identical ranges. The server learning rate η (server_lr) was explored within the range of [0.6, 0.7, 0.8, 0.9, 1.0]. The local SGD learning rate (inner_lr) was investigated within the range of [0.005, 0.01, 0.015, 0.02, 0.025, 0.03].For MetaVD, an additional KL divergence weight parameter β (beta) is needed, and we set its optimal value to 10.

Visualization

  • Tensorboard Setup

    cd runs
    tensorboard --logdir=./ --port=7770 --samples_per_plugin image=100 --reload_multifile=True --reload_interval 30 --host=0.0.0.0
    

    Access visualizations at localhost:7770.

:page_facing_up: Citation

If you find this work useful, please cite our paper:

@article{jeon2024federated,
  title={Federated Learning via Meta-Variational Dropout},
  author={Jeon, Insu and Hong, Minui and Yun, Junhyeog and Kim, Gunhee},
  journal={Advances in Neural Information Processing Systems},
  volume={36},
  year={2024}
}

Reference

Acknowledgement

Thank you, my colleagues, for your valuable contributions.