Skip to content

feat(baselines) Add GHBM implementation#7002

Open
RickZack wants to merge 30 commits intoflwrlabs:mainfrom
RickZack:main
Open

feat(baselines) Add GHBM implementation#7002
RickZack wants to merge 30 commits intoflwrlabs:mainfrom
RickZack:main

Conversation

@RickZack
Copy link
Copy Markdown

Issue

Description

Related issues/PRs

Proposal

This PR implements a Flower Baseline for the FL algorithms proposed in Zaccone et al., Communication-Efficient Federated Learning with Generalized Heavy-Ball Momentum

Explanation

The code implements GHBM, LocalGHBM and FedHBM as proposed in the official paper. The supported datasets are CIFAR-10/100 from Flower datasets, and a couple of CNNs (Lenet5-like and a ResNet-20), with the standard Dirichlet splitting and also the extreme non-iid splitting used in the paper (corresponding to setting the alpha=0).

Some bash scripts are included to run the simulation for the new algorithms and a couple of baselines, FedCM and FedAvg, for the extreme non-iid setting on ResNet-20. The corresponding plots are reported in the README.md, reproducing the results proposed in Fig. 2 (middle) of the paper.

Checklist

Any other comments?

Copilot AI review requested due to automatic review settings April 11, 2026 11:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Flower Baseline implementing the GHBM-family FL algorithms (GHBM, LocalGHBM, FedHBM) and provides scripts/documentation to reproduce CIFAR-10/100 non-IID experiments and comparisons.

Changes:

  • Introduces a new ghbm Flower app (ServerApp/ClientApp), model/dataset utilities, and custom strategies for GHBM momentum handling.
  • Adds experiment launch scripts for CIFAR-10 extreme non-IID (alpha=0) across multiple algorithms.
  • Adds baseline-specific pyproject.toml and a detailed README.md describing setup and reproduction steps.

Reviewed changes

Copilot reviewed 17 out of 20 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
baselines/ghbm/scripts/run_cifar10_noniid_localghbm.sh Adds LocalGHBM CIFAR-10 extreme non-IID launcher configuration
baselines/ghbm/scripts/run_cifar10_noniid_ghbm.sh Adds GHBM CIFAR-10 extreme non-IID launcher configuration
baselines/ghbm/scripts/run_cifar10_noniid_fedhbm.sh Adds FedHBM CIFAR-10 extreme non-IID launcher configuration
baselines/ghbm/scripts/run_cifar10_noniid_fedcm.sh Adds FedCM reproduction launcher using GHBM with tau=1
baselines/ghbm/scripts/run_cifar10_noniid_fedavg.sh Adds FedAvg launcher configuration for comparison
baselines/ghbm/pyproject.toml Defines baseline packaging, dependencies, and Flower app configuration defaults
baselines/ghbm/ghbm/utils.py Adds shared type aliases and a state-dict cloning helper
baselines/ghbm/ghbm/trainer.py Adds local train/test loops plus gradient modifiers for momentum corrections
baselines/ghbm/ghbm/strategy.py Adds evaluation scheduling/logging strategy and GHBM server-momentum strategy
baselines/ghbm/ghbm/server_app.py Adds ServerApp entry point, W&B logging, evaluation summaries, and checkpoint saving
baselines/ghbm/ghbm/model.py Adds LeNet and CIFAR ResNet(-20 etc.) implementations and a model factory
baselines/ghbm/ghbm/dataset.py Adds CIFAR partitioning (Dirichlet and shard-based alpha=0), transforms, and loaders
baselines/ghbm/ghbm/config.py Adds enums and parsing helpers for run-config values
baselines/ghbm/ghbm/client_app.py Adds ClientApp train/evaluate handlers and algorithm-specific modifier preparation
baselines/ghbm/ghbm/algorithm.py Adds client-side algorithm state handling for GHBM/LocalGHBM/FedHBM
baselines/ghbm/ghbm/init.py Adds baseline package marker docstring
baselines/ghbm/README.md Adds baseline documentation and reproduction instructions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread baselines/ghbm/ghbm/trainer.py Outdated
Comment thread baselines/ghbm/ghbm/client_app.py Outdated
Comment thread baselines/ghbm/ghbm/server_app.py
Comment thread baselines/ghbm/README.md Outdated
Comment thread baselines/ghbm/README.md Outdated
Comment thread baselines/ghbm/pyproject.toml Outdated
Comment thread baselines/ghbm/ghbm/strategy.py Outdated
Comment thread baselines/ghbm/ghbm/client_app.py Outdated
Comment thread baselines/ghbm/ghbm/server_app.py
Comment thread baselines/ghbm/ghbm/__init__.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba2023c245

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread baselines/ghbm/ghbm/config.py
Comment thread baselines/ghbm/ghbm/dataset.py
RickZack and others added 2 commits April 11, 2026 13:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4badd74f14

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread baselines/ghbm/ghbm/trainer.py
@github-actions github-actions bot added the Contributor Used to determine what PRs (mainly) come from external contributors. label Apr 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 20 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread baselines/ghbm/README.md
Comment thread baselines/ghbm/ghbm/server_app.py Outdated
Comment thread baselines/ghbm/ghbm/strategy.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f6e7a5de6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread baselines/ghbm/ghbm/dataset.py Outdated
Comment thread baselines/ghbm/ghbm/dataset.py
RickZack and others added 2 commits April 11, 2026 15:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cde6820ba4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread baselines/ghbm/ghbm/trainer.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 20 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread baselines/ghbm/ghbm/trainer.py
Comment thread baselines/ghbm/ghbm/trainer.py
Comment thread baselines/ghbm/ghbm/trainer.py
Comment thread baselines/ghbm/README.md Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fdf2c12358

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread baselines/ghbm/ghbm/trainer.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 20 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread baselines/ghbm/ghbm/server_app.py Outdated
Comment thread baselines/ghbm/ghbm/model.py Outdated
Comment thread baselines/ghbm/ghbm/client_app.py Outdated
Comment thread baselines/ghbm/ghbm/client_app.py Outdated
@RickZack RickZack requested a review from panh99 as a code owner April 11, 2026 17:39
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e93b8fd7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread baselines/ghbm/ghbm/trainer.py
Updated loss calculation to use dataset size instead of batch size for more accurate validation results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contributor Used to determine what PRs (mainly) come from external contributors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants