Skip to content

Latest commit

 

History

History
125 lines (82 loc) · 9.13 KB

README.md

File metadata and controls

125 lines (82 loc) · 9.13 KB

Fling

FL-Launching (Fling) is a research platform for Federated Learning using PyTorch as backend.

Its goal is to simulate the distributed learning process of Federated Learning on single or multiple machines, providing a fair testing platform for the performance of various federated learning algorithms on different datasets. It is mainly based on the Python language and uses the PyTorch framework as the backend module for deep learning, supporting a variety of federated learning algorithms and commonly used federated learning datasets.

It mainly supports:

  • Generic Federated Learning methods, such as FedAvg.
  • Personalized Federated Learning methods, such as FedPer.
  • Attacking methods, such as DLG.

Installation

Firstly, it is recommended to install PyTorch manually with a suitable version (specifically 1.1.0 or higher). However, using PyTorch version 2.0.0 or later is preferred due to its better computational efficiency. Instructions for installation can be found at this link.

After the first step, you can simply install the latest version of Fling with the following command by using Git:

git clone https://github.com/FLAIR-Community/Fling
cd Fling
pip install -e .

Finally, you can use

fling -v

to check whether Fling is successfully installed.

Quick Start

After successfully install Fling, users can start the first Fling experiment by using the following command. An example for generic federated learning:

python flzoo/mnist/mnist_fedavg_cnn_toy_config.py

Or using our cli util by:

fling run -c flzoo/mnist/mnist_fedper_cnn_toy_config.py -p personalized_model_pipeline

This config is a simplified version for conducting FedAvg on the dataset MNIST and iterate for 4 communication rounds.

For other algorithms and datasets, users can refer to argzoo/ or customize your own configuration files.

For visualization utilities, please refer to README for visualization.

For attacking methods, please refer to our examples in: demo for attack

Tutorials:

Overall Framework of Fling | Fling 整体框架

Meaning for Each Configuration Key | 配置文件各字段含义

How to Add a New FL Algorithm | 如何自定义联邦学习算法

How to Add a New Dataset | 如何添加新数据集

Cli Usage in Fling | Fling 的 CLI 使用

Feature

  • Support for a variety of algorithms and datasets.
  • Support multiprocessing training on each client for better efficiency.
  • Using single GPU to simulate Federated Learning process.
  • Strong visualization utilities. See this README file for detailed information. There are also demos for reference.

Supported Algorithms

generic   Generic federated learning, which finally trains a single global model for all clients.

personalized   Personalized federated learning, which finally trains a personalized model for each client.

attacking   Attacking methods, which simulate the attacking process of adversaries and test the robustness of federated learning algorithms.

cross-domain   Cross-domain federated learning, which finally trains models for all clients from different domains.

visualization   Visualization utilities for federated learning.

Algorithm Reference Link Categories Demo
FedAvg Communication-Efficient Learning of Deep Networks from Decentralized Data genericcross-domain python flzoo/cifar10/cifar10_fedavg_resnet_config.py
FedProx Federated Optimization in Heterogeneous Networks generic python flzoo/cifar10/cifar10_fedprox_resnet_config.py
FedMOON Model-Contrastive Federated Learning generic python flzoo/cifar10/cifar10_fedmoon_cnn_config.py
SCAFFOLD SCAFFOLD: Stochastic Controlled Averaging for Federated Learning generic python flzoo/cifar10/cifar10_scaffold_resnet_config.py
FedPart Why Go Full? Elevating Federated Learning Through Partial Network Updates genericpersonalized python flzoo/cifar10/cifar10_fedpart_resnet8_config.py
FedPer Federated Learning with Personalization Layers personalized python flzoo/cifar10/cifar10_fedper_resnet_config.py
FedBN FedBN: Federated Learning on Non-IID Features via Local Batch Normalization personalized python flzoo/cifar10/cifar10_fedbn_resnet_config.py
FedRoD On Bridging Generic and Personalized Federated Learning for Image Classification personalized python flzoo/cifar10/cifar10_fedrod_resnet_config.py
pFedSD Personalized Edge Intelligence via Federated Self-Knowledge Distillation personalized python flzoo/cifar10/cifar10_pfedsd_resnet_config.py
FedCAC Bold but Cautious: Unlocking the Potential of Personalized Federated Learning through Cautiously Aggressive Collaboration personalized python flzoo/cifar10/cifar10_fedcac_resnet_config.py
DLG Deep Leakage from Gradients attacking python fling/utils/attack_utils/demo/demo_dlg.py
iDLG Inverting Gradients -- How easy is it to break privacy in federated learning? attacking python fling/utils/attack_utils/demo/demo_idlg.py

Feedback and Contribution

  • For any bugs, questions, feature requirements, feel free to propose them in issues
  • For any contributions that can improve Fling (more algorithms or better system design), we warmly welcome you to propose them in a pull request.

Acknowledgments

Special thanks to @kxzxvbk, @chuchugloria, @KeyGuo, @XinHao-96, @Ando233, @shonnyx.

Citation

@misc{Fling,
    title={Fling: Framework for Federated Learning},
    author={Fling Contributors},
    publisher = {GitHub},
    howpublished = {\url{https://github.com/FLAIR-Community/Fling}},
    year={2023},
}

License

Fling is released under the Apache 2.0 license.