Giter Site home page Giter Site logo

illidanlab / fedrbn Goto Github PK

View Code? Open in Web Editor NEW
25.0 4.0 2.0 524 KB

[AAAI'23] Federated Robustness Propagation: Sharing Robustness in Heterogeneous Federated Learning

License: MIT License

Python 100.00%
federated-learning robustness transfer-learning aaai

fedrbn's Introduction

FedRBN for Federated Robustness Propagation

PyTorch implementation for paper: "Federated Robustness Propagation: Sharing Robustness in Heterogeneous Federated Learning", Junyuan Hong, Haotao Wang, Zhangyang Wang and Jiayu Zhou. AAAI'23

paper / code / slides / poster.

TL;DR As AT is computation-intensive and users in FL have heterogeneous computation resources, Federated Robustness Propagation (FRP) aims to share the AT users' robustness with ST users. We propose the first simple yet effective algorithm to conduct FRP.

Abstract

Federated learning (FL) emerges as a popular distributed learning schema that learns a model from a set of participating users without sharing raw data. One major challenge of FL comes with heterogeneous users, who may have distributionally different (or non-iid) data and varying computation resources. As federated users would use the model for prediction, they often demand the trained model to be robust against malicious attackers at test time. Whereas adversarial training (AT) provides a sound solution for centralized learning, extending its usage for federated users has imposed significant challenges, as many users may have very limited training data and tight computational budgets, to afford the data-hungry and costly AT. In this paper, we study a novel FL strategy: propagating adversarial robustness from rich-resource users that can afford AT, to those with poor resources that cannot afford it, during federated learning. We show that existing FL techniques cannot be effectively integrated with the strategy to propagate robustness among non-iid users and propose an efficient propagation approach by the proper use of batch-normalization. We demonstrate the rationality and effectiveness of our method through extensive experiments. Especially, the proposed method is shown to grant federated models remarkable robustness even when only a small portion of users afford AT during learning.

Usage

Preparation:

  1. Package dependencies: Use conda env create -f environment.yml to create a conda env and activate by conda activate fedrbn. Major dependencies include pytorch, torchvision, wandb, numpy, thop for model size customization, and advertorch for adversarial training.
  2. Data: Set up your paths to data in utils/config.py. Refer to FedBN for details of Digits and DomainNet datasets.

Train and test: Set --data to be one of Digits, DomainNet, Cifar10. Set --mode to desired algorithms.

# FedRBN
python fedat.py --mode fedrbn --data Digits # train
python fedat.py --mode fedrbn --data Digits --test --test_noise LinfPGD # test with LinfPGD attack

Use sweeps with tuned hyper-parameters. Modify sweeps/bmk_noise_ratio/digits.yaml for different settings, e.g., number of AT domains (n_noise_domain) or ratio of AT users per domain (noise_ratio).

# Digits
wandb sweep sweeps/benchmark/digits.yaml  # train
wandb sweep sweeps/benchmark/digits_test.yaml  # test
# DomainNet
wandb sweep sweeps/benchmark/digits.yaml  # train
wandb sweep sweeps/benchmark/digits_test.yaml  # test

Acknowledgement

The codes are greatly based on FedBN repo.

Citation

@inproceedings{hong2023fedrbn,
  title={Federated robustness propagation: Sharing adversarial robustness in federated learning},
  author={Hong, Junyuan and Wang, Haotao and Wang, Zhangyang and Zhou, Jiayu},
  booktitle={AAAI},
  year={2023}
}

fedrbn's People

Contributors

jyhong836 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

realrui fabacha

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.