Evaluating Transformer Models for Named Entity Recognition in Indian Legal Texts

Named Entity Recognition (NER) in legal texts is vital for extracting information from vast, unstructured legal documents. The complexity of legal language—characterized by formal style, domain-specific terminology, and unique entity types such as case numbers, legal citations, court names, judges, and involved parties—poses significant challenges. Traditional machine learning models fall short due to their reliance on manual feature engineering and limited adaptability to the nuanced legal language. This paper evaluates transformer-based models, DistilBERT, DistilRoBERTa, and InLegalBERT, for NER in Indian court judgments using a comprehensive dataset prepared by OpenNyAI, which contains 46,545 annotated legal entities across 14 distinct types (e.g., petitioner, respondent, statute). To address imbalanced entity distribution, we propose a cleaning process and optimization of dataset splits using Jensen-Shannon Divergence, ensuring a more balanced representation of entities across training, validation, and test sets. We fine-tuned each model on three versions of the dataset: (1) the original dataset, (2) a cleaned dataset with sentences lacking tagged entities removed, and (3) a version with optimized entity distribution. Performance evaluation based on precision, recall, and F1-score revealed that DistilRoBERTa achieved the highest F1-score of 0.8672, significantly outperforming DistilBERT and demonstrating improvements over InLegalBERT, which is pre-trained on legal texts. Our results underscore that balanced dataset splits and robust preprocessing are crucial for enhancing model generalizability and performance in legal NER tasks, as evidenced by substantial gains in F1-scores following these preprocessing steps.

Authors

Publication Details

Published
2025-03-07
DOI
https://doi.org/10.1109/icdt63985.2025.10986633
Primary Topic
Topic Modeling
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Evaluating Transformer Models for Named Entity Recognition in Indian Legal Texts

Ayush Bhandari, Aarti Sahitya, Prathamesh Gawade, Priyanshu Giriyan
Topic Modeling
article

Evaluating Transformer Models for Named Entity Recognition in Indian Legal Texts

Ayush Bhandari, Aarti Sahitya, Prathamesh Gawade, Priyanshu Giriyan
article en

Abstract

Named Entity Recognition (NER) in legal texts is vital for extracting information from vast, unstructured legal documents. The complexity of legal language—characterized by formal style, domain-specific terminology, and unique entity types such as case numbers, legal citations, court names, judges, and involved parties—poses significant challenges. Traditional machine learning models fall short due to their reliance on manual feature engineering and limited adaptability to the nuanced legal language. This paper evaluates transformer-based models, DistilBERT, DistilRoBERTa, and InLegalBERT, for NER in Indian court judgments using a comprehensive dataset prepared by OpenNyAI, which contains 46,545 annotated legal entities across 14 distinct types (e.g., petitioner, respondent, statute). To address imbalanced entity distribution, we propose a cleaning process and optimization of dataset splits using Jensen-Shannon Divergence, ensuring a more balanced representation of entities across training, validation, and test sets. We fine-tuned each model on three versions of the dataset: (1) the original dataset, (2) a cleaned dataset with sentences lacking tagged entities removed, and (3) a version with optimized entity distribution. Performance evaluation based on precision, recall, and F1-score revealed that DistilRoBERTa achieved the highest F1-score of 0.8672, significantly outperforming DistilBERT and demonstrating improvements over InLegalBERT, which is pre-trained on legal texts. Our results underscore that balanced dataset splits and robust preprocessing are crucial for enhancing model generalizability and performance in legal NER tasks, as evidenced by substantial gains in F1-scores following these preprocessing steps.

Peace, Justice and strong institutions
Openalex Percentile: Top 95%
Topic Modeling
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.