LawChain: A Practical Framework for Accessible Legal Retrieval in Low-Resource Jurisdictions
Abstract
We present LawChain, a practical blueprint and reference implementation for building legal information retrieval (IR) systems in low-resource jurisdictions, grounded in our deployment for Sri Lankan legislative Acts. The work addresses common barriers in such settings, including heterogeneous PDF sources, retrieval performance and scarce evaluation benchmarks. We develop a structure-preserving, layout-aware extraction pipeline that isolates the main legislative text, retains section boundaries, and normalizes artifacts introduced by PDF formatting. On top of this corpus, we implement a multi-engine retrieval architecture combining BM25 keyword search and dense semantic retrieval, enhanced with query expansion (including HyDE) and an agentic loop for refining vague queries. To incorporate inter-document legal context, we construct a Neo4j-based knowledge graph capturing amendments, references, and other relationships across Acts. Results from curated evaluation sets show strong retrieval performance, with the integrated system achieving Precision@5 of 0.8345 and Recall@5 of 0.9357. We also contribute reusable resources, including section-wise and act-wise Q-A datasets totaling over 26,000 entries and a graph dataset with 22,812 section nodes. Finally, we describe a modular microservices design that supports rapid experimentation and future extension to additional languages and retrieval components.