Skip to content
forked from Oschart/FLoBC

A Decentralized Blockchain-Based Federated Learning Framework

Notifications You must be signed in to change notification settings

pythonicode/FLoBC

 
 

Repository files navigation

FLoBC

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.

System View

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.

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

Languages

  • Rust 49.9%
  • JavaScript 24.7%
  • CSS 14.7%
  • SCSS 5.8%
  • Python 4.0%
  • Shell 0.8%
  • HTML 0.1%