Towards Trustworthy Legal AI through LLM Agents and Formal Reasoning

Linze Chen, Yufan Cai, Zhe Hou, Jinsong DongarXiv 2025 · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable proficiency in legal text comprehension, even passing bar examinations. However, their deployment in judicial decision-making remains problematic due to a lack of logical guarantees. LLMs are prone to hallucinations, conflating legal requirements, and providing "black box" reasoning that lacks transparency and auditability. To address these issues, researchers from the National University of Singapore and Griffith University have developed L4L, a neuro-symbolic framework designed to anchor LLM-based legal reasoning in formal logic.

The Challenge: Formal vs. Substantive Rationality

The fundamental hurdle in legal AI is bridging the gap between substantive rationality—the flexible, interpretive aspect of law—and formal rationality—the strict, logical application of statutory rules. While current Retrieval-Augmented Generation (RAG) approaches reduce factual errors, the final reasoning step remains opaque. In a rule-of-law system, judicial decisions must be mathematically traceable to governing statutes. L4L addresses this by ensuring that legal verdicts are not just linguistically fluent but logically consistent with formalized law.

The L4L Framework

L4L operates as a "solver-centric" system through four primary stages:

  1. Statute Knowledge Building: Natural language legal provisions are "autoformalized" into logical constraints (Horn clauses) and compiled into an executable Satisfiability Modulo Theories (SMT) knowledge base using the Z3 solver.
  2. Dual Fact-and-Statute Extraction: To simulate courtroom dynamics, the system employs adversarial agents: a Prosecutor LLM (prompted to maximize conviction) and a Defense Attorney LLM (prompted to maximize acquittal). These agents independently extract structured "fact tuples" (Actor, Action, Condition) from case narratives.
  3. Solver-Centric Adjudication: The SMT solver checks extracted facts against formalized statutes to identify applicable articles and ensure logical consistency. If an inconsistency is found (e.g., facts failing to meet a statutory threshold), the solver provides feedback to the LLMs to refine their extraction.
  4. Judicial Rendering: A Judge LLM synthesizes the solver-verified logic with retrieved precedents and interpretive principles to draft a final, human-readable verdict.
The L4L framework architecture combining LLM agents with SMT-based formal reasoning.

Evaluation and Results

The L4L framework was evaluated against three benchmarks: LeCaRDv2 (Chinese criminal cases), LEEC (legal element extraction), and a Synthetic Perturbation Dataset designed to test sensitivity to minor factual changes (e.g., drug weight or defendant age).

L4L consistently outperformed both general-purpose models (like GPT-4o and GPT-5.2) and domain-specific baselines such as LexiLaw. In statute prediction on LeCaRDv2, L4L achieved an F1-score of 39.08% for general provisions, compared to GPT-5.2's 31.14%. Furthermore, L4L significantly improved sentencing accuracy, reducing the Root Mean Squared Error (RMSE) to 12.72 months, whereas GPT-4o recorded 32.84 months.

Performance comparison of L4L against baseline models on LeCaRDv2 and LEEC datasets.

Discussion and Future Directions

The success of L4L highlights the benefits of adversarial extraction, which prevents single-model bias by surfacing both aggravating and mitigating factors. By separating symbolic logic from narrative rendering, the system gains rigor without sacrificing linguistic nuance.

However, limitations remain. The system's performance is still tethered to the LLM's initial extraction accuracy; missing details in the narrative lead to "garbage in, garbage out" scenarios for the solver. Additionally, while L4L excels at statutory application, future work is needed to handle the "open-textured" nature of case law and evolving jurisprudence. Despite these challenges, L4L represents a significant step toward transparent, auditable AI tools for the legal profession.

Summary updated

BibTeX
@misc{chen2025towards,
  author = {Linze Chen and Yufan Cai and Zhe Hou and Jinsong Dong},
  title = {{Towards Trustworthy Legal AI through LLM Agents and Formal Reasoning}},
  year = {2025},
  eprint = {2511.21033},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.21033},
}
Figure