Abstract
Natural Language Processing (NLP) in the legal domain has seen increasing success with the emergence of Transformer-based Pre-trained Language Models (PLMs) pre-trained on legal text. PLMs trained over European and US legal text are available publicly; however, legal text from other domains, such as India, have a lot of distinguishing characteristics. In this work, we investigate pre-training in the Indian legal domain. We re-train (continue pre-training) two popular legal PLMs, LegalBERT and CaseLawBERT, on Indian legal data, as well as train a model from scratch with a vocabulary based on Indian legal text. We apply these PLMs over three benchmark legal NLP tasks—Legal Statute Identification from facts, Semantic Segmentation of Court Judgment Documents, and Court Appeal Judgment Prediction—over both Indian and non-Indian (EU, UK) datasets. We observe that our approach not only enhances performance on the new domain (Indian texts) but also over the original domain (European and UK texts).
Introduction: The Jurisdictional Challenge
While Large Language Models (LLMs) like BERT have revolutionized NLP, they often stumble in specialized fields like law. Existing "Legal BERTs" (such as those trained on EU or US data) are available, but law is inherently jurisdictional. Indian legal text presents unique challenges that standard models are ill-equipped to handle:
- Linguistic Idiosyncrasies: Frequent use of local terms (e.g., daroga for constable, lathi for stick) and specific salutations (Shri, Smt).
- Data Noise: Many Indian legal records are digitized from handwritten or poorly scanned documents, leading to missing spaces and punctuation errors that trip up standard tokenizers.
- Document Length: Legal judgments are far longer than the 512-token limit of standard BERT models.
To address these issues, researchers from IIT Kharagpur developed specialized Transformer models—InLegalBERT, InCaseLawBERT, and CustomInLawBERT—by pre-training on a massive 27GB corpus of Indian court judgments and statutes.
Methodology
The researchers took three distinct approaches to model development:
- Continued Pre-training (InLegalBERT & InCaseLawBERT): They took existing models (LegalBERT and CaseLawBERT) and continued their training on the Indian corpus. This allows the model to retain prior legal knowledge while adapting to Indian nuances.
- Training from Scratch (CustomInLawBERT): They built a model from the ground up, including a custom vocabulary generated via the WordPiece algorithm on Indian legal text to better handle local terms and OCR noise.
- Hierarchical BERT (HierBERT) Architecture: To handle long documents, they used a "Hierarchical BERT" setup. This uses a BERT encoder for individual text chunks and an LSTM with an Attention head to aggregate those chunks into a full document representation.
Datasets
The study utilized a massive 27GB pre-training corpus consisting of ~5.4 million documents, including judgments from the Supreme Court of India and 26 High Courts (1950–2019) and 1,113 Central Government Acts.
For evaluation, they used five benchmark datasets: ILSI (Indian Legal Statute Identification), ECtHR-B (European Court of Human Rights), ISS & UKSS (Semantic segmentation of Indian and UK Supreme Court cases), and ILDC-multi (Indian Legal Documents Corpus for judgment prediction).
Key Results and Insights
The "Cross-Domain" Bonus
One of the most striking findings was that InLegalBERT (trained on Indian data) outperformed the original LegalBERT on European (ECtHR) and UK datasets. This suggests that exposure to diverse legal English—even from a different country—helps the model learn a more robust "legal-ese" representation.
Performance Highlights
- State-of-the-Art (SOTA): InLegalBERT established new SOTA results on 4 out of the 5 benchmark datasets tested.
- Perplexity Gains: InLegalBERT achieved a perplexity of 5.25 on Indian text, a massive improvement over the vanilla BERT's 25.76.
- Statute Identification: On the Indian ILSI dataset, InLegalBERT achieved an m-F1 of 64.58%, significantly higher than vanilla BERT (59.11%).
- Judgment Prediction: On the ILDC-multi task, InLegalBERT reached an m-F1 of 83.09%, outperforming the best results reported in the original dataset paper (77.07%).
Conclusion
This work demonstrates that domain-specific "continued pre-training" is a powerful tool for specialized NLP. While LegalBERT proved more adaptable to the Indian context than CaseLawBERT, both localized models significantly outperformed general-purpose counterparts. Future directions include exploring hierarchical pre-training to better capture the structural flow of long legal documents and investigating localized re-training as a means to mitigate jurisdictional biases.
Summary updated