Interview Q&A / AI & Generative AI

BeginnerIn-depth3 min readUpdated 2 Oct 2026

What are hallucinations in LLMs, and how can you reduce them?

SHORT ANSWER

A hallucination is when an LLM produces fluent, confident output that is false or not supported by its input, such as an invented fact or citation. You reduce them by grounding the model in real sources, allowing it to say "I don't know", lowering randomness and checking outputs.

Explain it simply

Picture a student in a viva who does not know the answer but does not want to stay silent. They give an answer that sounds right, in the correct style, with confident words. The examiner might even believe it. An LLM hallucinating is similar, except the model is not trying to bluff. It is doing what it was trained to do: produce likely-sounding text.

Because an LLM predicts the next token based on patterns, it has no built-in check that says "this fact is true". If the question is about something rare, recent or private, the most likely-sounding continuation can be wrong. That is why a model can invent a research paper title, a court case, a library function that does not exist, or a wrong policy detail.

Example

text
Prompt:  "Which function in Python's standard library converts a string to snake_case?"
Bad:     "Use str.to_snake_case(), added in a recent version."   (no such method)
Better:  "Python's standard library has no built-in snake_case function.
          You can write one with the re module, for example ..."

The bad answer follows the shape of a typical answer perfectly, which is exactly why it is easy to trust.

How it works

Hallucinations come from a few sources:

  • Gaps in training data. The model may never have seen the fact, or saw it rarely.
  • Outdated knowledge. Training data stops at some date.
  • Pressure to answer. Training rewards helpful answers, so the model tends to produce one even when unsure.
  • Missing or confusing context. A vague prompt or irrelevant retrieved text pushes the model to fill gaps.

Ways to reduce them:

  1. Ground the model. Use RAG or tools (search, a database, a calculator) so it answers from real data instead of memory.
  2. Give permission to abstain. Instruct it: "If the context does not contain the answer, say you don't know."
  3. Ask for citations to the provided sources, then check that the cited text actually supports the claim.
  4. Lower the temperature for factual tasks so it does not pick unlikely tokens.
  5. Constrain the output, for example to a fixed list of categories or a JSON schema.
  6. Verify. Use code that validates the output, a second check by another model call, or human review for high-stakes cases.

Real-world use

  • A bank chatbot answers only from approved policy documents and hands over to a human agent when unsure.
  • A coding assistant's suggestions are run against tests before being accepted.
  • A legal or medical summary tool shows the source passage next to each statement so a professional can verify it.

Common mistakes

  • Believing a single technique removes hallucinations completely. Every method reduces them; none guarantees zero.
  • Assuming a confident tone means a correct answer.
  • Using RAG but never testing retrieval, so the model gets the wrong context and hallucinates anyway.
  • Asking the model to "be accurate" and treating that as a fix. Instructions help a little; grounding and verification help much more.

What to say in the interview

"A hallucination is output that sounds plausible but is false or not supported by the input. It happens because the model generates likely text rather than checking facts, so gaps in its knowledge get filled with plausible guesses. To reduce it I ground the model with retrieval or tools, tell it to say it doesn't know when the context lacks the answer, ask for citations, use a low temperature for factual tasks, and validate the output, with human review where mistakes are costly. You can reduce hallucinations a lot, but you design the system assuming some will still happen."

Follow-up questions

  • Why does RAG reduce hallucinations but not eliminate them?
  • How would you measure the hallucination rate of a chatbot?
  • What is the difference between a hallucination and an answer based on outdated information?

#hallucinations#llm#reliability#generative-ai

Related questions

Practise more AI & Generative AI questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open AI & Generative AI quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.