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.5.2

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.5.2
File Size Uploaded
pfl-0.5.2.tar.gz 171.1 kB Details

Built distribution (wheel)

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

Total release size: 404.1 kB

Release files / pfl-0.5.2.tar.gz

Download URL pfl-0.5.2.tar.gz
Size 171.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0e11774b19d732d9b724b218f78b1a3482b58560cc8f23c5cf131207d9bd36d1
BLAKE2b-256 checksum
How to use checksums
32fa826756f7a28919604e4dbad9e4b85655ed93e1f0337eb6df313ef0b65d43
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 Sep 16, 2026.

Transparency log

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

Download URL pfl-0.5.2-py3-none-any.whl
Size 233.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63bda1cc83b518abc166a6bf7f4953274e1661d4d8970c66d4a80d1557a46d52
BLAKE2b-256 checksum
How to use checksums
93476f53185d74e7fdbc1c9ecc86875bb27662da6b204a512dc4e27729c40e20
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 Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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