The Hidden Structure -- Improving Legal Document Understanding Through Explicit Text Formatting
Not on the map. Why?
Abstract (arXiv)
Legal contracts possess an inherent, semantically vital structure (e.g., sections, clauses) that is crucial for human comprehension but whose impact on LLM processing remains under-explored. This paper investigates the effects of explicit input text structure and prompt engineering on the performance of GPT-4o and GPT-4.1 on a legal question-answering task using an excerpt of the CUAD. We compare model exact-match accuracy across various input formats: well-structured plain-text (human-generated from CUAD), plain-text cleaned of line breaks, extracted plain-text from Azure OCR, plain-text extracted by GPT-4o Vision, and extracted (and interpreted) Markdown (MD) from GPT-4o Vision. To give an indication of the impact of possible prompt engineering, we assess the impact of shifting task instructions to the system prompt and explicitly informing the model about the structured nature of the input. Our findings reveal that GPT-4o demonstrates considerable robustness to variations in input structure, but lacks in overall performance. Conversely, GPT-4.1's performance is markedly sensitive; poorly structured inputs yield suboptimal results (but identical with GPT-4o), while well-structured formats (original CUAD text, GPT-4o Vision text and GPT-4o MD) improve exact-match accuracy by ~20 percentage points. Optimizing the system prompt to include task details and an advisory about structured input further elevates GPT-4.1's accuracy by an additional ~10-13 percentage points, with Markdown ultimately achieving the highest performance under these conditions (79 percentage points overall exact-match accuracy). This research empirically demonstrates that while newer models exhibit greater resilience, careful input structuring and strategic prompt design remain critical for optimizing the performance of LLMs, and can significantly affect outcomes in high-stakes legal applications.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 23 of its 46 references that are in the map. First posted on arXiv 19 May 2025.
Builds on
23 of 46 references.
References · 23
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023GPT-4 Technical Reportcited by 18,396
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,626
- 2024GPT-4o System Cardcited by 4,588
- 2023Let's Verify Step by Stepcited by 3,789
- 2024A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and Applicationscited by 431
- 2023Ragas: Automated Evaluation of Retrieval Augmented Generationcited by 418
- 2023LegalBench: A Collaboratively Built Benchmark for Measuring Legal Reasoning in Large Language Modelscited by 336
- 2021CUAD: An Expert-Annotated NLP Dataset for Legal Contract Reviewcited by 236
- 2024Does Prompt Formatting Have Any Impact on LLM Performance?cited by 141
- 2023Large Language Models in Law: A Surveycited by 128
11 more
- 2024The Prompt Report: A Systematic Survey of Prompt Engineering Techniquescited by 121
- 2024LegalBench-RAG: A Benchmark for Retrieval-Augmented Generation in the Legal Domaincited by 118
- 2024Efficient multi-prompt evaluation of LLMscited by 73
- 2023PromptBench: A Unified Library for Evaluation of Large Language Modelscited by 44
- 2024Better Call GPT, Comparing Large Language Models Against Lawyerscited by 26
- 2024Struct-X: Enhancing Large Language Models Reasoning with Structured Datacited by 11
- 2024Notes on Applicability of GPT-4 to Document Understandingcited by 7
- 2025MDEval: Evaluating and Enhancing Markdown Awareness in Large Language Modelscited by 7
- 2025A Law Reasoning Benchmark for LLM with Tree-Organized Structures including Factum Probandum, Evidence and Experiencescited by 7
- 2021The Law of Large Documents: Understanding the Structure of Legal Contracts Using Visual Cuescited by 4
- 2025Effect of Selection Format on LLM Performancecited by 3
Built on by
Citing papers per year: 2026: 5.
5 papers.
- 2026Benchmarking Small Language Models and Small Reasoning Language Models on System Log Severity Classificationcited by 1
- 2026Agent-Based Software Artifact Evaluationcited by 0
- 2026MIRAGE: A Micro-Interaction Relational Architecture for Grounded Exploration in Multi-Figure Artworkscited by 0
- 2026Information Extraction from Electricity Invoices with General-Purpose Large Language Modelscited by 0
- 2026ContraVis: Evidence-Grounded Visual Analytics for Contradiction Review in Legal Contractscited by 0
- 2026ContraVis: Evidence-Grounded Visual Analytics for Contradiction Review in Legal Contracts22 Sep 2026
- 2026MIRAGE: A Micro-Interaction Relational Architecture for Grounded Exploration in Multi-Figure Artworks26 Apr 2026
- 2026Information Extraction from Electricity Invoices with General-Purpose Large Language Models1 Apr 2026
- 2026Agent-Based Software Artifact Evaluation2 Feb 2026
- 2026Benchmarking Small Language Models and Small Reasoning Language Models on System Log Severity Classification12 Jan 2026