Analysing similarities between legal court documents using natural language processing approaches based on transformers

Recent advancements in Artificial Intelligence have yielded promising results in addressing complex challenges within Natural Language Processing (NLP), serving as a vital tool for expediting judicial proceedings in the legal domain. This study focuses on the detection of similarity among judicial documents within an inference group, employing eight NLP techniques grounded in transformer architecture, specifically applied to a case study of legal proceedings in the Brazilian judicial system. The transformer-based models utilised - BERT, GPT-2, RoBERTa, and LlaMA - were pre-trained on general-purpose corpora of Brazilian Portuguese and subsequently fine-tuned for the legal sector using a dataset of 210,000 legal cases. Vector representations of each legal document were generated based on their embeddings, facilitating the clustering of lawsuits and enabling an evaluation of each model's performance through the cosine distance between group elements and their centroid. The results demonstrated that transformer-based models outperformed traditional NLP techniques, with the LlaMA model, specifically fine-tuned for the Brazilian legal domain, achieving the highest accuracy. This research presents a methodology employed in a real case involving substantial documentary content that can be adapted for various applications. It conducts a comparative analysis of existing techniques focused on a non-English language to quantitatively explain the results obtained with various NLP transformers-based models. This approach advances the current state of the art in NLP applications within the legal sector and contributes to the achievement of Sustainable Development Goals.

Authors

Institutions

Publication Details

Journal
PLoS ONE
Published
2025-04-08
DOI
https://doi.org/10.1371/journal.pone.0320244
Citations
2
Primary Topic
Artificial Intelligence in Law
Type
article
Field-Weighted Citation Impact
17.04
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Analysing similarities between legal court documents using natural language processing approaches based on transformers

Erick Giovani Sperandio Nascimento, Raphael Souza de Oliveira
2 citations
PLoS ONE
Artificial Intelligence in Law
17.04
article

Analysing similarities between legal court documents using natural language processing approaches based on transformers

Erick Giovani Sperandio Nascimento, Raphael Souza de Oliveira
article en
2 citations

Abstract

Recent advancements in Artificial Intelligence have yielded promising results in addressing complex challenges within Natural Language Processing (NLP), serving as a vital tool for expediting judicial proceedings in the legal domain. This study focuses on the detection of similarity among judicial documents within an inference group, employing eight NLP techniques grounded in transformer architecture, specifically applied to a case study of legal proceedings in the Brazilian judicial system. The transformer-based models utilised - BERT, GPT-2, RoBERTa, and LlaMA - were pre-trained on general-purpose corpora of Brazilian Portuguese and subsequently fine-tuned for the legal sector using a dataset of 210,000 legal cases. Vector representations of each legal document were generated based on their embeddings, facilitating the clustering of lawsuits and enabling an evaluation of each model's performance through the cosine distance between group elements and their centroid. The results demonstrated that transformer-based models outperformed traditional NLP techniques, with the LlaMA model, specifically fine-tuned for the Brazilian legal domain, achieving the highest accuracy. This research presents a methodology employed in a real case involving substantial documentary content that can be adapted for various applications. It conducts a comparative analysis of existing techniques focused on a non-English language to quantitatively explain the results obtained with various NLP transformers-based models. This approach advances the current state of the art in NLP applications within the legal sector and contributes to the achievement of Sustainable Development Goals.

PLoS ONEVol. 20(4)
Serviço Nacional de Aprendizagem Industrial (BR), University of Surrey (GB), Ministério da Saúde (BR)
Quality Education
Openalex Percentile: Top 2%
Artificial Intelligence in Law
17.04
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.