Source-linked AI summary

LawGPT: A Chinese Legal Knowledge-Enhanced Large Language Model

Zhi Zhou, Jiang-Xin Shi, Peng-Xiao Song, Xiao-Wen Yang, Yi-Xuan Jin, Lan-Zhe Guo, Yu-Feng Li

arXiv:2406.04614v1cs.CLcs.AI

TL;DR

Existing LLMs leave privacy and legal-knowledge gaps for practical Chinese legal tasks. LawGPT combines legal-oriented pre-training with legal supervised fine-tuning, and the authors report that it outperforms open-source LLaMA 7B. The report presents the model as a step toward practical Chinese legal LLMs.

  • Problem

    For practical Chinese legal tasks, API-accessed proprietary LLMs do not guarantee privacy for sensitive cases, while open-source models have insufficient legal knowledge.

    Source: §1 · p. 1
  • Method

    LawGPT combines legal-oriented pre-training on legal documents with legal supervised fine-tuning using a knowledge-driven instruction dataset.

    Source: §1 · p. 2, §3.1 · p. 4, §3.2 · p. 4
  • Results

    LawGPT outperforms the open-source LLaMA 7B model in major legal tasks.

    Source: §1 · p. 2, §5 · p. 6
  • Takeaways & Limitations

    The authors present LawGPT as contributing to the development of a practical Chinese legal LLM.

    Source: §1 · p. 2, §5 · p. 6

Abstract

from arXiv · show

Large language models (LLMs), including both proprietary and open-source models, have showcased remarkable capabilities in addressing a wide range of downstream tasks. Nonetheless, when it comes to practical Chinese legal tasks, these models fail to meet the actual requirements. Proprietary models do not ensure data privacy for sensitive legal cases, while open-source models demonstrate unsatisfactory performance due to their lack of legal knowledge. To address this problem, we introduce LawGPT, the first open-source model specifically designed for Chinese legal applications. LawGPT comprises two key components: legal-oriented pre-training and legal supervised fine-tuning. Specifically, we employ large-scale Chinese legal documents for legal-oriented pre-training to incorporate legal domain knowledge. To further improve the model's performance on downstream legal tasks, we create a knowledge-driven instruction dataset for legal supervised fine-tuning. Our experimental results demonstrate that LawGPT outperforms the open-source LLaMA 7B model. Our code and resources are publicly available at https://github.com/pengxiao-song/LaWGPT and have received 5.7K stars on GitHub.

1 Introduction

The paper identifies privacy and legal-knowledge gaps in existing LLMs for practical Chinese legal tasks. It introduces LAWGPT, combining legal-domain pre-training and instruction fine-tuning, and reports better performance than open-source LLaMA 7B on major legal tasks.

1 Introduction

  • Proprietary LLMs accessed through APIs do not guarantee privacy for sensitive legal cases, while open-source models lack sufficient legal knowledge and downstream-task fit.The paper identifies these as two obstacles to practical legal use.Source: §1 · p. 1
  • The authors frame an open-source model specifically designed for legal applications as a response to the privacy and performance obstacles.They describe LAWGPT as the first open-source model of this kind for Chinese legal applications.Source: §1 · p. 2
  • LAWGPT surpasses the open-source LLaMA 7B model in major legal tasks.The authors present this as evidence for the model’s effectiveness.Source: §1 · p. 2
  • LAWGPT is introduced as an open-source Chinese legal knowledge-enhanced model, with legal-oriented pre-training and legal supervised fine-tuning.The pre-training incorporates legal-domain knowledge; a knowledge-driven instruction dataset supports downstream-task adaptation.Source: §1 · p. 2

2 Related Work

The related-work section surveys general LLMs applied to legal tasks, legal-specific language models, and benchmarks used to evaluate legal capabilities. It describes model adaptation and retrieval approaches alongside benchmark coverage across tasks and cognitive levels.

2 Related Work

  • The section organizes prior work around general language models, legal language models, and legal benchmarks.These are the three areas the authors say the review covers.Source: §2 · p. 2

2.1 General Language Models

  • Proprietary and open-source general LLMs are described as capable across downstream tasks, including legal applications.The paper notes that open-source models can be fine-tuned with targeted legal datasets.Source: §2.1 · p. 2

2.2 Legal Language Models

  • Prior legal language models address tasks such as judgment prediction, retrieval, reading comprehension, and question answering, while newer approaches fine-tune legal corpora or use retrieval.The cited work also includes systems for legal reasoning and hallucination robustness.Source: §2.2 · pp. 2–3

2.3 Legal Benchmarks

  • LawBench covers 20 legal tasks across knowledge memorization, understanding, and application; LAiW covers 14 tasks across three legal-capability levels.SimuCourt evaluates judicial analysis and decision-making.Source: §2.3 · p. 3

3 Methodology

LAWGPT addresses legal-knowledge and downstream-task gaps through legal-oriented pre-training followed by legal supervised fine-tuning. The method describes the legal corpus and instruction data, then applies the fine-tuned model to wrapped instructions at inference.

3 Methodology

  • LAWGPT uses legal-oriented pre-training to add legal-domain knowledge to an open-source base model, followed by legal supervised fine-tuning for downstream legal tasks.The authors identify insufficient legal knowledge and task-specific training as challenges for open-source general LLMs.Source: §3 · p. 4

3.1 Legal-Oriented Pre-Training

  • The legal pre-training corpus DLPT contains 500K legal documents from civil, criminal, and administrative law, and the model is trained autoregressively on legal text.The objective optimizes the base-model parameters using the corpus.Source: §3.1 · p. 4

3.2 Legal-Supervised Fine-Tuning

  • The 300K-sample DLFT instruction dataset combines 200K open-source crime-task samples, 20K JEC-QA samples, and 80K legal QA samples refined with ChatGPT.The authors describe supervised fine-tuning on this dataset to adapt the pre-trained model to downstream tasks.Source: §3.2 · pp. 4–5

3.3 Inference of LAWGPT

  • At inference, users wrap an instruction with the Alpaca testing template, tokenize it, and generate a response autoregressively with the fine-tuned model.The generated response is the model’s output for the supplied instruction.Source: §3.2 · p. 5, §3.3 · p. 5

3.2 Legal-Supervised Fine-Tuning

  • Fine-tuning wraps DLFT instructions and outputs in the Alpaca training template and optimizes the pre-trained model on the output tokens.The paper describes this as the objective for obtaining the final LAWGPT parameters.Source: §3.2 · p. 5

4 Experiments

The experiments train LAWGPT in two legal-adaptation stages and evaluate it zero-shot across eight legal applications. It outperforms LLaMA 7B on major tasks and average performance, though a significant gap with proprietary models remains.

4.1 Implementation Details

  • Training uses a Chinese-Alpaca-Plus 7B base model, with LoRA-based legal-oriented pre-training on DLPT followed by legal supervised fine-tuning on DLFT.DLPT contains 500K legal pre-training corpus items and DLFT contains 30K legal-supervised corpus items; training used 8 NVIDIA V100 GPUs.Source: §4.1 · p. 5

4.2 Performance Evaluation

  • In zero-shot evaluation across eight legal applications, LAWGPT outperforms LLaMA 7B on major tasks and achieves better average performance.Table 1 compares LAWGPT with proprietary models and 7B open-source models.Source: Table 1 · p. 6, §4.2 · p. 6
  • Despite its data-privacy advantage, LAWGPT still has a significant performance gap with proprietary models.Source: §4.2 · p. 6

5 Conclusion

The conclusion presents LAWGPT as a Chinese legal knowledge-enhanced model built through legal-oriented pretraining and legal supervised fine-tuning. Experiments report better performance than open-source LLaMA 7B, and the authors hope the work inspires Chinese legal-AI research.

  • LAWGPT is introduced as a Chinese legal knowledge-enhanced model designed for Chinese legal applications.Source: §5 · p. 6
  • Legal-oriented pretraining incorporates legal-domain knowledge, while legal supervised fine-tuning enhances performance on downstream legal tasks.Source: §5 · p. 6
  • Experiments report that LAWGPT outperforms open-source LLaMA 7B, and the authors hope it will inspire Chinese legal-AI research.Source: §5 · p. 6
Loading 2406.04614v1…