Skip to content

Repository files navigation

Version
1.5.0
Main Libraries
Flower
PyTorch
Torchvision
Testing Datasets
torchvision.datasets (+38)
Testing Models
torchvision.models (+120)

AP4FED: A Federated Learning Benchmark Platform

AP4FED is a Federated Learning benchmark platform built on top of Flower. It helps users define, run, and compare configurable FL simulations with architectural patterns, local or Docker-based execution, and performance reporting.

The platform supports software architects and researchers in evaluating design decisions quantitatively. It can be used to study how architectural patterns affect accuracy, training time, communication time, and total round time.

AP4FED has been used in three research works:

  • "Performance Analysis of Architectural Patterns for Federated Learning Systems", published at ICSA 2025, introduced the first version of the platform and the baseline pattern evaluation [1].
  • "Experimenting Architectural Patterns in Federated Learning Systems", published in the Journal of Systems and Software, extended the experimental analysis to multiple architectural pattern configurations [2].
  • "Agentic Runtime Reconfiguration of Architectural Patterns in Federated Learning", published in the Journal of Systems and Software, introduces AI-agent-based runtime reconfiguration of architectural patterns [3].

Table of contents

Prerequisites

AP4FED can run as a Local project or as a Docker project. The local mode is enough for standard Flower simulations. Docker mode is useful when experiments need stronger client isolation and more realistic resource allocation.

Local Project

To create a virtual environment, install dependencies, and run the tool, execute:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python home.py

Docker Project

To run a Docker project, ensure that the following prerequisites are installed:

Headless Experiments / Cluster Runs

For paper-oriented runners and cluster executions, AP4FED provides a bootstrap flow for headless machines. This setup runs experiments and generates CSV results without opening the GUI.

./scripts/bootstrap_experiment_env.sh
source .venv-experiments/bin/activate
python scripts/verify_experiment_env.py --mode local

To run Docker-backed experiments, verify the container runtime too:

python scripts/verify_experiment_env.py --mode docker

The full workflow is documented in docs/HPC_EXPERIMENTS.md.

The Python environment does not install or start Ollama. LLM-based approaches (Voting-based, Role-based, Debate-based) call an Ollama-compatible HTTP endpoint configured through --ollama-base-url.

How To Run

After installing the prerequisites, run AP4FED from the repository root:

python home.py

Then use the GUI to configure and run a Federated Learning simulation.

Framework

FL Simulation Process General Overview

Users can choose to create a new project or load an existing JSON configuration to define system parameters, such as dataset properties, client selection criteria, and training mechanisms. For example, the Heterogeneous Data Handler allows synthetic data generation to augment client datasets and address non-IID data distributions. After configuration, the simulation process orchestrates interactions between clients and the server, tracks system metrics such as training, communication, and round times, and outputs a detailed report. This enables users to test design decisions and optimize FL system performance with ease.

AP4FED GUI

Testing Models and Dataset

Dataset

AP4FED supports the following datasets from the torchvision.datasets library:

  • "CIFAR-10"
  • "CIFAR-100"
  • "FMNIST"
  • "FashionMNIST"
  • "KMNIST"
  • "MNIST"

Models

AP4FED supports the following models from the torchvision.models library:

  • AlexNet
    • alexnet
  • ConvNeXt
    • convnext_tiny
    • convnext_small
    • convnext_base
    • convnext_large
  • DenseNet
    • densenet121
    • densenet161
    • densenet169
    • densenet201
  • EfficientNet
    • efficientnet_b0
    • efficientnet_b1
    • efficientnet_b2
    • efficientnet_b3
    • efficientnet_b4
    • efficientnet_b5
    • efficientnet_b6
    • efficientnet_b7
  • EfficientNet V2
    • efficientnet_v2_s
    • efficientnet_v2_m
    • efficientnet_v2_l
  • GoogLeNet / Inception
    • googlenet
    • inception_v3
  • MnasNet
    • mnasnet0_5
    • mnasnet0_75
    • mnasnet1_0
    • mnasnet1_3
  • MobileNet
    • mobilenet_v2
    • mobilenet_v3_large
    • mobilenet_v3_small
  • RegNet X
    • regnet_x_400mf
    • regnet_x_800mf
    • regnet_x_1_6gf
    • regnet_x_3_2gf
    • regnet_x_8gf
    • regnet_x_16gf
    • regnet_x_32gf
  • RegNet Y
    • regnet_y_400mf
    • regnet_y_800mf
    • regnet_y_1_6gf
    • regnet_y_3_2gf
    • regnet_y_8gf
    • regnet_y_16gf
    • regnet_y_32gf
  • ResNet
    • resnet18
    • resnet34
    • resnet50
    • resnet101
    • resnet152
  • ResNeXt
    • resnext50_32x4d
  • ShuffleNet
    • shufflenet_v2_x0_5
    • shufflenet_v2_x1_0
  • SqueezeNet
    • squeezenet1_0
    • squeezenet1_1
  • VGG
    • vgg11
    • vgg11_bn
    • vgg13
    • vgg13_bn
    • vgg16
    • vgg16_bn
    • vgg19
    • vgg19_bn
  • Wide ResNet
    • wide_resnet50_2
    • wide_resnet101_2
  • Swin Transformer
    • swin_t
    • swin_s
    • swin_b
  • Vision Transformer (ViT)
    • vit_b_16
    • vit_b_32
    • vit_l_16
    • vit_l_32

In addition, AP4FED includes three simple Convolutional Neural Networks for testing:

ParameterModel CNN 16kModel CNN 64kModel CNN 256k
Conv. 13 filters, 5x5 kernel6 filters, 5x5 kernel12 filters, 5x5 kernel
PoolMax pooling, 2x2 kernelMax pooling, 2x2 kernelMax pooling, 2x2 kernel
Conv. 28 filters, 5x5 kernel16 filters, 5x5 kernel32 filters, 5x5 kernel
FC 160 units120 units240 units
FC 242 units84 units168 units
FC 310 units20 units30 units
Batch Size323232
Learning Rate0.0010.0010.001
OptimizerSGDSGDSGD

Architectural Patterns

AP4FED implements the following architectural patterns:

Architectural PatternPattern CategoryDescription
Client RegistryClient ManagementA registry to store relevant information of each client device participating in Federated Learning rounds.
Client SelectorClient ManagementA mechanism to dynamically select clients based on specific criteria, such as data distribution, device capabilities, or network conditions, to optimize the federated learning process.
Client ClusterClient ManagementA strategy to group clients into clusters based on shared characteristics, such as data similarity or device attributes, improving model accuracy and convergence in non-IID data scenarios.
Message CompressorModel ManagementA component designed to reduce the size of data exchanged between clients and the server by compressing messages, which lowers communication latency and bandwidth usage in federated learning environments.
Model Co-Versioning RegistryModel ManagementA component designed to store intermediate .pt model versions alongside global models, facilitating detailed tracking of model evolution and ensuring accountability in federated learning environments.
Multi-Task Model TrainerModel TrainingAllows training different global models simultaneously.
Heterogeneous Data HandlerModel TrainingEnables pre-processing operations to enhance the quality of datasets for each client participating in the FL process.

The Client Registry architectural pattern is implemented by adding the following parameters:

AttributeData TypeDescription
cIDstringClient’s Unique Identifier
cluster_TypestringCluster associated to each Client
n_CPUintNumber of Client’s CPU
training_timefloatClient’s Training Time
communication_timefloatClient’s Communication Time
total_round_timefloatClient’s Total Round Time

The open-science artifact for the ICSA 2025 study [1] is available on Zenodo:

DOI

The open-science artifact for the Journal of Systems and Software study on multiple architectural pattern configurations [2] is available on Zenodo:

DOI

The open-science artifact for the Journal of Systems and Software study on agentic runtime reconfiguration [3] is available on Zenodo:

DOI

References

[1] Compagnucci, I., Pinciroli, R., & Trubiani, C. (2025). Performance Analysis of Architectural Patterns for Federated Learning Systems. 22nd IEEE International Conference on Software Architecture (ICSA 2025).

This paper introduces the first version of AP4FED and evaluates individual architectural patterns for Federated Learning systems.

@inproceedings{CompagnucciFL,
author = {Compagnucci, Ivan and Pinciroli, Riccardo and Trubiani, Catia},
title = {{Performance Analysis of Architectural Patterns for Federated Learning Systems}},
booktitle = {International Conference on Software Architecture, {ICSA 25}},
pages = {289--300},
publisher = {{IEEE}},
year = {2025},
doi = {10.1109/ICSA65012.2025.00036},
url = {https://doi.org/10.1109/ICSA65012.2025.00036}
}

[2] Compagnucci, I., Pinciroli, R., & Trubiani, C. (2026). Experimenting Architectural Patterns in Federated Learning Systems. Journal of Systems and Software, 232, 112655.

This paper extends the experimental evaluation of AP4FED to combinations of architectural patterns and analyzes their impact on FL performance metrics.

@article{COMPAGNUCCI2026112655,
author = {Ivan Compagnucci and Riccardo Pinciroli and Catia Trubiani},
title = {Experimenting Architectural Patterns in Federated Learning Systems},
journal = {Journal of Systems and Software},
volume = {232},
pages = {112655},
year = {2026},
issn = {0164-1212},
doi = {10.1016/j.jss.2025.112655},
url = {https://www.sciencedirect.com/science/article/pii/S0164121225003243}
}

[3] Compagnucci, I., Lu, Q., & Trubiani, C. (2026). Agentic Runtime Reconfiguration of Architectural Patterns in Federated Learning. Journal of Systems and Software, 240, 112966.

This paper introduces AI-agent-based runtime reconfiguration for AP4FED, including single-agent and multi-agent strategies for adapting architectural patterns during FL execution.

@article{COMPAGNUCCI2026112966,
author = {Ivan Compagnucci and Qinghua Lu and Catia Trubiani},
title = {Agentic Runtime Reconfiguration of Architectural Patterns in Federated Learning},
journal = {Journal of Systems and Software},
volume = {240},
pages = {112966},
year = {2026},
issn = {0164-1212},
doi = {10.1016/j.jss.2026.112966},
url = {https://www.sciencedirect.com/science/article/pii/S0164121226001998}
}

About

AP4Fed is a Federated Learning platform built on top of Flower, an open-source Python library designed to simplify the development of Federated Learning systems. AP4Fed enhances this foundation with architectural patterns and advanced adaptation and monitoring capabilities, enabling performance evaluation.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages