Skip to content

Oschart/FLoBC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FLoBC: A Decentralized Blockchain-Based Federated Learning Framework

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.

System View

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.

Prerequisites

$ npm install -g babel-cli

To Run the Tool

Using GUI

Install the prerequisites
$ npm install express
$ npm install 
To run the web service
$ cd frontend/src/components
$ node service.js
$ cd ../..
$ cd frontend
$ npm start
Initialization Form

To configure the system Initialization Page

Progress Monitoring

Progress Monitoring

Demo Video

demo video

Using Scripts

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

Manually

To build the rust code and/or the validating node
$ 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
To run the validating node
$ cd backend
$ sh run_node <node number> <sync scheme> <scoring flag> <model directory name>
$ cd ..
To build the lightclient
$ cd lightclient
$ npm install
$ npm start -- <validator port number> <dataset past> <trainer noise> <model directory name> 

To use the provided models, you need:

  • python >= 3
  • tensorflow
  • keras
  • numpy
  • pandas

To use the provided MNIST 28x28 models, download MNIST data

https://www.kaggle.com/oddrationale/mnist-in-csv

To use the provided MNIST 20x20 models:

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

Authors

About

A Decentralized Blockchain-Based Federated Learning Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •