OpenFedLLM: Training Large Language Models on Decentralized Private Data via Federated Learning

Rui Ye, Wenhao Wang, Jingyi Chai, Dihan Li, Zexi Li, Yinda Xu, Yaxin Du, Yanfeng Wang, Siheng Chen

TL;DR

OpenFedLLM is a new open-source framework designed to train Large Language Models (LLMs) on decentralized, private data using Federated Learning (FL). By enabling collaborative instruction tuning and value alignment without ever sharing raw data, the framework allows smaller models (like Llama-2-7B) to significantly outperform giants like GPT-4 in specialized domains such as finance.

What Problem Does This Paper Address?

We are approaching a "data wall." While LLM performance scales with data, researchers estimate that high-quality public text data will be exhausted by 2026. Meanwhile, vast repositories of high-quality data remain "dark"—locked away in private silos like hospitals, banks, and law firms due to strict privacy regulations and proprietary concerns.

The challenge is how to leverage this decentralized private data to continue improving LLMs without compromising privacy. Individual organizations often lack enough data to train a state-of-the-art model alone, but they cannot legally or competitively share their raw data to create a centralized pool.

Methods

The authors introduce OpenFedLLM, a research-friendly codebase that bridges the gap between the Federated Learning and LLM communities. The framework focuses on two critical stages of LLM training:

  1. Federated Instruction Tuning (FedIT): Multiple clients collaboratively perform supervised fine-tuning (SFT) to improve the model's ability to follow human instructions.
  2. Federated Value Alignment (FedVA): To ensure models are helpful and harmless, the authors implement a federated version of Direct Preference Optimization (DPO). Unlike traditional RLHF, DPO is more stable and doesn't require training a separate reward model, making it ideal for the complexities of a federated environment.

To make this computationally feasible for diverse participants, the framework utilizes Parameter-Efficient Fine-Tuning (PEFT) via LoRA and 8-bit quantization. This allows a client to participate in training a 7B parameter model using just a single consumer-grade GPU (like an NVIDIA RTX 3090).

Overview of the OpenFedLLM framework, integrating FL algorithms with instruction tuning and value alignment.

Datasets

The study evaluates OpenFedLLM across 8 diverse training datasets covering general knowledge, finance, medical, code, and math domains.

Table 2: Descriptions of adopted datasets in this paper. We report the number of data samples in the dataset (Nsample), averaged instruction length (¯Linst.), and averaged response length (¯LResp.), where the length is calculated on the tokenized sentence using Llama2 tokenizer [4]. For the two datasets for value alignment, we measure the preferred response as the ¯LResp.. Note that these are just datasets explored in experiments, while our OpenFedLLM framework is not limited to these, which also supports datasets such as WizardLM_evol [16] and ChatDoctor [66].

For evaluation, the authors use over 30 metrics, including closed-ended benchmarks (MMLU, BBH) and open-ended benchmarks (MT-Bench, Vicuna-Bench) to assess both raw knowledge and conversational capability.

Key Insights and Ideas

  • Collaboration Beats Isolation: In every single test case, models trained via Federated Learning outperformed those trained on a single client's local data. This provides a clear "participation incentive" for organizations with limited data.
  • Domain Expertise via FL: The most striking finding was in the financial domain. A Llama-2-7B model trained via FL on the FinGPT dataset outperformed GPT-4. This suggests that collaborative training on specialized private data can overcome the sheer parameter-count advantage of general-purpose giants.
  • No Algorithmic Silver Bullet: The authors tested 7 different FL algorithms (e.g., FedAvg, FedProx, SCAFFOLD). They found that no single algorithm dominates across all domains; for instance, SCAFFOLD performed best in finance, while FedYogi excelled in general instruction tuning.
  • Value Alignment is Possible in FL: The paper demonstrates that FedDPO successfully injects human values (helpfulness and harmlessness) into models without needing centralized data, which is crucial for deploying responsible AI in sensitive industries.

Key Results

  • General Performance: FL methods showed a ≥ 12% improvement on the MT-Bench (a standard for instruction-following) compared to individual local training.
  • Financial Benchmark: On the financial sentiment analysis task, FL-trained models achieved significantly higher F1 scores than both GPT-3.5 and GPT-4.
  • Medical Domain: All FL algorithms consistently outperformed local training across 9 medical benchmarks, with FedAvg and FedProx showing the most stable gains.

Limitations and Future Work

While OpenFedLLM is a major step forward, the authors highlight several remaining hurdles:

  • Heterogeneous Preferences: In Federated Value Alignment, different clients may have conflicting values (e.g., different cultural norms). Training a single global model that satisfies everyone is a complex, open problem.
  • Robustness and Security: FL is vulnerable to "poisoning attacks" where a malicious client sends updates designed to degrade the model or insert backdoors. The authors call for more research into robust defense mechanisms specifically for LLMs.
  • Personalization: While FL improves general performance, a "one-size-fits-all" global model might actually perform worse on a specific client's niche data than their own local model. Developing Personalized Federated Learning for LLMs is a key future direction.

Summary updated

BibTeX
@misc{ye2024openfedllm,
  author = {Rui Ye and Wenhao Wang and Jingyi Chai and Dihan Li and Zexi Li and Yinda Xu and Yaxin Du and Yanfeng Wang and Siheng Chen},
  title = {{OpenFedLLM: Training Large Language Models on Decentralized Private Data via Federated Learning}},
  year = {2024},
  eprint = {2402.06954},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.06954},
}
Figure