Skip to content

Implement Federated Learning with Flower #28

@iAmGiG

Description

@iAmGiG

Goal

Replace incomplete TensorFlow Federated implementation with modern Flower framework.

Background

Current State (TFF):

  • TensorFlow Federated 0.40.0
  • Impossible to install (dependency conflicts)
  • Never successfully used botnet data (used EMNIST instead)
  • Simulation-only, not production-ready

Target (Flower):

  • Modern, actively maintained
  • Better documentation
  • Framework-agnostic
  • Production deployment support

Implementation

Architecture

src/federated_learning/
├── __init__.py
├── flower/
│   ├── __init__.py
│   ├── server.py          # Flower server
│   ├── client.py          # Device clients
│   └── strategy.py        # Custom FedAvg
├── simulation/
│   ├── __init__.py
│   └── run_simulation.py  # FL simulation
└── utils/
    ├── __init__.py
    └── aggregation.py

Components

Server (server.py):

  • Orchest rates federated training
  • Aggregates client updates
  • Custom FedAvg strategy

Client (client.py):

  • One client per IoT device (9 total)
  • Local training on device data
  • Send updates to server

Simulation (run_simulation.py):

  • Simulated FL environment
  • Test before deployment

Tasks

  • Install Flower (flwr)
  • Implement server
  • Implement client
  • Implement custom aggregation strategy
  • Create simulation framework
  • Run experiments
  • Compare centralized vs federated accuracy
  • Document FL implementation
  • Create deployment guide

Experiments

  1. Baseline: Centralized training (all devices)
  2. Local: Per-device models (no aggregation)
  3. Federated: Flower FL (FedAvg)

Metrics:

  • Accuracy (global and per-device)
  • Communication rounds
  • Training time
  • Model size

Research Questions

  1. Does FL maintain accuracy vs centralized?
  2. Can we achieve device-specific personalization?
  3. What is the communication cost?
  4. How does it scale?

Related

Priority

HIGH - Core feature for federated learning capability

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfederated-learningFederated learning related issuesmodernizationModernizing code, dependencies, and structure

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions