Skip to main content
QUICK REVIEW

[Paper Review] FedJAX: Federated learning simulation with JAX

Jae Hun Ro, Ananda Theertha Suresh|arXiv (Cornell University)|Aug 4, 2021
Privacy-Preserving Technologies in DataComputer Science30 references20 citations
TL;DR

FedJAX is a JAX-based open-source library for federated learning simulations that simplifies research by providing intuitive primitives, prepackaged datasets, models, and algorithms. It enables training on EMNIST in under five minutes and on Stack Overflow in under an hour using TPUs, leveraging JAX's high-performance XLA compilation and automatic differentiation for rapid prototyping and evaluation.

ABSTRACT

Federated learning is a machine learning technique that enables training across decentralized data. Recently, federated learning has become an active area of research due to an increased focus on privacy and security. In light of this, a variety of open source federated learning libraries have been developed and released. We introduce FedJAX, a JAX-based open source library for federated learning simulations that emphasizes ease-of-use in research. With its simple primitives for implementing federated learning algorithms, prepackaged datasets, models and algorithms, and fast simulation speed, FedJAX aims to make developing and evaluating federated algorithms faster and easier for researchers. Our benchmark results show that FedJAX can be used to train models with federated averaging on the EMNIST dataset in a few minutes and the Stack Overflow dataset in roughly an hour with standard hyperparameters using TPUs.

Motivation & Objective

  • To address the growing need for efficient, easy-to-use tools to prototype and evaluate federated learning algorithms in research.
  • To reduce the complexity of implementing federated learning by abstracting away low-level communication and aggregation logic.
  • To enable high-performance simulation using JAX's XLA compilation and automatic differentiation on accelerators like TPUs and GPUs.
  • To provide out-of-the-box support for standard federated learning benchmarks, including EMNIST and Stack Overflow.
  • To accelerate research iteration by minimizing boilerplate code and enabling rapid experimentation with federated averaging and other common algorithms.

Proposed method

  • Uses JAX's functional programming paradigm and automatic differentiation to define model updates and optimization steps in a composable, high-performance way.
  • Provides a `for_each_client` primitive that applies local training steps across selected clients in a single, vectorized operation.
  • Employs weighted averaging for server model updates, with client-specific contributions scaled by local data size.
  • Leverages JAX's `jit` and `pmap` for compilation and parallelization across multiple TPU cores, significantly improving training speed.
  • Integrates with standard federated datasets such as EMNIST-62 and Stack Overflow, abstracting client-level data access and shuffling.
  • Offers modular components for server aggregation, client training, and model initialization, enabling plug-and-play implementation of new algorithms.

Experimental results

Research questions

  • RQ1How can federated learning simulation be made more accessible and faster for researchers without requiring deep systems expertise?
  • RQ2What performance gains can be achieved using JAX-based simulation with XLA compilation and hardware acceleration on TPUs and GPUs?
  • RQ3How efficiently can standard federated learning algorithms like FedAvg be implemented and benchmarked using a functional, composable API?
  • RQ4To what extent does FedJAX reduce the code complexity required to implement and evaluate federated learning algorithms compared to existing libraries?
  • RQ5Can FedJAX achieve sub-hour training times for large-scale federated benchmarks like Stack Overflow using standard hyperparameters?

Key findings

  • FedJAX achieves training of a convolutional neural network on the EMNIST-62 dataset using federated averaging in under five minutes on a single TPU core.
  • On the Stack Overflow dataset, training a single-layer LSTM with federated averaging completes in under an hour using eight TPU cores.
  • The use of JAX's `pmap` for multi-core TPU training reduces average training round duration from 3.73 seconds (single TPU core) to 1.26 seconds (eight cores).
  • The library maintains high model accuracy, achieving 85.85% test accuracy on EMNIST and 24.67% on Stack Overflow, comparable to prior work.
  • Benchmark results show that FedJAX enables full training and evaluation pipelines to be executed in under 50 minutes on a multi-core TPU for the Stack Overflow task.
  • The library's design allows researchers to implement federated averaging with minimal code—under 20 lines of JAX code for the core training loop—demonstrating high usability.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.