Flower: A Friendly Federated Learning Framework

A unified approach to federated learning. Federate any workload, any ML framework, and any programming language.

pip install flwr
Flower Logo

Why Flower?


Flower was built to encounter real-world setups with a large number of clients. Researchers used Flower to run workloads with more than 10.000 clients.

ML Frameworks

Flower is compatible with a wide range of existing and future Machine Learning frameworks. You love Keras? Great. You prefer PyTorch? Awesome. Raw NumPy, no automatic differentiation? You rock!

Mobile, Edge & Beyond

Flower enables research on all kinds of servers and devices, including mobile. Android, iOS, Raspberry Pi, Nvidia Jetson, all compatible with Flower.

Proven Infrastructure

Flower provides federated learning infrastructure to ensure low engineering effort which enables you to concentrate on your own ML use case.

Platform Independent

Flower is interoperable with different operating systems and hardware platforms to work well heterogeneous edge device environments.


It's easy to get started. 20 lines of Python is enough to build a full federated learning system in Keras. See Keras Quickstart or PyTorch Quickstart to get started.

Flower Usage Example


import flwr as fl

# Start Flower server for three rounds of federated learning
fl.server.start_server(config={"num_rounds": 3})


import tensorflow as tf
import flwr as fl

# Load and compile Keras model
model = tf.keras.applications.MobileNetV2((32, 32, 3), classes=10, weights=None)
model.compile("adam", "sparse_categorical_crossentropy", metrics=["accuracy"])

# Load CIFAR-10 dataset
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar10.load_data()

# Define Flower client
class CifarClient(fl.client.keras_client.KerasClient):
    def get_weights(self):
        return model.get_weights()

    def fit(self, weights, config):
        model.fit(x_train, y_train, epochs=1, batch_size=32, steps_per_epoch=3)
        return model.get_weights(), len(x_train), len(x_train)

    def evaluate(self, weights, config):
        loss, accuracy = model.evaluate(x_test, y_test)
        return len(x_test), loss, accuracy

# Start Flower client
fl.client.start_keras_client(server_address="[::]:8080", client=CifarClient())

Getting Started

Installation Guide

The Flower documentation has detailed instructions on what you need to install Flower and how you install it. Spoiler alert: you only need pip! Check out our installation guide.

Keras and PyTorch

Do you already use Keras or PyTorch? Then you can simply follow our Keras/PyTorch Quickstart examples that make it easy to federate your existing machine learning workloads.

Who is using it?

Some of the best research institutes in the world use Flower

Logo of University of Oxford
Logo of University of Cambridge
Logo of University of Avignon
Logo of UCL
Flower Logo

Follow us!

Join us on our journey to connect fleet devices and be part of the future of machine learning.