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.0.tar.gz (1.2 MB 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.0-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for blazefl-3.0.0.tar.gz
Algorithm Hash digest
SHA256 59312d4f00acdd9734b5e6e8fb1b877370568becf8056a2a322625673df5c148
MD5 817559437eb66dc2d7ae0d5edbbca6bf
BLAKE2b-256 3aebde84cd40d9f50ca028e0bac443b64cd7cff3565adc84e678d0e23d5d00a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazefl-3.0.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: blazefl-3.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d8ce5ae0808a48108dfc092c1e807430504dca591e5cb54f8b01e85120b88a8
MD5 856a37b0ec02b563e272a42b8246591b
BLAKE2b-256 a0bd33be3f5c882b55af207a0427be39b6b7335df435d103ae1b23f043071dfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazefl-3.0.0-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