GithubHelp home page GithubHelp logo

lins-lab / fedthe Goto Github PK

View Code? Open in Web Editor NEW
45.0 2.0 3.0 8.36 MB

[ICLR 2023] Test-time Robust Personalization for Federated Learning

Home Page: https://arxiv.org/abs/2205.10920

License: Apache License 2.0

Python 32.21% Shell 0.01% Jupyter Notebook 67.78%
federated-learning ood-robustness test-time-adaptation

fedthe's Introduction

Test-time Robust Personalization for Federated Learning

Liangze Jiang*, Tao Lin*

arXiv | BibTeX

This is an official PyTorch implementation of the paper Test-Time Robust Personalization for Federated Learning (ICLR 2023). In this work, we:

  • Identify the importance of robustifying Federated Learning (FL) models under the evolving local test set during deployment.
  • Construct a benchmark (BRFL) for effectively evaluating the Out-of-Distribution (OOD) robustness of FL algorithms.
  • Propose a novel Test-time Head Ensemble method for FL (FedTHE/FedTHE+) that conducts adaptive and robust personalization for advanced In-distribution (ID)/OOD performance.

Abstract

Federated Learning (FL) is a machine learning paradigm where many clients collaboratively learn a shared global model with decentralized training data. Personalization on FL model additionally adapts the global model to different clients, achieving promising results on consistent local training & test distributions. However, for real-world personalized FL applications, it is crucial to go one step further: robustifying FL models under the evolving local test set during deployment, where various types of distribution shifts can arise.

In this work, we identify the pitfalls of existing works under test-time distribution shifts and propose Federated Test-time Head Ensemble plus tuning (FedTHE+), which personalizes FL models with robustness to various test-time distribution shifts. We illustrate the advancement of FedTHE+ (and its degraded computationally efficient variant FedTHE) over strong competitors, for training various neural architectures (CNN, ResNet, and Transformer) on CIFAR10 and ImageNet and evaluating on diverse test distributions. Along with this, we build a benchmark for assessing the performance and robustness of personalized FL methods during deployment.

Usage

Requirements

To distribute FL clients over GPUs and do local training efficiently, this codebase is based on PyTorch with MPI backend for a Master-Worker computation/communication topology. We rely on env/Dockerfile to manage the environment.

Please do docker pull ljiang98/fedthe_iclr2023:latest for an image built from the above Dockerfile, if it's not convenient for you to build the image locally.

How to Run

The main entry point of a single experiment is main.py. To facilitate experiments running, we provide scripts for running the bulk experiments in the paper. For example, to run FedTHE/FedTHE+ and other baselines on CIFAR10 with CNN (Tab. 1), you can run the following command:

python run_exps.py --script_path exps/exp_cifar10_cnn.py

For other architectures, simply do:

python run_exps.py --script_path exps/exp_cifar10_cct.py
python run_exps.py --script_path exps/exp_cifar10_resnet.py

For running on ImageNet with ResNet, you can run the following:

python run_exps.py --script_path exps/exp_imagenet_resnet.py

The Benchmark for Robust FL

This repo also contains a separated codebase for the Benchmark for Robust FL (BRFL), for the ease of reusing.

The benchmark currently employs CIFAR10 and ImageNet32 (downsampled ImageNet) as base datasets, and constructs various test distributions by applying different types of distribution shifts, including:

  • In-distribution (ID) test set
  • Co-variate distribution shift (e.g., the Common Corruptions CIFAR10-C)
  • Label distribution shift
  • Natural distribution shift (e.g., CIFAR10.1)
  • Mixture of tests: the mixture of the above ID/OOD test distributions.

For each client, the benchmark creates the above 5 ID/OOD test sets in different dataloaders. For more details, please see BRFL/README.md or Sec. 5 of our paper.

Bibliography

If you find this repository helpful for your project, please consider citing our work:

@inproceedings{jiang2023test,
  title={Test-Time Robust Personalization for Federated Learning},
  author={Jiang, Liangze and Lin, Tao},
  booktitle = {International Conference on Learning Representations (ICLR)},
  year={2023}
}

fedthe's People

Contributors

liangzejiang avatar petemir avatar tlin-taolin 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fedthe's Issues

could you provide a docker image?

I have bullied many times dockerfile provided, but still remain many problems, could you provide an official image for this project?

TTA

如果我想直接关注TTA,看哪个部分?get_worker_class好像没有在master中调用,不知道TTA的流程是啥

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.