@mohammad/fed-poison-lab
flwr new @mohammad/fed-poison-labFederated Poisoning Lab with Flower (Quickstart Example)
This quickstart-style Flower example simulates one poisoned client sending malicious model updates (sign-flip attack) and compares three aggregation strategies: FedAvg (baseline), FedTrimmedAvg, and Krum. The model/data are intentionally tiny.
Set up the project
Fetch the app
Install Flower:
pip install flwr
Fetch the app:
flwr new @flwrlabs/fed-poison-lab
This creates a new directory called fed-poison-lab with the following structure:
fed-poison-lab ├── fed_poison_lab │ ├── __init__.py │ ├── client_app.py # Defines ClientApp │ ├── server_app.py # Defines ServerApp │ └── task.py # Defines synthetic data/model utilities ├── pyproject.toml # Project metadata like dependencies and configs └── README.md
Install dependencies and project
cd fed-poison-lab pip install -e .
Run the project
You can run this app in both simulation and deployment mode without changing code. If you are new to Flower, start with simulation mode. By default, flwr run uses the Simulation Engine.
Run with the Simulation Engine
Default run (FedAvg + poisoning):
flwr run .
Same run with logs streamed:
flwr run . --stream
You can override config values defined in pyproject.toml. For example:
flwr run . --run-config "strategy='fedtrimmedavg'" flwr run . --run-config "strategy='krum'" flwr run . --run-config "poison-strength=0.0" flwr run . --run-config "poison-from-round=4"
Run with the Deployment Engine
Follow this how-to guide to run the same app using Flower's Deployment Engine. After that, you might be interested in secure TLS-enabled communications and SuperNode authentication.