{"id":15646439,"url":"https://github.com/alshedivat/fedpa","last_synced_at":"2025-04-30T11:45:20.763Z","repository":{"id":69041521,"uuid":"294840893","full_name":"alshedivat/fedpa","owner":"alshedivat","description":"Federated posterior averaging implemented in JAX","archived":false,"fork":false,"pushed_at":"2023-04-13T11:09:15.000Z","size":30031,"stargazers_count":49,"open_issues_count":1,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-02T02:42:30.460Z","etag":null,"topics":["federated-learning","jax","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alshedivat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-09-12T00:44:27.000Z","updated_at":"2024-06-25T06:16:43.000Z","dependencies_parsed_at":"2023-10-20T16:52:47.786Z","dependency_job_id":null,"html_url":"https://github.com/alshedivat/fedpa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alshedivat%2Ffedpa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alshedivat%2Ffedpa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alshedivat%2Ffedpa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alshedivat%2Ffedpa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alshedivat","download_url":"https://codeload.github.com/alshedivat/fedpa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223779601,"owners_count":17201288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["federated-learning","jax","python"],"created_at":"2024-10-03T12:12:54.368Z","updated_at":"2024-11-09T03:15:35.740Z","avatar_url":"https://github.com/alshedivat.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Federated Learning via Posterior Averaging\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/alshedivat/fedpa/blob/master/fedpa_playground.ipynb)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n![FedAvg vs. FedPA](/assets/fedavg-vs-fedpa.gif)\n\nThis repository contains a minimalistic (yet general and modular) [JAX](https://github.com/google/jax) implementation of federated posterior averaging (FedPA) algorithm along with a variety of simulation experiments on synthetically generated problems.\n\n## Usage\nThe easiest way to reproduce our synthetic experiments and/or compare FedAvg and FedPA is by using the colab notebook provided in this repository (simply click the `Open in Colab` button at the top of README).\nIf you would like to use our JAX implementation of FedAvg or FedPA elsewhere, the `federated/` folder can be used a standalone Python package.\n\n## Organization of the code\n\nAll the code is located under the `federated` folder and organized into multiple sub-modules:\n- `objectives`: Contains implementations of synthetic objective functions. We assume that each client is represented by the corresponding objective. The objective is base on the client's data and can be (1) evaluated or (2) return a (stochastic) gradient at a given point (or parameter vector).\n- `inference`: Contains functions for computing client updates, running SGD (and its variations), doing posterior sampling, estimating moments of a distribution from samples.\n- `learning`: Contains implementations of the learning algorithms (FedAvg, FedPA, and their variations.)\n- `utils`: Contains various utility functions, e.g., for timing code or plotting figures.\n\n**A note on implementation.**\nOur minimalistic library is implemented in a functional style.\nThe main learning function is [`fed_opt`](https://github.com/alshedivat/fedpa/blob/master/federated/learning/algorithms.py#L85-L158) (defined in `federated.learning.algorithms`), which implements the generalized federated optimization (corresponds to Algorithm 1 in [our paper](https://arxiv.org/abs/2010.05273), originally proposed by [Reddi*, Charles*, et al. (2020)](https://arxiv.org/abs/2003.00295)).\n`fed_opt` takes `client_update_fn` and `server_update_fn` functions as arguments, which are used for computing client and server updates, respectively.\nFedAvg and FedPA are implemented by providing the corresponding `client_update_fn` and `server_update_fn` arguments to `fed_opt`.\n\n## Reproducing results on FL benchmark tasks\n\nThis mini-library does NOT support running experiments on FL benchmark tasks such as EMNIST, CIFAR100, etc.\nIf you would like to run FedPA on these benchmarks, please use our [TFF implementation](https://github.com/google-research/federated/tree/master/posterior_averaging).\n\n## Citation\n```bibtex\n@inproceedings{alshedivat2021federated,\n  title={Federated Learning via Posterior Averaging: A New Perspective and Practical Algorithms},\n  author={Al-Shedivat, Maruan and Gillenwater, Jennifer and Xing, Eric and Rostamizadeh, Afshin},\n  booktitle={International Conference on Learning Representations (ICLR)},\n  year={2021}\n}\n```\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falshedivat%2Ffedpa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falshedivat%2Ffedpa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falshedivat%2Ffedpa/lists"}