SaulLM-54B & SaulLM-141B: Scaling Up Domain Adaptation for the Legal Domain

Pierre Colombo, Telmo Pires, Malik Boudiaf, Rui Melo, Gabriel Hautreux, Etienne Malaboeuf, Johanne Charpentier, Dominic Culver, Michael Desa

Introduction

The legal domain presents a unique challenge for Large Language Models (LLMs) due to its dense, highly structured language and the requirement for extreme precision across diverse jurisdictions. While general-purpose models like GPT-4 demonstrate significant capability, they often lack the specialized expertise required for complex legal reasoning. Previous efforts to develop domain-specific legal LLMs were limited by smaller model sizes (typically 7B to 12B parameters) and relatively small training datasets.

This research explores a fundamental scaling question: To what extent can legal specialization be improved by scaling both model size and corpus volume? To address this, the authors developed SaulLM-54B and SaulLM-141B, the first large-scale, open-source models specifically adapted for the legal sector.

Methodology

The researchers utilized the Mixtral Mixture-of-Experts (MoE) architecture as a foundation. The adaptation process follows a rigorous three-stage pipeline designed to instill legal expertise while maintaining general reasoning capabilities.

The three-stage domain adaptation pipeline for SaulLM, transitioning from Mixtral-Base to SaulLM-Large.
  1. Continued Pretraining: The base Mixtral models underwent continued training on a massive 500-billion-token legal corpus. To prevent "catastrophic forgetting," the training included a "replay" of 2% general data and 5% math data, ensuring the preservation of logical reasoning skills.
  2. Legal Instruction Fine-Tuning (IFT): The models were trained to follow specific legal commands using a combination of real-world data and synthetically generated dialogues.
  3. Preference Alignment (DPO): Using Direct Preference Optimization (DPO), the models were aligned with human-like legal interpretations, teaching them to prioritize accurate and logically sound reasoning.

Datasets and Evaluation

The scale of data used in this project is unprecedented for domain-specific modeling. The pretraining corpus includes 520 billion tokens sourced from the FreeLaw subset, the EDGAR database, legislation from the UK, EU, and Australia, and a 400-billion-token web-scraped legal dataset.

Performance was evaluated using LegalBench-Instruct, a comprehensive benchmark testing six types of legal reasoning: issue-spotting, rule-recall, rule-application, rule-conclusion, interpretation, and rhetorical understanding.

Key Results

The adaptation strategy yielded significant performance gains. SaulLM-large (141B) achieved a mean balanced accuracy of 75.34% on LegalBench-Instruct, notably surpassing both GPT-4 (73.35%) and Llama-3 (70.20%).

Mean Balanced Accuracy of SaulLM-large compared to other state-of-the-art models on LegalBench-Instruct.

Analysis across specific reasoning categories showed that the SaulLM family consistently improved in tasks such as issue-spotting and drawing legal conclusions. The researchers found that scaling from 7B to 141B parameters provided a massive boost in legal reasoning, although they observed "inverse scaling" in approximately 20% of tasks, where larger models performed worse.

Discussion and Insights

Several key insights emerged from the scaling process:

  • The Role of Math Data: Including 5% math data during pretraining was critical. Without it, the model's logical reasoning performance declined, suggesting that mathematical logic serves as a foundation for legal reasoning.
  • Synthetic Data Efficiency: Generating high-quality legal reasoning chains using existing strong models (like Mixtral-142B-Instruct) proved to be a powerful alignment tool.
  • Efficiency of Adaptation: Continued pretraining on a specialized corpus was found to be a more energy-efficient path to domain expertise than training a model from scratch.

Limitations

Despite their success, the models exhibit some trade-offs. The heavy specialization makes them slightly less effective at following generic, non-legal instructions. Additionally, the DPO alignment process sometimes increased verbosity, which occasionally caused automated evaluation parsers to fail, leading to potential under-reporting of performance in certain interpretation tasks.

The SaulLM models are released under the MIT License, providing the research community with a robust open-source toolkit for legal AI development.

Summary updated

BibTeX
@inproceedings{colombo2024saullm,
  author = {Pierre Colombo and Telmo Pires and Malik Boudiaf and Rui Melo and Gabriel Hautreux and Etienne Malaboeuf and Johanne Charpentier and Dominic Culver and Michael Desa},
  title = {{SaulLM-54B \& SaulLM-141B: Scaling Up Domain Adaptation for the Legal Domain}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=NLUYZ4ZqNq},
}
Figure