Adaptive Test-Time Personalization for Federated Learning

Wenxuan Bao, Tianxin Wei, Haohan Wang, Jingrui He

Abstract

Standard Federated Learning (FL) often struggles to generalize across diverse client data distributions. While Personalized FL (PFL) attempts to address this through local fine-tuning, it typically requires labeled data, which is often unavailable in real-world scenarios. This paper introduces Adaptive Test-time Personalization (ATP), a framework that enables models to personalize themselves to new, unseen clients using only unlabeled data at test-time. By learning module-specific "adaptation rates" during training, ATP effectively navigates the complex trade-offs between feature and label distribution shifts.

The Challenge of Personalization in Federated Learning

In standard Federated Learning, a central server coordinates multiple clients to train a global model without accessing their private data. However, real-world clients exhibit significant heterogeneity; for instance, different users may capture images under varying lighting conditions or focus on different object classes.

Existing Personalized FL (PFL) methods attempt to mitigate this by fine-tuning models for individual users. However, these methods usually rely on the presence of labeled data at the client level. While Test-Time Adaptation (TTA) methods offer a way to adapt to unlabeled data, they are often specialized for specific types of shifts. A method optimized for image corruptions (feature shift) frequently fails when class proportions change (label shift), and vice versa. This creates a performance trade-off that makes existing TTA methods unreliable for the hybrid shifts common in federated environments.

Comparison between the testing phases of Global FL (GFL), Personalized FL (PFL), and the proposed Test-time Personalized FL (TTPFL). TTPFL enables model personalization without requiring labeled data.

Methodology: Adaptive Test-time Personalization (ATP)

ATP addresses these limitations by learning a set of adaptation rates ($\alpha$) during the training phase. These rates act as per-module learning rates that dictate how much each component of the neural network should change during test-time adaptation.

1. Training Phase: Learning to Adapt

During training, source clients simulate the test-time environment. They perform an unsupervised update (minimizing entropy) on the global model using their local data. Subsequently, they use their actual ground-truth labels to calculate how those updates should have been weighted to minimize prediction error. These optimal adaptation rates are then aggregated and averaged across all clients by the server.

2. Testing Phase: Personalizing to Unseen Clients

When a new client joins the network, they receive the global model along with the learned adaptation rates. Using their local, unlabeled data, they calculate an update direction via entropy minimization and apply it according to the pre-learned rates. For streaming data, the authors introduce ATP-Online, which utilizes a cumulative moving average of update directions to prevent "over-adaptation" to noisy, small batches.

Key Insights and the Performance Trade-off

A critical finding of this research is the Module Sensitivity Trade-off. The authors demonstrate that adapting the final layer of a network is highly effective for label shifts but can be detrimental under feature shifts. Conversely, adapting Batch Normalization (BN) layers assists with feature shifts but can degrade performance if class proportions are skewed.

The performance trade-off of existing TTA methods under feature and label distribution shifts. Most methods excel at one but fail at the other.

ATP overcomes this by providing fine-grained control. It learns rates for specific components (e.g., BN running means vs. BN weights) rather than entire blocks. Interestingly, ATP sometimes learns negative adaptation rates. Under label shift, "disaligning" intermediate features can actually help the model better reflect shifted class priors, a counter-intuitive strategy that proves highly effective.

Experimental Results

The researchers evaluated ATP across several benchmarks, including CIFAR-10/100 (with synthetic corruptions and label skews), Digits-5, and the PACS domain generalization benchmark.

  • Hybrid Shifts: On CIFAR-10 with combined image corruption and label skew, ATP-online achieved 75.37% accuracy, significantly outperforming the next best baseline (EM at 69.85%) and the "No adaptation" baseline (63.68%).
  • Domain Generalization: On the PACS dataset, ATP-online showed robust improvements across almost all domains (Art, Cartoon, Photo, Sketch) compared to standard fine-tuning methods.
  • Efficiency: ATP is highly communication-efficient, as it only requires the transmission of a small vector of adaptation rates rather than full model parameters during the learning-to-adapt phase.

Conclusion and Future Work

ATP provides a robust framework for personalizing federated models at test-time without requiring client labels. While highly effective, the authors note that the current implementation assumes a fixed global model. Future work may involve co-training the global model specifically to be more adaptable (meta-learning). Additionally, while communication is efficient, the computational overhead of calculating gradients on edge devices remains a consideration for low-power deployments.

Summary updated

BibTeX
@inproceedings{bao2023adaptive,
  author = {Wenxuan Bao and Tianxin Wei and Haohan Wang and Jingrui He},
  title = {{Adaptive Test-Time Personalization for Federated Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=rbw9xCU6Ci},
}
Figure