- The paper demonstrates that integrating continual pre-training, supervised fine-tuning, and retrieval-augmented generation significantly improves performance on specialized legal tasks.
- The model outperforms baselines with statute prediction accuracy of 35%, charge prediction accuracy of 31%, legal summarization at 71.6, and legal QA scoring 84.0.
- The approach offers practical benefits including dynamic knowledge retrieval and reduced retraining costs, enhancing legal reasoning amid evolving statutes.
LuWen: Architecture and Methodological Innovations in Legal Domain Language Modeling
Model Design and Technical Approach
WisdomInterrogatory (LuWen) is an open-source Chinese legal LLM architected to address the unique demands of the legal domain—characterized by specialized terminology, structured language, complex reasoning, and rapidly evolving statutes. Built atop Baichuan1-7B, LuWen incorporates three synergistic pillars: continual pre-training (CPT) on a broad legal corpus, supervised fine-tuning (SFT) leveraging curated instruction-response datasets, and retrieval-augmented generation (RAG) with a comprehensive legal knowledge base.
The CPT phase leverages a 200 GB corpus, with a targeted mix of 20% legal and 80% general-domain data, enhancing domain expertise while retaining generalist capabilities. SFT employs a balanced, high-quality dataset of 100,000 instruction tuning samples (30% legal, 70% general), meticulously filtered for diversity, conversational complexity, and up-to-date legal terminology. RAG transforms the model from closed-book to open-book, integrating multi-source legal knowledge in real-time, thereby improving output accuracy and responsiveness to legislative changes.
Figure 1: LuWen Technology Roadmap, illustrating CPT, SFT, and RAG integration.
Instruction-Response Data Construction
A core methodological strength of LuWen lies in its approach to instruction-response generation for SFT. Self-collected legal texts, predominantly narrative, are systematically abstracted and reformatted into Q&A pairs tailored for practical legal tasks—charge prediction, provision identification, case summarization, document extraction, and judicial reasoning.
Manual seed instructions define task requirements and multi-step response structuring, paving the way for automated augmentation using template expansion and ChatGPT-assisted answer generation. Rigorous data filtering ensures representative diversity and excludes outdated or sensitive content, leveraging clustering and mapping dictionaries for term upgrades.
Figure 2: An example of constructed instruction-response data, showcasing structured task abstraction and template-based expansion.
Retrieval-Augmented Generation: Knowledge Base Integration
LuWen’s RAG approach is founded on a multi-source, multi-path retrieval pipeline. Legal knowledge bases are constructed from law statutes, judicial interpretations, document templates, textbooks, case libraries, examination archives, and Q&A libraries. Each item is stored as a key-value pair, optimizing both retrieval accuracy and downstream augmentation.
Intent recognition directs queries to appropriate sources, while retrieval combines statistical (keyword matching) and semantic (vector similarity) methods, the latter enhanced by contrastive learning on statutes and case materials. Knowledge fusion mechanisms assemble relevant multi-source snippets for input to the model, increasing both factual accuracy and legal relevance.
Figure 3: Multi-source, multi-path legal knowledge retrieval process, encompassing intent recognition and hybrid retrieval.
A practical demonstration of LuWen’s retrieval in action evidences the model’s ability to synthesize case knowledge and statutory provisions for informed, context-aware responses.
Figure 4: Sample display of LuWen added to the retrieval database, highlighting integrated knowledge response.
Experimental Evaluation and Quantitative Results
LuWen was evaluated across five legal tasks—legal judgment prediction, judicial examination, text summarization, law article question answering, and judicial decision reasoning—using both prediction and generative settings. Baselines included Baichuan2-Chat, GLM2, Qwen, InternLM2, GPT-3.5, and Baichuan+SFT.
In legal judgment prediction, LuWen achieved statute prediction accuracy of 0.35 and charge prediction accuracy of 0.31, substantially outperforming all baselines. Supervised fine-tuning on targeted legal tasks is identified as the principal driver of this improvement, surpassing even GPT-3.5 and Baichuan2 models.
For generation tasks, LuWen attained legal text summarization scores of 71.6, compared to Baichuan+SFT’s 47.9 and GPT-3.5’s 67.3. In law article question answering, LuWen scored 84.0, more than doubling GPT-3.5’s 38.0, and exceeding Baichuan+SFT’s 44.0. Judicial decision reasoning reached 53.7 for LuWen, with clear dominance over baselines.
Strong quantitative performance on generation tasks reflects LuWen’s advanced fluency and domain expertise, especially for knowledge-based reasoning and legal interpretation where domain-specific instruction-tuning and RAG offer critical advantages.
Practical and Theoretical Implications
LuWen’s architecture demonstrates that legal domain LLMs benefit markedly from domain-optimized continual pre-training, careful instruction dataset construction, and retrieval-augmented generation. The hybrid approach allows practitioners to deploy models that are contextually accurate and responsive to evolving legal knowledge, addressing practical necessities such as legal consultation, case analysis, statute recommendation, and document summarization.
Theoretically, LuWen’s integrated retrieval mechanism positions it as a dynamically updatable system, reducing retraining costs as statutory changes emerge. The balance between general-language and domain-legal corpora is shown to be essential for retaining broad natural language understanding while excelling in domain-specific tasks.
Future Directions
The authors highlight future directions including: autonomous task decomposition via CoT or agent-based frameworks, automated knowledge base-specific retrieval model training, and expansion into multimodal capabilities (audio, image, and video) to better reflect legal domain practicalities. These improvements could drive further advances in both model robustness and applicability across diverse legal scenarios.
Conclusion
LuWen represents a comprehensive technical contribution to legal-domain LLMs, combining continual pre-training, rigorous instruction-tuning, and retrieval-augmented generation to achieve state-of-the-art performance in specialized legal tasks. The approach demonstrably elevates both prediction and generation quality, with significant implications for future legal AI developments in real-world, rapidly-evolving contexts.