FedJudge: Federated Legal Large Language Model

Linan Yue, Qi Liu, Yichao Du, Weibo Gao, Ye Liu, Fangzhou Yao

TL;DR

FedJudge is the first federated learning framework designed specifically for Legal Large Language Models (LLMs), resolving the tension between data privacy and centralized training. By combining parameter-efficient fine-tuning (LoRA) with continual learning constraints, FedJudge enables multiple legal institutions to collaboratively train a powerful model without exposing sensitive raw data or succumbing to severe data distribution shifts.

What Problem Does This Paper Address?

Developing specialized Legal LLMs (like ChatLaw or Lawyer LLaMA) typically requires massive, centralized datasets. However, real-world legal data is highly sensitive, containing private individual information distributed across isolated siloes—such as courts, law firms, and prosecutors' offices. Due to strict privacy regulations, directly pooling this data into a central server is often impossible.

Federated Learning (FL) offers a decentralized alternative where clients train models locally and only share parameter updates. However, applying standard FL to LLMs hits two massive bottlenecks:

  1. Massive Overhead: Full fine-tuning and transmitting billions of parameters creates unsustainable computational and communication costs for local clients.
  2. Data Heterogeneity (Non-IID Data): Different legal institutions handle completely different styles of text. A court uses formal, specialized language; a legal consultation firm handles colloquial layman queries; a legal reasoning client deals with rigorous logical breakdowns. This severe distribution shift causes standard FL algorithms to degrade in performance.
Examples of data heterogeneity across different legal clients

Methods

To tackle these challenges, the authors introduce FedJudge, which introduces two core strategies:

  • Parameter-Efficient Fine-Tuning (FedJudge-Base): Instead of updating the entire LLM, FedJudge integrates Low-Rank Adaptation (LoRA). The base LLM weights remain completely frozen, and only small, lightweight rank decomposition matrices are trained locally. Clients upload only these compact LoRA parameters to the central server for aggregation, drastically cutting down communication bandwidth and local compute requirements.
  • Continual Learning Constraints (FedJudge-CL): To mitigate data distribution shifts, the authors introduce a continual learning mechanism based on parameter importance (calculated via a Jacobian matrix on the server). The core principle is intuitive: the more important a global parameter weight is to the global model's knowledge, the less it is allowed to change during local training. This prevents local clients from catastrophically forgetting global legal knowledge while adapting to their local text styles.
Overview of the FedJudge framework architecture

Datasets

The framework was evaluated using three distinct real-world datasets to simulate a heterogeneous three-client federated network:

  1. Court View Generation Dataset (Client 1): 59,927 cases from the C3VG dataset, where the model acts as a judge, transforming case facts into formal court views.
  2. Legal Consultation Dataset (Client 2): Colloquial legal questions asked by laymen, paired with answers generated by ChatGPT, using data sourced from Lawyer LLaMA.
  3. Legal Reasoning Dataset (Client 3): Complex legal questions requiring fine-grained reasoning, detailed evidence, and multi-step procedures.
Statistics of the three legal datasets

Key Insights and Ideas

  • Centralized Mixing Isn't Always Best: Surprisingly, a standard centralized model trained by simply mixing all data together (Center) underperformed the federated model on several metrics. Naively blending highly conflicting text distributions (e.g., colloquial chats vs. formal court verdicts) can cause negative interference during training.
  • The Danger of Local Isolation: Models trained purely on their own local data (Center-Client) perform well on their specific domain but fail catastrophically when tested on others. For instance, a model trained only on legal consultations achieves terrible scores when forced to generate formal court views, highlighting the necessity of a shared global model.
  • Continual Learning Stabilizes FL: Using Jacobian-based parameter constraints acts as an effective anchor, bridging the gap between local specialization and global cohesion, and steadily improving performance across training epochs.

Key Results

Using Baichuan-7B as the pre-trained LLM backbone, the authors demonstrated that FedJudge-CL consistently outperforms both FedJudge-Base and traditional centralized baselines across automated metrics (ROUGE, BLEU, and BertScore).

  • Automated Metrics: On the Court View task, the personalized federated model (CL-Client1) achieved a BertScore of 84.18, significantly beating the standard centralized Center model (77.71).
  • Human Evaluation: Automated metrics often penalize LLMs for generating longer, more comprehensive answers than the short ground-truth references. To account for this, a human study scored model outputs from 1 to 5 on usefulness and fluency. CL-Client2 achieved the highest scores (4.11 for Usefulness and 4.62 for Fluency), proving it generates higher quality, more detailed legal advice than its competitors.

Limitations and Future Work

  • Single-Round Conversations Only: The current iteration of FedJudge is trained exclusively on single-round dialogue data. As a result, it lacks the ability to maintain context across multi-round, interactive legal conversations.
  • Future Directions: The authors plan to incorporate multi-round conversation datasets in future work to enhance FedJudge's interactive capabilities for real-world deployment.
  • Ethical Disclaimer: The authors explicitly note that FedJudge is designed as an assistant tool for professionals and laymen, and its outputs should not be treated as a definitive substitute for professional legal counsel.

Summary updated

BibTeX
@inproceedings{yue2024fedjudge,
  author = {Linan Yue and Qi Liu and Yichao Du and Weibo Gao and Ye Liu and Fangzhou Yao},
  title = {{FedJudge: Federated Legal Large Language Model}},
  booktitle = {DASFAA},
  year = {2024},
  doi = {10.1007/978-981-97-5569-1\_17},
}
Figure