Abstract
We introduce InternLM-Law, a large language model (LLM) tailored for addressing diverse legal tasks related to Chinese laws. These tasks range from responding to standard legal questions to analyzing complex real-world legal situations. Our work contributes to Chinese Legal NLP research by (1) conducting one of the most extensive evaluations of state-of-the-art general-purpose and legal-specific LLMs to date; (2) presenting a methodology for training a Chinese legal LLM that offers superior performance to all of its counterparts; and (3) facilitating future research by making all of our code and model publicly available.
Introduction
Legal Artificial Intelligence (LegalAI) requires a difficult balance: a model must possess vast rote knowledge of statutes (memorization), the ability to interpret nuanced facts (understanding), and the logic to apply law to complex real-world scenarios (application). While general-purpose LLMs are highly capable, they often lack specific Chinese legal expertise. Conversely, existing Chinese legal LLMs frequently suffer from narrow evaluation scopes, subpar reasoning on long-form documents, and an inconsistent professional persona.
InternLM-Law was developed to bridge these gaps, providing a model that handles everything from textbook exercises to 20,000-token court judgments with high fidelity and a structured, authoritative voice.
Methodology: Two-Stage Supervised Fine-Tuning
InternLM-Law is built upon the InternLM2-Chat-7B base model, utilizing its 200k-token context window. The researchers employed a specialized two-stage training strategy:
- Stage 1 (Broad Knowledge): The model is trained on a massive mixture of data, including 22 distinct legal NLP tasks (20k samples each), 500k filtered legal consultation Q&A pairs, and 100k QA pairs derived from the Chinese National Legal Database. Crucially, 1 million general-purpose instruction samples were included to maintain reasoning and conversational fluidity.
- Stage 2 (Refinement & Alignment): To polish the model’s "professional persona," the authors curated 6k "expert-level" consultation pairs. These were enhanced by GPT-4 and manually verified for logical rigor and citation accuracy. To prevent "catastrophic forgetting" of Stage 1 knowledge, 14k "replay" samples were mixed in.
Datasets and Evaluation
The paper utilizes a comprehensive suite of data sources for both training and evaluation, including LawBench, CAIL (Challenge of AI in Law), JEC_QA, and the Chinese National Legal Database (FLK).
Beyond standard benchmarks, the authors introduced a new long-text evaluation set consisting of 20 real Chinese legal judgments, each exceeding 20,000 characters. This tests the model's ability to retrieve and analyze information from massive documents, a common requirement in real-world legal practice. Human evaluation was also conducted using 1,000 open-ended questions from the legal section of Zhihu.
Key Results
InternLM-Law achieved state-of-the-art results across the board. On the LawBench benchmark, it outperformed models like ChatLaw, DISC-Law, and even the 72B-parameter Qwen model in several categories, securing the best results on 14/20 tasks in zero-shot settings and 15/20 in one-shot settings.
In a blind human evaluation judged by law students, InternLM-Law's responses were preferred over GPT-4's 76.8% of the time, scoring particularly high on "Detail" and "Clarity." On the long-text judgment task, the model achieved an F1 score of 84.73%, whereas earlier legal models failed entirely due to context limits.
Insights and Discussion
- General Data as a Catalyst: Mixing general-purpose data with legal data improved legal performance, suggesting that general data helps the model transfer high-level analytical skills to the legal domain.
- The "Lawyerly" Persona: Stage 2 training was critical; without it, the win rate against GPT-4 in consultations dropped from 76.8% to 26.2%. This stage specifically improved the structure and logical flow of the advice.
- Instruction Following and Tool Use: InternLM-Law showed high fidelity to complex instructions (e.g., JSON output) and successfully demonstrated the ability to execute Python code to solve complex criminal damages calculations.
Conclusion
InternLM-Law represents a significant advancement in Chinese LegalAI, offering a robust, open-source solution for complex legal reasoning and long-document analysis. While challenges like hallucinations and native numerical reasoning remain, the model's performance establishes a new state-of-the-art for the field. The code and models are publicly available at https://github.com/InternLM/InternLM-Law.
Summary updated