LearnThatStack Ace your next interview
LLM Fundamentals · question
Question 7 of 58

What is a hallucination, and why do LLMs hallucinate?

beginner
← All LLM Fundamentals questions
Re-explain

A hallucination is model output that sounds confident and fluent but is false or unsupported by any source: invented citations, fake API methods, wrong dates.

The model is trained to produce likely text, not verified facts. Knowledge sits compressed in the weights, so gaps get filled with something plausible.

Post-training rewards confident answers, so guessing often scores better than admitting ignorance.

Nothing in the API flags a hallucination. Grounding and verification stay the application's job.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for LLM Fundamentals One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

  • Why doesn't setting temperature to 0 stop hallucinations? Temperature only changes how the next token is picked. If the most likely continuation is wrong, greedy decoding returns it every time.
  • If you ground the model with RAG, can it still hallucinate? How? Yes. Retrieval can miss or return the wrong chunk, and the model can still ignore or misread it. Name one check, such as verifying citations against sources.
  • What practical techniques reduce hallucinations in an LLM application? Grounding in retrieved sources, letting the model say it doesn't know, structured output with validation, and checking claims before users see them.
  • Can token log probabilities tell you when the model is making something up? Low probability can flag uncertainty, but models are often confidently wrong and post-training can skew calibration. It's a signal, not a detector.
  • How would you measure hallucination rates in a production system? A labeled eval set, groundedness checks against the retrieved sources, sampled human review, and user reports tracked over time.

What you can say

  1. A hallucination is output that sounds confident and fluent but is false or has no source behind it, like an invented citation, a fake API method or a wrong date.
  2. It happens because the model is trained to produce likely text, not verified facts.
  3. Its knowledge sits compressed in the weights, so when there's a gap, it fills it with something that looks plausible.
  4. Post-training adds to the problem, because it rewards confident answers, and guessing often scores better than admitting it doesn't know.
  5. Nothing in the API flags a hallucination, so grounding and verification stay the application's job, not the model's.

Weak answers to avoid

  • Calls it a bug the next model will fix It follows from training the model to predict likely text. Say you can reduce it with grounding and checks, but you can't expect it to go away.
  • Treats temperature 0 or RAG as a cure Greedy decoding still returns a wrong answer if it's the most likely one, and retrieval can fail. Present these as ways to reduce it, not guarantees.
  • Defines it but never explains why The question has two halves. Give the causes too: likely text over verified facts, gaps in compressed knowledge, and post-training that rewards confident guesses.
  • Says the model is lying or knows it's wrong There is no intent. The model produces plausible text either way and nothing in the API marks the false parts, so the application has to verify.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the LLM Fundamentals cheatsheet.

From the blog: Jev explained: the AI model that returns decisions, not text

← Back to all LLM Fundamentals questions
Pro · $10/mo

51 of 58 LLM Fundamentals answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime