Skip to main content

ByzFL Library

Project description

ByzFL Documentation

Welcome to the official documentation of ByzFL, developed by DCL at EPFL and WIDE at INRIA Rennes!


What is ByzFL?

ByzFL is a Python library for Byzantine-resilient Federated Learning. It is fully compatible with both PyTorch tensors and NumPy arrays, making it versatile for a wide range of machine learning workflows.

Key Features

  1. Robust Aggregators and Pre-Aggregators:
    • Aggregate gradients robustly while mitigating the impact of Byzantine participants.
  2. Byzantine Attacks:
    • Simulate and evaluate different attack strategies to test resilience.
  3. Machine Learning Pipelines:
    • Train and benchmark robust aggregation schemes and attack implementations seamlessly.

Installation

Install the ByzFL library using pip:

pip install byzfl

After installation, the library is ready to use. Here’s a quick example of how to use the Trmean robust aggregator and the SignFlipping Byzantine attack:


Quick Start Example

import byzfl
import numpy as np

# Number of Byzantine participants
f = 1

# Honest vectors
honest_vectors = np.array([[1., 2., 3.],
                           [4., 5., 6.],
                           [7., 8., 9.]])

# Initialize and apply the attack
attack = byzfl.SignFlipping()
byz_vector = attack(honest_vectors)

# Create f identical attack vectors
byz_vectors = np.tile(byz_vector, (f, 1))

# Concatenate honest and Byzantine vectors
all_vectors = np.concatenate((honest_vectors, byz_vectors), axis=0)

# Initialize and perform robust aggregation
aggregate = byzfl.Trmean(f=f)
result = aggregate(all_vectors)
print("Aggregated result:", result)

Output:

Aggregated result: [2.5 3.5 4.5]

Learn More

Explore the key components of ByzFL:

  • Aggregators
    Learn about robust aggregation methods.
  • Attacks
    Discover Byzantine attack implementations.
  • Pipeline
    Build and benchmark your models.

License

ByzFL is open-source and distributed under the MIT License.

Contributions are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

byzfl-0.0.4.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

byzfl-0.0.4-py3-none-any.whl (66.4 kB view details)

Uploaded Python 3

File details

Details for the file byzfl-0.0.4.tar.gz.

File metadata

  • Download URL: byzfl-0.0.4.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.11.0

File hashes

Hashes for byzfl-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8f47426e62d45647fb663e6bd3c49996b5b9d81e43fcc99f4a418fe290419c38
MD5 ea8860120212de30b4e0981ddcd95e46
BLAKE2b-256 7c2b1e2bb92145044f8e26b2b352e8e37c845ff0b2a41070e8742125722f9b2e

See more details on using hashes here.

File details

Details for the file byzfl-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: byzfl-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 66.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.11.0

File hashes

Hashes for byzfl-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 55bfe776d7918ddddecadccf7c965a88d0fd8eb387349cd0c844a2c2f2f20ac0
MD5 57cd935a223a3fed399a6132e85396bb
BLAKE2b-256 58162a27dbe6cc5702d7b3786d7771add090a54b307eaced92c0e1fe6e6497eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page