Skip to content
AI Playbooks · 10 min read

How to Reduce AI Hallucinations: A Beginner’s Playbook on Why AI Makes Things Up

Learn how to reduce AI hallucinations with a simple story: why AI makes things up, how to ground answers in real sources and how to test for errors.

Cover for the CodeSpy playbook on how to reduce AI hallucinations: grounding, saying I don't know, and testing

Meera is a developer in Pune. Last month she built a small help-centre chatbot for an online bookshop. On Monday a customer asked it, “How many days do I have to return a book?” The bot replied, kindly and confidently, “You have 30 days.” The real policy is 14 days.

Nobody had told the bot 30 days. It simply made it up. Meera’s manager asked one question: “Can you stop it doing that?” This playbook is the answer she found. It shows how to reduce AI hallucinations in plain steps, even if you have never trained a model and never will.

Last verified: 25 November 2026. AI tools change fast; check the linked sources for anything newer.

Who this is for: beginners, developers and product people who use a chatbot or an AI API and want answers they can trust. No maths needed. Time needed: about 30-45 minutes, plus an hour to try it on your own app.

What is an AI hallucination, in simple words

An AI hallucination is an answer that sounds right but is false. The model is not lying on purpose. It does not know it is wrong.

Think of a new shop assistant on their first day who is too shy to say “I don’t know.” A customer asks about returns, so they give the answer that sounds most likely. Often they are right. Sometimes they are confidently wrong.

A large language model (LLM) works in a similar way. It writes one small piece of text, called a token, at a time, always picking a likely next word based on patterns from its training. You can read more in How LLMs Work: tokens, context window and temperature. Nothing in that process checks the answer against the truth.

Why does AI make things up?

There are two simple reasons, both described in OpenAI’s research note “Why language models hallucinate” (5 September 2025).

  • Rare facts cannot be guessed from patterns. Grammar and common facts repeat a lot in training text. A person’s birthday or your shop’s return policy may appear once or never, so the model fills the gap with something that only looks right.
  • Guessing is rewarded. Many tests score a model only on how many answers are right. Like a multiple-choice exam, a guess can earn points, while “I don’t know” earns zero. So models learn to guess.

OpenAI’s note gives a clear example from one test. An older model, o4-mini, got 24% of answers right but 75% wrong, because it almost never held back. A newer model, gpt-5-thinking-mini, got 22% right, only 26% wrong, and said “I don’t know” 52% of the time. Slightly fewer right answers, far fewer made-up ones.

The precise version in one sentence: a hallucination is a fluent, confident output that is not supported by facts or by the information the model was given.

The good news: to reduce AI hallucinations you do not need to retrain anything. You decide what facts the model sees, what it is allowed to say, and how you check it.

How to reduce AI hallucinations: the playbook at a glance

  1. Collect the wrong answers: build a small test list, including questions with no answer.
  2. Give the model the facts: put the right information in front of it.
  3. Give it permission to say “I don’t know”.
  4. Ask for quotes and sources, then check them.
  5. Lower the risk: narrow the task and add a human check where it matters.
  6. Measure: count right, wrong and “I don’t know” answers after every change.

Play 1: Collect the wrong answers

Goal: see exactly where and how your AI makes things up, before you try to fix it.

  1. Write 20-30 real questions your users ask. Copy them from support emails or chat logs.
  2. Write the correct answer next to each one, from your real documents.
  3. Add 5 questions your documents cannot answer, for example “Do you ship to Mars?”. These are the trap questions.
  4. Run every question through your AI and mark each answer: right, wrong, or “I don’t know”.

Meera found that her bot got 18 of 25 questions right (illustrative numbers). Worse, it answered all 5 trap questions with invented details.

This is a small version of an eval, a repeatable test for AI. The AI evals playbook goes further.

You are done when: you have a list of questions, correct answers and trap questions, and you know your starting score.

Play 2: Give the model the facts

Goal: stop the model guessing by handing it the right information at the moment it answers. This is the single biggest way to reduce AI hallucinations.

Back to the shop assistant. If you tape the return policy to the counter, they read it instead of guessing. For an AI, this is called grounding: putting trusted text into the prompt.

  1. Find the documents that hold the true answers (policies, help pages, product data).
  2. For a few short documents, paste them straight into the prompt.
  3. For many documents, search them first and include only the best matches. This is called RAG, retrieval-augmented generation. See What is RAG?.
  4. Tell the model clearly: answer only from the documents provided, not from general knowledge.

Meera added the bookshop’s policy pages to every prompt. The 30-day answer disappeared, because the real “14 days” was now right in front of the model.

You are done when: every question in your test list can be answered from text the model actually sees.

Play 3: Give it permission to say “I don’t know”

Goal: make holding back a normal, allowed answer instead of a failure.

Anthropic’s guide “Reduce hallucinations” lists this as the first basic step and says it can drastically reduce false information. Models were trained in a world that rewards guessing, so you have to say out loud that “I don’t know” is fine. It is also the cheapest way to reduce AI hallucinations: one extra sentence in the prompt.

Here is a simple prompt template. It is an illustration; the exact wording can vary between tools.

You are the help assistant for an online bookshop.
Answer ONLY from the documents below.
If the documents do not contain the answer, reply exactly:
"I'm not sure. Let me connect you with our team."
Do not guess dates, prices or policies.

<documents>
{{POLICY_PAGES}}
</documents>

Question: {{USER_QUESTION}}

In plain steps: tell it its job, limit it to your documents, give it an exact sentence to use when unsure, and name the things it must never guess.

Meera’s bot now answered the “Mars” trap question with the hand-off sentence instead of a made-up shipping fee.

You are done when: your trap questions get the “I’m not sure” reply, not invented details.

Play 4: Ask for quotes and sources, then check them

Goal: make every answer easy to check, so made-up claims are caught before a user sees them. Checking is how you reduce AI hallucinations that slip past Plays 2 and 3.

  1. For long documents, ask the model to first copy the exact sentences it will rely on, then answer using only those quotes. Anthropic’s guide suggests this for long texts.
  2. Ask it to show which document or section each claim came from.
  3. Ask it to review its own answer: any claim without a supporting quote must be removed.
  4. In your code, check that each quote really appears in the document. A simple text search is enough to start.

Meera’s bot now shows a small line under each answer: “From: Returns policy, section 2.” When the quote check fails, the app shows the hand-off message instead.

You are done when: each answer comes with a quote or source, and your app rejects quotes it cannot find.

Play 5: Lower the risk where it matters

Goal: make the remaining mistakes rare and harmless.

  • Narrow the task. “Answer returns questions from this page” fails less than “answer anything about our company”.
  • Keep creativity low for facts. A lower temperature setting makes answers more predictable. It does not fix missing facts, but it reduces random wording.
  • Ask twice. Run the same question a few times and compare. If the answers disagree, treat it as a warning sign. Anthropic’s guide calls this best-of-N verification.
  • Add a human for high stakes. Money, health, legal or anything you cannot undo should be checked by a person. See AI guardrails and human approval.

Meera kept the bot for simple questions and sent anything about refunds above a set amount to a human (an illustrative rule her team chose).

You are done when: high-risk answers always pass a human or a hard rule before reaching a customer.

Play 6: Measure after every change

Goal: know, with numbers, that your work to reduce AI hallucinations paid off.

  1. Re-run your test list from Play 1 after each change to the prompt, model or documents.
  2. Track three numbers: right, wrong, and “I don’t know”.
  3. Aim to push wrong down first. A few extra “I don’t know” answers are usually better than confident mistakes.
  4. Add every new wrong answer a real user reports to the test list.

After a week, Meera’s bot scored 23 right, 0 wrong and 2 “I don’t know” out of 25 (illustrative). Not perfect, but now it is honest when it is unsure.

You are done when: you have a simple table of scores over time and wrong answers are trending down.

Do you need all of this?

Your situationStart withWhy
Personal use of a chatbotPlays 3 and 4Ask for sources and check them yourself
A few documents, simple botPlays 1, 2, 3Paste the facts and allow “I don’t know”
Many documentsAdd RAG to Play 2Only the most relevant text fits in the prompt
Money, health or legal answersAll six playsA human check is needed on top

Mistakes to avoid

Most beginners who try to reduce AI hallucinations trip over the same few things.

  • Expecting zero hallucinations. Every source agrees they can be reduced, not removed. Fix: design for the leftover mistakes with hand-offs and human checks.
  • Testing only easy questions. The bot looks perfect until a real user asks something odd. Fix: always include trap questions.
  • Trusting a citation without checking it. Models can invent sources too. Fix: check quotes against the real text in code.
  • Stuffing in every document. Too much text can hide the right answer. Fix: send only what is needed; see context engineering.
  • Judging only by how many answers are right. That repeats the guessing problem. Fix: count wrong answers separately.

How to know it is working

You have managed to reduce AI hallucinations when these simple checks hold:

  • Wrong answers on your test list go down after each change.
  • Trap questions get the “I’m not sure” reply every time.
  • Every answer shows a source, and the quote check passes.
  • Fewer support tickets say “the bot told me something wrong”.

Your checklist

  • ☐ 20-30 real questions with correct answers
  • ☐ 5 trap questions with no answer in the documents
  • ☐ The right documents included in every prompt
  • ☐ An allowed “I’m not sure” reply in the prompt
  • ☐ Quotes or sources required, and checked in code
  • ☐ Human review for high-stakes answers
  • ☐ Right / wrong / “I don’t know” tracked after every change

Frequently asked questions

Can AI hallucinations be completely stopped?

No. Today’s language models can still make things up, even with good prompts and documents. The realistic goal is to make mistakes rare, easy to spot and safe to recover from.

Do newer or bigger models hallucinate less?

Often, but not always. OpenAI’s own example shows a newer model that was wrong far less often mainly because it said “I don’t know” more. Always test on your own questions instead of trusting a model name to reduce AI hallucinations for you.

Does RAG stop hallucinations?

RAG helps a lot because the model reads real facts before answering. It can still fail if the search finds the wrong text, so check retrieval too. The RAG accuracy playbook shows how.

How do I spot a hallucination as a normal user?

Be careful with exact numbers, dates, names, quotes and links. Ask the chatbot for its source, open it, and check it says what the answer claims.

Back to Meera’s bookshop bot

A week later, the same customer question came in: “How many days do I have to return a book?” The bot answered “14 days”, showed the line from the returns policy, and handed a tricky refund question to a person. Meera’s manager stopped asking whether the bot could be trusted and started asking which questions to add next.

The way to reduce AI hallucinations is a habit, not a single setting. Your next step: write ten real questions and three trap questions for your own AI today, and run them. Then read the AI evals playbook to turn that list into a test you run on every change.

Sources: OpenAI’s research note “Why language models hallucinate” (5 September 2025, including the SimpleQA numbers quoted above) and Anthropic’s guide “Reduce hallucinations” (basic and advanced strategies). Story numbers are illustrative.

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Newsletter

Get the next guide before anyone else.

One email a week with new playbooks and tutorials. No spam, unsubscribe anytime.