[![DOI](https://zenodo.org/badge/320731198.svg)](https://zenodo.org/badge/latestdoi/320731198)
# 基于梯度补偿的高效联邦学习框架 Overlap-FedAvg - 四川大学
这是四川大学科研项目 "Communication-Efficient Federated Learning with Compensated Overlap-FedAvg" 官方代码实现,发表在 TPDS 2021 上。
联邦学习由于每个 Epoch 的同步数据与模型的大小相同,引入了大量的通信开销,从而导致通信效率低下。为此,我们提出了一个将模型训练阶段与模型上传、下载阶段并行的框架 Overlap-FedAvg,使模型上传、下载阶段可以完全覆盖模型训练阶段。与普通的 FedAvg 相比,Overlap-FedAvg 进一步发展了分层计算策略、数据补偿机制和 Nesterov 梯度加速算法。此外,Overlap-FedAvg 与其他许多压缩方法是正交的,可以将它们一起应用,最大限度地利用集群。
### 论文摘要
> While petabytes of data are generated each day by a number of independent computing devices, only a few of them can be finally collected and used for deep learning (DL) due to the apprehension of data security and privacy leakage, thus seriously retarding the extension of DL. In such a circumstance, federated learning (FL) was proposed to perform model training by multiple clients' combined data without the dataset sharing within the cluster. Nevertheless, federated learning with periodic model averaging (FedAvg) introduced massive communication overhead as the synchronized data in each iteration is about the same size as the model, and thereby leading to a low communication efficiency. Consequently, variant proposals focusing on the communication rounds reduction and data compression were proposed to decrease the communication overhead of FL. In this paper, we propose Overlap-FedAvg, an innovative framework that loosed the chain-like constraint of federated learning and paralleled the model training phase with the model communication phase (i.e., uploading local models and downloading the global model), so that the latter phase could be totally covered by the former phase. Compared to vanilla FedAvg, Overlap-FedAvg was further developed with a hierarchical computing strategy, a data compensation mechanism, and a nesterov accelerated gradients (NAG) algorithm. In Particular, Overlap-FedAvg is orthogonal to many other compression methods so that they could be applied together to maximize the utilization of the cluster. Besides, the theoretical analysis is provided to prove the convergence of the proposed framework. Extensive experiments conducting on both image classification and natural language processing tasks with multiple models and datasets also demonstrate that the proposed framework substantially reduced the communication overhead and boosted the federated learning process.
## 快速上手
### 克隆仓库
```
git clone https://github.com/Soptq/Overlap-FedAvg
cd Overlap-FedAvg
```
### 安装环境
```
pip install -r requirements.txt
```
### 准备数据集
```
python prepare_data.py
```
### 运行模拟实验
在这里,为了简化演示过程,我们提供的 Overlap-FedAvg 脚本是在五卡单机环境下模拟了联邦学习的分布式环境。5 张卡中 GPU:0 是主节点,GPU:1 到 GPU:4 是子节点。但是需要注意的是,虽然在单机下模拟实验会让环境配置工作变得简单很多,但同时也会显著降低网络的通讯速度,从而使得集群的通讯效率变相增高,给实验结果带来偏差。所以,我们推荐有条件的话在真实的联邦学习环境下进行实验以测试该方法的有效性。
朴素 FedAvg 方法可以通过以下代码运行:
```
python FedAvg.py --world_size 5 --lr 0.001 --batch_size 32 --max_epoch 10 --client_epoch 5 --dataset mnist --model mlp --gpus 0,1,2,3,4
```
相似的,Overlap-FedAvg 可以通过以下代码运行:
```
python AsyncFedAvg.py --world_size 5 --lr 0.001 --batch_size 32 --max_epoch 10 --client_epoch 5 --dataset mnist --model mlp --gpus 0,1,2,3,4
```
## 引用
```
@article{zhou2020communication,
title={Communication-Efficient Federated Learning with Compensated Overlap-FedAvg},
author={Zhou, Yuhao and Qing, Ye and Lv, Jiancheng},
journal={IEEE transactions on parallel and distributed systems},
publisher={IEEE}
}
```
## 开源协议
```
MIT License
Copyright (c) 2020 Soptq
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
<项目介绍> 联邦学习由于每个 Epoch 的同步数据与模型的大小相同,引入了大量的通信开销,从而导致通信效率低下。为此,我们提出了一个将模型训练阶段与模型上传、下载阶段并行的框架 Overlap-FedAvg,使模型上传、下载阶段可以完全覆盖模型训练阶段。与普通的 FedAvg 相比,Overlap-FedAvg 进一步发展了分层计算策略、数据补偿机制和 Nes - 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
Overlap-FedAvg-main.zip (32个子文件)
Overlap-FedAvg-main
Utils
__init__.py 0B
Sample.py 5KB
Helper.py 4KB
Dataloader.py 8KB
Optimizer
__init__.py 0B
SGD.py 4KB
__pycache__
__init__.cpython-37.pyc 156B
SGD.cpython-37.pyc 4KB
FedAvg.py 6KB
LICENSE 1KB
AsyncFedAvg.py 10KB
Networks
Resnet.py 3KB
MLP.py 691B
CNNCifar.py 689B
Transformer.py 4KB
MnistNet.py 934B
VGG.py 2KB
prepare_data.py 324B
Characters
AsyncCharacters_StateDict.py 18KB
Characters.py 10KB
AsyncCharacters_Param.py 18KB
Characters_StateDict.py 10KB
AsyncCharacters.py 16KB
__pycache__
AsyncCharacters.cpython-37.pyc 12KB
Characters.cpython-37.pyc 7KB
Characters_Param.py 11KB
requirements.txt 957B
rnn_data
wikitext-2
valid.txt 1.07MB
README.txt 159B
.train.txt.icloud 159B
test.txt 1.2MB
README.md 5KB
共 32 条
- 1
资源评论
机智的程序员zero
- 粉丝: 2407
- 资源: 4796
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- resource资源配置环境
- 技术资料分享AU9254A21非常好的技术资料.zip
- clickhouse-common-static-dbg-23.3.1.2823.x86-64包前部分
- 技术资料分享AT070TN92非常好的技术资料.zip
- 基于springboot+mybatis+shiro+activity的企业办公Oa系统源码+数据库(毕业设计)
- OpenFPGAduino-FPGA开发资源源代码
- 基于HTML5的交流论坛的设计与实现+vue
- 基于SpringBoot + MyBatis + vue3实现的音乐信息管理系统前后端分离(源码+数据库+运行指导)
- 技术资料分享ADV7123非常好的技术资料.zip
- 各省资本存量数据2000-2023年(原始数据+测算+结果).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功