Knowledge Base Regulation Tracker Standards & Frameworks OSS Directory AI Incident Database Research Paper Library Case Studies Society Articles News Jobs About Charter Sign inBecome a Member

PFLlib

Federated learning

Personalised federated learning library with dozens of implemented algorithms, datasets and scenarios that runs on a single machine, with differential privacy and privacy-evaluation options, for research and teaching.

federated learningpersonalised fl

How it Works

PFLlib is designed as a beginner-friendly and comprehensive library for federated learning (FL), allowing users to run experiments on a single machine without requiring distributed infrastructure. The library simplifies the implementation of FL algorithms by structuring code into modular components. Users can generate datasets and scenarios using generateDATA.py, while algorithm execution is managed through main.py, clientNAME.py, and serverNAME.py. For new algorithms, only modifications to clientNAME.py and serverNAME.py are required, ensuring ease of extension and integration.

The library supports three primary scenarios: label skew, feature shift, and real-world data distributions. Each scenario is implemented with datasets that can be split into independent and identically distributed (IID) or non-IID configurations. Non-IID distributions are further categorized into pathological (extreme label imbalance) and practical (Dirichlet-distributed) settings.

The library also includes privacy-preserving mechanisms, such as differential privacy and privacy-evaluation tools, to ensure compliance with modern data protection standards.

Users can contribute new algorithms, datasets, or metrics by following structured guidelines.

Use Cases

PFLlib is primarily targeted at researchers and educators in the field of federated learning, offering a standardized platform for benchmarking and developing new algorithms. Its modular design allows for quick experimentation with traditional FL (tFL) and personalized FL (pFL) methods, making it ideal for academic studies and teaching.

These algorithms address challenges such as communication efficiency, data heterogeneity, and model personalization. For instance, FedCP and FedDBE are highlighted for their performance across varying levels of data heterogeneity, providing practical solutions for real-world FL deployments.

These datasets enable users to test algorithms under controlled conditions, such as pathological non-IID distributions where clients hold only subsets of labels, or practical non-IID settings modeled via Dirichlet distributions.

The library also facilitates privacy-preserving FL research through differential privacy and privacy-evaluation tools.

Beyond research, PFLlib can be used for teaching federated learning concepts. The library’s benchmarking capabilities also provide a foundation for comparing the efficacy of different approaches, fostering a deeper understanding of FL dynamics.

Key Features & Capabilities

PFLlib includes 39 traditional and personalized FL algorithms, categorized into groups such as update-correction-based (e.g., SCAFFOLD), regularization-based (e.g., FedProx, FedDyn), and meta-learning-based (e.g., Per-FedAvg). Each algorithm is implemented with a focus on addressing specific challenges in FL, such as non-IID data distributions, communication efficiency, and model personalization.

The library supports three distinct scenarios to model real-world FL environments:

  • Label skew scenario: Features 16 datasets (e.g., MNIST, Cifar10, FEMNIST) that can be split into IID or non-IID configurations. Non-IID splits include pathological cases where clients hold only a subset of labels and practical cases using Dirichlet distributions for more realistic imbalances.
  • Feature shift scenario: Utilizes datasets like Amazon Review and DomainNet to simulate domain adaptation challenges, where data distributions vary across clients due to differences in feature spaces.

This efficiency is achieved through a simple file structure where each FL algorithm is encapsulated in two primary files, simplifying implementation and extension.

Privacy is a core consideration in PFLlib, with built-in support for differential privacy and privacy-evaluation tools. These features allow researchers to quantify privacy risks and ensure compliance with standards such as GDPR. The library also provides systematic research support, enabling users to evaluate algorithms under varying privacy constraints.

For users seeking to extend PFLlib, the repository offers clear guidelines for adding new algorithms, datasets, or metrics.

PFLlib distinguishes between traditional FL (tFL) and personalized FL (pFL) algorithms, with pFL methods designed to exploit data heterogeneity for improved client-specific performance. Notable pFL algorithms include FedCP, GPFL, and FedDBE, which have demonstrated robust performance across heterogeneous data distributions. For algorithms addressing both data and model heterogeneity, users are directed to the extended project HtFLlib.

This capability is particularly valuable for evaluating scalability and performance under diverse conditions. Users can also configure experiments to train on a subset of clients and evaluate on new clients, though not all algorithms support this feature.

Sources

Contribute

Spot an error, or know a record we should add? Members can propose additions and submit corrections.