FedJudge: Federated Legal Large Language Model

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

Abstract

Legal intelligence relies on Large Language Models (LLMs) trained on sensitive data distributed across various institutions. Privacy concerns and data heterogeneity (non-IID data) hinder centralized training and standard federated learning approaches. We present FedJudge, a federated learning framework tailored for the legal domain. FedJudge combines parameter-efficient fine-tuning via Low-Rank Adaptation (LoRA) with a continual learning constraint based on the Jacobian matrix. This approach ensures communication efficiency and mitigates performance degradation caused by diverse local data distributions. Experimental results on real-world legal datasets demonstrate that FedJudge outperforms centralized baselines and standard federated methods in both automated metrics and human evaluation.

Introduction

The advancement of Legal Intelligence—AI systems designed to assist judicial professionals and the public—is contingent upon access to high-quality, domain-specific data. However, legal data is inherently sensitive and typically siloed within courts, law firms, and government offices. Centralizing this data for model training is often prohibited by strict privacy regulations.

Federated Learning (FL) provides a decentralized alternative where models are trained locally, and only parameter updates are shared. Despite its promise, applying FL to LLMs in the legal sector faces two primary obstacles:

  1. Efficiency: The massive scale of LLMs makes full parameter synchronization across networks computationally and bandwidth-prohibitive.
  2. Data Heterogeneity: Legal data is highly non-IID (not identically and independently distributed). For instance, formal judicial summaries differ significantly from informal citizen consultations. Standard FL often fails to reconcile these differences, leading to "catastrophic forgetting" of global knowledge.

Methodology

FedJudge addresses these challenges through a dual-component architecture consisting of FedJudge-Base and FedJudge-CL.

The FedJudge architecture illustrating the federated training process using LoRA adapters and a central server for aggregation.

FedJudge-Base: Efficiency via LoRA

To overcome communication bottlenecks, FedJudge utilizes Low-Rank Adaptation (LoRA). Instead of updating the entire LLM, the framework freezes the backbone weights and trains only low-rank adapter matrices. During federated rounds, only these small adapters are transmitted to the central server for aggregation, significantly reducing the communication load.

FedJudge-CL: Effectiveness via Continual Learning

To manage data heterogeneity, FedJudge treats the federated learning process as a continual learning problem. The framework introduces a constraint based on the Jacobian matrix of the global model. By identifying parameters critical to the global model's performance, the server can penalize local clients if they deviate too drastically from these "important" weights. This mechanism prevents local models from drifting toward local biases and preserves the collective intelligence of the federation.

Experimental Setup and Datasets

The framework was evaluated using three distinct legal tasks, simulating a heterogeneous environment with three clients: Court View Generation, Legal Consultation, and Legal Reasoning.

Examples of instruction-based inputs and outputs for the three legal tasks: Court View, Consultation, and Legal Reasoning.

The backbone model for these experiments was Baichuan-7B, an open-source LLM optimized for the Chinese language.

Results and Discussion

FedJudge-CL consistently outperformed both centralized "Center" models (trained on pooled data) and standard federated baselines across ROUGE, BLEU, and BertScore metrics.

  • Performance Gains: In Court View Generation, FedJudge-CL achieved a BertScore of 84.18, compared to 72.84 for the base model. In Legal Consultation, it reached 64.33, surpassing the centralized baseline of 62.27.
  • Human Evaluation: Blind tests by human experts rated FedJudge-CL highly, with scores of 4.11/5 for usefulness and 4.62/5 for fluency.
  • The Mixing Paradox: Interestingly, the centralized "Center" model often performed worse than FedJudge. This suggests that naive data pooling can lead to linguistic interference between formal and informal domains, whereas FedJudge’s constrained adaptation allows for better specialized learning.

Conclusion

FedJudge represents a significant step toward privacy-preserving legal AI. By leveraging LoRA for efficiency and Jacobian-based continual learning for stability, it enables institutions to collaborate without compromising data security. Future research will focus on extending the framework to multi-turn dialogues and scaling the system to support a larger number of diverse clients.

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