StrucChunk: Structure-Aware Retrieval for Legal Document RAG
Organizations: Independent Researcher.
Abstract
Retrieval-Augmented Generation (RAG) can ground LLM outputs in domain-specific knowledge, but legal documents are hard: standard chunking fragments hierarchical argument structure, and generic embeddings struggle with both precise citation matching and semantic understanding. We propose StrucChunk (Structure Aware Chunking) with hybrid dense-sparse retrieval for hierarchically structured legal documents. It treats documents as directed acyclic graphs of provisions, preserves clause boundaries, resolves cross-references before embedding, and combines BM25 with BGE-M3 via Reciprocal Rank Fusion. We evaluate on five corpora, three legal traditions and two languages. StrucChunk reaches 100% boundary precision (vs. 7.7% for recursive splitting on CrPC), preserves 97.6% of documented cross-references (vs. 0%), and matches section coverage with 40.3% fewer chunks on GDPR. On LegalBench-RAG (6,858 query-passage pairs), it 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%); chunking accounts for 88% and 73% of the gain. On 501 GDPR queries, Recall@5 is 0.868 with R@1 improving +59%. On NitiBench-CCL (3,730 Thai financial law queries), HR@5 is 0.856 vs. 0.594 for naive chunking (+44.1%), showing that section-boundary alignment is the dominant factor across languages, and cross-reference augmentation adds +2.3% on cross-reference queries. We release the implementation, 5,256 evaluation queries across five legal corpora, annotation methodology and chunking quality metrics. Code: github.com/SinghSuryaDeep/legal-rag-strucchunk-1
Figures & tables
| Document | Domain | Pages | Sections | Cross-Refs |
|---|---|---|---|---|
| CrPC (1973) | Criminal | 263 | 517 | 1,131 |
| CPC (1908) | Civil | 316 | 158+ | 814 |
| Property | CrPC/CPC | GDPR |
|---|---|---|
| Legal tradition | Common law (India) | Civil law (EU) |
| Document type | Procedural code | Regulatory instrument |
| Primary hierarchy | Chapter Section | Chapter Article Para. |
| Secondary struct. | Subsections | Recitals (1–173) |
| Cross-ref style | “Section 167” | “Article 6(1)(f)”, “Recital 47” |
| Property | CrPC/CPC/GDPR | NitiBench-CCL |
|---|---|---|
| Language | English | Thai |
| Legal tradition | Common / Civil law | Civil law (Thailand) |
| Document type | Statutory codes / Regulation | Financial law statutes |
| Primary hierarchy | Chapter Section | Book Chapter Section |
| Section notation | “Section N” | “mātrā N” |
| Corpus size | 517–517 sections | 5,127 sections, 36 laws |
| Component | Specification |
|---|---|
| Embedding Model | BAAI/bge-m3 (567M params, 1024 dims; multilingual) |
| Vector Database | FAISS IndexFlatIP |
| Sparse Retrieval | bm25s v0.2.0 |
| PDF Parsing | pdfplumber (1–3 only) |
| NitiBench corpus | HuggingFace Parquet (no PDF parsing needed) |
| Chunk Parameters | max_tokens=512, overlap=0.15 |
| Metric | Recursive | StrucChunk |
|---|---|---|
| Boundary Precision (CrPC) | 7.7% | 100.0% |
| Boundary Precision (GDPR) | 2.8% | 100.0% |
| Cross-Ref Preservation (CrPC) | 0.0% (0/42) | 97.6% (41/42) |
| Cross-Ref Preservation (GDPR) | 0.0% (0/9) | 100.0% (9/9) |
| Chunk Count (CrPC) | 491 | 503 |
| Chunk Count (GDPR) | 211 | 126 |
| Chunking Retrieval | Dense | BM25 | Hybrid (RRF) |
| Recursive (baseline) | 0.521 | 0.503 | 0.557 |
| StrucChunk | 0.800 | 0.737 | 0.804 |
| Chunking effect (Hybrid fixed) | — | — | |
| Retrieval effect (StrucChunk fixed) | ref | — |
| Chunking Retrieval | Dense | BM25 | Hybrid (RRF) |
| Recursive (baseline) | 0.120 | 0.138 | 0.158 |
| StrucChunk | 0.198 | 0.269 | 0.259 |
| Chunking effect (Hybrid fixed) | — | — | |
| Retrieval effect (StrucChunk fixed) | ref | — |
| Chunking Retrieval | Dense | BM25 | Hybrid (RRF) |
| Recursive (baseline) | 0.798 | 0.679 | 0.818 |
| StrucChunk | 0.908 | 0.816 | 0.868 |
| Chunking effect (Hybrid fixed) | — | — | |
| Retrieval effect (StrucChunk fixed) | ref | — |
Legal IR
Legal information retrieval finds and ranks relevant statutes, cases, patents, and other legal materials for queries and evidence-grounded systems.
See all 53 papers