The Risk of Federated Learning to Skew Fine-Tuning Features and Underperform Out-of-Distribution Robustness

Mengyao Du, Miao Zhang, Yuwen Pu, Kai Xu, Shouling Ji, Quanjun YinarXiv 2024 · DOI

Abstract

Federated fine-tuning of Large Language Models (LLMs) often compromises out-of-distribution (OOD) robustness due to inherent data heterogeneity among clients. This paper identifies "feature skew" as a primary driver of this degradation and proposes General Noisy Projection (GNP). GNP restores robustness by anchoring fine-tuned models to their pre-trained states and utilizing controlled noise injection to maintain feature diversity. Experimental results on sentiment analysis benchmarks demonstrate significant gains in OOD accuracy without sacrificing in-distribution performance.

Introduction

Large Language Models (LLMs) are typically developed in two distinct stages: massive-scale pre-training followed by task-specific fine-tuning. In sectors with sensitive data, such as healthcare or legal services, Federated Learning (FL) has emerged as a vital paradigm, enabling multiple clients to collaboratively fine-tune a shared model without exposing raw local data.

Overview of the federated fine-tuning pipeline and the challenges of data heterogeneity and robustness.

However, a significant challenge in FL is data heterogeneity. Client datasets are rarely Identically and Independently Distributed (IID); for instance, one client may possess only positive sentiment data while another has only negative. This research reveals that such heterogeneity causes "feature skew," where the model's internal representations become overly specialized to local distributions, leading to a sharp decline in out-of-distribution (OOD) robustness.

Quantifying Feature Skew

To analyze the impact of federated fine-tuning on model internals, the authors propose three diagnostic metrics:

  1. Singular Value Entropy (SVE): Quantifies the complexity and diversity of feature representations. A high SVE indicates a rich, multi-dimensional understanding of data.
  2. Largest Singular Value Ratio (LSVR): Serves as a proxy for feature transferability. Lower ratios suggest features are well-distributed rather than concentrated in a single dominant dimension.
  3. Gradient Deviation Angle (GDA): Measures the angular drift of the fine-tuned model's weights relative to the original pre-trained "anchor" weights.

The study finds that as data heterogeneity increases, SVE drops significantly, indicating a "feature collapse" where the model loses the general linguistic wisdom acquired during pre-training.

The General Noisy Projection (GNP) Algorithm

To mitigate feature skew and restore robustness, the authors introduce the General Noisy Projection (GNP) algorithm. GNP operates through two primary mechanisms:

  • Robustness Projection: This step identifies a "robustness vector" by projecting the fine-tuned weights back onto the pre-trained weight space. By anchoring the model to its pre-trained state, GNP forces it to retain the robust features learned during the initial training phase.
  • Noise Injection: GNP adds calculated Gaussian noise to the model weights. While seemingly counter-intuitive, this noise acts as a regularizer, preventing the model from over-fitting to skewed local client data and artificially enhancing feature diversity (SVE).

Experimental Setup

The researchers evaluated GNP using a RoBERTa-base model across several sentiment analysis benchmarks. The In-Distribution (ID) task utilized Amazon product reviews for federated fine-tuning. Robustness was tested against three OOD datasets: DynaSent (adversarial), SemEval (Twitter), and SST (movie reviews).

Visualization of label distribution across clients for different Dirichlet parameter (alpha) values, representing varying degrees of data skew.

Data heterogeneity was simulated using a Dirichlet distribution with parameter $\alpha$. As shown in the figure above, a smaller $\alpha$ (e.g., 0.1) represents extreme skew, while a larger $\alpha$ (e.g., 10.0) approaches an IID distribution.

Key Results and Insights

The implementation of GNP yielded several critical findings:

  • Substantial Robustness Gains: In high-skew scenarios ($\alpha=0.1$) on the SST dataset, standard Adapter tuning achieved only 37.4% accuracy. The addition of GNP improved this to 63.9%, a nearly 27% absolute gain.
  • Preservation of Task Accuracy: Unlike many robustness techniques that incur an "accuracy tax," GNP maintained or improved performance on the primary ID task. For example, Adapter tuning accuracy on the Amazon dataset rose from 84.4% to 89.4% under high skew.
  • PEFT Sensitivity: The study noted that Parameter-Efficient Fine-Tuning (PEFT) methods respond differently to skew. BitFit, which only updates bias terms, demonstrated inherent robustness due to its constrained parameter space, while LoRA and Adapters were more susceptible to drift without GNP.

Conclusion

The research highlights a fundamental trade-off in federated fine-tuning: the pursuit of local accuracy often comes at the expense of global robustness. By treating robustness as an inherited trait from pre-training, the GNP algorithm provides a "plug-and-play" solution that allows federated models to remain accurate on local tasks while retaining the generalizable "common sense" of their pre-trained origins.

Summary updated

Abstract

To tackle the scarcity and privacy issues associated with domain-specific datasets, the integration of federated learning in conjunction with fine-tuning has emerged as a practical solution. However, our findings reveal that federated learning has the risk of skewing fine-tuning features and compromising the out-of-distribution robustness of the model. By introducing three robustness indicators and conducting experiments across diverse robust datasets, we elucidate these phenomena by scrutinizing the diversity, transferability, and deviation within the model feature space. To mitigate the negative impact of federated learning on model robustness, we introduce GNP, a \underline{G}eneral \underline{N}oisy \underline{P}rojection-based robust algorithm, ensuring no deterioration of accuracy on the target distribution. Specifically, the key strategy for enhancing model robustness entails the transfer of robustness from the pre-trained model to the fine-tuned model, coupled with adding a small amount of Gaussian noise to augment the representative capacity of the model. Comprehensive experimental results demonstrate that our approach markedly enhances the robustness across diverse scenarios, encompassing various parameter-efficient fine-tuning methods and confronting different levels of data heterogeneity.
BibTeX
@misc{du2024risk,
  author = {Mengyao Du and Miao Zhang and Yuwen Pu and Kai Xu and Shouling Ji and Quanjun Yin},
  title = {{The Risk of Federated Learning to Skew Fine-Tuning Features and Underperform Out-of-Distribution Robustness}},
  year = {2024},
  eprint = {2401.14027},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.14027},
}
Figure