WaFL: Web3 Accelerated Federated Learning

WaFL: Web3 Accelerated Federated Learning

Pairing ML Waffles with the sweetness ofWeb3 Syrup

The problem WaFL: Web3 Accelerated Federated Learning solves

Federated Learning is an ML paradigm that solves the issue of training Global Models among several entities without distributing sensitive data from each participating entity. In a gist, it works by clients locally training their models on their data and only sharing their model weights with an aggregator that uses an aggregation algorithm (e.g. FedAvg).
More info here

While this novel approach mitigates the privacy problem, it also has its caveats:

• It requires clients to trust the aggregator for proper aggregations of weights
• A malicious client can poison the model's performance.

We realized that this problem statement has a tailor-made solution in blockchain. So we built a seamless and secure framework for ML developers to Federate their models: WaFL!

The solution is a two-part approach:

• The aggregator entity is defined as a smart contract to ensure trustless and reliable aggregation computing for all model updates from the clients.
• The local model training compute performed by the clients is converted to an off-chain zkSNARK. The on-chain aggregator module verifies the ZKP before using the client's model weights for aggregation.

We provide all the middleware for the client to connect and interact with the aggregator as well as handle all the data flow for them so that they can work on their forte, i.e. their local models.
We provide a few-step setup so that everyone can start working with WaFL on the go.

Along with our main product, we also provide a service for the users to graph their model metrics (e.g. accuracy and loss scores). By simply signing up on our website, the users can track their model progress and tweak their hyper-parameters.

Challenges we ran into

  • Structuring various components properly to follow the proper structural flow design.
  • Converting Machine Learning Code to circuits for zkSNARKS.
  • Seamless Integration of the Sponsor SDKs.
  • Thorough testing required a lot of Gas Fees, which was troublesome as the Faucets were either deprecated or empty.
  • Dataflow between the Backend Modules required several refactors to work seamlessly.
  • Deploying Smart Contract on Testnet required a lot of pre-requisite setup to spin up our own Subnet and Node Network.

Discussion