Skip to content

refactor(baselines): Updated Floco baseline to Flower 1.26.0#6657

Open
birnbaum wants to merge 4 commits intoflwrlabs:mainfrom
birnbaum:main
Open

refactor(baselines): Updated Floco baseline to Flower 1.26.0#6657
birnbaum wants to merge 4 commits intoflwrlabs:mainfrom
birnbaum:main

Conversation

@birnbaum
Copy link
Contributor

@birnbaum birnbaum commented Mar 2, 2026

Issue

Description

The Floco baseline was still based on Flower 1.18.0 and e.g. not using the new Message API.

Related issues/PRs

#4941

Proposal

Explanation

This PR updates the Floco baseline to Flower 1.26.0 by migrating client/server/strategy code to the current app/message-based API and aligning config/dependencies accordingly.

Main changes:

  • Migrated baseline to the current Flower app stack and refactored model utilities to simplify model creation and state handling for Floco under the new API.
  • Refreshed baseline plots after re-running all experiments (still about 8h on an M1 Mac).
  • Set baselines/floco/run.sh executable
  • Updated documentation: Added Floco to top-level README.md.

Copilot AI review requested due to automatic review settings March 2, 2026 12:00
Copy link
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

This PR updates the Floco baseline to Flower 1.26.0 by migrating the baseline to the current message-/app-based API (ServerApp/ClientApp, Message, RecordDict, ArrayRecord/MetricRecord) and aligning the baseline’s config, scripts, and documentation accordingly.

Changes:

  • Migrated Floco client/server/strategy to the Flower 1.26 app + message-based APIs.
  • Updated baseline dependency/config in pyproject.toml and added an experiment runner script.
  • Refreshed plots/results tooling and surfaced the baseline in the repo’s top-level README.

Reviewed changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
baselines/floco/run.sh Adds a convenience script to run all Floco/FedAvg experiments for both splits.
baselines/floco/pyproject.toml Bumps Flower dependency to >=1.26.0, updates tooling targets, and updates config keys (e.g. fraction-train).
baselines/floco/floco/strategy.py Ports Floco strategy to flwr.serverapp.strategy.FedAvg and message-based training/eval configuration + aggregation.
baselines/floco/floco/server_app.py Refactors to ServerApp entrypoint, centralized eval callback, and result serialization.
baselines/floco/floco/client_app.py Refactors to ClientApp train/evaluate handlers using Message + records; keeps Floco+ personalization via context.state.
baselines/floco/floco/model.py Refactors model creation/state handling and updates simplex classifier implementation for the new API.
baselines/floco/floco/dataset.py Adjusts Context import and typing updates for dataloader helpers.
baselines/floco/floco/plot_results.py Updates results parsing/plotting to match the new JSON output layout and metric keys.
baselines/floco/_static/CIFAR10_Fold.png Updated plot artifact for the Fold split.
baselines/floco/_static/CIFAR10_Dirichlet.png Updated plot artifact for the Dirichlet split.
baselines/floco/README.md Minor formatting tweaks and updated run instructions context.
README.md Adds Floco to the top-level list of Flower baselines.

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

Comment on lines +126 to +127
self._weights = torch.nn.ParameterList(
[_initialize_weight(self.weight) for _ in range(endpoints)]
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

In _SimplexLinear.__init__, _initialize_weight(self.weight) accesses self.weight, but weight is overridden as a property which depends on self._weights (not yet initialized). This will raise an AttributeError during initialization. Consider not overriding weight (override forward instead), or initialize _weights using the underlying Linear parameter via self._parameters["weight"]/a separately stored tensor shape before defining/using the computed weight.

Suggested change
self._weights = torch.nn.ParameterList(
[_initialize_weight(self.weight) for _ in range(endpoints)]
base_weight = self._parameters["weight"]
self._weights = torch.nn.ParameterList(
[_initialize_weight(base_weight) for _ in range(endpoints)]

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot added the Contributor Used to determine what PRs (mainly) come from external contributors. label Mar 2, 2026
@birnbaum
Copy link
Contributor Author

birnbaum commented Mar 2, 2026

Not sure about the two failing checks, the PR title seems to be in the right format and if I run isort locally, it has no complains 🤷🏻‍♂️

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.

2 participants