[Paper Review] LegalRelectra: Mixed-domain Language Modeling for Long-range Legal Text Comprehension
LegalRelectra is a mixed-domain language model trained on legal and medical corpora using the Reformer-based Electra framework to enable long-range text comprehension in personal injury cases. It outperforms general and single-domain models in named entity recognition for legal and medical terminology, especially on long passages up to 8,092 tokens, due to improved architecture and domain-specific tokenization.
The application of Natural Language Processing (NLP) to specialized domains, such as the law, has recently received a surge of interest. As many legal services rely on processing and analyzing large collections of documents, automating such tasks with NLP tools emerges as a key challenge. Many popular language models, such as BERT or RoBERTa, are general-purpose models, which have limitations on processing specialized legal terminology and syntax. In addition, legal documents may contain specialized vocabulary from other domains, such as medical terminology in personal injury text. Here, we propose LegalRelectra, a legal-domain language model that is trained on mixed-domain legal and medical corpora. We show that our model improves over general-domain and single-domain medical and legal language models when processing mixed-domain (personal injury) text. Our training architecture implements the Electra framework, but utilizes Reformer instead of BERT for its generator and discriminator. We show that this improves the model's performance on processing long passages and results in better long-range text comprehension.
Motivation & Objective
- To address the challenge of long-range comprehension in legal text, which exceeds the 512-token limit of standard BERT-based models.
- To improve processing of mixed-domain legal and medical text, such as personal injury cases containing both legal and clinical terminology.
- To enhance model performance by replacing BERT components in the Electra framework with Reformer-based generators and discriminators for longer context handling.
- To evaluate the impact of domain-specific tokenization versus standard BERT tokenization on model performance in legal and medical NER.
- To demonstrate superior performance on downstream named entity recognition tasks involving plaintiff, defendant, medical conditions, and case types in long legal documents.
Proposed method
- Adopted the Electra framework but replaced BERT generators and discriminators with Reformer-based components to enable long-context processing up to 8,092 tokens.
- Pre-trained LegalRelectra on a mixed corpus of legal, medical, and personal injury text to capture domain-specific terminology from both fields.
- Trained a custom domain-specific tokenizer for legal and medical terminology, improving recognition of complex terms compared to standard BERT tokenization.
- Utilized the discriminator in the Electra setup to refine predictions by masking and reconstructing tokens, enhancing representation learning.
- Fine-tuned the model on a named entity recognition (NER) downstream task using a partially automated annotation pipeline for legal and medical entities.
- Evaluated performance against general and specialized models (e.g., BERT, Clinical-Bert, Legal-Bert) on F1 scores for legal and medical entity recognition.
Experimental results
Research questions
- RQ1Can a Reformer-based Electra architecture significantly improve long-range text comprehension in legal documents beyond the 512-token limit of BERT?
- RQ2Does pre-training on a mixed legal and medical corpus enhance performance on both legal and medical named entity recognition compared to single-domain models?
- RQ3How does domain-specific tokenization compare to standard BERT tokenization in terms of accuracy for legal and medical terminology recognition?
- RQ4To what extent does the Electra training framework improve performance on long legal texts compared to standard fine-tuning approaches?
- RQ5Can a single model effectively handle the syntactic and lexical complexity of personal injury cases that span both legal and medical domains?
Key findings
- LegalRelectra outperformed BERT and Legal-Bert in named entity recognition for legal entities such as plaintiff and defendant, especially in long documents where context is critical.
- The model achieved superior F1 scores on legal entity recognition compared to all baselines, demonstrating improved long-range comprehension due to the Reformer-based architecture.
- LegalRelectra showed strong performance on medical terminology recognition, second only to Clinical-Bert, indicating effective learning from mixed-domain pretraining.
- The use of a domain-specific tokenizer improved medical entity recognition compared to the standard BERT tokenizer, which negatively impacted performance on complex medical terms.
- Reformer-based training resulted in better recall than precision, but the overall F1 score was higher than baseline models, confirming the effectiveness of the Electra framework in this context.
- The model demonstrated robustness in extracting key legal information such as case types and injuries, even when such information was located at the beginning of long documents.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.