Home / Question bank / LLM Fundamentals

LLM FundamentalsMidQuestion 11 of 13

Why do LLMs hallucinate, and how do you reduce it in a product?

30-second answer

Pre-training optimizes for plausible continuations, not truth, so the model will fill gaps fluently. In products: ground answers with retrieval, require citations and verify them, allow and reward 'I don't know', use lower temperature for factual tasks, constrain output formats, and measure faithfulness with evals rather than spot checks.

Try answering out loud before reading on. The walkthrough below is paced for a 40-minute interview round.

0–5 min Clarify and frame

Ask which kind matters for this product: fabricated facts, unsupported claims relative to provided documents, wrong citations, or invented tool arguments. Framing: "I'll explain why hallucination happens, then design layered mitigations and a way to measure them, since you can't eliminate it, only manage it."

5–15 min Core explanation: causes

  • Training objective: next-token prediction rewards plausible continuations, not truth.
  • Knowledge gaps: rare or post-cutoff facts are weakly stored; the model fills gaps fluently.
  • Exposure to "always answer" data: instruction data and preference tuning can reward confident answers over "I don't know".
  • Decoding: sampling can pick low-probability wrong tokens; one early error compounds.
  • Context problems: irrelevant or conflicting retrieved passages, or too much context.

Two types: intrinsic (contradicts the provided source) and extrinsic (unsupported by any source).

15–25 min Deep dive: layered mitigations

Layer Mitigation
Scope Restrict to tasks where answers can be grounded or verified
Retrieval Ground answers in retrieved documents; improve recall with hybrid search and reranking
Prompt "Answer only from the context; if not present, say you don't know"; ask for citations by source ID
Decoding Low temperature for factual tasks; structured outputs
Verification Check each citation supports its sentence (NLI model or LLM judge); validate tool arguments against schemas and real data
Product Show sources, allow "I'm not sure", human review for high-stakes outputs
Model Pick models with good calibration and abstention; fine-tune with "I don't know" examples

A useful pattern is claim decomposition: split the answer into atomic claims and verify each against the context; drop or flag unsupported ones.

25–32 min Measuring it

  • Golden set with reference answers and source documents, including unanswerable questions.
  • Metrics: faithfulness/groundedness rate, citation precision, abstention rate on unanswerable questions, false-abstention rate on answerable ones.
  • LLM-as-judge calibrated against human labels.
  • Production: sample traffic for review, track user corrections.

Trade-off: pushing abstention up reduces hallucination but frustrates users with unnecessary "I don't know" responses. Measure both.

32–37 min Production example

An HR policy assistant gave a wrong parental-leave answer by blending two countries' policies. Fixes: filter retrieval by the employee's country, require inline citations, and add a verifier that rejects answers whose claims aren't entailed by cited passages, falling back to "Here are the relevant policy sections" with links. Unsupported-answer rate on the eval set dropped substantially, at the cost of slightly more fallbacks.

37–40 min Likely follow-ups

  • Can RAG still hallucinate? Yes: ignoring context, mis-combining passages, or citing the wrong source.
  • How do you detect hallucination without references? Self-consistency (sample several answers and check agreement), verifier models, checking against external tools.
  • Do bigger models hallucinate less? Generally on common knowledge, but they can be more convincing when wrong.

What interviewers listen for

  • Root causes, not just "models make things up".
  • Multiple layers, including product design and verification.
  • Measurement with unanswerable cases and the abstention trade-off.

Red flags

  • Claiming a prompt or temperature 0 solves it.
  • No evaluation plan.