Software engineering meets legal texts: LLMs for auto detection of contract smells

Although there have been many major advances in Artificial Intelligence including its application to a wide variety of tasks, some specialized domains remain difficult to tackle. In this work, we examine parallels between software engineering and legal contract drafting and analysis. Porting well-known code smells principles to various legal contracts, we introduce ”contract smells,” text patterns that are indicative of potentially significant issues within contractual agreements. We leverage semi-auto labeling with GPT-4, prompting and expert spot checks, to create datasets for suitability testing of auto detection of these contract smells. Using transformer-based models, we explore the impact of legal domain knowledge, hyperparameters fine tuning and specific task information on detection success. We achieve high accuracy with further fine-tuning of BERT as well as LEGAL-BERT, while more consistent results were achieved using task-specific data. We further demonstrate that although multi-class detection can boost coverage of rare smells, single-class detection yields better accuracy. While this is an initial foray into the idea of contract smells, this work underscores the feasibility of applying advanced NLP techniques and LLMs to automate aspects of legal contract review, suggesting a scalable path toward standardized, machine-assisted legal drafting and analysis. • Showcased introduction of software engineering principles into contract drafting. • Pioneered concepts of ”contract smells” and their automated anomaly detection. • Demonstrated scalable semi-automated labeling with GPT prompts and expert validation. • Successful auto-detection results of pre-trained and task-specific LLMs. • Multi-class models aid complex smells; single-class outperforms on common ones.

Authors

Institutions

Publication Details

Journal
Machine Learning with Applications
Published
2025-03-18
DOI
https://doi.org/10.1016/j.mlwa.2025.100639
Citations
1
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
3.25
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Software engineering meets legal texts: LLMs for auto detection of contract smells

Daniel Katz, Hongming Wang, Moriya Dechtiar
1 citations
Machine Learning with Applications
Software Engineering Research
3.25
article

Software engineering meets legal texts: LLMs for auto detection of contract smells

Daniel Katz, Hongming Wang, Moriya Dechtiar
article en
1 citations

Abstract

Although there have been many major advances in Artificial Intelligence including its application to a wide variety of tasks, some specialized domains remain difficult to tackle. In this work, we examine parallels between software engineering and legal contract drafting and analysis. Porting well-known code smells principles to various legal contracts, we introduce ”contract smells,” text patterns that are indicative of potentially significant issues within contractual agreements. We leverage semi-auto labeling with GPT-4, prompting and expert spot checks, to create datasets for suitability testing of auto detection of these contract smells. Using transformer-based models, we explore the impact of legal domain knowledge, hyperparameters fine tuning and specific task information on detection success. We achieve high accuracy with further fine-tuning of BERT as well as LEGAL-BERT, while more consistent results were achieved using task-specific data. We further demonstrate that although multi-class detection can boost coverage of rare smells, single-class detection yields better accuracy. While this is an initial foray into the idea of contract smells, this work underscores the feasibility of applying advanced NLP techniques and LLMs to automate aspects of legal contract review, suggesting a scalable path toward standardized, machine-assisted legal drafting and analysis. • Showcased introduction of software engineering principles into contract drafting. • Pioneered concepts of ”contract smells” and their automated anomaly detection. • Demonstrated scalable semi-automated labeling with GPT prompts and expert validation. • Successful auto-detection results of pre-trained and task-specific LLMs. • Multi-class models aid complex smells; single-class outperforms on common ones.

Machine Learning with ApplicationsVol. 20
Chicago Kent College of Law (US), Harvard University Press (US), Stanford Medicine (US), Bucerius Law School (DE)
Openalex Percentile: Top 10%
Software Engineering Research
3.25
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.