This repository is an implementation of FLoBC: A Decentralized Blockchain-Based Federated Learning Framework.
@inproceedings{ghanem2022flobc,
title={FLoBC: A Decentralized Blockchain-Based Federated Learning Framework},
author={Ghanem, Mohamed and Dawoud, Fadi and Gamal, Habiba and Soliman, Eslam and El-Batt, Tamer},
booktitle={2022 Fourth International Conference on Blockchain Computing and Applications (BCCA)},
pages={85--92},
year={2022},
organization={IEEE}
}
This project supports the training of stochastic gradient descent models over blockchain.
Training and validation is performed on the user's local data. Nodes share insights or gradients rather than data.
The system utilizes a reward/punishment policy to incentivize legitimate training, and to punish and hinder malicious trainers.
As shown in the figure, trainers nodes perform local training, then share their updates with the validators that evaluate their updates and carry out the consensus process to update the global model on the blockchain. Subsequently, trainers are given a trust reward or pentaly, and a new model is added to the blockchain.
For more details about the system, check the slides and this video.
- git clone https://github.com/Oschart/FLoBC.git
- npm
- node https://nodejs.org/en/download/
- babel
$ npm install -g babel-cli
$ npm install express
$ npm install
$ cd frontend/src/components
$ node service.js
$ cd ../..
$ cd frontend
$ npm start
Using the spawn script, you can run the system with certain number of trainers, validators, synchronization scheme and training period. For instructions on how to run the spawn script, check
$ cd backend
$ sh build_finalize.sh -n <number of validating nodes> -b -c -j
$ cd ..
- -b is used to build rust
- -c is used to clear the blockchain
- -j is used to build the node.js validator
$ cd backend
$ sh run_node <node number> <sync scheme> <scoring flag> <model directory name>
$ cd ..
$ cd lightclient
$ npm install
$ npm start -- <validator port number> <dataset past> <trainer noise> <model directory name>
- python >= 3
- tensorflow
- keras
- numpy
- pandas
https://www.kaggle.com/oddrationale/mnist-in-csv
resize the downloaded data using this script, or download it from here
- N.B. Place training data in ./lightclient/models/MODEL_NAME/
- N.B. Place test data in ./backend/tx_validator/src/models/MODEL_NAME/data.csv
- Mohamed Ghanem Oschart
- Fadi Adel theRadFad
- Habiba Gamal habibagamal
- Eslam Soliman Eslam-Soliman
- Dr. Hossam Sharara
- Dr. Tamer ElBatt