These colab-based tutorials walk you through the main TFF concepts and APIs using practical examples. Reference documentation can be found in the TFF guides.
Getting started with federated learning
-
Federated Learning for image classification introduces the key parts of the Federated Learning (FL) API, and demonstrates how to use TFF to simulate federated learning on federated MNIST-like data.
-
Federated Learning for text generation further demonstrates how to use TFF's FL API to refine a serialized pre-trained model for a language modeling task.
-
Tuning recommended aggregations for learning shows how the basic FL computations in
tff.learningcan be combined with specialized aggregation routines offering robustness, differential privacy, compression, and more.
Getting started writing custom federated computations
- Building Your Own Federated Learning Algorithm shows how to use the TFF Core APIs to implement federated learning algorithms, using Federated Averaging as an example.
Simulation best practices
-
High-performance simulations with TFF describes how to setup and configure the high performance TFF runtime.
-
TFF simulation with accelerators (GPU) shows how TFF's high-performance runtime can be used with GPUs.
-
Working with ClientData gives best practices for integrating TFF's ClientData-based simulation datasets into TFF computations.
Intermediate and advanced tutorials
-
Implementing Custom Aggregations explains the design principles behind the
tff.aggregatorsmodule and best practices for implementing custom aggregation of values from clients to server. -
Random noise generation points out some subtlities with using randomness in decentralized computations, and proposes best practices and recommend patterns.
-
Sending Different Data To Particular Clients With tff.federated_select introduces the
tff.federated_selectoperator and gives a simple example of a custom federated algorithm that sends different data to different clients. -
Client-efficient large-model federated learning via federated_select and sparse aggregation shows how TFF can be used to train a very large model where each client device only downloads and updates a small part of the model, using
tff.federated_selectand sparse aggregation. -
TFF for Federated Learning Research: Model and Update Compression demonstrates how custom aggregations building on the tensor_encoding API can be used in TFF.
-
Custom Federated Algorithms, Part 1: Introduction to the Federated Core and Part 2: Implementing Federated Averaging introduce the key concepts and interfaces offered by the Federated Core API (FC API).
-
Experimental support for JAX in TFF shows how JAX computations can be used in TFF, demonstrating how TFF is designed to be able to interoperate with other frontend and backend ML frameworks.