---
title: "Solving Legal AI Hallucinations"
date: "2026-08-04"
description: "How structural citation graphs prevent AI models from fabricating legal authority."
author: "Dike Engineering"
readTime: "6 min read"
heroImage: "/images/artwork/legal-nodes.png"
tags: ["Engineering", "Grounding", "AI Safety"]
---

A single misquoted article number can invalidate an entire legal argument. That's not true of most domains a language model gets used for. If a model gets a movie recommendation wrong, nobody's harmed. If it gets a statute number wrong in a contract dissolution clause, someone can lose a case, miss a filing deadline, or underpay an employee's severance because the formula it cited doesn't actually match the law.

We spend most of our engineering time on exactly this problem, so it's worth walking through why it happens and what actually fixes it, because the two things people usually reach for, bigger models and better prompting, don't.

> A movie recommendation that's wrong costs you an evening. A statute number that's wrong costs someone their case.

## Why models hallucinate citations in the first place

A language model doesn't have a lookup table of statutes sitting somewhere in its weights. What it has is a compressed statistical representation of everything it read during training, and when you ask it for Article 144(b) of some act, it generates the token sequence that's most probable given everything it's seen that looks like a legal citation. Most of the time, for well-known, frequently-cited provisions, that works fine, because the real text was heavily represented in training data.

The failure mode shows up on everything else: less common articles, recently amended provisions, anything from a jurisdiction that's underrepresented in the training corpus. The model doesn't know it doesn't know. It generates something that has the right shape, a plausible article number, a fluent-sounding rule, formatted exactly like a real citation, and there's no internal signal telling it "I'm guessing here." We ran into this directly:

```json
{
  "query": "What are the corporate governance rules for board elections?",
  "hallucinated_citation": "Article 144(b) of the Companies Act",
  "actual_status": "Article 144(b) was repealed in 2021"
}
```

The model wasn't being careless. It was doing exactly what it's trained to do, predict plausible text, and legal citations happen to be a place where "plausible" and "correct" can diverge completely without any surface-level warning sign.

## Why bigger models and better prompts don't fix this

The intuitive fix is to use a stronger model, or to prompt it more carefully: "only cite articles you're certain about," "say 'I don't know' if you're not sure." Both help a little and neither actually closes the gap, because the underlying issue isn't reasoning quality. A larger model is better at generating fluent, plausible-sounding text, which is precisely the property that makes hallucinated citations convincing. And a model can't reliably introspect on whether a specific fact was memorized correctly versus reconstructed from a similar pattern; it doesn't have access to that distinction internally.

The only fix that actually works is giving the model something to check against instead of asking it to generate from memory.

> You can't prompt your way out of a lookup problem. You need the lookup.

## What grounding with a citation graph looks like in practice

Structured verification means resolving every cited article against a real, current source at query time, not trusting whatever the model recalls. We built this as a graph rather than a flat document store for a specific reason: legal authority is relational. A statute has amendments that supersede parts of it. It has implementing regulations that fill in operational detail. It gets applied and interpreted by court rulings that themselves become citable authority. An agent that can only fetch one article in isolation is still missing most of what a lawyer would actually need to answer the question correctly.

So when an agent queries Dike, it's not getting back a single paragraph of text. It's getting the current version of the article, a flag if that article has been amended or repealed, links to related implementing regulations, and pointers to rulings that have applied it. That's enough for the agent to answer "is this still good law" as well as "what does the law say."

The bilingual side matters just as much here. A lot of MENA legal AI work has relied on translating Arabic statutes into English and reasoning over the translation, which quietly discards the exact wording a citation depends on. We keep the official Arabic text as the source of truth and provide English alongside it with citation anchors that hold across both, so an agent working in either language is still grounded in the same underlying document.

None of this eliminates the possibility of a model saying something wrong. What it does is replace "the model generated a citation" with "the model retrieved a citation and can show you exactly where it came from." That's the difference between an answer you have to trust blindly and one you can actually check in thirty seconds.
