Federated Learning over Blockchain.
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 it can be seen in the figure. Trainers perform training, then share their updates with the validators that validate the updates and perform consensus. After which 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/FDMMLS.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