Git Product home page Git Product logo

candle-fl's Introduction

Federated Learning with Candle

This is a proof-of-concept of federated learning using the Candle framework with Rust. It implements the FedAvg algorithm for horizontal federated learning with data provided by workers.

Multiple workers connect to a coordinator, which orchestrates them to train a model on their local data. The focus of this code is on the distributed system needed for federated learning, not on the machine learning model. As such, the model is a simple linear classification model and each worker trains on the same MNIST dataset.

Architecture

The components communicate using gRPC in a client-server model.

Coordinator

A coordinator manages the training process. It provides a publish-subscribe service for workers to connect to, send training requests, and receive training results. These results are then aggregated by the coordinator. It also provides a service to start a training run.

Worker

Workers have access to their local training data. They connect to a coordinator and wait for training requests. When they receive a training request, they train a model on their local data and send the trained model back to the coordinator.

Usage

Build the project with cargo build -r and start the coordinator with cargo run -r --bin coordinator then connect one or more workers with cargo run -r --bin worker. With the workers connected, start a training run with cargo run -r --bin start_training 10. This will train the model for 10 rounds. For example:

$ cargo run -r --bin coordinator &
$ cargo run -r --bin worker &
$ cargo run -r --bin worker &
$ cargo run -r --bin start_training 10

candle-fl's People

Contributors

nfnt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.