Skip to main content

pfl: Python framework for Private Federated Learning simulations

GitHub License CircleCI PyPI - Python Version

Documentation website: https://apple.github.io/pfl-research

pfl is a Python framework developed at Apple to empower researchers to run efficient simulations with privacy-preserving federated learning (FL) and disseminate the results of their research in FL. We are a team comprising engineering and research expertise, and we encourage researchers to publish their papers, with this code, with confidence.

The framework is not intended to be used for third-party FL deployments but the results of the simulations can be tremendously useful in actual FL deployments. We hope that pfl will promote open research in FL and its effective dissemination.

pfl provides several useful features, including the following:

  • Get started quickly trying out PFL for your use case with your existing model and data.
  • Iterate quickly with fast simulations utilizing multiple levels of distributed training (multiple processes, GPUs and machines).
  • Flexibility and expressiveness - when a researcher has a PFL idea to try, pfl has flexible APIs to express these ideas.
  • Scalable simulations for large experiments with state-of-the-art algorithms and models.
  • Support both PyTorch and TensorFlow.
  • Unified benchmarks for datasets that have been vetted for both PyTorch and TensorFlow.
  • Support other models in addition to neural networks, e.g. GBDTs. Switching between types of models is seamless.
  • Tight integration with privacy features, including common mechanisms for local and central differential privacy.

Results from benchmarks are maintained in this Weights & Biases report.

Installation

Installation instructions can be found here. pfl is available on PyPI and a full installation be done with pip:

pip install 'pfl[tf,pytorch,trees]'

Getting started - tutorial notebooks

To try out pfl immediately without installation, we provide several colab notebooks for learning the different components in pfl hands-on.

  • Introduction to Federated Learning with CIFAR10 and TensorFlow.
  • Introduction to PFL research with FLAIR and PyTorch.
  • Introduction to Differential Privacy (DP) with Federated Learning.
  • Creating Federated Dataset for PFL Experiment.

We also support MLX!

But you have to run this notebook locally on your Apple silicon, see all Jupyter notebooks available here.

Getting started - benchmarks

pfl aims to streamline the benchmarking process of testing hypotheses in the Federated Learning paradigm. The official benchmarks are available in the benchmarks directory, using a variety of realistic dataset-model combinations with and without differential privacy (yes, we do also have CIFAR10).

Copying these examples is a great starting point for doing your own research. See the quickstart on how to start converging a model on the simplest benchmark (CIFAR10) in just a few minutes.

Contributing

Researchers are invited to contribute to the framework. Please, see here for more details.

Citing pfl-research

@article{granqvist2024pfl,
  title={pfl-research: simulation framework for accelerating research in Private Federated Learning},
  author={Granqvist, Filip and Song, Congzheng and Cahill, {\'A}ine and van Dalen, Rogier and Pelikan, Martin and Chan, Yi Sheng and Feng, Xiaojun and Krishnaswami, Natarajan and Jina, Vojta and Chitnis, Mona},
  journal={arXiv preprint arXiv:2404.06430},
  year={2024},
}

Metadata

Release files for pfl 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pfl 0.6.0
File Size Uploaded Provenance Actions
pfl-0.6.0.tar.gz 172.2 kB With provenance Details for pfl-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pfl 0.6.0
File Interpreter ABI Platform Actions
pfl-0.6.0-py3-none-any.whl Python 3 none any Details for pfl-0.6.0-py3-none-any.whl

Total release size: 406.4 kB

Release files / pfl-0.6.0.tar.gz

Download URL pfl-0.6.0.tar.gz
Size 172.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0c5797ad334104db81ae2d820ac3ac115a718c9dbe87e6a671d31e3b00640b48
BLAKE2b-256 checksum
How to use checksums
df666ac6217fef387727d8e0ec9c6000c20979e8406d25a3f912be01b6155c11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pfl-0.6.0-py3-none-any.whl

Download URL pfl-0.6.0-py3-none-any.whl
Size 234.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
148f31390262c9c529b500b3bfccbb0734362fb9a38948618730811cca9b22ee
BLAKE2b-256 checksum
How to use checksums
c94701d9a06392e8cc2946c19ba308c1aea869115c77681ef823b5d7de3b1481
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for pfl 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pfl-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page