# 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.

AI and LLM interview question Q134, Retrieval-augmented generation (RAG). Intermediate, very common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-to-reduce-hallucinations-in-rag

## Say it in 30 seconds

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.

## Say it in 2 minutes

RAG means the system searches your documents first, then pastes the best passages into the prompt. A hallucination here is an answer that sounds sure but isn't in those documents, or contradicts them. Most of the time one of two things goes wrong: the search missed the right passage or brought back an old one, or the model ignored the passage and answered from memory. So I fix the search first, because a model can't quote a passage it never received.

Next, I change how the model writes. I tell it to use only the passages, and to admit uncertainty when they don't cover the question. I ask it to pull the exact sentence behind each claim and cite it. OpenAI's research says that most scoreboards rank models on accuracy, and that a wrong answer is worse than the model saying it doesn't know. So a model that admits a gap is doing its job. Anthropic's guidance says that, on long documents, quoting first grounds the answer in the real text.

Then I check the answer. A groundedness check compares each claim with its sources and flags anything they don't back. In a bank's support bot, a fee question gets the current schedule, the old 2019 table is filtered out by date, and any fee that can't be cited is withheld while the customer is handed to a person. I'd say that this cuts hallucinations a lot, but not to zero, so I test with real questions and keep a person in the loop for money.

## 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.

- **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.

*Diagram, Where a wrong RAG answer starts: 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.*
1. An old passage wins the search because its words match the question best.
2. The right passage never arrives, so the model has nothing correct to work from.
3. The model writes a fluent answer anyway, and nothing in the output flags it.

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. **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. **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. **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. **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.

*Diagram, Layers that keep a RAG answer grounded: 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. The question goes to the search, which keeps only current fee documents.
2. The best passages go to the model, which writes from them alone.
3. The answer gets a citation for each claim, then the groundedness check.
4. Claims the sources back reach the customer. The rest go to a person.

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. **Rerank:** The 1 March 2026 schedule moves to the top, so the model sees the current fee first.
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. **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. **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:

```text
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." Better: A 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." Better: Good retrieval doesn't guarantee a true answer. Check each claim against its source.
- Trap: "Put do not hallucinate in the system prompt." Better: A 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?

A. Refunds above 500 pounds need a manager's approval. (Refund policy 2026, section 4)
B. Refunds up to 300 pounds need no approval. (Refund policy 2021, retired 1 January 2025)
C. The returns desk is open 9 a.m. to 6 p.m. on weekdays.
D. Gift cards can only be refunded as store credit.

**Answer:** B. The 2021 policy was retired, and nothing filtered it out. The search ranked it because its wording matched the question. Filter by effective date, and show the cited section so people can see which version they are reading.

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

A. Keep the claim, because a citation is attached
B. Remove the claim, or say it can't be confirmed
C. Ask the model to reword the claim more confidently
D. Lower the temperature, a setting for how random the wording is, and generate again

**Answer:** B. A citation with no matching quote is a claim the sources don't back. Anthropic's guidance says the model must retract it. Rewording, or lowering that setting, adds no facts, so it changes the tone, not the truth.

## Can you answer these from memory?

**Flash cards**

- **What is a RAG hallucination?** A confident answer that the retrieved sources don't support.
- **What are the two main causes?** The search misses or brings an old passage, or the model ignores a good one.
- **Why fix the search first?** A model can't quote a passage it never received.
- **What does a groundedness check do?** It compares each claim with its sources and flags any they don't back.
- **Should the model ever say I don't know?** Yes. A confident wrong answer costs more than an honest I don't know, so design that answer in.
- **Can RAG remove hallucinations?** No. Anthropic says its prompt techniques significantly reduce them but don't eliminate them.

## Likely follow-up questions

- Q131 Retrieval metrics: recall@k, MRR, nDCG? https://designervenkat.online/interview/ai/retrieval-metrics-recall-at-k-mrr-ndcg
- Q132 Generation metrics: faithfulness, answer relevance? https://designervenkat.online/interview/ai/rag-generation-metrics-faithfulness-answer-relevance
- Q133 What are common RAG failure modes? https://designervenkat.online/interview/ai/common-rag-failure-modes
- Q135 How do you add citations? https://designervenkat.online/interview/ai/how-do-you-add-citations
- Q138 RAG vs long context: which to use? https://designervenkat.online/interview/ai/rag-vs-long-context
- Q139 How do you keep the index fresh? https://designervenkat.online/interview/ai/how-do-you-keep-the-index-fresh

## Learn it in depth

- [Retrieval-augmented generation](https://designervenkat.online/learn/ai-engineering/rags)
- [Grounded generation](https://designervenkat.online/learn/ai-engineering/generation)
- [RAG & Dynamic Filters](https://designervenkat.online/learn/ai-engineering/rag-and-dynamic-filters)
