NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

FAX: Scalable and Differentiable Federated Primitives in JAX

Keith Rush, Zachary Charles, Zachary Garrett · DOI

Introduction

Modern machine learning frameworks like PyTorch and JAX excel at data and model parallelism. However, emerging fields such as Federated Learning, Meta-Learning, and Differential Privacy require a different paradigm. These domains often rely on a "MapReduce" pattern: performing local computations across thousands of partitions (Map) and then aggregating the results (Reduce).

Current approaches often force researchers to choose between specialized, less flexible frameworks or custom loops that scale poorly on large-scale hardware like TPU pods. Furthermore, calculating gradients across the reduction step in custom implementations is often manual and error-prone. FAX addresses these challenges by introducing MapReduce operations as first-class, differentiable primitives within the JAX ecosystem.

The FAX Framework

FAX embeds MapReduce building blocks directly into JAX as primitives, enabling seamless integration with automatic differentiation and JIT compilation. The framework introduces three core operations:

  1. broadcast: Distributes a single value to all partitions.
  2. map_fn: Executes a function on every partition in parallel.
  3. reduce_sum: Aggregates results from all partitions into a single value.
MapReduce primitives in FAX

By registering these as JAX primitives, FAX ensures that the derivative of a MapReduce program is itself a MapReduce program. Computations are lowered to XLA HLO, allowing them to run on high-performance runtimes like Pathways. Crucially, FAX decouples the logical number of partitions from the physical hardware, using internal sharding annotations to optimize data movement.

Experimental Setup

The framework was evaluated using a partitioned version of the CCNews dataset, where articles were grouped by domain to simulate natural data partitioning. Transformer language models of three scales—350 million (350M), 1 billion (1B), and 8 billion (8B) parameters—were trained to test the system's robustness and scalability.

Key Insights

A significant finding is that advanced compilers like GSPMD often fail to optimally shard distributed loops without explicit hints. FAX provides these sharding hints, preventing out-of-memory (OOM) errors and ensuring efficient scaling for models exceeding 1B parameters.

Additionally, because FAX operations are preserved in JAX’s intermediate representation (jaxpr), programs are highly portable. A program written for a TPU pod can be interpreted for different systems, such as Apache Beam, without logic modification. This differentiability also enables "self-tuning" algorithms, where gradients can optimize hyperparameters governing the distributed process.

Performance Evaluation

FAX demonstrates exceptional weak scaling, maintaining near-constant runtime as workload and hardware scale proportionally. As shown in the figure below, the 350M model training time remains stable while scaling from 2 to 2,048 partitions.

Weak scaling performance across model sizes

Compared to standard JIT-compiled Python for-loops, which exhibit linear runtime increases with partition count, FAX maintains flat performance. In large-scale tests, the framework successfully managed updates for over 1 trillion model parameters per round across a massive worker pool.

Conclusion and Future Work

FAX provides a scalable, differentiable foundation for distributed machine learning research. While the current implementation focuses on linear reductions (sum/mean) and pytree structures, future work will explore non-linear reductions and more complex hierarchical data partitioning. Enhancing the maturity of interpreters for diverse production environments also remains a key objective.

Summary updated

BibTeX
@inproceedings{rush2024fax,
  author = {Keith Rush and Zachary Charles and Zachary Garrett},
  title = {{FAX: Scalable and Differentiable Federated Primitives in JAX}},
  booktitle = {WANT @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=RwdyPAK2xD},
}
Figure