Flower AI Summit 2026·April 15–16·London

@mohammad/he-flower-example

12
6
flwr new @mohammad/he-flower-example

Federated Learning with Homomorphic Encryption and Flower

This Flower app demonstrates a simple homomorphic aggregation workflow using CKKS via TenSEAL (built on Microsoft SEAL). Clients compute synthetic local updates and send either:

  1. Plain updates (mode="plain", default), or
  2. Encrypted updates (mode="he_ckks").

In HE mode, clients encrypt with a public key/context. The server aggregates encrypted updates and decrypts only the aggregate.

Set up the project

Fetch the app

Install Flower:

pip install flwr

Fetch the app:

flwr new @mohammad/he-flower-example

This creates a new directory called he-flower-example with the following structure:

he-flower-example
├── he_flower_example
│   ├── __init__.py
│   ├── client_app.py   # Defines ClientApp
│   ├── server_app.py   # Defines ServerApp
│   └── task.py         # Defines synthetic updates + CKKS helpers
├── pyproject.toml      # Project metadata like dependencies and configs
└── README.md

Install dependencies and project

Install the dependencies defined in pyproject.toml as well as the he_flower_example package:

pip install -e .

Run the project

Run with the Simulation Engine

Run the default (plain) mode:

flwr run .

Run with homomorphic aggregation:

flwr run . --run-config "mode='he_ckks'"

You can also override other settings, for example:

flwr run . --run-config "mode='he_ckks' num-server-rounds=5 learning-rate=0.25"

The final global vector is saved to final_model.npz.

Run with the Deployment Engine

Follow this how-to guide to run the same app with Flower's Deployment Engine.