Flower A Friendly Federated Learning Framework

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

to learn federated learning

Flower Monthly: Oct 4th 1700 GMT

Users love Flower

In just a few lines of code I was able to federate my Machine Learning project.

Author image

Sandra Carrasco Limeros, Deep Learning Researcher at AI Sweden

The flexibility of Flower is precisely what we need to develop production-ready solutions for our customers.

Author image

Jan Schlicht, Lead Engineer at Katulu

Scaling FL experiments to 1,000 or even 10,000 clients can be very challenging. Flower takes care of all the scaling complexities and allows researchers like me to focus on writing client and server-side algorithms.

Author image

Akhil Mathur, Principal Research Scientist at Nokia Bell Labs

I love working with Flower because it is so easy to use and very compatible with, e.g., PyTorch, NumPy, and Weights & Biases.

Author image

Xinchi Qiu, PhD Student at the University of Cambridge

Flower was a natural choice for us [...]: it is agnostic to any particular ML framework, [...]; in addition, it allows both to run simulations on a single machine and to develop real FL systems ready to be deployed, almost using the same code.

Author image

Paolo Bellavista, Professor at the University of Bologna

My Students are free to choose their FL Framework, but Flower has proven itself because it’s difficult to get wrong!

Author image

Afra Mashhadi, Assistant Professor at the University of Washington

Flower was much much easier to implement. We were wishing we had started with Flower to begin with!

Author image

Jason Mixon, PhD Student and Instructor at Dakota State University

Federated learning has always been a concept that has been daunting to me. It only took me 3 hours to understand it with Flower, using the great documentation and tutorials.

Author image

James Faure, Student Researcher at Stellenbosch University

Some of the best organizations in the world use Flower

University of Cambridge logo
Brave Software logo
Harvard University logo
Orange logo
Massachusetts Institute of Technology logo
Samsung AI logo
Technical University of Munich logo
Siemens Healthineers logo
University of Oxford logo
Accenture logo

Federate easily

Getting started with Flower can be so easy. Code examples show different usage scenarios of Flower in combination with popular machine learning frameworks.

0. Install Flower and TensorFlow

pip install flwr tensorflow

1. client.py

import flwr as fl
import tensorflow as tf

# Load model and data (MobileNetV2, CIFAR-10)
model = tf.keras.applications.MobileNetV2((32, 32, 3), classes=10, weights=None)
model.compile("adam", "sparse_categorical_crossentropy", metrics=["accuracy"])
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar10.load_data()

# Define Flower client
class CifarClient(fl.client.NumPyClient):
  def get_parameters(self, config):
    return model.get_weights()

  def fit(self, parameters, config):
    model.fit(x_train, y_train, epochs=1, batch_size=32)
    return model.get_weights(), len(x_train), {}

  def evaluate(self, parameters, config):
    loss, accuracy = model.evaluate(x_test, y_test)
    return loss, len(x_test), {"accuracy": accuracy}

# Start Flower client
fl.client.start_numpy_client(server_address="", client=CifarClient())

2. server.py

import flwr as fl

# Start Flower server

Federated Learning Tutorials

This series of tutorials introduces the fundamentals of Federated Learning and how to implement it with Flower.


What is Federated Learning?

What is Federated Learning?

  • Classic Machine Learning
  • Challenges of classical Machine Learning
  • Federated Learning
  • Federated Evaluation
  • Federated Analytics
  • Differential Privacy
Start now


Get started with Flower

Get started with Flower

  • Preparation
  • Step 01: Centralized Training with PyTorch
  • Step 02: Federated Learning with Flower
Start now
Code editor with Flower code

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.

PyTorch, TensorFlow, 🤗, ...?

Do you use PyTorch, TensorFlow, scikit-learn, MXNet, or Hugging Face? Then simply follow our quickstart examples that help you to federate your existing ML projects.

_Why Flower?

A unified approach to federated learning, analytics, and evaluation.


Flower was built to enable real-world systems with a large number of clients. Researchers used Flower to run workloads with tens of millions of clients.

ML Framework Agnostic

Flower is compatible with most existing and future machine learning frameworks. You love Keras? Great. You prefer PyTorch? Awesome. Raw NumPy, no automatic differentiation? You rock!

Cloud, Mobile, Edge & Beyond

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

Research to Production

Flower enables ideas to start as research projects and then gradually move towards production deployment with low engineering effort and proven infrastructure.

Platform Independent

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


It's easy to get started. 20 lines of Python is enough to build a full federated learning system. Check the code examples to get started with your favorite framework.

Join ourCommunity!

Join us on our journey to make federated approaches available to everyone.

Flower Logo