apple/pfl-research
GitHub: apple/pfl-research
这是一个用于加速隐私联邦学习研究的 Python 仿真框架。
Stars: 355 | Forks: 42
# `pfl`:用于隐私联邦学习仿真的 Python 框架
[](https://github.com/apple/pfl-research/blob/main/LICENSE)
[](https://dl.circleci.com/status-badge/redirect/gh/apple/pfl-research/tree/main)
[](https://github.com/apple/pfl-research/blob/main/pyproject.toml#L18)
**文档网站:** https://apple.github.io/pfl-research
`pfl` 是 Apple 开发的一个 Python 框架,旨在赋能研究人员运行高效的隐私保护联邦学习 (FL) 仿真,并传播他们在 FL 领域的研究成果。我们的团队兼具工程和研究专长,并鼓励研究人员自信地发表使用此代码支撑的论文。
该框架 `并非` 旨在用于第三方的 FL 部署,但其仿真结果在实际 FL 部署中可能具有极大的参考价值。
我们希望 `pfl` 能够促进 FL 领域的开放研究及其有效传播。
`pfl` 提供了多种实用功能,包括:
* 利用您现有的模型和数据,快速入门并尝试将隐私保护联邦学习 (PFL) 应用于您的特定场景。
* 利用多层级分布式训练(多进程、多 GPU 和多机器)进行快速仿真,从而快速迭代。
* 灵活性与表达性 — 当研究人员有新的 PFL 想法需要尝试时,`pfl` 提供了灵活的 API 来表达这些想法。
* 为大型实验提供可扩展的仿真,支持最先进的算法和模型。
* 同时支持 PyTorch 和 TensorFlow。
* 为经过 PyTorch 和 TensorFlow 验证的数据集提供统一的基准测试。
* 支持神经网络以外的其他模型,例如 GBDT。在不同类型的模型之间无缝切换。
* 与隐私特性紧密集成,包括用于本地和中心差分隐私的常用机制。
基准测试的结果维护在 [这份 Weights & Biases 报告](https://api.wandb.ai/links/pfl/5scd5f66)中。
## 安装说明
安装说明可在 [此处](http://apple.github.io/pfl-research/installation.html) 找到。
`pfl` 已在 PyPI 上发布,可以通过 pip 进行完整安装:
```
pip install 'pfl[tf,pytorch,trees]'
```
## 入门教程 - 教学笔记本
为了无需安装即可立即体验 `pfl`,我们提供了一些 Colab 笔记本,用于亲身体验学习 `pfl` 的不同组件。
* [](https://colab.research.google.com/github/apple/pfl-research/blob/develop/tutorials/Introduction%20to%20Federated%20Learning%20with%20CIFAR10%20and%20TensorFlow.ipynb) 使用 CIFAR10 和 TensorFlow 进行联邦学习入门。
* [](https://colab.research.google.com/github/apple/pfl-research/blob/develop/tutorials/Introduction%20to%20PFL%20research%20with%20FLAIR.ipynb) 使用 FLAIR 和 PyTorch 进行 PFL 研究入门。
* [](https://colab.research.google.com/github/apple/pfl-research/blob/develop/tutorials/Introduction%20to%20Differential%20Privacy%20with%20Federated%20Learning.ipynb) 联邦学习中的差分隐私 (DP) 入门。
* [](https://colab.research.google.com/github/apple/pfl-research/blob/develop/tutorials/Creating%20Federated%20Dataset%20for%20PFL%20Experiment.ipynb) 为 PFL 实验创建联邦数据集。
我们也支持 MLX!
* ([Jupyter 笔记本](https://github.com/apple/pfl-research/blob/develop/tutorials/Introduction%20to%20Federated%20Learning%20with%20CIFAR10%20and%20MLX.ipynb)) 使用 CIFAR10 和 MLX 进行联邦学习入门。
但您需要在 Apple silicon 设备上本地运行此笔记本,查看所有可用的 Jupyter 笔记本 [此处](https://github.com/apple/pfl-research/tree/develop/tutorials)。
## 入门 - 基准测试
`pfl` 旨在简化在联邦学习范式中测试假设的基准测试流程。官方基准测试位于 [benchmarks](./benchmarks) 目录中,使用了多种真实的、经过联邦学习验证(是的,我们也有 CIFAR10)的数据集-模型组合,包括有差分隐私和无差分隐私两种情况。
**复制这些示例是进行您自己研究的良好起点。**
[查看快速入门](./benchmarks#quickstart),了解如何在短短几分钟内,使用最简单的基准测试(CIFAR10)让模型开始收敛。
## 参与贡献
我们邀请研究人员为该框架做出贡献。更多详情请参阅 [此处](http://apple.github.io/pfl-research/support/contributing.html)。
## 引用 pfl-research
```
@article{granqvist2024pfl,
title={pfl-research: simulation framework for accelerating research in Private Federated Learning},
author={Granqvist, Filip and Song, Congzheng and Cahill, {\'A}ine and van Dalen, Rogier and Pelikan, Martin and Chan, Yi Sheng and Feng, Xiaojun and Krishnaswami, Natarajan and Jina, Vojta and Chitnis, Mona},
journal={arXiv preprint arXiv:2404.06430},
year={2024},
}
```
标签:AI研究, Apex, Python, PyTorch, TensorFlow, 凭据扫描, 分布式训练, 多模型支持, 开源框架, 持续集成, 无后门, 机器学习, 模拟框架, 研究工具, 网络安全, 联邦学习, 逆向工具, 隐私保护, 隐私特性