While large language models (LLMs) have showcased impressive capabilities, they struggle with addressing legal queries due to the intricate complexities and specialized expertise required in the legal field. In this paper, we introduce InternLM-Law, a specialized LLM tailored for addressing diverse legal queries related to Chinese laws, spanning from responding to standard legal questions (e.g., legal exercises in textbooks) to analyzing complex real-world legal situations. We meticulously construct a dataset in the Chinese legal domain, encompassing over 1 million queries, and implement a data filtering and processing pipeline to ensure its diversity and quality. Our training approach involves a novel two-stage process: initially fine-tuning LLMs on both legal-specific and general-purpose content to equip the models with broad knowledge, followed by exclusive fine-tuning on high-quality legal data to enhance structured output generation. InternLM-Law achieves the highest average performance on LawBench, outperforming state-of-the-art models, including GPT-4, on 13 out of 20 subtasks. We make InternLM-Law and our dataset publicly available to facilitate future research in applying LLMs within the legal domain.
翻译:尽管大语言模型(LLMs)已展现出令人印象深刻的能力,但由于法律领域所需的错综复杂性和专业知识,它们在处理法律咨询方面仍面临困难。本文介绍了InternLM-Law,这是一个专门用于处理与中国法律相关的各类法律咨询的定制化大语言模型,其范围涵盖从回答标准法律问题(例如教科书中的法律练习题)到分析复杂的现实法律情境。我们精心构建了一个中文法律领域的数据集,包含超过100万个查询,并实施了一个数据过滤与处理流程,以确保其多样性和质量。我们的训练方法采用了一种新颖的两阶段流程:首先在特定法律内容和通用内容上对大语言模型进行微调,使模型具备广泛的知识;随后,仅在高质量法律数据上进行专门微调,以增强结构化输出的生成能力。InternLM-Law在LawBench基准测试中取得了最高的平均性能,在20个子任务中的13个上超越了包括GPT-4在内的最先进模型。我们将公开发布InternLM-Law及我们的数据集,以促进未来在大语言模型于法律领域应用方面的研究。