Automated vs Manual Prompt Optimisation for Legal Contract Clause Extraction: A Comparative Study of DSPy and Few-Shot Prompting Using LLM-Based Evaluation

This study compares Manual Few-Shot promptingversus DSPy (Declarative Self-improving Python)for legal contract clause extraction. We evaluated both approaches on 50 real SEClegal contracts from the CUAD benchmark datasetacross 4 clause types: Parties, Governing Law,Expiration Date, and Effective Date. Training set: 10 contractsTest set: 20 contractsEvaluation: Claude Haiku as LLM judge (0-3 scale) Results show DSPy outperforms manual few-shotoverall (1.94 vs 1.85 average score, +4.9%). Key finding: DSPy shows largest improvement onGoverning Law (+21%) — the most complex clause.Manual few-shot wins on Effective Date —the simplest formulaic clause. Practical insight: DSPy beats manual promptingon complexity. Human intuition wins on simplicity.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-06-14
DOI
https://doi.org/10.5281/zenodo.20687196
Primary Topic
Artificial Intelligence in Law
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Automated vs Manual Prompt Optimisation for Legal Contract Clause Extraction: A Comparative Study of DSPy and Few-Shot Prompting Using LLM-Based Evaluation

Ananth Raghavendra
Zenodo (CERN European Organization for Nuclear Research)
Artificial Intelligence in Law
article

Automated vs Manual Prompt Optimisation for Legal Contract Clause Extraction: A Comparative Study of DSPy and Few-Shot Prompting Using LLM-Based Evaluation

Ananth Raghavendra
article en

Abstract

This study compares Manual Few-Shot promptingversus DSPy (Declarative Self-improving Python)for legal contract clause extraction. We evaluated both approaches on 50 real SEClegal contracts from the CUAD benchmark datasetacross 4 clause types: Parties, Governing Law,Expiration Date, and Effective Date. Training set: 10 contractsTest set: 20 contractsEvaluation: Claude Haiku as LLM judge (0-3 scale) Results show DSPy outperforms manual few-shotoverall (1.94 vs 1.85 average score, +4.9%). Key finding: DSPy shows largest improvement onGoverning Law (+21%) — the most complex clause.Manual few-shot wins on Effective Date —the simplest formulaic clause. Practical insight: DSPy beats manual promptingon complexity. Human intuition wins on simplicity.

Zenodo (CERN European Organization for Nuclear Research)
Peace, Justice and strong institutions
Openalex Percentile: Top 3%
Artificial Intelligence in Law
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.

Automated vs Manual Prompt Optimisation for Legal Contract Clause Extraction: A Comparative Study of DSPy and Few-Shot Prompting Using LLM-Based Evaluation — Ananth Raghavendra · Zenodo (CERN European Organization for Nuclear Research) (2026) | TGRS Research Map | TGRS