Executable explanation traces for legal LLM predictions via retrieval-augmented codification
Abstract
Explainability is particularly challenging in legal prediction, where decisions are expected not only to be accurate but also to be justified under explicit legal norms and open to external scrutiny. Legal reasoning therefore provides one of the most demanding settings for explainable AI because a legal determination often depends on information distributed across the input record, external legal sources, procedural context, evidentiary assumptions, and institutional judgment. Direct outcome generation hides this decision path, while natural-language rationales and retrieved citations do not necessarily show whether a legal condition was actually applied. This article presents studies of retrieval-augmented codification as a way to produce executable explanation traces for legal large language model (LLM) predictions. The goal is not to generate human-facing rationales directly, but to produce auditable artifacts: short programs that extract signals, apply program-level conditions, follow branches, and produce final labels under a fixed output schema. The approach retrieves legal sources and fold-safe in-domain examples, compiles them into an executable intermediate representation, and refines the program using model feedback. The resulting trace records retrieved materials, generated conditions, feedback, and the final prediction. We evaluate this framework on five legal benchmarks covering Chinese criminal law, European human-rights cases, U.S. class-action complaints,…
Read the paper
Related studies
- Knowledge Management Perspective of Generative Artificial Intelligence
- Navigating Generative Artificial Intelligence Promises and Perils for Knowledge and Creative Work
- Characterizing the evolving research on enterprise content management
- Large language models and multimodal foundation models for precision oncology
- From Generative AI to Extended Reality: Multidisciplinary Perspectives on the Challenges, Opportunities, and Future of Educational Computing
- Generative Artificial Intelligence: A New Engine for Advancing Environmental Science and Engineering
Go deeper in Evidence Hub
Evidence Hub adds a study data sheet (design, sample size, evidence level, key numbers), an AI summary and a chat grounded in the paper's text.