Explainable RAG System for Lawyers
October 2025 – September 2028
This work was supported by the Federal Ministry of Research, Technology and Space (BMFTR) as grant xJuRAG (16IS25015B).
The enormous capabilities of modern neural language models to reproduce human-like communication have been impressively demonstrated in recent years with the release of large language models (LLMs) such as GPT, Llama, and Mistral. Applications built on LLMs achieve tasks such as answering questions, retrieving information from large document collections, generating content, and producing software code at an unprecedented level.
Despite their performance, there are several aspects that call for caution when using LLMs in many domains. In addition to the phenomenon of hallucinations—i.e., the invention of facts when a task exceeds the model’s knowledge limits—there are technical challenges related to the deployment and scalability of LLM applications in industry. Another factor that is often overlooked in public discussions about language models is the lack of explainability inherent in the transformer architecture underlying every modern language model. Sensitive industries such as healthcare, finance, and the legal sector, in particular, rely on transparent and explainable model predictions when using them to automate workflows.
Explainability in the context of this project is understood as making a model’s outputs comprehensible and transparent at the model level. In the case of transformer models, this means developing methods that identify how the attention mechanism processes semantic and causal relationships between tokens. The project aims to go beyond approaches that merely improve reliability by enriching a language model with context-specific information and highlighting text passages relevant to an answer. Instead, it explicitly investigates how the model’s internal reasoning process can be understood and quantified, based on a concrete, domain-specific application in the legal field.
In this project, current research findings on the explainability of transformer models will be transferred to a Retrieval-Augmented Generation (RAG) application in the legal domain. The goal is to demonstrate the feasibility of reliable and transparent AI applications (Explainable AI, XAI) for legal research and judicial decision-making. A key focus is on usability for legal professionals such as lawyers and judges, in order to unlock the potential of language models for legally sensitive and complex professional tasks. More broadly, the project aims to promote public discourse and the widespread adoption of explainable, reliable, and transparent AI methods beyond the legal domain, making them accessible to other industries as well.