Skip to content

This repository contains the Proof of Concept (PoC) for running Federated Learning on top of Nillion. It consists of two main components: a Server and a Client.

License

Notifications You must be signed in to change notification settings

NillionNetwork/nillion-federated-learning

Repository files navigation

Nillion Federated Learning

This repository contains the Proof of Concept (PoC) for running Federated Learning on top of Nillion. It consists of two main components: a Server and a Client.

Table of Contents

  1. Introduction
  2. Prerequisites
  3. Setup
  4. Running the System
  5. Regenerating gRPC
  6. Project Structure
  7. License

Introduction

Federated Learning is a machine learning technique that trains algorithms across multiple decentralized edge devices or servers holding local data samples, without exchanging them. This project demonstrates how to implement Federated Learning using Nillion's secure infrastructure.

Prerequisites

  • Python 3.10 or higher
  • pip
  • poetry

Setup

  1. Install poetry:
pip install poetry
  1. Install project dependencies with examples extras to run the examples:
poetry install -E examples

Running the System

To run the Federated Learning system, you need to start the Nillion devnet, the server, and at least two clients.

  1. Start the Nillion devnet:
# Terminal 0
nillion-devnet
  1. Start the server:
# Terminal 1
poetry run python3 examples/logistic_regression/server.py
  1. Start the first client:
# Terminal 2
poetry run python3 examples/logistic_regression/client.py 0
  1. Start the second client:
# Terminal 3
poetry run python3 examples/logistic_regression/client.py 1

You can start additional clients by incrementing the client number on the server.py file.

Regenerating gRPC

If you make changes to the fl_service.proto file, you need to regenerate the gRPC code:

poetry run python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. nillion_fl/network/fl_service.proto

Project Structure

  • examples/: Includes various example implementations (convolutional networks, logistic regression, neural networks).
  • nillion_fl/: The main package for Nillion Federated Learning (contains base client, and server implementations)
    • core/: Core components for client and server implementations.
    • network/: Contains protocol buffer definitions for network communication.
    • nilvm/: Nillion Network related components, including federated averaging implementation.
    • pytorch/: PyTorch-specific implementations for client and server.

License

This project is licensed under the Apache2 License. See the LICENSE file for details.

About

This repository contains the Proof of Concept (PoC) for running Federated Learning on top of Nillion. It consists of two main components: a Server and a Client.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published