Trust / Technical

AI Hallucination in Legal AI: How to Prevent It and What to Require From Vendors

Quick Take / Direct Answer

AI hallucination in legal contexts — where a language model generates plausible but factually incorrect output — is structurally prevented in RAG systems by grounding every answer in retrieved source documents. A properly built legal RAG system returns "I cannot find this in your document library" when no relevant source exists, rather than generating a speculative answer. Required safeguards: source citation on every answer, retrieval confidence scoring, human-in-the-loop escalation, and regular accuracy testing.

Why Hallucination Is Different in Legal AI vs General AI

In general AI use (drafting a marketing email, summarising a news article), a minor factual error is inconvenient. In legal AI, a hallucinated case citation submitted in a brief results in attorney discipline. A hallucinated contract clause that an attorney misses during review creates liability exposure. A hallucinated precedent that shapes legal advice given to a client is a professional responsibility failure.

The risk is asymmetric: the benefit of getting the right answer fast is high; the cost of getting the wrong answer confidently is potentially catastrophic.

This is why the architecture of a legal AI system matters more than in consumer AI contexts. Hallucination is not just an inconvenience — it is a professional liability risk.


How RAG Architecture Prevents Hallucination

The core mechanism: In a RAG system, the language model is instructed to answer only from the retrieved document passages. It is not permitted to draw on its training data (general internet knowledge) when answering questions about your firm's documents.

Step 1: Retrieval-first answering Every query first searches the document library. The language model only generates an answer after relevant passages are retrieved. If no relevant passages are found, the system returns a "not found" response rather than generating content from training data.

Step 2: Source citation requirements Every answer must include the source document name, section, and the specific passage quoted. If the system cannot cite a source, it cannot give an answer. This makes hallucination visible — if there is no citation, the answer has no basis.

Step 3: Retrieval confidence scoring Each retrieved passage is scored for semantic relevance to the query. Passages below a defined confidence threshold are excluded from the answer. The system returns "I cannot find a confident answer to this question in your library" rather than generating a low-confidence response.

Step 4: Human-in-the-loop escalation For queries where confidence is borderline, the system escalates to a human reviewer rather than generating an uncertain answer. This is configurable by query category — higher-stakes query types trigger lower confidence thresholds.


Testing a Vendor's Hallucination Prevention

Before accepting any legal AI system into production, require:

  1. Known-answer accuracy testing: Provide the vendor with 20 queries where you already know the correct answer from your document library. Require 90%+ accuracy on these queries before go-live.
  2. Out-of-scope query testing: Ask the system 10 questions that cannot be answered from the ingested documents. Verify that it responds with "I cannot find this" rather than generating a hallucinated answer.
  3. Source verification: For every answer returned during testing, verify the cited source document and passage against the original document. Ensure citations are accurate.
  4. Stress testing: Ask intentionally misleading or ambiguous questions to test the system's behaviour at the edges.

FAQs

Q: How do large law firms using Harvey AI handle hallucination risk? A: Harvey and similar general-purpose legal AI tools are typically used for general drafting and research tasks — not for retrieving specific case matter information. Attorneys are instructed to verify any legal citations generated by AI before including them in documents or advice. Most sophisticated firms have formal AI review protocols requiring attorney sign-off on all AI-assisted output.

Q: Can a RAG system hallucinate? A: Yes — in two ways. First, if the retrieval step fails to find the right document (retrieval error), the language model may generate an answer from its training data instead. This is why confidence thresholds and "not found" responses are essential. Second, the language model may slightly misrepresent what the retrieved passage says (generation error). This is why source citations and attorney review of AI output remain necessary.

Q: What is the attorney's responsibility when using AI-assisted research? A: The attorney remains fully responsible for any work product that incorporates AI-assisted research. ABA Opinion 512 and state bar guidance consistently confirm that AI does not transfer professional responsibility. Every AI output that influences client advice must be reviewed by a qualified attorney.