GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
← 🧠 Foundations of LLMs & GenAI
Foundational

Why LLMs Hallucinate

An LLM generates the most plausible next token given its training, with no built-in notion of truth or any source to check against, which is why it can produce confident, fluent, and completely fabricated answers. FDE loops test this because every enterprise buyer asks 'can we trust it,' and you need to explain the cause and the mitigations (grounding, refusal, citations, evals) in terms an exec will accept.

WATCH THE EXPLAINER3:19
Transcript

The demo goes well. Then someone asks a question the documents don't cover, and the assistant answers anyway, in the same confident voice it used when it was right. That moment is the whole topic.

A language model is trained to predict the next token that best continues the text. That's the entire objective. Truth isn't in the loss function. The model learns what plausible text looks like, and a confident, specific, well-formed answer looks plausible whether or not it's correct.

So ask for a fact the model never saw, or saw rarely, or saw contradicted across sources. It has no "no data here" signal to return. It produces the most likely continuation, which is often a fluent, authoritative-sounding fabrication.

You've seen the shapes. A citation to a paper that doesn't exist. An API method that was never built. A refund policy, invented because thirty days is common.

The fluency is the trap. The same machinery that makes correct answers sound confident makes wrong ones sound confident too. So hallucination isn't a bug you can patch out. A model with no access to ground truth, and an objective of sounding plausible, will sometimes be plausibly wrong.

You'll be asked this in a room with a buyer. The line that lands: the model is an extremely well-read improviser, not a database. Ask it something it knows well and it's reliable. Ask it something outside what it learned and it will still answer confidently. Our job is to give it the right documents to answer from, and to make it say "I don't know" when it has none. That moves the problem from "the AI lies" to "we control what it's allowed to answer from."

Every mitigation attacks a step in that chain. Grounding via RAG retrieves the relevant documents and tells the model to answer only from them. That swaps recall from fuzzy memory for reading from a source. Then the single most valuable instruction in a grounded system: if the context doesn't contain the answer, say you don't know. A model that abstains beats one that guesses.

First, require a citation for each claim, because a made-up claim has no real passage to point to. And measure faithfulness, meaning does the answer follow from the context, on a golden set, often with an LLM-as-a-judge plus human spot-checks. None of these makes the model know the truth. They keep it answering from material you control.

In the interview, the answer that fails is "we'll fine-tune it to stop hallucinating." Fine-tuning changes behavior and style, not access to current truth. The follow-up is harder. Your RAG system hallucinated even though the right document was retrieved. Why? The model ignored or misread the context. Tighten the refusal instruction, lower the temperature, and check whether the chunk held the answer or just looked relevant.

So you don't promise to eliminate it. You manage it: ground the model, let it refuse, demand citations, and measure faithfulness. You never eliminate it. The causal chain and the full answer are on fdeinterviews.com.

TL;DR: A model predicts plausible text, not true text. It has no internal fact-checker and no concept of "I don't know" unless you build one, so when it lacks the answer it fills the gap with something that sounds right. You reduce this by grounding the model in retrieved sources, instructing it to refuse when unsupported, demanding citations, and measuring faithfulness with evals. You do not eliminate it.

Why it happens at all

The demo goes well until someone asks a question the documents do not cover, and the assistant answers anyway, in the same confident voice it used when it was right. That moment is the whole topic.

A language model is trained to predict the next token that best continues the text, judged against enormous amounts of training data. That is the entire objective. Truth is not in the loss function. The model learns what plausible text looks like, and a confident, specific, well-formed answer looks plausible whether or not it is correct.

So when you ask for a fact the model never saw, or saw rarely, or saw contradicted across sources, it does not have a "no data here" signal to return. It produces the most likely continuation, which is often a fluent, authoritative-sounding fabrication: a citation to a paper that does not exist, an API method that was never built, a refund policy invented because thirty days is common. The fluency is the trap. The same machinery that makes correct answers sound confident makes wrong ones sound confident too.

This is why hallucination is not a bug to be patched out. It is a direct consequence of how the model works. A model with no access to ground truth and an objective of "sound plausible" will sometimes be plausibly wrong.

How to explain it to a non-technical exec

You will be asked this in a room with a buyer. The line that lands: "The model is an extremely well-read improviser, not a database. Ask it something it knows well and it is reliable. Ask it something outside what it learned and it will still answer confidently, because guessing fluently is what it was trained to do. Our job is to give it the right documents to answer from and to make it say 'I don't know' when it has none." That reframes the problem from "the AI lies" to "we control what it is allowed to answer from," which is what makes the deal safe.

Mitigations that actually work

Where a confident fabrication comes from 1 The objective predict the next token 2 Truth is not in the loss plausible is 3 A fact it never saw or saw contradicted 4 No "no data here" signal nothing to return instead 5 The likeliest continuation is produced anyway 6 Fluent, specific, formed a paper that does not exist 7 The reader believes it the fluency is the trap A confident, specific, well-formed answer looks plausible whether or not it is correct. That is the entire objective, so this is not a bug to be patched out. Unless you build one. This is the gap the refuse-when-unsupported instruction fills, and it is the single most valuable line in a grounded system. A citation to a paper that was never written, an API method that was never built, a refund policy invented because thirty days is common. The same machinery that makes correct answers sound confident makes wrong ones sound confident too. Grounding and citations attack this step, not the ones above it.

Before the mitigations, the spine above traces where a fabrication comes from, because every one of those mitigations attacks a specific step in it.

rendering diagram…
  • Grounding via RAG. Retrieve the relevant documents and instruct the model to answer only from them. This swaps "recall from fuzzy memory" for "read from a source," which is far more reliable.
  • Refuse when unsupported. The single most valuable instruction in a grounded system: "If the context does not contain the answer, say you do not know." A model that abstains beats one that guesses, especially in regulated or high-stakes settings.
  • Citations. Require the model to point at the source passage for each claim. Citations let a human verify and make fabrication visible, because a made-up claim has no real passage to point to.
  • Evaluation. Measure faithfulness (does the answer follow from the provided context) on a golden set, often with an LLM-as-a-judge (a second model prompted to grade whether each claim in the answer is supported by the context) plus human spot-checks. You cannot manage what you do not measure, and a faithfulness metric is what tells you a prompt change helped or hurt.

None of these makes the model "know" truth. They constrain it to answer from material you control and surface the cases where it cannot.

Why interviewers probe this

It is the question behind every enterprise objection, so they want to see that you neither overpromise nor panic. The answer that fails is "we'll fine-tune it to stop hallucinating," which misunderstands the cause; fine-tuning changes behavior and style, not the model's access to current truth. The follow-up they hold in reserve is "your RAG system still hallucinated on a question where the right document was retrieved, why?" Strong answer: the model ignored or misread the context, so you tighten the refuse-when-unsupported instruction, lower temperature, and check whether the retrieved chunk actually contained the answer or just looked relevant.

Common misconceptions

  • "Hallucination means the model is broken or low quality." It is inherent to predicting plausible text without grounding; even frontier models do it.
  • "RAG eliminates hallucination." It reduces it by grounding, but the model can still ignore or misread the retrieved context. You still need refusal and faithfulness checks.
  • "Fine-tuning will fix factual errors." Fine-tuning shapes behavior and format and bakes in static facts at best; it does not give the model live, citable truth. Use grounding for facts.
  • "Higher temperature is the cause." Sampling can surface unlikely tokens, but the root cause is the lack of grounding and any notion of truth, not the sampler.

Key takeaways

  • Models predict plausible next tokens with no built-in concept of truth, so confident fabrication is expected behavior, not a defect.
  • Mitigate with grounding (RAG), an explicit instruction to refuse when unsupported, required citations, and faithfulness evals.
  • Explain it to non-technical stakeholders as "a well-read improviser, not a database," and emphasize that you control what it answers from.
  • You manage hallucination; you do not eliminate it. Fine-tuning changes behavior, not access to current truth.

Related concepts

Practise this in questions