Skip to main content
QUICK REVIEW

[Paper Review] Legal Transformer Models May Not Always Help

Saibo Geng, Rémi Lebret|arXiv (Cornell University)|Sep 14, 2021
Topic ModelingComputer Science15 references5 citations
TL;DR

This paper investigates the effectiveness of domain-adaptive pre-training and adapters in legal NLP, finding that domain-adapted models like LegalRoBERTa only significantly improve performance on low-resource tasks. It demonstrates that adapters achieve comparable performance to full fine-tuning with much lower training costs, and releases LegalRoBERTa, a RoBERTa-based model pre-trained on legal text for improved legal NLP applications.

ABSTRACT

Deep learning-based Natural Language Processing methods, especially transformers, have achieved impressive performance in the last few years. Applying those state-of-the-art NLP methods to legal activities to automate or simplify some simple work is of great value. This work investigates the value of domain adaptive pre-training and language adapters in legal NLP tasks. By comparing the performance of language models with domain adaptive pre-training on different tasks and different dataset splits, we show that domain adaptive pre-training is only helpful with low-resource downstream tasks, thus far from being a panacea. We also benchmark the performance of adapters in a typical legal NLP task and show that they can yield similar performance to full model tuning with much smaller training costs. As an additional result, we release LegalRoBERTa, a RoBERTa model further pre-trained on legal corpora.

Motivation & Objective

  • To evaluate whether domain-adaptive pre-training improves performance on legal NLP tasks compared to standard models.
  • To investigate the relationship between domain-adaptive pre-training benefits and downstream task data size.
  • To assess the performance of adapters as an efficient alternative to full fine-tuning in legal NLP.
  • To release a new legal-specific RoBERTa model, LegalRoBERTa, pre-trained on curated legal corpora.
  • To determine under what conditions domain-adaptive pre-training is truly beneficial in legal NLP applications.

Proposed method

  • Collected and cleaned 4.9GB of public legal text from sources including Caselaw Access Project, Google Patents, and patent litigation documents.
  • Pre-trained a RoBERTa model on this legal corpus to create LegalRoBERTa, using masked language modeling with domain-specific hyperparameters.
  • Benchmarked LegalRoBERTa and other legal models (e.g., LegalBERT) against base BERT and RoBERTa on two legal NLP tasks: legal text classification and case retrieval.
  • Systematically varied training data size in the legal text classification task to assess the impact of data scarcity on domain-adaptive pre-training gains.
  • Implemented and evaluated adapters—small, trainable neural modules inserted into transformer layers—on legal text classification, comparing their performance and training cost to full fine-tuning.
  • Used standard metrics (Precision, Recall, F1, R@5, P@5, RP@5, NDCG@5) to evaluate retrieval and classification performance across models and settings.

Experimental results

Research questions

  • RQ1Does domain-adaptive pre-training with legal corpora significantly improve performance on legal NLP tasks compared to standard pre-trained models?
  • RQ2How does the benefit of domain-adaptive pre-training vary with the size of the downstream training dataset?
  • RQ3Can adapter-based fine-tuning achieve performance comparable to full model fine-tuning while reducing training cost and storage requirements?
  • RQ4Is there a measurable performance gain from using LegalRoBERTa over base RoBERTa or BERT in legal text classification and retrieval tasks?
  • RQ5Under what conditions should researchers prefer domain-adapted models over standard models in legal NLP applications?

Key findings

  • Domain-adaptive pre-training with legal corpora only yields significant performance improvements on low-resource downstream tasks, with marginal gains on high-resource tasks.
  • LegalRoBERTa outperformed base RoBERTa and BERT on low-resource text classification and retrieval tasks, achieving an F1 score of 0.72 on the LMTC task and NDCG@5 of 0.80 on case retrieval.
  • LegalBERT achieved a higher F1 (0.73) than LegalRoBERTa (0.72) on the same retrieval task, but both outperformed base RoBERTa (F1: 0.74) and BERT (F1: 0.71).
  • Adapters achieved comparable performance to full fine-tuning: on the LMTC task, the adapter-based model matched the full fine-tuned model’s F1 (0.72) and NDCG@5 (0.80).
  • The performance gain from domain-adaptive pre-training was negligible when the downstream training data was large, but substantial when data was scarce, confirming a strong data-size dependency.
  • Despite using less training data than LegalBERT, LegalRoBERTa achieved similar performance, suggesting efficient pre-training is possible with focused legal corpora.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.