LLMS & GENERATIVE AI · QUESTION 32
Why do LLMs hallucinate, and how can you reduce it?
On this page
LLMs generate likely continuations rather than verifying every claim against a source of truth. They can therefore produce fluent but unsupported statements when context is missing, ambiguous, or outside their learned patterns. Reduce risk by retrieving trusted evidence, limiting the task, validating structured outputs, allowing abstention, and evaluating realistic failure cases; none of these methods guarantees correctness.
LET'S MAKE IT SIMPLE
First, the idea in plain English
A language model is trained to produce plausible text from context. Plausibility and truth are related only imperfectly: if the model lacks a fact, it may still generate a confident-looking continuation. An application can make reliable evidence available, ask the model to stay within it, and show uncertainty or decline when evidence is inadequate.
A USEFUL COMPARISON
Picture it this way
Imagine someone trying to answer every question in a conversation even when they do not know the fact. They may offer a convincing guess instead of saying “I’m not sure.” A well-designed workflow gives them a trusted reference and permission to pause; the model still needs checks because it can misread the reference.
FOLLOW THE JOURNEY
Ground generation in evidence and check the result
Trace common causes of unsupported answers and practical safeguards.
This simplified visual highlights the main relationships. In practice, the exact design depends on the requirements; A safe fallback is better than a fabricated fact.
A question is checked for evidence, retrieved sources are supplied to the model, output claims are validated, and unsupported answers are corrected or declined.
How to read this visual
This simplified visual highlights the main relationships. In practice, the exact design depends on the requirements; A safe fallback is better than a fabricated fact.
UNDER THE HOOD
How it works, step by step
Identify uncertainty
Determine whether the prompt contains enough reliable context.
Why it matters: Missing evidence raises the chance of unsupported completion.
Retrieve trusted sources
Find relevant, permission-checked material for the question.
Why it matters: External evidence can ground answers in current information.
Generate within scope
Ask for an answer supported by the supplied context.
Why it matters: Clear constraints reduce unnecessary invention.
Check or abstain
Validate citations and claims, or say evidence is insufficient.
Why it matters: A safe fallback is better than a fabricated fact.
OUTSIDE THE TEXTBOOK
A practical example
For a benefits question, retrieve the current policy and provide its effective date to the model. Ask it to cite the relevant section, then verify the citation points to text that supports the answer. If no suitable passage is found, the application should say it could not find the policy rather than inventing a rule.
GO A LITTLE DEEPER
Technical details that matter
- Hallucination can originate in model generation, weak retrieval, stale sources, prompt ambiguity, or transformations that discard context.
- Citation presence alone does not establish that a claim is supported; evaluate claim-to-source entailment.
- Human review, constrained generation, and domain-specific validators can reduce risk for consequential workflows.
MAKE A GOOD CHOICE
When is this useful?
- Knowledge assistants that answer from approved documents.
- Applications that need explicit abstention when sources are incomplete.
- Risk reviews that categorize unsupported claims by cause and consequence.
For exact calculations or records, use deterministic code or structured queries and ask the model only to explain results.
WATCH OUT FOR
Common misunderstandings
- Assuming a confident tone indicates confidence calibration or factual support.
- Treating a citation as proof without checking the cited passage.
- Expecting one prompt change to eliminate hallucinations.
REAL-WORLD TRADE-OFFS
Limitations and failure cases
- Retrieved evidence can be irrelevant, stale, or contradictory.
- Automated fact checks may miss subtle unsupported claims.
- Even grounded models can misinterpret evidence or omit important qualifications.
WHAT TO REMEMBER
Key takeaways
- 1Next-token generation does not inherently verify facts.
- 2Grounding, output checks, and abstention reduce risk but do not guarantee truth.
- 3Evaluate the complete retrieval-and-generation path.
PRACTICE THE FOLLOW-UP
What might an interviewer ask next?
Does RAG eliminate hallucinations?
No. It can provide useful evidence, but retrieval may fail and a model can still misstate or ignore retrieved passages. Evaluate evidence selection and answer support.
How can an application safely respond when unsure?
Define a threshold or rule for insufficient evidence, communicate the limitation, and route high-impact questions to a trusted source or reviewer.
SAY IT OUT LOUD
How to explain this in an interview
“LLMs are optimized to generate likely text, not to verify each claim, so missing context can lead to plausible but unsupported answers. I would ground the response in trusted sources, constrain the task, validate important claims and citations, and allow the system to abstain. Then I would evaluate failures across the entire application, because retrieval and prompting can fail too.”
Connect this question to the roadmap topic it supports.