Skip to content

Conversation

@francordel
Copy link

Issue

Closes #6043.


Description

Flower currently lacks a robust aggregation strategy to defend against poisoning attacks in Federated Learning.
When malicious clients send corrupted model updates, the standard FedAvg aggregation can be heavily compromised, leading to a significant degradation in global model performance.


Related issues/PRs

  • Enables the new baseline proposed in #6039.

Proposal

Implement FedRDF (Robust and Dynamic Aggregation Function) — a strategy that defends against poisoning attacks through adaptive, frequency-domain aggregation.

Explanation

FedRDF introduces the following improvements:

  1. Adaptive aggregation: Detects poisoning using the Kolmogorov–Smirnov test for skewness in client updates.
  2. FFT-based robust aggregation: When anomalies are detected, transforms client updates to the frequency domain using the Discrete Fourier Transform (DFT), selects dominant components, and filters outliers before reconstructing the update via inverse FFT.
  3. Configurable threshold: The threshold parameter controls the robustness–efficiency trade-off.
    • threshold ≤ 0: Always uses FFT-based robust aggregation.
    • threshold > 0: Switches adaptively based on detected skewness.
  4. Layer-wise processing: Performs robust aggregation on each model layer individually for fine-grained resilience.

Implementation Details

  • Inherits from FedAvg.
  • Overrides aggregate_fit() to perform adaptive, DFT-based aggregation.
  • Adds threshold parameter for dynamic switching.
  • Fully compatible with Flower’s existing strategy API.

Testing

  • 10 unit tests implemented and passing.
  • Validated against a 30% poisoning attack scenario.
  • Result: FedRDF maintained a distance to benign clients of 0.012, compared to 29.971 for FedAvg (≈2500× more robust).

Reference

E. Mármol Campos, A. González-Vidal, J. L. Hernández-Ramos, and A. Skarmeta,
"FedRDF: A Robust and Dynamic Aggregation Function Against Poisoning Attacks in Federated Learning",
IEEE Transactions on Emerging Topics in Computing, vol. 13, no. 1, pp. 48–67, 2025.
DOI: 10.1109/TETC.2024.3474484


Checklist

  • Implement proposed change.
  • Write tests (10 unit tests, all passing).
  • Update documentation.
  • Make CI checks pass.
  • Ping maintainers on Slack (channel #contributions).

Any other comments?

Files changed:

  • framework/py/flwr/server/strategy/fedrdf.py (371 lines) — strategy implementation.
  • framework/py/flwr/server/strategy/fedrdf_test.py (228 lines) — test suite.
  • framework/py/flwr/server/strategy/__init__.py (2 lines) — added FedRDF export.

@jafermarq
Copy link
Member

Hey @francordel , thanks for opening the PR! We recently migrated all strategies to https://github.com/adap/flower/tree/main/framework/py/flwr/serverapp/strategy and make use of the Message abstraction instead of FitIns/Res etc. Could you update the strategy in that way? Also, because scipy is not a package that comes with Flower, we'll need to put the import in a try/except. Or is there a way to use ks_2samp without introducing a new dependency?

@github-actions github-actions bot added the Contributor Used to determine what PRs (mainly) come from external contributors. label Oct 22, 2025
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.

Add support for dynamic robust aggregation using spectral similarity (FedRDF)

2 participants