Abstract
Federated learning (FL) is a general framework for learning across heterogeneous clients while preserving data privacy, under the orchestration of a central server. FL methods often compute gradients of loss functions purely locally, typically using automatic differentiation (AD) techniques. We propose a federated automatic differentiation (FAD) framework that enables computing derivatives of functions involving client and server computation as well as communication between them, operating in a manner compatible with existing federated technology. We show that FAD may be implemented using various accumulation modes (forward, reverse, and mixed), which introduce distinct computation-communication trade-offs. Further, we show that a broad class of federated computations is closed under these various modes of FAD, implying that if the original computation is privacy-preserving, its derivative can be computed using only those same primitives. We demonstrate that FAD can be used to create self-tuning algorithms that automatically adjust server optimization steps or learn weighting schemes, significantly improving performance and stability.
Introduction
Federated Learning (FL) involves training models on decentralized data residing on devices like smartphones or IoT sensors. Tuning these systems is notoriously difficult due to data heterogeneity and the disconnect between local client updates and global server optimization. Standard algorithms like FedAvg do not always behave like standard gradient descent, making traditional hyperparameter optimization theory difficult to apply.
Currently, optimizing FL hyperparameters (hypergradient descent) requires manual derivation of complex formulas or numerical approximations, which are error-prone and often ignore privacy constraints like Secure Aggregation (SecAgg). This paper introduces Federated Automatic Differentiation (FAD), a framework to make the entire federated pipeline differentiable, allowing for automated tuning of learning rates and client weights without compromising privacy.
The Federated AD Framework
The core of FAD is treating federated computation as a directed acyclic graph (DAG) of "federated values"—data residing either on the server or distributed across clients.
The authors define three primary modes for computing derivatives within this graph:
- Forward-Mode: Propagates derivatives alongside data. It is simple to implement but can become communication-intensive for high-dimensional parameters.
- Reverse-Mode: Analogous to standard backpropagation. While theoretically efficient, it is difficult to implement in cross-device FL where clients frequently drop offline, as it requires re-contacting the same clients in a backward pass.
- Mixed-Mode: A hybrid approach that uses reverse-mode locally (on server/client) and forward-mode across communication boundaries. This allows derivatives to be computed during the forward pass, requiring no additional communication rounds or persistent client connections.
A key theoretical contribution is the Closure Property: the class of privacy-compatible federated computations (using primitives like federated_broadcast and federated_sum) is closed under differentiation. This ensures that FAD can be implemented using the same privacy-preserving primitives as the original training algorithm.
Applications and Results
FAD was evaluated on diverse benchmarks including CIFAR-100, EMNIST, and Stack Overflow datasets.
Automated Hyperparameter Tuning
By applying FAD to the FedOpt framework, the authors created "self-tuning" optimizers. Instead of manual grid searches, the algorithm learns the optimal server learning rate and momentum on the fly. On CIFAR-100, this approach achieved 45.6% accuracy, surpassing the 43.2% of the best-fixed baseline. Furthermore, bootstrap analysis showed that FAD-tuned algorithms reach peak accuracy with 1/10th the number of trials required for manual sweeps.
Dynamic Client Weighting
FAD was used to learn weighting schemes for aggregating client updates. In experiments on heterogeneous datasets, the framework discovered a dynamic interpolation strategy: weighting by the number of examples is beneficial early in training, while uniform weighting improves late-stage convergence. This nuance is typically missed by static weighting schemes.
Stability
On the Stack Overflow tag prediction task, FAD significantly improved training stability. While nearly half of the fixed-parameter trials diverged, none of the FAD-enabled trials failed, demonstrating the robustness of automated tuning in complex, real-world scenarios.
Conclusion
Federated Automatic Differentiation provides a principled way to compute gradients across communication boundaries in distributed systems. By ensuring compatibility with existing privacy primitives and offering efficient "Mixed-Mode" execution, FAD enables a new generation of self-tuning, privacy-preserving federated algorithms. Future work includes developing more robust systems for reverse-mode AD and integrating these capabilities into mainstream FL libraries.
Summary updated