About

What Is AI Hallucination? Why LLMs Make Up Plausible Facts

RAG doesn't stop it when the answer isn't in the docs. One line of instruction took a 3B model from 8/10 to 10/10

Short version: hallucination is when an AI states something false as if it were fact. Adding RAG, which looks up your documents and feeds them in, doesn't make it go away. I measured it: on 10 questions whose answer wasn't in the docs, Qwen2.5 0.5B made up all 10, and 3B still made up 2. But adding one line, "if it's not in the documents, say so," got 3B to answer "not in the documents" for all 10. After reading this you'll know why hallucination happens, and what to test and add when you build a RAG chatbot.

Why it happens

An LLM is trained to pick a plausible next word. Whether that word is true is never a separate lesson. So when you ask about something it doesn't know, it tends to produce a plausible answer instead of saying it doesn't know.

The 2025 paper "Why Language Models Hallucinate" (Kalai et al.) adds another reason. Most benchmarks score "I don't know" the same as a wrong answer: zero. Under that rule, guessing scores higher. The models were raised to be good test-takers.

What I tried: internal docs of a company that doesn't exist

I made up a logistics company called Kumo Freight and wrote five short policy docs: leave, expenses, IT, office and shipping. Since the company doesn't exist, any concrete answer given without the docs is invented.

There were 20 questions. For 10 the answer is in the docs. The other 10 are on the same topic but the answer isn't there ("how many days of paternity leave?" against a leave doc that never mentions it). The retriever found the right topic but the answer just isn't there. That's the most common way RAG fails.

Models: Qwen2.5-Instruct at 0.5B, 1.5B and 3B, run with transformers 4.56.2 on a Mac CPU with greedy decoding, so every run gives the same answer. I graded with a regex first, then read every answer myself.

Of 10 questions not answered in the docs,   0.5B   1.5B   3B
how many got "not there"
no documents                                  0      0      2
documents in the prompt (RAG)                 0      5      8
RAG + one line "say if it's missing"          4      9     10

Did it say the answer was not there?10 questions whose answer is not in the docs. Qwen2.5-Instruct 0.5B / 1.5B / 3B, greedy decoding10 / 10no documents0.5B 01.5B 03B 2docs in prompt (RAG)0.5B 01.5B 53B 8RAG + one line:say if it is missing0.5B 41.5B 93B 10The other 10 questions (answer in the docs) stayed at 10/10 for every model, with or without the line.Made-up company Kumo Freight, 5 short policy docs. Every answer read by hand after a regex pass.

On the 10 questions that were answered in the docs, all three models got 10 out of 10 with RAG. Adding the instruction kept it at 10. I worried "say it's missing" would make them hold back on things they did know. It didn't.

Made-up answers recycle numbers from the docs

At first I assumed RAG would close the topic. It didn't. The worse part is what the invented answers look like.

I asked 0.5B how many people the smallest meeting room seats. It said 20. The doc only says the largest room, Yodo, seats 20. For the hotel allowance on business trips it said 1,000 yen, and after the instruction was added it offered the 3,000 yen daily meal allowance as the answer. 1.5B said standard delivery costs $0.

Without documents the answers are obviously off, like "Dell Latitude 7000 series," which is almost a relief. With RAG, the invented answer comes wearing a real number from the docs. The reader assumes it has a source.

Even 3B said the office "does not operate on Saturdays, as it only operates from 8:00 to 21:00 on weekdays," stating a guess one step beyond the doc as fact.

One line does more than you'd expect

I added this to the system prompt: "Use only the documents. If the answer is not in the documents, reply exactly: Not in the documents." 1.5B went from 5 to 9, and 3B from 8 to 10.

0.5B only got to 4. In a small model the habit of answering something beats the instruction. If you plan to run a small model yourself to save money, measure this part separately.

Without documents, just "if you don't know, say I don't know" got 3B to say it for all 20. The hallucinations vanish, but so do the answers it could have given. The instruction only stops it from making things up. RAG is what gives it something to answer with. You need both.

What to do when you build a RAG chatbot

Put unanswerable questions in your test set: if you only test with questions the docs answer, all three models score 10 out of 10 and the problem stays hidden. Mix in about half same-topic questions the docs don't answer.

Make "it's missing" a fixed sentence: with a fixed reply like "Not in the documents." it's easy to turn it into a "contact support" button in the UI, and easy to count.

Ask for the source sentence: if the answer comes with the sentence it was based on, a person catches recycled numbers like that "20" right away. I didn't measure this one here.

Pick model size by measuring: with the same instruction, 0.5B got 4 and 3B got 10. If you want a small model, build this table first.

RAG, instructions or fine-tuning: what reduces hallucination

The model doesn't know the facts: RAG. It gives the model material to answer from. But RAG alone doesn't stop the model inventing things when that material is missing.

It invents when the material is missing: one line in the prompt, plus testing with unanswerable questions. In this experiment that was the cheapest fix with the biggest effect.

Putting facts in with fine-tuning: I wouldn't. You retrain whenever the docs change, and you can't say where an answer came from.

If you've built a chatbot that answers from your internal docs but can't ship it because it sometimes tells plausible lies, feel free to ask negabaro. We can start by building a set of unanswerable questions and measuring how many it makes up today.

Key Concepts

1

Write questions the docs answer and same-topic questions they don't, about half and half

2

With RAG alone, count how often it says the answer isn't there — 0.5B 0/10, 1.5B 5/10, 3B 8/10

3

Add "if the answer is not in the documents, reply exactly: Not in the documents." and measure again — 4, 9, 10

4

Check the answerable questions didn't lose accuracy (all three stayed at 10/10 here)

5

Read the wrong answers for recycled numbers from the docs — "the smallest room seats 20"

Use Cases

Internal policy or FAQ chatbots — when retrieval finds the topic but the docs don't hold the answer When a similar number in the docs gets attached to a different item (meal allowance passed off as hotel allowance) When you run a small model yourself to save money Citing papers, court cases or APIs that don't exist
← What Is Constitutional AI? Letting AI Critique Itself by Principles What Is Audio Tokenization? How Neural Codecs Turn Sound into Tokens →