Skip to content

fedai-oss/fl-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

50 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FL-Go

CI Status Security FOSSA Go Version License Release

Go Report Card Contributors Stars Forks Issues


A Go implementation of OpenFL - An Open Framework for Federated Learning.

FL-Go provides the same CLI-driven workflow as the original OpenFL but with Go handling the orchestration and coordination while delegating ML operations to Python scripts.

๐Ÿš€ Features

  • OpenFL-Compatible CLI: Same commands and workflow as the original OpenFL
  • Go Orchestration: Fast, efficient coordination and communication in Go
  • Python ML Integration: Seamless delegation of training/evaluation to Python
  • gRPC Communication: Secure, efficient communication between components
  • Multi-round Federated Learning: Support for multiple training rounds
  • Asynchronous Federated Learning: Based on Papaya paper for scalable FL
  • Mode Switching: Easy switching between synchronous and asynchronous FL modes
  • Staleness-Aware Aggregation: Intelligent handling of stale updates in async mode
  • Multiple Aggregation Algorithms: Support for FedAvg, FedOpt, and FedProx algorithms
  • Modular Algorithm Framework: Easy to add new aggregation algorithms
  • Hyperparameter Configuration: Fine-tune algorithm behavior via YAML configuration
  • Comprehensive Monitoring: Real-time web UI with REST API for tracking FL metrics
  • Event Streaming: WebSocket-based real-time monitoring of federation progress
  • Resource Monitoring: Track system performance and collaborator health
  • Security Features: mTLS support for secure communication
  • Production Ready: Comprehensive testing, CI/CD, and monitoring

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    gRPC     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Aggregator    โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  Collaborator   โ”‚
โ”‚   (Go Server)   โ”‚             โ”‚   (Go Client)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                               โ”‚
         โ”‚ metrics                       โ”‚ metrics
         โ–ผ                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Model Averaging โ”‚             โ”‚ Training Script โ”‚
โ”‚   (Go Logic)    โ”‚             โ”‚   (Python ML)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ”‚ monitoring
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      REST/WS    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Monitoring API  โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค   Web Dashboard โ”‚
โ”‚  (Go Server)    โ”‚                 โ”‚  (React TypeScript)โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ Project Structure

fl-go/
โ”œโ”€โ”€ ๐Ÿ“ api/                    # Protocol definitions
โ”œโ”€โ”€ ๐Ÿ“ cmd/                    # Application entry points
โ”œโ”€โ”€ ๐Ÿ“ pkg/                    # Core packages
โ”œโ”€โ”€ ๐Ÿ“ web/                    # Web UI
โ”œโ”€โ”€ ๐Ÿ“ examples/               # Examples and samples
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ plans/              # Federation plan examples
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ workspaces/         # Complete workspace examples
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ monitoring/         # Monitoring examples
โ”‚   โ””โ”€โ”€ ๐Ÿ“ scripts/            # Example scripts
โ”œโ”€โ”€ ๐Ÿ“ docs/                   # Documentation
โ”œโ”€โ”€ ๐Ÿ“ scripts/                # Build and utility scripts
โ”œโ”€โ”€ ๐Ÿ“ configs/                # Configuration files
โ”œโ”€โ”€ ๐Ÿ“ deploy/                 # Deployment configurations
โ”œโ”€โ”€ ๐Ÿ“ tests/                  # Test files and test data
โ””โ”€โ”€ ๐Ÿ“ tools/                  # Development tools

๐Ÿš€ Quick Start

Prerequisites

  • Go 1.23 or later
  • Git
  • Docker (optional)
  • Node.js and npm (for web UI development)

Installation

  1. Clone the repository

    git clone https://github.com/fedai-oss/fl-go.git
    cd fl-go
  2. Setup development environment

    make setup-dev
  3. Build the project

    make build
  4. Run tests to verify installation

    make test

Your First Federation

  1. Create a federation plan

    # Use a sample plan
    cp examples/plans/basic/sync_plan.yaml my_federation.yaml
  2. Start the aggregator

    ./bin/fx aggregator start --config my_federation.yaml
  3. Start collaborators (in separate terminals)

    ./bin/fx collaborator start --config my_federation.yaml --name client-1
    ./bin/fx collaborator start --config my_federation.yaml --name client-2
  4. Monitor progress

    ./bin/fx monitor start --config configs/monitoring/development.yaml

    Then visit http://localhost:3000 in your browser.

๐Ÿ“š Documentation

Getting Started

User Guides

Examples

Development

Security

๐Ÿ”ง Development

Building

# Build all components
make build

# Build specific components
make build-monitor
make build-web

# Build Docker image
make docker-build

Testing

# Run all tests
make test

# Run specific test types
make test-unit
make test-integration
make test-security
make test-performance

# Run with coverage
make test-coverage

Code Quality

# Format code
make format

# Run linting
make lint

# Validate federation flows
make validate

๐Ÿ› ๏ธ Examples

Basic Federation

# Use the basic example
cd examples/workspaces/basic_fl_workspace
./bin/fx aggregator start --config plan.yaml

Secure Federation with mTLS

# Use the secure example
cd examples/workspaces/secure_mtls_workspace
./bin/fx security generate-certs --output-dir certs
./bin/fx aggregator start --config plan.yaml

Async Federation

# Use the async example
cd examples/workspaces/async_fl_workspace
./bin/fx aggregator start --config plan.yaml

๐Ÿ”’ Security & Compliance

FL-GO includes comprehensive security features and compliance tools:

Security Features

  • mTLS Support: Mutual TLS authentication for secure communication
  • Certificate Management: Automated certificate generation and validation
  • Secure Communication: Encrypted gRPC communication
  • Access Control: Role-based access control for monitoring

Compliance Tools

  • FOSSA Integration: Automated dependency analysis and license compliance
  • Security Scanning: Integrated gosec and govulncheck for vulnerability detection
  • Code Quality: Automated linting and code quality checks
  • Audit Trail: Comprehensive logging and monitoring

Setup Security Features

# Generate certificates for mTLS
./bin/fx security generate-certs --output-dir certs

# Verify certificates
./bin/fx security verify-certs --cert certs/client.crt --key certs/client.key

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Setup development environment
make setup-dev

# Run tests
make test

# Format code
make format

Pull Request Process

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests and documentation
  5. Run the test suite
  6. Submit a pull request

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • OpenFL - The original OpenFL framework
  • Papaya - Asynchronous federated learning paper
  • gRPC - High-performance RPC framework
  • React - Web UI framework

๐Ÿ“ž Support


FL-Go - Empowering Federated Learning with Go

Get Started โ€ข Documentation โ€ข Examples โ€ข Contributing

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

โšก