Skip to main content

RigFL

RigFL is a modular framework for rigorous federated learning experimentation. Algorithm-specific behavior is isolated behind a common interface, so that algorithms use the same orchestration, evaluation, configuration, and reporting machinery.

Key Features

  • Stable experiment and partition identity. RigFL derives two separate fingerprints: one identifying a result from its distinct experiment configuration, the other identifying a partitioned dataset from its data configuration. A change to either produces a new identity, so earlier generated results and partitions are never overwritten. An experiment whose result already exists is not rerun—expanding or changing a sweep will only execute new combinations.

  • Support for model-heterogeneous algorithms. RigFL supports algorithms designed for clients with different model architectures. The architecture selection can be configured as a named family or an explicit ordered list.

  • Joint hyperparameter tuning across multiple seeds. Support for evaluating combinations of hyperparameters across several random seeds.

  • Client-centered performance reporting. Evaluation metrics that reveal whether the benefits of collaboration are broadly shared across clients, exposing disparities and uneven benefits that commonly reported averages obscure. See Client-centered metrics.

  • Traceable result files. Each completed experiment produces a result file containing its full evaluation history, resolved configuration, Git commit and uncommitted-change status, software versions, and client data-partition information.

  • Documented fidelity to the source papers. Algorithms follow their published specifications; where a paper leaves a detail unspecified or its released code diverges from the text, the resolution is recorded in DEVIATIONS.md.

  • Optional W&B tracking. Weights & Biases can be enabled to log experiment settings and validation performance during training.

Installation

pip install rigfl

RigFL requires Python 3.10–3.12.

Example workflow

The following CIFAR-10 example walks you through generating client data partitions, running an experiment, and reporting the results.

Generate client data partitions

First define the data source and data partitioning configuration in configs/datasets.yaml:

datasets:
  cifar10:
    backend: flower
    source_dataset: uoft-cs/cifar10
    partition:
      scheme: dirichlet
      num_clients: 3
      alpha: 0.5

Generate client datasets by running:

python -m rigfl.data.generate --dataset cifar10

RigFL passes the settings to Flower, derives a stable fingerprint from the data partitioning configuration, and saves the generated files under:

data/cifar10/partition_<fingerprint>/
├── manifest.json
└── clients/
    ├── client_0/
    │   ├── train.pt
    │   ├── validation.pt
    │   └── test.pt
    └── ...

Running the command again with the same data configuration reuses the existing partition. Changing a partitioning entry produces a different fingerprint and a separate directory instead of replacing the previous partition.

To add another dataset, create another entry in configs/datasets.yaml. See the data configuration guide for the available settings and guidance for datasets with multiple configurations, nonstandard splits, or ambiguous input and target columns.

Define and run the experiment

YAML files define experiment configurations: experiments/cifar10_run.yaml:

experiment:
  dataset: cifar10
  model_architectures: [fedavg_cnn]
  rounds: 2
  seed: 0
  shared_dim: 128
  eval_gap: 1
  device: cpu
  out_dir: results/cifar10_run

algorithm:
  local_epochs: 1
  lr: 0.01

The YAML has two sections. Entries under experiment define the overarching configuration for the execution of RigFL’s shared workflow. Entries under algorithm specify how individual algorithms operate. An algorithm entry may be supported by one or several algorithms. In a multi-algorithm sweep, each entry is applied only to algorithms that support it.

Run the experiment with:

python -m rigfl.experiment.run \
  --algorithm fedavg \
  --config experiments/cifar10_run.yaml

This trains FedAvg for two communication rounds and writes results to results/cifar10_run.

Report results

Summarize the results with:

python -m rigfl.experiment.collect \
  --results-dir results/cifar10_run

Client-centered metrics

Aggregate performance metrics can signal that collaborative learning improves upon local training on average, even though collaboration worsens performance at some individual clients. RigFL provides evaluation metrics that surface unevenly distributed benefits.

  • Win rate: the fraction of matched client-and-seed pairs in which an algorithm results in improved performance over the Local baseline.

  • Performance among the worst-served clients: reports the average performance of the lowest-scoring 10% of clients and the 10th-percentile score, which marks the lower tail of the client-performance distribution.

  • Standard deviation: the spread in performance across clients.

Algorithms

Implemented algorithms:

Local training and Global Ensemble are available as reference baselines.

Algorithm-specific departures from the original papers are documented in DEVIATIONS.md.

Sweeps and tuning

experiments/cifar10_tune.yaml provides a multi-algorithm, multi-seed tuning example. A sweep expands the values defined along each axis. Algorithm entries are applied only to algorithms that support them, so options belonging to different algorithms are not unnecessarily cross-multiplied.

Expand the sweep and print its cluster submission command with:

python -m rigfl.experiment.launch \
  --config experiments/cifar10_tune.yaml \
  --queue <queue>

Each complete hyperparameter combination is treated as one candidate, with its seeds aggregated as replicates. Rank the completed candidates and write runnable selected configurations with:

python -m rigfl.experiment.collect \
  --results-dir results/cifar10_tune \
  --selection-metric accuracy \
  --selection-view both \
  --rank \
  --select-out results/cifar10_tune_selected

Adding an algorithm

Extend RigFL by adding a module under rigfl/algorithms/ containing:

  • A configuration class that inherits from AlgorithmConfig.
  • An algorithm class that inherits from Algorithm.

The algorithm class must define four operations:

  1. init_globals() initializes the shared state, which represents the information the server maintains and distributes to clients at the start of each round. The shared state may take the form of a global model, model parameters, prototypes, a classifier head, or another algorithm-specific structure.
  2. local_train(...) is called once per client per round. It receives the client and shared state, performs the client-side computation, and returns the client's upload, which represents the information the client sends to the server. The upload may have the same form as the shared state, be a different structure entirely, or carry additional information required for server-side computation.
  3. aggregate(...) receives all client uploads, performs the server-side computation, and returns the shared state for the next round. This may involve averaging parameters, combining prototypes, or training a server-side component.
  4. predict(...) performs inference for the supplied inputs and returns a Predictions object.

Declare all of the relevant arguments for the algorithm in its configuration class.

from rigfl.core import Algorithm, Predictions
from rigfl.core.config import AlgorithmConfig


class NewAlgorithmConfig(AlgorithmConfig):
    local_epochs: int = 1
    lr: float = 0.01
    # ...additional arguments


class NewAlgorithm(Algorithm):
    def init_globals(self):
        ...

    def local_train(self, client, shared_state):
        ...

    def aggregate(self, client_uploads, shared_state):
        ...

    def predict(self, client, x, shared_state) -> Predictions:
        ...

In local_train(...) and predict(...), client refers to the Client instance being processed. The client's local model and training data loader are accessed through client.model and client.train_loader, respectively. client.state is a dictionary that can carry any additional client-specific information that must persist across rounds.

Access the arguments defined in the algorithm’s configuration class through self.config, such as self.config.lr.

Register both classes in rigfl/experiment/registry.py:

REGISTRY = {
    "local": AlgorithmSpec(Local, LocalConfig),
    "fedavg": AlgorithmSpec(FedAvg, FedAvgConfig),
    # ...other algorithms
    "new_algorithm": AlgorithmSpec(NewAlgorithm, NewAlgorithmConfig),
}

Runner note: AlgorithmSpec uses the iterative runner by default. If an algorithm genuinely cannot be expressed as repeated local training followed by aggregation, define a different runner and matching operation protocol instead of changing the meaning of the standard operations. FedDES is one such exception and uses p2p_one_shot.

Experiment tracking with Weights & Biases

Install the optional W&B dependency with:

pip install "rigfl[wandb]"

Enable tracking by setting wandb: true under experiment in the YAML configuration file, or pass --wandb when running experiments from the command line.

Development and testing

Clone the repository and install RigFL in editable mode with its testing dependency, then run the test suite:

git clone https://github.com/briannamueller/RigFL.git
cd RigFL
python -m venv .venv
source .venv/bin/activate
pip install -e ".[test]"
pytest -q

License

MIT. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rigfl-0.1.0.tar.gz (164.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rigfl-0.1.0-py3-none-any.whl (119.7 kB view details)

Uploaded Python 3

File details

Details for the file rigfl-0.1.0.tar.gz.

File metadata

  • Download URL: rigfl-0.1.0.tar.gz
  • Upload date:
  • Size: 164.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rigfl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c5e04a8be108b6ee74df914eb6c114bdd98a3a114145f081a978f6a0cc9ae454
MD5 b2932d5e945acc0b7524c2e28eaac941
BLAKE2b-256 1f35d98dfad09f78e829fb0d858adf63872d305a185ba94ee1e9c80eb3a23cde

See more details on using hashes here.

Provenance

The following attestation bundles were made for rigfl-0.1.0.tar.gz:

Publisher: publish.yml on briannamueller/RigFL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rigfl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rigfl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 119.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rigfl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78436ae5198ed5b23ba7c4931f84d0062269f2f41ba16593f7a4f5e4ec64a0cd
MD5 7728995a97c661a826fc7c52f4a51cfa
BLAKE2b-256 1bd284846b3ef1d96810ec2d62c51e01211c68b5a55ba504adfcbddae1890ff7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rigfl-0.1.0-py3-none-any.whl:

Publisher: publish.yml on briannamueller/RigFL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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