LawInstruct: A Resource for Studying Language Model Adaptation to the Legal Domain

Joel Niklaus, Lucia Zheng, Arya D. McCarthy, Christopher Hahn, Brian M. Rosen, Peter Henderson, Daniel E. Ho, Garrett Honke, Percy Liang, Christopher D. Manning

Abstract

Large Language Models (LLMs) have demonstrated remarkable capabilities in the legal domain, yet the most performant models remain closed-source, raising privacy and data protection concerns for legal practitioners. This paper introduces LawInstruct, a large-scale legal instruction-tuning dataset containing 12 million examples across 24 languages and 17 jurisdictions. By fine-tuning the T5 model family on this resource, we develop FLawN-T5. Our results show that FLawN-T5 achieves a state-of-the-art 50% performance improvement in legal reasoning for base-sized open models on the LegalBench suite, while maintaining robust performance on general-knowledge benchmarks like MMLU.

Introduction

The legal profession requires high-precision reasoning, mastery of "legalese," and adherence to jurisdiction-specific statutes. While proprietary models like GPT-4 have passed the Bar Exam, their "black box" nature is often incompatible with the strict confidentiality requirements of law firms. Open-source alternatives are preferred for on-premise deployment but typically struggle with legal nuances due to a lack of specialized training data.

Existing instruction-tuning datasets, such as Super-NaturalInstructions, contain a negligible fraction of legal tasks. This "data desert" prevents open models from developing the specialized logic required for legal interpretation. To address this, we present LawInstruct, the largest collection of legal instructions to date, and evaluate the impact of domain-specific instruction tuning on model performance.

Methodology and Model Adaptation

We employed a systematic two-stage adaptation strategy using the T5 (Text-to-Text Transfer Transformer) architecture, scaling from 60M to 11B parameters.

The FLawN-T5 training and evaluation pipeline, illustrating the transition from general-purpose Flan-T5 to domain-specific legal expertise.
  1. Continued Pretraining (CPT): Models were first exposed to the MultiLegalPile, a 689GB multilingual legal corpus. This phase allows the model to internalize the specialized vocabulary and structural patterns of legal text.
  2. Instruction Fine-Tuning (IFT): We converted 58 distinct legal datasets into an instruction-following format using 107 manually curated templates. This process created LawInstruct, teaching the models to execute specific legal tasks such as summarization, entailment, and question answering.

A key finding in our methodology was the importance of "mixing." Training exclusively on legal data led to performance degradation. Optimal results were achieved by mixing LawInstruct with general-purpose instruction data (Flan), ensuring the model retained its foundational logic while acquiring specialized expertise.

The LawInstruct Dataset

LawInstruct represents a significant expansion of available legal AI resources. It encompasses 12 million examples across 24 languages and 17 jurisdictions, covering a wide array of cognitive tasks.

Distribution of task types and jurisdictions within the LawInstruct dataset, highlighting its diversity in both function and geography.

The dataset includes tasks ranging from court case summarization and argument mining to complex legal QA. By including 24 EU languages, LawInstruct provides a robust foundation for multilingual legal research, moving beyond the English-centric focus of many previous datasets.

Key Insights and Results

Our evaluation on LegalBench (162 tasks) and MMLU yielded several critical insights:

  • Instruction Tuning vs. Pretraining: For larger models, instruction tuning (IFT) provided a more significant performance boost than continued pretraining (CPT). This suggests that high-level legal reasoning is more effectively learned through structured task examples than raw text exposure.
  • The "Generalist" Anchor: Maintaining a mix of general instruction data is vital. General-purpose logic serves as a necessary scaffold for specialized legal reasoning; without it, models suffer from a loss of versatility.
  • Performance Gains: The resulting FLawN-T5 model set new benchmarks for its size class. The "Base" model achieved a 15-point (50%) improvement over standard Flan-T5 on LegalBench. The XL variant reached a balanced accuracy of 58.1, an 8-point lead over previous open-source baselines.
  • Preservation of General Knowledge: Critically, the specialized training did not result in "catastrophic forgetting." Performance on MMLU remained stable across all model sizes.

Limitations and Future Directions

While LawInstruct significantly closes the gap, challenges remain. Open models still struggle with "Conclusion" tasks—the most cognitively demanding category in LegalBench—when compared to massive closed-source models. Furthermore, the reliance on human-written templates may limit the linguistic variety the model can process.

Future work should focus on evaluating long-form generative tasks, such as brief drafting, which require expert human evaluation. By releasing the permissively licensed portions of LawInstruct, we hope to catalyze further innovation in the open-source legal AI community.

Summary updated

BibTeX
@inproceedings{niklaus2025lawinstruct,
  author = {Joel Niklaus and Lucia Zheng and Arya D. McCarthy and Christopher Hahn and Brian M. Rosen and Peter Henderson and Daniel E. Ho and Garrett Honke and Percy Liang and Christopher D. Manning},
  title = {{LawInstruct: A Resource for Studying Language Model Adaptation to the Legal Domain}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.findings-naacl.7},
}
Figure