Abstract
Transformer-based pre-trained models have revolutionized NLP for superior performance and generality. Fine-tuning pre-trained models for downstream tasks often requires private data, for which federated learning is the de-facto approach (i.e., FedNLP). However, our measurements show that FedNLP is prohibitively slow due to the large model sizes and the resultant high network/computation cost. Towards practical FedNLP, we identify as the key building blocks adapters, small bottleneck modules inserted at a variety of model layers. A key challenge is to properly configure the depth and width of adapters, to which the training speed and efficiency is highly sensitive. No silver-bullet configuration exists: the optimal choice varies across downstream NLP tasks, desired model accuracy, and mobile resources. To automate adapter configuration, we propose FedAdapter, a framework that enhances the existing FedNLP with two novel designs. First, FedAdapter progressively upgrades the adapter configuration throughout a training session; the principle is to quickly learn shallow knowledge by only training fewer and smaller adapters at the model's top layers, and incrementally learn deep knowledge by incorporating deeper and larger adapters. Second, FedAdapter continuously profiles future adapter configurations by allocating participant devices to trial groups. Extensive experiments show that FedAdapter can reduce FedNLP's model convergence delay to no more than several hours, which is up to 155.5$\times$ faster compared to vanilla FedNLP and 48$\times$ faster compared to strong baselines.
Introduction: The Challenge of Federated NLP
Modern Natural Language Processing (NLP) relies on massive Transformer models like BERT and GPT. While these models are powerful, fine-tuning them on private user data (like emails or messages) is a significant challenge for mobile devices. The standard approach, Federated Learning (FedNLP), requires devices to download and upload hundreds of megabytes of model weights every round and perform heavy computations that drain batteries.
Our measurements show that vanilla FedNLP is "prohibitively slow," often taking days to converge. This inefficiency stems from the sheer size of modern NLP models compared to traditional Computer Vision (CV) models, as well as the resultant high network and computation costs on resource-constrained mobile hardware.
Why Standard Optimizations Fail
To understand the bottlenecks, we conducted diagnostic measurements comparing NLP and CV models and evaluating common optimization techniques.
As shown in Figure 3(a), NLP models are significantly more complex than CV models. This leads to the slow convergence times seen in Figure 3(b), where training on devices like the Raspberry Pi 4B can take hundreds of hours. A major bottleneck is communication (Figure 3c), as large model weights must be synchronized frequently. Even "layer freezing"—only training the top few layers—offers limited gains. Figure 3(d) shows that it significantly increases accuracy loss while only moderately reducing training time, as the device must still perform a full forward pass through the frozen bottom layers.
The FedAdapter Framework
The core of our solution is the Adapter—a tiny bottleneck module inserted into Transformer layers. Instead of updating millions of parameters, FedAdapter only updates these small modules (often <1% of the total model size).
FedAdapter introduces three key innovations:
- Progressive Training: It treats architecture as a curriculum, starting with a "shallow" configuration (small adapters at the top layers) to capture easy wins quickly. As training plateaus, it incrementally adds deeper and larger adapters.
- Sideline Trials: To solve the "no silver bullet" problem of configuration, the server uses "extra" available mobile devices to test different adapter settings in parallel, promoting the configuration with the best convergence rate.
- Activation Cache: Since bottom layers remain frozen for long periods, FedAdapter caches their outputs on the device's storage, allowing subsequent rounds to skip the forward pass for those layers entirely.
Key Results
Extensive experiments on benchmarks like SEMEVAL and ONTONOTES using real-world mobile hardware (Jetson TX2, Jetson Nano, RPI 4B) demonstrate FedAdapter's effectiveness:
- Massive Speedups: FedAdapter reached target accuracy up to 155.5× faster than vanilla fine-tuning and 48× faster than strong baselines like model quantization.
- Resource Efficiency: It reduced network traffic by an average of 126.7× and per-device energy consumption by 18.4×.
- Real-World Convergence: On the SEMEVAL dataset, while vanilla FedNLP took over 124 hours to converge, FedAdapter finished in just 2.3 hours.
Conclusion
FedAdapter transforms FedNLP from a prohibitively slow process into a practical framework for mobile devices. By dynamically configuring adapters and utilizing activation caching, it achieves state-of-the-art performance with a fraction of the resource cost. Future work will explore mitigating stragglers in asynchronous settings and the interaction between adapters and advanced privacy techniques like Differential Privacy.
Summary updated