Legalyze: An Open‐Source Structure‐Aware Agentic <scp>RAG</scp> Platform for High‐Precision Legal Intelligence

ABSTRACT The integration of Large Language Models into the legal domain is constrained by a reliability gap, where models can generate incorrect or unsupported information in specialized reasoning tasks. This issue is especially important in jurisdictions such as Pakistan, where legal texts have strong structural dependencies and require accurate grounding. This research introduces Legalyze, an open‐source and modular five‐tier system designed to support legal analysis. The system uses Structure‐Aware Hierarchical Indexing (SAHI) and a dual‐stream retrieval pipeline that combines lexical and semantic search using Reciprocal Rank Fusion. It also includes a component called Legal Wisdom of Extraction, which identifies key legal entities such as petitioners, respondents, court names and referenced laws from the text. By preserving the structure of legal documents and grounding responses in retrieved evidence, the system substantially improves the grounding of generated outputs. Evaluation on a 1.2 million‐token corpus of Pakistani statutes and case law, comprising five statutory and case‐law sources with 67 legal queries assessed by three independent legal reviewers under a reviewer‐blinded evaluation protocol (Fleiss' , substantial agreement), showing a reduction in pooled hallucination rates from 54.7% in a zero‐shot baseline to 5.5%, outperforming standard retrieval‐based approaches. The improvement over both baselines is statistically significant across all pairwise comparisons (Cochran's , ; McNemar exact: Zero‐Shot vs. Legalyze ). A seven‐configuration offline retrieval ablation further demonstrates that an offline surrogate of the Legalyze architecture achieves Recall@5 of 65.0%, compared to 45.0% for flat lexical retrieval, confirming the retrieval gains attributable to structure‐aware indexing.

Link
https://doi.org/10.1111/exsy.70415
Found by
Crossref
Authors
Ali Hamza, Maaz Bin Rizwan, Maemoona Kayani, Shafa‐at Ali Sheikh
Organizations
Department of Software Engineering National University of Sciences and Technology (NUST) Islamabad Pakistan, Department of Epidemiology, Rollins School of Public Health Emory University Georgia Atlanta USA
Categories
evaluation, dataset
Published
2026-09-10
Last seen by the radar
2026-09-12
Citations
0
Radar score
35.50 / 100 (how it is scored)
Why it scored so
Matched: corpus, evaluat; Primary record: Crossref
Is this record right? If you made this work and something here is wrong or missing, tell us what to fix.

More records found by Crossref