← Back to Blog

Hallucination isn't a bug you fix once

Every production LLM feature eventually runs into the same question: "why

did it say something that isn't true?" Hallucination doesn't get fixed with

a better prompt or a newer model — it's a structural property of how these

models generate text, and it needs to be designed around, not patched once.

Why it happens

An LLM predicts the next most plausible token given everything before it.

"Plausible" is not the same thing as "true." When the model doesn't have

the actual fact available in its context, it still has to produce

something — and it produces the most statistically likely continuation,

fluently, whether or not it's grounded in anything real. The model has no

internal mechanism that distinguishes "I know this" from "I'm generating

something that sounds right."

This is why hallucination gets worse, not better, on questions that are

obscure, recent, or outside training data — exactly the cases where a

confident wrong answer is most dangerous, because it's the hardest for a

user to catch.

What actually reduces it

Grounding via retrieval (RAG). The single highest-leverage fix: don't

ask the model to recall facts from its parameters, give it the facts in

context and ask it to synthesize from what's provided. This doesn't

eliminate hallucination, but it changes the failure mode from "invented

fact" to "wrong retrieval" — which is a different, more debuggable problem.

Explicit "I don't know" permission. Prompts that only describe the

happy path implicitly pressure the model to always produce an answer. State

directly that if the retrieved context doesn't contain the answer, the

correct response is to say so — not guess.

Structured output with citations. Require the model to reference which

retrieved chunk supports each claim. This doesn't stop hallucination outright,

but a claim with no matching citation is now mechanically detectable instead

of requiring a human to fact-check every sentence.

Lower temperature for factual tasks. Higher temperature increases

diversity, which is useful for creative tasks and actively harmful for

tasks where there's one correct answer.

Evaluation sets that specifically test for hallucination. Include

questions in your test suite where the correct answer is "not in the

provided context" — if your eval only checks "did it answer the question

correctly," it never catches a model that answers confidently when it

shouldn't answer at all.

The mindset shift

Treat hallucination like you'd treat any other reliability problem: not

solvable by one fix, but reducible with layered mitigations, monitored in

production, and never fully eliminated. Any team promising a hallucination-

free LLM feature is describing a goal, not a shipped property.