Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 15

Understanding and Mitigating LLM Hallucinations

Recommended resources

Introduction

Welcome back. In our previous lesson, we examined the "black box" problem, grappling with the tradeoff between a model's performance and our ability to understand its internal logic. We differentiated between building transparent models from the start (interpretability) and trying to explain opaque ones after the fact (explainability). This raised a crucial question: What happens when the issue isn't just an opaque reasoning process, but an output that is demonstrably false?

This lesson transitions from the challenge of understanding a model's logic to the challenge of trusting its output. Our learning outcome is to analyze the phenomenon of 'hallucination' in Large Language Models (LLMs) and its implications for reliability and evidence.

We will dissect what hallucinations are, explore their technical origins within the architecture of LLMs, and, most importantly for your career goals, analyze their profound impact on the legal profession. When an AI tool used for legal research fabricates case law, it's not just a technical glitch; it's a direct threat to the integrity of legal arguments and a violation of a lawyer's professional duties. Understanding this phenomenon is non-negotiable for anyone aspiring to work at the intersection of AI and law.


1. Defining Hallucination: More Than Just an Error

At a basic level, a hallucination is when an AI model, particularly an LLM, generates information that is plausible-sounding but factually incorrect, nonsensical, or disconnected from the provided source data.

However, a more precise technical definition is crucial. As you'll see in the following video, hallucination is not merely about accuracy. It's about a model's failure to recognize and communicate the limits of its own knowledge.

Why Language Models Hallucinate - Adam Kalai

To start, let's watch this segment from a talk by Adam Kalai, a researcher at the Institute for Advanced Study. He provides a clear and insightful introduction to what makes hallucination a unique type of error.

Watch the segment from 00:48 to 04:00. Pay close attention to how Kalai distinguishes LLM hallucination from human error. The key idea is that instead of saying 'I don't know,' the model confidently invents an answer.

As Kalai points out, a human expert, when asked a question outside their knowledge, will typically admit uncertainty. An LLM, by contrast, will often "fill in the blanks" with a fabrication. This has critical implications for reliability, especially in high-stakes fields like law.

A Typology for Legal Hallucinations: Correctness and Groundedness

In the legal domain, simply saying an output is "false" isn't specific enough. A landmark study from Stanford University, which we will explore throughout this lesson, provides a more granular and legally relevant framework. It deconstructs factual hallucinations along two axes: correctness and groundedness.

  • Correctness: Refers to the factual accuracy of the tool's response. Is the statement it makes about the law actually true?
  • Groundedness: Refers to the relationship between the model's response and the sources it cites. Does the cited case actually support the proposition the model is making?

Let's dive into the paper to see how these concepts are formally defined.

Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools

The paper 'Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools' establishes a clear typology for understanding different failure modes of legal AI. This framework is essential for precise analysis.

Please read Section 4, 'Conceptualizing Legal Hallucinations,' which starts on page 6. Focus on: Section 4.1 (Correctness): How it defines 'correct', 'incorrect', and 'refusal'. Section 4.2 (Groundedness): The distinction between 'grounded', 'ungrounded', and 'misgrounded'. Note how their definition of 'grounded' is specific to the legal context. Section 4.3 (Hallucination): The final definition of a hallucination as a response that is either incorrect or misgrounded. Table 1 in this section provides excellent, concrete examples of these categories.

This typology is incredibly powerful. An AI can provide a legally correct statement (e.g., "The right to same-sex marriage is constitutionally protected") but ground it in a completely irrelevant case (e.g., Miranda v. Arizona). This is a misgrounded response and, by this paper's robust definition, a hallucination. Such errors are particularly insidious because a cursory check might not reveal the flaw, misleading a time-pressed lawyer.

Causes and Types of LLM Hallucination
This diagram provides a concise overview of the various causes and resulting types of LLM hallucinations. The concepts of 'Factual Contradiction' and 'Source-Reference Divergence' map directly to the legal concepts of incorrectness and misgroundedness we just discussed.

2. The Technical Roots: Why Do Hallucinations Happen?

To understand how to mitigate hallucinations, we first need to understand why they are an inherent property of how LLMs work.

The Nature of Next-Word Prediction

As we've touched on previously, LLMs are not databases of facts; they are highly complex probabilistic models. Their fundamental task during pre-training is next-word prediction. They learn the statistical patterns of language from a vast corpus of text to predict which word is most likely to follow a given sequence.

This process is excellent for learning grammar, style, and common associations. However, it struggles with facts that lack underlying rules or patterns.

Why Language Models Hallucinate - Adam Kalai

Let's return to Adam Kalai's talk. He provides an excellent, intuitive explanation for why the core task of language prediction inevitably leads to hallucinating certain types of facts.

Watch two key segments: 07:18 - 09:31: Kalai uses the example of birthdays to illustrate how next-word prediction fails for arbitrary facts that don't follow learnable rules, unlike grammar or spelling. 13:24 - 17:00: This part is more technical but gets to the heart of the matter. He presents a theorem showing that the unsupervised task of predicting language is fundamentally harder (i.e., more prone to error) than the supervised task of classifying true vs. false statements. You don't need to follow every mathematical detail, but grasp the core concept: if a model can't distinguish true from false in a given domain (like birthdays), the pre-training process forces it to generate falsehoods.

This core issue is compounded by the fine-tuning process, where models are often optimized to be helpful and conversational. Saying "I don't know" is perceived as less helpful, so the model learns to generate a plausible, confident answer, even if it has to invent one.

Retrieval-Augmented Generation (RAG): A Solution with Limits

The primary technical strategy to combat hallucination in domain-specific applications like legal research is Retrieval-Augmented Generation (RAG). Instead of relying solely on its internal "memory," the system first retrieves relevant documents from a trusted database and then uses those documents as context to generate an answer.

Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools (Paper Explained)

In this video, Yannic Kilcher explains the paper we're studying. He provides one of the clearest explanations available of how RAG works and, crucially, why it's not a foolproof solution.

Watch the segment from 15:29 to 26:31. It covers: How RAG Works: It dynamically inserts retrieved documents into the LLM's prompt, turning a 'closed-book' exam into an 'open-book' one. Why RAG Fails: It highlights the limitations. What if the retrieval step pulls irrelevant or misleading documents? The LLM's world is confined to the prompt, and it may struggle to reason about bad information, especially in a complex domain like law.

The "Hallucination-Free?" paper expands on these limitations specifically for the legal domain (Section 3.2):

  1. Retrieval is Challenging: Legal queries are often not simple fact lookups. They require reasoning to even identify the relevant issue and what to search for.
  2. Relevance is Complex: A textually similar case might be from the wrong jurisdiction, have been overturned, or apply a different legal standard. An LLM might not grasp this crucial non-textual context.
  3. Generation is Non-Trivial: Legal text requires synthesizing facts, holdings, and rules from multiple sources while respecting hierarchies of authority (e.g., a Supreme Court decision overrules a lower court).

The paper's example of asking about a fictional "Judge Wilgarten" perfectly illustrates this: the system retrieves a real case mentioning a real Judge Ellis, but then hallucinates that Judge Wilgarten wrote it, creating a response that is subtly and dangerously wrong.


3. Implications for the Legal Profession: Reliability and Evidence

The existence of hallucinations in specialized legal AI tools is not a theoretical problem. The Stanford study empirically demonstrates its prevalence and its insidious nature.

The Sobering Reality: Hallucination Rates in Legal AI

The study tested leading commercial legal AI products from LexisNexis and Thomson Reuters. The results are a wake-up call.

Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools

Let's examine the core findings of the 'Hallucination-Free?' paper. These results quantify the risks we've been discussing.

Please read Sections 6.1 and 6.2 ('Hallucinations Persist Across Query Types' and 'Hallucinations Can Be Insidious'). In 6.1, focus on Figure 4, which shows the hallucination rates. Note that even the best-performing tool hallucinates over 17% of the time. In 6.2, carefully read the examples of how these hallucinations manifest. Pay special attention to the categories: Misunderstanding Holdings, Distinguishing Between Legal Actors, and Respecting the Order of Authority. The examples in Tables 3 and 4 are particularly illuminating.

As the paper shows, these are not just benign errors. A tool might state the exact opposite of a case's holding, confuse a litigant's argument with the court's decision, or claim a lower court overruled the Supreme Court. These are fundamental errors of legal reasoning that can undermine an entire legal argument.

Professional Responsibility and the Duty of Verification

This reality has profound implications for a lawyer's ethical obligations. Relying on an AI tool without verification is not just risky; it can constitute professional malpractice.

Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools

Finally, let's read the paper's conclusion on what this means for practicing lawyers.

Please read Section 8, 'Implications,' and Section 9, 'Conclusion.' Focus on how the authors connect their findings to the lawyer's duty of competence (Rule 1.1) and duty of supervision (Rule 5.3). The core message is that given the current state of the technology, lawyers must verify every proposition and citation produced by these tools.

The conclusion is inescapable: while AI tools offer powerful efficiencies, they do not replace the fundamental need for human legal judgment and diligent verification. Treating their output as presumptively correct is a dangerous and professionally irresponsible act.

Test your understanding!

You are a senior associate at a law firm. A junior associate submits a research memo for a case involving a retaliation claim under the Family and Medical Leave Act (FMLA) in the Eleventh Circuit. They used a legal AI tool. The memo includes the following paragraph:

"The standard for FMLA retaliation in the Eleventh Circuit is unsettled. While the most recent controlling case, Lapham v. Walgreen Co., applied a 'but-for' causation standard, other district courts in the circuit have used a less strict 'motivating factor' standard, as seen in Lee v. Yellowpages.Com LLC and Nelson v. Americold Logistics LLC. Therefore, there is ambiguity we can leverage in our argument."

Based on the 'Hallucination-Free?' paper (Table 4, row 6), identify the type of hallucination present and explain the professional risk of relying on this paragraph.

Show answer

This is a classic example of a subtle but critical misgrounded hallucination.

  1. Type of Hallucination: The AI's response is incorrect because it misrepresents the state of the law. It creates a false sense of ambiguity. While the individual statements about the cases might be technically true (those cases exist and say those things), the overall legal conclusion is false. It fails to respect the order of authority. The decision in Lapham by the Eleventh Circuit Court of Appeals is controlling precedent. The older, lower district court rulings (Lee and Nelson) are no longer relevant on this point.
  2. Professional Risk: Relying on this would be a serious error. A lawyer filing a brief based on this flawed understanding would be arguing a point of law that has already been settled against them. This would immediately damage their credibility with the court and demonstrate a lack of competence (violating Rule 1.1). The opposing counsel would easily point out that the standard is, in fact, definitive, making the argument appear frivolous or ill-informed.

Conclusion

In this lesson, we have moved from the opacity of AI's reasoning to the unreliability of its outputs. We've seen that hallucinations are not just random errors but are a systemic consequence of how LLMs are built and trained.

Key Takeaways:

  • Hallucination is the generation of plausible but factually incorrect information, rooted in an LLM's failure to express uncertainty rather than just being wrong.
  • In the legal context, hallucinations can be precisely categorized by their lack of correctness (factual accuracy) or groundedness (support from cited sources). A response can be correct but misgrounded, a particularly dangerous failure mode.
  • The phenomenon arises from the core next-word prediction task and is only partially solved by Retrieval-Augmented Generation (RAG), which has significant limitations in the complex domain of law.
  • Empirical evidence shows that even specialized legal AI tools hallucinate at a significant rate, producing insidious errors that misstate holdings and disrespect legal hierarchies.
  • This places a non-delegable duty of verification on legal professionals. Uncritical reliance on AI outputs can breach ethical duties of competence and supervision.

Preview of the Next Lesson:

Hallucinations represent an inherent vulnerability in current AI systems. But what about external threats? In our next lesson, we will evaluate AI system vulnerabilities, including 'adversarial attacks' and 'catastrophic forgetting'. We will explore how malicious actors can intentionally manipulate AI systems to produce desired outcomes and other ways in which a model's knowledge can unexpectedly degrade.