Manuscript Offprint

arXiv:2610.26313

StrucChunk: Structure-Aware Retrieval for Legal Document RAG

Surya Deep Singh, Ashutosh Tripathi, Gaurav Deep Singh

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Retrieval-Augmented Generation (RAG) systems offer a promising approach for grounding Large Language Model outputs in domain-specific knowledge. Applying RAG to legal documents presents unique challenges: standard chunking strategies fragment hierarchical argument structure, and generic embedding models struggle with the dual vocabulary demands of precise citation matching and semantic understanding. To deal with this, We propose StrucChunk (Structure-Aware Chunking) combined with hybrid dense-sparse retrieval, designed specifically for hierarchically structured legal documents. Our method treats documents as directed acyclic graphs of provisions, preserving clause boundaries and resolving cross-references prior to embedding, with Reciprocal Rank Fusion combining BM25 keyword precision with BGE-M3 semantic representations. We have evaluated our method on five corpora, three legal traditions, and two languages. StrucChunk achieves 100% boundary precision (vs. 7.7% for recursive splitting on CrPC), preserves 97.6% of documented cross-references (vs. 0%), and achieves equivalent section coverage with 40.3% fewer chunks on GDPR. Empirically, on LegalBench-RAG—an independently annotated benchmark of 6,858 query-passage pairs—StrucChunk achieves Char-Recall@8 of 48.18% vs. 23.59% for the best baseline (+104%), surpassing the published state-of-the-art by +83%. On 501 queries each for CrPC and CPC (Indian law), Recall@5 improves from 0.557 to 0.804 (+44.4%) and from 0.158 to 0.259 (+64.6%) respectively; chunking accounts for 88% and 73% of total gain. On 501 GDPR queries (EU law), Recall@5 = 0.868 with R@1 improving +59%. On NitiBench-CCL (3,730 queries, Thai financial law), StrucChunk achieves HR@5 = 0.856 vs. 0.594 for naive chunking (+44.1%), confirming that section-boundary alignment is the dominant factor across languages; naive fixed-size chunking structurally cannot represent 29.6% of Thai legal sections whose text exceeds the chunk limit, and StrucChunk's cross-reference augmentation provides an additional +2.3% specifically on cross-reference queries. We have also released implementation, 5,256 evaluation queries across five legal corpora, annotation methodology, and chunking quality metrics. The code is available at github.com/SinghSuryaDeep/legal-rag-strucchunk-1.

Keywords: Retrieval-Augmented Generation, Legal NLP, Document Chunking, Hybrid Search, Information Retrieval

1 Introduction

The integration of Large Language Models (LLMs) into legal practice has accelerated dramatically, with AI-powered tools now assisting practitioners in contract review, statutory research, regulatory compliance checking, and litigation support. Yet for these tools to be deployable in high-stakes settings—where an erroneous statutory citation can constitute professional malpractice and an incorrect interpretation of a sub-provision can affect fundamental rights—factual precision is non-negotiable. Retrieval-Augmented Generation (RAG) [1] offers a principled approach to this challenge by grounding LLM outputs in authoritative source documents retrieved at query time, thereby reducing reliance on parametric knowledge that may be outdated or hallucinated.

However, even RAG-augmented legal systems exhibit alarming error rates. Dahl et al. [2] found hallucination rates of 58–88% on case law queries; Magesh et al. [3] documented 17–33% hallucination rates in commercial RAG-augmented legal tools, with retrieval failures accounting for ≈40–50% of errors. These findings reveal a fundamental weakness: RAG is only as reliable as what it retrieves. A system that fetches the wrong provision cannot generate a correct legal answer regardless of the LLM's parametric capability. The bottleneck lies squarely in the retrieval layer. Kabir et al. [4] confirm this empirically, reporting that standard RAG pipelines achieve semantic similarity of only 0.76 on legal documents—significantly below 0.91 on scientific text and 0.90 on financial documents—establishing that legal retrieval is a categorically harder problem that demands domain-specific solutions. These findings collectively establish that effective legal RAG requires domain-specific optimization at every pipeline stage.

Legal documents pose three retrieval challenges that standard RAG approaches fail to address.

Hierarchical structure. Statutes are organized by parts, chapters, sections, and subsections, where the hierarchical position of a provision determines its legal scope and effect. Naive chunking by token count severs these logical units, losing the context required to interpret sub-provisions. For instance, a subsection specifying an exception to a legal obligation is uninterpretable in isolation; splitting at token boundaries creates orphaned chunks whose meaning depends entirely on a parent provision that may not be retrieved.

Cross-references. Legal language relies heavily on internal pointers (“subject to Section 167,” “as defined in Article 4(1)”). Standard chunking orphans referenced content from its source, forcing LLMs to reason about incomplete legal specifications.

When a chunk references another provision, the content of that provision is not merely helpful—it is legally required for accurate interpretation.

Vocabulary duality. Legal queries require both exact keyword matching (section numbers, article citations) and semantic understanding (“bail” ≈ “custody,” “consent” ≈ “agreement”). Neither pure dense retrieval (which excels at semantic similarity but misses exact citation matching) nor pure sparse retrieval (which excels at keyword matching but misses paraphrase and synonym relationships) resolves this tension alone.

The root cause of these failures is that standard RAG pipelines treat legal documents as flat sequences of text to be divided by token count. This representation discards precisely the information most important for legal retrieval: the hierarchical position of a provision within the statutory scheme, the identity of provisions it cross-references, and the breadcrumb trail from the governing chapter to the specific sub-clause. We propose that effective legal retrieval requires what we term a Legal Map—a representation that preserves the document's logical structure as a navigational aid embedded directly in chunk content prior to indexing, rather than stored as metadata that generic embedding models ignore. This structural signal, we argue, is the dominant factor in retrieval quality for hierarchically organized legal corpora.

We have summarized our all contributions as follows:

  1. StrucChunk (Structure-Aware Chunking): a chunking strategy treating legal documents as directed acyclic graphs (DAGs) of nested provisions, preserving clause boundaries and prepending hierarchical context, with sentence-boundary splitting for oversized sections.

  2. Hybrid Retrieval Pipeline: BM25 combined with BGE-M3 embeddings via Reciprocal Rank Fusion, jointly addressing keyword precision and semantic understanding.

  3. Chunking Quality Metrics: four intrinsic metrics validating the chunking contribution independently of retrieval: boundary precision, cross-reference preservation rate, chunk count efficiency, and intra-chunk semantic coherence.

  4. Evaluation: independent validation (LegalBench-RAG), mechanistic analysis (CrPC + CPC), cross-domain generalization (GDPR), and cross-language generalization (NitiBench-CCL, Thai), following the empirical rigor principles of Sculley et al. [5].

  5. Annotated Evaluation Datasets: 5,256 queries across five legal corpora (CrPC: 501, CPC: 501, GDPR: 501, LBR: 776 independent, NitiBench-CCL: 3,730 independent), with documented annotation methodology.

These contributions yield consistent, large-magnitude improvements validated across five corpora spanning three legal traditions and two languages. On LegalBench-RAG (independently annotated, 776 queries), StrucChunk achieves Char-Recall@8 = 48.18% vs. 23.59% for the best baseline (+104%), surpassing published state-of-the-art by +83%. On CrPC (501 queries), Recall@5 improves from 0.557 to 0.804 (+44.4%), with 2×2 ablation confirming that chunking accounts for 88% of the total gain. On NitiBench-CCL (3,730 Thai queries, independently annotated), HR@5 = 0.856 vs. 0.594 for naive chunking (+44.1%), and structural analysis reveals that 29.6% of Thai legal sections are structurally unrepresentable by any naive fixed-size chunk. All improvements are statistically significant ( p≤0.002p \leq 0.002, Wilcoxon signed-rank with Benjamini-Hochberg correction; Cohen's d 0.14–0.69).

Our work specifically targets retrieval quality for hierarchically structured legal documents. We do not evaluate downstream answer quality or claim generalization to unstructured legal document types without further validation.

Paper structure. Section 2 reviews related work on RAG systems, legal NLP, hierarchical document structure, chunking strategies, and hybrid retrieval. Section 3 introduces the StrucChunk algorithm and hybrid retrieval pipeline, preceded by a formal problem statement. Section 4 details the experimental design, corpus statistics, baselines, and evaluation protocols. Section 5 presents results, from intrinsic chunking quality metrics through all retrieval evaluations. Section 6 discusses the Legal Map hypothesis, cross-language generalization, failure analysis, and limitations. Section 7 addresses broader impact, and Section 8 concludes with future directions.

References (20)