• Stars
    star
    480
  • Rank 88,084 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Federated Deep Learning in PaddlePaddle

DOC | Quick Start | 中文

Release License

PaddleFL is an open source federated learning framework based on PaddlePaddle. Researchers can easily replicate and compare different federated learning algorithms with PaddleFL. Developers can also benefit from PaddleFL in that it is easy to deploy a federated learning system in large scale distributed clusters. In PaddleFL, several federated learning strategies will be provided with application in computer vision, natural language processing, recommendation and so on. Application of traditional machine learning training strategies such as Multi-task learning, Transfer Learning in Federated Learning settings will be provided. Based on PaddlePaddle's large scale distributed training and elastic scheduling of training job on Kubernetes, PaddleFL can be easily deployed based on full-stack open sourced software.

Overview of PaddleFL

Data is becoming more and more expensive nowadays, and sharing of raw data is very hard across organizations. Federated Learning aims to solve the problem of data isolation and secure sharing of data knowledge among organizations. The concept of federated learning is proposed by researchers in Google [1, 2, 3]. PaddleFL implements federated learning based on the PaddlePaddle framework. Application demonstrations in natural language processing, computer vision and recommendation will be provided in PaddleFL. PaddleFL supports the current two main federated learning strategies[4]: vertical federated learning and horizontal federated learning. Multi-tasking learning [7] and transfer learning [8] in federated learning will be developed and supported in PaddleFL in the future.

  • Horizontal Federated Learning: Federated Averaging [2], Differential Privacy [6], Secure Aggregation[11]
  • Vertical Federated Learning: Two-party training with PrivC[5], Three-party training with ABY3 [10]

Recent Feature Release Roadmap

  • 2021.08: Two party federated learning in vertical scenario
  • 2021.Q4: GPU version of MPC, Split Learning Based vertical federated learning

Framework Design of PaddleFL

There are mainly two components in PaddleFL: Data Parallel and Federated Learning with MPC (PFM).

  • With Data Parallel, distributed data holders can finish their Federated Learning tasks based on common horizontal federated strategies, such as FedAvg, DPSGD, etc.

  • PFM is implemented based on secure multi-party computation (MPC) to enable secure training and prediction. As a key product of PaddleFL, PFM intrinsically supports federated learning well, including horizontal, vertical and transfer learning scenarios. Users with little cryptography expertise can also train models or conduct prediction on encrypted data.

Data Parallel

In Data Parallel, the whole process of model training is divided into two stages: Compile Time and Run Time. Components for defining a federated learning task and training a federated learning job are as follows:

A. Compile Time

  • FL-Strategy: a user can define federated learning strategies with FL-Strategy such as Fed-Avg[2]

  • User-Defined-Program: PaddlePaddle's program that defines the machine learning model structure and training strategies such as multi-task learning.

  • Distributed-Config: In federated learning, a system should be deployed in distributed settings. Distributed Training Config defines distributed training node information.

  • FL-Job-Generator: Given FL-Strategy, User-Defined Program and Distributed Training Config, FL-Job for federated server and worker will be generated through FL Job Generator. FL-Jobs will be sent to organizations and federated parameter server for run-time execution.

B. Run Time

  • FL-Server: federated parameter server that usually runs in cloud or third-party clusters.

  • FL-Worker: Each organization participates in federated learning will have one or more federated workers that will communicate with the federated parameter server.

  • FL-scheduler: Decide which set of trainers can join the training before each updating cycle.

For more instructions, please refer to the examples

Federated Learning with MPC

PaddleFL MPC implements secure training and inference tasks based on the underlying MPC protocol like ABY3[10] and PrivC[5], which are high efficient multi-party computing model. In PaddeFL, two-party federated learning based on PrivC mainly supports linear/logistic regression and DNN model. Three-party federated learning based on ABY3 supports linear/logistic regression, DNN model, CNN model and FM.

In PaddleFL MPC, participants can be classified into roles of Input Party (IP), Computing Party (CP) and Result Party (RP). Input Parties (e.g., the training data/model owners) encrypt and distribute data or models to Computing Parties (There exist three computing parties in ABY3 protocol while two computing parties in PrivC protocol). Computing Parties (e.g., the VM on the cloud) conduct training or inference tasks based on specific MPC protocols, being restricted to see only the encrypted data or models, and thus guarantee the data privacy. When the computation is completed, one or more Result Parties (e.g., data owners or specified third-party) receive the encrypted results from Computing Parties, and reconstruct the plaintext results. Roles can be overlapped, e.g., a data owner can also act as a computing party.

A full training or inference process in PFM consists of mainly three phases: data preparation, training/inference, and result reconstruction.

A. Data Preparation

  • Private data alignment: PFM enables data owners (IPs) to find out records with identical keys (like UUID) without revealing private data to each other. This is especially useful in the vertical learning cases where segmented features with same keys need to be identified and aligned from all owners in a private manner before training.

  • Encryption and distribution: PFM provides both online and offline data encryption and distribution solutions. If users choose the offline data sharing scheme, data and models from IPs will be encrypted using Secret-Sharing[9], and then be sent to CPs, via directly transmission or distributed storage like HDFS. If users adopt the online solution, IPs encrypt and distribute data and models online at the beginning of the training phase. Each CP can only obtain one share of each piece of data, and thus is unable to recover the original value in the Semi-honest model.

B. Training/Inference

A PFM program is exactly a PaddlePaddle program, and will be executed as normal PaddlePaddle programs. Before training/inference, user needs to choose a MPC protocol, define a machine learning model and their training strategies. Typical machine learning operators are provided in paddle_fl.mpc over encrypted data, of which the instances are created and run in order by Executor during run-time.

For more information of Training/inference phase, please refer to the following doc.

C. Result Reconstruction

Upon completion of the secure training (or inference) job, the models (or prediction results) will be output by CPs in encrypted form. Result Parties can collect the encrypted results, decrypt them using the tools in PFM, and deliver the plaintext results to users (Currently, data sharing and reconstruction can be supported in both offline and online modes).

For more instructions, please refer to mpc examples

Installation

Environment preparation

  • CentOS 7 (64 bit)
  • Python 3.5/3.6/3.7 ( 64 bit) or above
  • pip3 9.0.1+ (64 bit)
  • PaddlePaddle 1.8.5
  • Redis 5.0.8 (64 bit)
  • GCC or G++ 8.3.1
  • cmake 3.15+

Installation steps

We provide three ways to install PaddleFL:

  1. Use PaddleFL in docker

We highly recommend to run PaddleFL in Docker

#Pull and run the docker
docker pull paddlepaddle/paddlefl:1.1.2
docker run --name <docker_name> --net=host -it -v $PWD:/paddle <image id> /bin/bash
  1. Install PaddleFL via installation package

We provide compiled PaddlePaddle and PaddleFL installation packages, you can download and install them directly.

First, install PaddlePaddle

#Install PaddlePaddle
wget https://paddlefl.bj.bcebos.com/paddlepaddle-1.8.5-cp**-cp**-linux_x86_64.whl
pip3 install paddlepaddle-1.8.5-cp**-cp**-linux_x86_64.whl

Please replace ** with the python version in the installation environment. E.g., if you are using python3.8, the commands are as below:

wget https://paddlefl.bj.bcebos.com/paddlepaddle-1.8.5-cp38-cp38-linux_x86_64.whl
pip3 install paddlepaddle-1.8.5-cp38-cp38-linux_x86_64.whl

Then, install PaddleFL

#Install PaddleFL
pip3 install paddle_fl

The above command will automatically install PaddleFL corresponding to python3.8. For other python3 environments, you can download the corresponding installation package from https://pypi.org/project/paddle-fl/1.1.2/#files and install it manually.

  1. Install PaddleFL from source code

If you want to compile and install from source code, please click here to get instructions.

If you are using the gloo communication model, you will need Redis. We also provide a stable Redis installation package for download.

wget --no-check-certificate https://paddlefl.bj.bcebos.com/redis-stable.tar
tar -xf redis-stable.tar
cd redis-stable &&  make

Easy Deployment with Kubernetes

Horizontal Federated Learning

kubectl apply -f ./python/paddle_fl/paddle_fl/examples/k8s_deployment/master.yaml

Please refer K8S deployment example for details

You can also refer K8S cluster application and kubectl installation to deploy your K8S cluster

PaddleFL Extension

fl-mobile simulator

FL-mobile is a framework integrated algorithm simulation , training and deployment. The simulator is part of FL-mobile.

The design purpose of the simulator is to simulate the actual cooperated training among multiple mobile terminal devices online. FL-mobile simulates multiple mobile terminal devices online on the server to verify the effect of algorithms rapidly. The advantages of the simulator are as follows:

  • Support training for single machine and distributed networks
  • Support training for common open source datasets
  • Support private and shared parameters in the models, the private parameters do not participant in the global update

On Going and Future Work

  • Vertical Federated Learning will support more algorithms.

  • Add K8S deployment scheme for PFM.

  • FL mobile simulator will be open sourced in following versions.

Related Work

[1]. Jakub Konečný, H. Brendan McMahan, Daniel Ramage, Peter Richtárik. Federated Optimization: Distributed Machine Learning for On-Device Intelligence. arXiv preprint 2016

[2]. H. Brendan McMahan, Eider Moore, Daniel Ramage, Blaise Agüera y Arcas. Federated Learning of Deep Networks using Model Averaging. arXiv preprint 2016

[3]. Jakub Konečný, H. Brendan McMahan, Felix X. Yu, Peter Richtárik, Ananda Theertha Suresh, Dave Bacon. Federated Learning: Strategies for Improving Communication Efficiency. arXiv preprint 2016

[4]. Qiang Yang, Yang Liu, Tianjian Chen, Yongxin Tong. Federated Machine Learning: Concept and Applications. ACM Transactions on Intelligent Systems and Technology 2019

[5]. Kai He, Liu Yang, Jue Hong, Jinghua Jiang, Jieming Wu, Xu Dong et al. PrivC - A framework for efficient Secure Two-Party Computation. In Proc. of SecureComm 2019

[6]. Martín Abadi, Andy Chu, Ian Goodfellow, H. Brendan McMahan, Ilya Mironov, Kunal Talwar, Li Zhang. Deep Learning with Differential Privacy. In Proc. of CCS 2016

[7]. Virginia Smith, Chao-Kai Chiang, Maziar Sanjabi, Ameet Talwalkar. Federated Multi-Task Learning. In Proc. of NIPS 2017

[8]. Yang Liu, Tianjian Chen, Qiang Yang. Secure Federated Transfer Learning. IEEE Intelligent Systems 2018

[9]. https://en.wikipedia.org/wiki/Secret_sharing

[10]. Payman Mohassel and Peter Rindal. ABY3: A Mixed Protocol Framework for Machine Learning. In Proc. of CCS 2018

[11]. Aaron Segal Antonio Marcedone Benjamin Kreuter Daniel Ramage H. Brendan McMahan Karn Seth K. A. Bonawitz Sarvar Patel Vladimir Ivanov. Practical Secure Aggregation for Privacy-Preserving Machine Learning. In Proc. of CCS 2017

More Repositories

1

PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Python
38,354
star
2

Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
C++
21,619
star
3

PaddleHub

Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)
Python
12,439
star
4

PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Python
12,003
star
5

PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
Python
11,233
star
6

PaddleSpeech

Easy-to-use Speech Toolkit including Self-Supervised Learning model, SOTA/Streaming ASR with punctuation, Streaming TTS with text frontend, Speaker Verification System, End-to-End Speech Translation and Keyword Spotting. Won NAACL2022 Best Demo Award.
Python
10,060
star
7

PaddleSeg

Easy-to-use image segmentation library with awesome pre-trained model zoo, supporting wide-range of practical tasks in Semantic Segmentation, Interactive Segmentation, Panoptic Segmentation, Image Matting, 3D Segmentation, etc.
Python
8,188
star
8

PaddleGAN

PaddlePaddle GAN library, including lots of interesting applications like First-Order motion transfer, Wav2Lip, picture repair, image editing, photo2cartoon, image style transfer, GPEN, and so on.
Python
7,661
star
9

models

Officially maintained, supported by PaddlePaddle, including CV, NLP, Speech, Rec, TS, big models and so on.
Python
6,868
star
10

Paddle-Lite

PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge (飞桨高性能深度学习端侧推理引擎)
C++
6,839
star
11

ERNIE

Official implementations for various pre-training models of ERNIE-family, covering topics of Language Understanding & Generation, Multimodal Understanding & Generation, and beyond.
Python
6,197
star
12

PaddleClas

A treasure chest for visual classification and recognition powered by PaddlePaddle
Python
5,244
star
13

VisualDL

Deep Learning Visualization Toolkit(『飞桨』深度学习可视化工具 )
HTML
4,716
star
14

PaddleX

PaddlePaddle End-to-End Development Toolkit(『飞桨』深度学习全流程开发工具)
Python
4,564
star
15

PaddleRec

Recommendation Algorithm大规模推荐算法库,包含推荐系统经典及最新算法LR、Wide&Deep、DSSM、TDM、MIND、Word2Vec、Bert4Rec、DeepWalk、SSR、AITM,DSIN,SIGN,IPREC、GRU4Rec、Youtube_dnn、NCF、GNN、FM、FFM、DeepFM、DCN、DIN、DIEN、DLRM、MMOE、PLE、ESMM、ESCMM, MAML、xDeepFM、DeepFEFM、NFM、AFM、RALM、DMR、GateNet、NAML、DIFM、Deep Crossing、PNN、BST、AutoInt、FGCNN、FLEN、Fibinet、ListWise、DeepRec、ENSFM,TiSAS,AutoFIS等,包含经典推荐系统数据集criteo 、movielens等
Python
4,077
star
16

PARL

A high-performance distributed training framework for Reinforcement Learning
Python
3,182
star
17

awesome-DeepLearning

深度学习入门课、资深课、特色课、学术案例、产业实践案例、深度学习知识百科及面试题库The course, case and knowledge of Deep Learning and AI
Jupyter Notebook
2,752
star
18

book

Deep Learning 101 with PaddlePaddle (『飞桨』深度学习框架入门教程)
Jupyter Notebook
2,728
star
19

FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
C++
2,695
star
20

Research

novel deep learning research works with PaddlePaddle
Python
1,694
star
21

PGL

Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on PaddlePaddle
Python
1,558
star
22

PaddleSlim

PaddleSlim is an open-source library for deep model compression and architecture search.
Python
1,507
star
23

PaddleVideo

Awesome video understanding toolkits based on PaddlePaddle. It supports video data annotation tools, lightweight RGB and skeleton based action recognition model, practical applications for video tagging and sport action detection.
Python
1,392
star
24

Paddle.js

Paddle.js is a web project for Baidu PaddlePaddle, which is an open source deep learning framework running in the browser. Paddle.js can either load a pre-trained model, or transforming a model from paddle-hub with model transforming tools provided by Paddle.js. It could run in every browser with WebGL/WebGPU/WebAssembly supported. It could also run in Baidu Smartprogram and WX miniprogram.
JavaScript
928
star
25

Serving

A flexible, high-performance carrier for machine learning models(『飞桨』服务化部署框架)
C++
869
star
26

PaddleHelix

Bio-Computing Platform Featuring Large-Scale Representation Learning and Multi-Task Deep Learning “螺旋桨”生物计算工具集
Python
784
star
27

RocketQA

🚀 RocketQA, dense retrieval for information retrieval and question answering, including both Chinese and English state-of-the-art models.
Python
742
star
28

X2Paddle

Deep learning model converter for PaddlePaddle. (『飞桨』深度学习模型转换工具)
Python
713
star
29

Knover

Large-scale open domain KNOwledge grounded conVERsation system based on PaddlePaddle
Python
670
star
30

Paddle-Lite-Demo

lib, demo, model, data
C++
640
star
31

Paddle2ONNX

ONNX Model Exporter for PaddlePaddle
Python
637
star
32

Parakeet

PAddle PARAllel text-to-speech toolKIT (supporting Tacotron2, Transformer TTS, FastSpeech2/FastPitch, SpeedySpeech, WaveFlow and Parallel WaveGAN)
Python
599
star
33

FlyCV

FlyCV is a high-performance library for processing computer visual tasks.
C++
560
star
34

Anakin

High performance Cross-platform Inference-engine, you could run Anakin on x86-cpu,arm, nv-gpu, amd-gpu,bitmain and cambricon devices.
C++
530
star
35

Paddle3D

A 3D computer vision development toolkit based on PaddlePaddle. It supports point-cloud object detection, segmentation, and monocular 3D object detection models.
Python
529
star
36

Quantum

Jupyter Notebook
528
star
37

PaddleYOLO

🚀🚀🚀 YOLO series of PaddlePaddle implementation, PP-YOLOE+, RT-DETR, YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOX, YOLOv5u, YOLOv7u, YOLOv6Lite, RTMDet and so on. 🚀🚀🚀
Python
500
star
38

VIMER

视觉预训练基础模型仓库
Python
479
star
39

PaddleTS

Awesome Easy-to-Use Deep Time Series Modeling based on PaddlePaddle, including comprehensive functionality modules like TSDataset, Analysis, Transform, Models, AutoTS, and Ensemble, etc., supporting versatile tasks like time series forecasting, representation learning, and anomaly detection, etc., featured with quick tracking of SOTA deep models.
Python
444
star
40

PaddleFleetX

飞桨大模型开发套件,提供大语言模型、跨模态大模型、生物计算大模型等领域的全流程开发工具链。
Python
417
star
41

PaddleRS

Awesome Remote Sensing Toolkit based on PaddlePaddle.
Python
330
star
42

PaddleSpatial

PaddleSpatial is an open-source spatial-temporal computing tool based on PaddlePaddle.
GLSL
316
star
43

PaddleCloud

PaddlePaddle Docker images and K8s operators for PaddleOCR/Detection developers to use on public/private cloud.
Go
279
star
44

ERNIE-SDK

ERNIE Bot Agent is a Large Language Model (LLM) Agent Framework, powered by the advanced capabilities of ERNIE Bot and the platform resources of Baidu AI Studio.
Jupyter Notebook
274
star
45

MetaGym

Collection of Reinforcement Learning / Meta Reinforcement Learning Environments.
Python
267
star
46

PASSL

PASSL包含 SimCLR,MoCo v1/v2,BYOL,CLIP,PixPro,simsiam, SwAV, BEiT,MAE 等图像自监督算法以及 Vision Transformer,DEiT,Swin Transformer,CvT,T2T-ViT,MLP-Mixer,XCiT,ConvNeXt,PVTv2 等基础视觉算法
Python
257
star
47

PaddleScience

PaddleScience is SDK and library for developing AI-driven scientific computing applications based on PaddlePaddle.
Python
234
star
48

docs

Documentations for PaddlePaddle
Python
230
star
49

InterpretDL

InterpretDL: Interpretation of Deep Learning Models,基于『飞桨』的模型可解释性算法库。
Python
226
star
50

Paddle-Inference-Demo

C++
223
star
51

PaddleRobotics

PaddleRobotics is an open-source algorithm library for robots based on Paddle, including open-source parts such as human-robot interaction, complex motion control, environment perception, SLAM positioning, and navigation.
Python
210
star
52

PaddleMIX

Paddle Multimodal Integration and eXploration, supporting mainstream multi-modal tasks, including end-to-end large-scale multi-modal pretrain models and diffusion model toolbox. Equipped with high performance and flexibility.
Python
207
star
53

TrustAI

飞桨可信AI
Python
179
star
54

ElasticCTR

ElasticCTR,即飞桨弹性计算推荐系统,是基于Kubernetes的企业级推荐系统开源解决方案。该方案融合了百度业务场景下持续打磨的高精度CTR模型、飞桨开源框架的大规模分布式训练能力、工业级稀疏参数弹性调度服务,帮助用户在Kubernetes环境中一键完成推荐系统部署,具备高性能、工业级部署、端到端体验的特点,并且作为开源套件,满足二次深度开发的需求。
Python
176
star
55

PALM

a Fast, Flexible, Extensible and Easy-to-use NLP Large-scale Pretraining and Multi-task Learning Framework.
Python
174
star
56

AutoDL

Python
158
star
57

PLSC

Paddle Large Scale Classification Tools,supports ArcFace, CosFace, PartialFC, Data Parallel + Model Parallel. Model includes ResNet, ViT, Swin, DeiT, CaiT, FaceViT, MoCo, MAE, ConvMAE, CAE.
Python
142
star
58

CINN

Compiler Infrastructure for Neural Networks
C++
139
star
59

LiteKit

Off-The-Shelf AI Development Kit for APP Developers based on Paddle Lite (『飞桨』移动端开箱即用AI套件, 包含Java & Objective C接口支持)
Objective-C
131
star
60

PaddleFlow

Go
104
star
61

PaddleDTX

Paddle with Decentralized Trust based on Xuperchain
Go
87
star
62

PaddleSports

Python
86
star
63

XWorld

A C++/Python simulator package for reinforcement learning
C++
84
star
64

hapi

hapi is a High-level API that supports both static and dynamic execution modes
Jupyter Notebook
76
star
65

benchmark

Python
74
star
66

PaddleSleeve

PaddleSleeve
Python
70
star
67

Mobile

Embedded and Mobile Deployment
Python
70
star
68

community

PaddlePaddle Developer Community
Jupyter Notebook
66
star
69

PaConvert

Code Convert to PaddlePaddle Toolkit
Python
66
star
70

PaddleDepth

Python
58
star
71

PaddleCustomDevice

PaddlePaddle custom device implementaion. (『飞桨』自定义硬件接入实现)
C++
49
star
72

PaddlePaddle.org

PaddlePaddle.org is the repository for the website of the PaddlePaddle open source project.
CSS
48
star
73

PaddleTest

PaddlePaddle TestSuite
Python
43
star
74

PaDiff

Paddle Automatically Diff Precision Toolkits.
Python
42
star
75

EasyData

Python
35
star
76

epep

Easy & Effective Application Framework for PaddlePaddle
Python
34
star
77

paddle-ce-latest-kpis

Paddle Continuous Evaluation, keep updating.
Python
26
star
78

VisionTools

Python
22
star
79

Contrib

contribution works with PaddlePaddle from the third party developers
Python
20
star
80

PaddleCraft

Take neural networks as APIs for human-like AI.
Python
20
star
81

PaddleTransfer

飞桨迁移学习算法库
Python
19
star
82

recordio

An implementation of the RecordIO file format.
Go
19
star
83

continuous_evaluation

Macro Continuous Evaluation Platform for Paddle.
Python
19
star
84

Perf

SOTA benchmark
Python
17
star
85

Paddle-bot

Python
17
star
86

examples

Python
17
star
87

continuous_integration

Python
16
star
88

tape

C++
14
star
89

PaddleSOT

A Bytecode level Implementation of Symbolic OpCode Translator For PaddlePaddle
Python
14
star
90

paddle_upgrade_tool

upgrade paddle-1.x to paddle-2.0
Python
12
star
91

talks

Shell
6
star
92

CLA

5
star
93

any

Legacy Repo only for PaddlePaddle with version <= 1.3
C++
5
star