esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

How Do You Reduce Hallucinations in RAG?

Why RAG answers still make things up, and the layers that cut it: better search, grounded prompts, citations and checks, for your AI interview.

In short

Make the search bring back the right passage, tell the model to answer only from those passages and to say when they don't cover the question, and require a citation for each claim. Then check the answer against its sources before it reaches the user.

13 min readIntermediateVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Hallucinations in RAG are confident answers the sources don't support. I cut them in layers. First, better search: hybrid search, a reranker, and date filters so old documents drop out. Second, the prompt lets the model answer only from the passages, and lets it say I don't know when they don't cover the question. Third, every claim needs a citation. Last, a groundedness check compares the answer with its sources. No single layer removes them all, so I measure the result with real questions.

What is a RAG hallucination, in plain words?

RAG stands for retrieval-augmented generation. Before the model answers, your system searches your own documents and pastes the best matches into the prompt. The model then writes its answer from them. A 2020 paper that introduced the approach reported that RAG models generate more factual language than a model that relies on its memory alone.

A hallucination is a confident answer that is not true. OpenAI describes them as "plausible but false statements generated by language models." In RAG the danger is that the answer looks sourced, because a search produced it. It can still cite the wrong document, or add a detail the documents never say.

Picture a new hire at a bank, answering a customer from the staff handbook. If the right page is missing, or they find last year's page, a careful hire says they will check. A rushed one answers from memory and sounds sure. A RAG model does the same unless you build rules that stop it.

The same thing happens in a bank's support bot when it reads an old fee table, and the worked case below shows it.

Key words

RAG
Retrieval-augmented generation: search your documents first, then let the model answer from what it found.
Grounded answer
An answer where every claim traces back to a passage in the sources.
Citation
A pointer, such as a document name and section, showing where a claim came from.
Reranker
A second model that re-sorts search results so the best passages come first.
Groundedness check
A test that compares each claim with its sources and flags the ones they don't back.

Where do wrong RAG answers come from?

Almost every wrong answer starts in one of two places. The search fails, or the model ignores good sources. OWASP, which publishes a top ten list of risks for LLM apps, lists misinformation as LLM07 in its 2026 edition. It says misinformation "can arise from hallucination, incomplete or stale context", and a model with no passage to lean on fills the gap from patterns it learned.

Where a wrong RAG answer starts

The search goes wrong

Old passage ranks first

a 2019 fee table with the same words

Right passage missed

no match for the exact product code

Model

writes the answer from what it got

Confident wrong answer

sounds sure, cites the wrong thing

  1. 1An old passage wins the search because its words match the question best.
  2. 2The right passage never arrives, so the model has nothing correct to work from.
  3. 3The model writes a fluent answer anyway, and nothing in the output flags it.
A search that ranks an old passage first, or misses the right one, hands the model the wrong facts. The model then writes a fluent answer from them. Nothing in the output warns the reader, so the error reaches the customer.

A worked case: a customer asks "What is the late payment fee on my card?" The search ranks a 2019 fee table first, because its words match the question best. The bot replies £25, a fee that was cut later. It sounds sure and cites the table. Nothing in the system stopped it.

How do you make the search bring back the right passage?

Search comes first, because a model can't quote a passage it never received. Three changes do most of the work.

  • Hybrid search

    It mixes keyword matching with meaning matching. Anthropic points out that embedding models can miss exact matches. A keyword method called BM25 is particularly effective for queries with unique identifiers or technical terms.

  • Reranking

    A second model re-sorts the top results, so the strongest passage moves to the front.

  • Filters

    Filter by date, owner or product, so a retired fee table never reaches the model.

Anthropic reported a method it calls contextual retrieval. It adds a short note of context to each passage before the passage is embedded for search. Anthropic says this cuts failed retrievals by 49%, and by 67% when combined with reranking. Treat that as one company's test, and measure your own.

Self-RAG, a 2023 research framework, goes further. The model decides when to search and critiques its own output. Its authors report that it outperforms ChatGPT and a retrieval-augmented Llama 2 chat model on question answering, reasoning and fact checking tasks, with significant gains in factuality and citation accuracy for long answers.

How do you keep the model to its sources?

Next, change how the model writes. Anthropic and OWASP both say answers should be grounded in sources.

  • “Minimize hallucinations in Claude's outputs by allowing uncertainty, grounding responses in direct quotes, and verifying claims with citations.”

    Anthropic, guide on reducing hallucinations

  • “Ground Claims Before Action: Require outputs to be grounded in authoritative and current sources.”

    OWASP, 2026 misinformation entry

  1. 1

    Give it a way out

    Tell it to admit uncertainty when the passages don't answer the question, and to say "I don't know". Anthropic recommends explicitly giving that permission.

  2. 2

    Quote before answering

    For long documents, ask it to pull the exact sentences first. Anthropic sets the threshold at 20k tokens and says this grounds responses in the actual text, which reduces hallucinations.

  3. 3

    Cite every claim

    Each claim names its document and section. If the model can't find a supporting quote, the claim comes out. Anthropic's guidance says it must retract the claim.

  4. 4

    Limit it to the sources

    Say the answer must come from the passages only, not from general knowledge.

Here is the limit. Anthropic says these techniques cut hallucinations a lot, but not to zero. OpenAI's research adds why the "I don't know" has to be designed in: most scoreboards rank models on accuracy, and a wrong answer is worse than the model saying it doesn't know, so a model is pushed toward guessing.

Tip

Asked how you would reduce hallucinations? Don't promise zero. Name the layers, and say how you would measure what is left.

What does a fix look like in a bank's support bot?

A mid-size bank runs a support bot over about 4,000 pages of fee and product documents, updated every quarter. Here is the same customer question, handled with the layers in place.

Layers that keep a RAG answer grounded

Customer question

asks about a late fee

Better sources

Hybrid search

keyword plus meaning matches

Reranker

moves the best passage to the top

Date filter

drops retired fee tables

Model

answers only from the passages

Checks

Citation per claim

names the document and section

Groundedness check

flags claims the sources don't back

Grounded answer

or a hand-off to a person

  1. 1The question goes to the search, which keeps only current fee documents.
  2. 2The best passages go to the model, which writes from them alone.
  3. 3The answer gets a citation for each claim, then the groundedness check.
  4. 4Claims the sources back reach the customer. The rest go to a person.
Five stages from question to reply. The search keeps only current fee documents, the model writes from those alone, and two checks decide what the customer sees. Anything the sources don't back goes to a person.
  1. 1

    Filter by date

    The 2019 table is dropped, because its end date has passed. Every document now carries an effective date, which is the data work this costs.

  2. 2

    Rerank

    The 1 March 2026 schedule moves to the top, so the model sees the current fee first.

  3. 3

    Answer from the passage

    The bot replies £12 and cites the schedule by name and section. It does not use its own memory of bank fees.

  4. 4

    Check the claim

    The groundedness check finds the £12 in the cited sentence. If that sentence had said £25, the check would flag the mismatch and the chat would go to an agent.

  5. 5

    Accept the cost

    Refusing when the sources are thin sends more chats to people. The bank accepts that for fee questions, because a wrong fee costs both trust and money.

Here is the citation rule in plain Python. Each claim is kept only if its quote really appears in the passage it cites.

Python
# A made-up fee bot's last check. The model proposes claims, each with a quote;
# code keeps a claim only if its quote really appears in the passage it cites.
PASSAGES = {
    "fees-2019": "Late payment fee on all cards: £25.",
    "fees-2026": "Late payment fee on all cards: £12 from 1 March 2026.",
}

def check(claims):
    for claim in claims:
        source = PASSAGES.get(claim["source"], "")
        if claim["quote"] in source:
            print("KEEP  " + claim["text"] + " [" + claim["source"] + "]")
        else:
            print("DROP  " + claim["text"] + " (quote not in " + claim["source"] + ")")

check([
    {"text": "The late fee is £12.", "source": "fees-2026",
     "quote": "Late payment fee on all cards: £12"},
    {"text": "The late fee is £25.", "source": "fees-2026",
     "quote": "Late payment fee on all cards: £25"},
    {"text": "Students pay no late fee.", "source": "fees-2026",
     "quote": "no late fee"},
])

Output

KEEP  The late fee is £12. [fees-2026]
DROP  The late fee is £25. (quote not in fees-2026)
DROP  Students pay no late fee. (quote not in fees-2026)

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a confident answer the sources don't support.
  • The two causes: the search misses, or the model ignores good sources.
  • Search fixes first: hybrid search, reranking and date filters.
  • Grounded prompts: permission to say I don't know, quotes and citations.
  • A groundedness check, and an honest note that RAG reduces hallucinations without removing them.
  • Testing with real questions, and a person for high-stakes answers.

Common traps

  • Trap"Just use a bigger model."

    BetterA bigger model still guesses when the right passage is missing. Fix the search and add citations first.

  • Trap"Our RAG is accurate, so every answer is true."

    BetterGood retrieval doesn't guarantee a true answer. Check each claim against its source.

  • Trap"Put do not hallucinate in the system prompt."

    BetterA rule in the prompt is a soft control. Pair it with checks in code and a person for high-stakes answers.

Can you spot the problem?

Spot the stale source

A bot answered a refund question with the wrong limit. Which retrieved snippet most likely caused it?

Quick check

Your bot cites a document for a claim, but the cited passage holds no matching quote. What should the system do?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q131Retrieval metrics: recall@k, MRR, nDCG?12 min
  2. Q132Generation metrics: faithfulness, answer relevance?10 min
  3. Q133What are common RAG failure modes?11 min
  4. Q135How do you add citations?11 min
  5. Q138RAG vs long context: which to use?12 min
  6. Q139How do you keep the index fresh?11 min

Learn it in depth

Last updated on 26 November 2026

Building a RAG bot over your own documents?

I design and build AI products and agents, including the search, the prompts and the checks around them. Book a short call and tell me which documents you have and what a wrong answer would cost.