Skip to main content

A blazing-fast, minimalist, and researcher-friendly simulation framework for Federated Learning.

Project description

A blazing-fast, minimalist, and researcher-friendly simulation framework for Federated Learning

uv PyPI Version License Python Versions arXiv

What is BlazeFL?

BlazeFL is a lightweight framework for single-node Federated Learning (FL) simulation that eliminates the trade-off between throughput and reproducibility. By leveraging Python's free-threading architecture, BlazeFL allows for shared-memory execution that bypasses the heavy overhead of inter-process communication (IPC) and serialization.

BlazeFL

Architecture overview: Shared-memory execution eliminates serialization/IPC overhead. Isolated RNG streams ensure deterministic results.

Feature Highlights

  • 🚀 Zero-Copy Parallelism: Uses thread-based parallelism (PEP 703) to exchange model parameters via shared memory. Achieve up to 3.1x speedup on communication-heavy workloads compared to traditional process-based frameworks.
  • 🔄 Bitwise Reproducibility: Guarantees identical results across runs, even with high concurrency. By assigning isolated RNG streams to each client, BlazeFL eliminates non-determinism caused by worker scheduling or completion-order-dependent aggregation.
  • 🧩 No Framework Lock-in: Built on Python Protocols. Integrate your existing PyTorch models and training loops with minimal changes. No rigid inheritance required.
  • 🍃 Minimalist Stack: Core execution relies only on PyTorch and Python standard libraries. Lightweight, easy to package, and highly portable.

Quick Look

BlazeFL keeps the simulation loop explicit and easy to debug. Here is the core pattern:

# Server-Client interaction is straightforward
while not handler.is_stopped():
    # 1. Server: Sample clients and prepare downlink
    sampled_clients = handler.sample_clients()
    broadcast = handler.downlink_package()

    # 2. Client Trainer: Process clients in parallel (Threads/Processes)
    trainer.local_process(broadcast, sampled_clients)
    uploads = trainer.uplink_package()

    # 3. Server: Aggregate uploads
    for pack in uploads:
        handler.load(pack)

Execution Modes

BlazeFL offers three execution modes to suit your environment:

  1. Multi-Threaded (Recommended): Best for Python 3.14+ (Free-threading). Zero-copy sharing and minimal overhead.
  2. Multi-Process: Utilizes separate processes to achieve isolation. Uses shared-memory tensors for efficient parameter exchange.
  3. Single-Threaded: Simple, sequential execution. Perfect for debugging and initial prototyping.

Robust Reproducibility

Parallel execution often breaks reproducibility due to floating-point rounding differences and global random state interference. BlazeFL solves this with a Generator-Based Strategy:

  1. Each client is assigned a dedicated RNGSuite.
  2. Random operations (sampling, shuffling, augmentation) consume these client-isolated generators.
  3. Results are materialized in a deterministic order, ensuring bitwise-identical aggregation.

[!TIP] To ensure full determinism in vision pipelines, use transforms that accept explicit generators. BlazeFL provides utilities to snapshot and restore these states seamlessly.

Benchmarks

In image classification experiments (CIFAR-10), BlazeFL substantially reduces execution time relative to widely used frameworks. The performance advantage is most pronounced in workloads where parameter exchange is the primary bottleneck.

CNN ResNet18

Installation

uv add blazefl
# Or with reproducibility features
uv add blazefl[reproducibility]

Examples

Contributing

We welcome contributions! Please see our contribution guidelines.

Citation

@misc{azuma2026blazeflfastdeterministicfederated,
      title={BlazeFL: Fast and Deterministic Federated Learning Simulation}, 
      author={Kitsuya Azuma and Takayuki Nishio},
      year={2026},
      eprint={2604.03606},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2604.03606}, 
}

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

blazefl-3.0.0rc1.tar.gz (817.4 kB view details)

Uploaded Source

Built Distribution

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

blazefl-3.0.0rc1-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file blazefl-3.0.0rc1.tar.gz.

File metadata

  • Download URL: blazefl-3.0.0rc1.tar.gz
  • Upload date:
  • Size: 817.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blazefl-3.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 67ae9433c7011d29e97af829cd434b6c2f6f4b0badfde22b2b80f5122a2dd5b6
MD5 70a0359999a7ca07796295345a2cbd31
BLAKE2b-256 a8b6eaf380aec669ac034a9215ce88a14d8f1c8339ee4a276a6f9b980abb3cd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazefl-3.0.0rc1.tar.gz:

Publisher: publish.yaml on kitsuyaazuma/blazefl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazefl-3.0.0rc1-py3-none-any.whl.

File metadata

  • Download URL: blazefl-3.0.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blazefl-3.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 551c25744a3e1aa9ad35829b9ae58e736ce3d19fffbda32b6217faa230b41044
MD5 3f18d5893c0b285de0ab703197c8b987
BLAKE2b-256 5cfb36098574f6eeddacbcb9a06d7bd0c3ed80b7c0b13b32e92c057b2ed333a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazefl-3.0.0rc1-py3-none-any.whl:

Publisher: publish.yaml on kitsuyaazuma/blazefl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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