AI

Why Do AI Models Hallucinate and How Can You Reduce It?

AI models hallucinate because they predict likely words instead of verifying facts, and their training often rewards confident guesses. Better prompts, trusted sources, and fact-checking can reduce these errors, but cannot eliminate them.

Ask a language model for a source, and it will hand you one with an author, a year, and a journal name. Sometimes the paper does not even exist.

That is a hallucination, an answer that sounds right, reads smoothly, and is not true. It is why people who use generative AI every day still keep a second tab open for fact-checking.

My view is that hallucination is not a glitch waiting for a patch. It follows from how these models are trained and how they are graded. That is also why you can reduce it a lot, but not erase it.

This guide explains why it happens, shows real cases where it cost people money, and walks through a small prompt experiment I built to see how far a better prompt can go.

What Are AI Hallucinations?


Start creating Verdict in seconds, and convert more of your visitors into leads.

An AI hallucination is an output that is fluent and confident but false, invented, or not supported by the source the model was given. OpenAI describes it as a plausible but false statement generated by a language model.

The confident tone is what makes it risky. A wrong answer that sounds unsure is easy to doubt. A wrong answer written like a textbook gets copied into emails, reports, and court filings.

IBM separates errors of fact, errors of context, and inconsistency inside one answer. The table below uses a simple version of that idea.

TypeWhat it looks likeExample
Factual errorA wrong fact stated as trueA wrong date or statistic
Fabricated sourceA citation, link, or case that does not existA believable paper title that cannot be found
Contextual errorThe answer ignores or contradicts the text you suppliedA summary that adds details missing from the document
InconsistencyThe answer contradicts itselfOne paragraph says 75%, the next says 80%

All four come from the same failure. The model produces what sounds likely, not what it has checked.

Why Do AI Models Hallucinate?


Start creating Verdict in seconds, and convert more of your visitors into leads.

They Predict Words, Not Facts

A language model is trained to predict the next word in a sequence. When it answers you, that step is called inference. Patterns like grammar and spelling repeat millions of times, so the model learns them reliably.

Rare facts are different. OpenAI’s research points out that arbitrary facts, such as a person’s birthday, cannot be worked out from patterns. Facts that appear only once in the training data are especially likely to be wrong. Pretraining also contains no true or false labels, only examples of fluent language.

The above image by Gemini Pro portrays that rare facts have no strong pattern, so a model still picks an answer.
The above image by Gemini Pro portrays that rare facts have no strong pattern, so a model still picks an answer. 

Training and Testing Reward Guessing

This is the part most people miss. Most models hallucinate partly because standard tests score accuracy only. On an exam where a blank answer earns zero and a lucky guess can earn a point, guessing always wins. Models trained and ranked this way learn to guess instead of saying “I don’t know.”

OpenAI shows this with SimpleQA results. One model declined to answer 52% of questions, got 22% right, and was wrong 26% of the time. Another declined only 1%, got 24% right, and was wrong 75% of the time. The accuracy was almost the same. The error rate was not.

This demonstration by Gemini Pro shows that when scoring rewards lucky guesses, guessing beats honesty. 

Training Data Has Gaps

Models learn from huge text collections that are incomplete, outdated, or biased. Google Cloud lists poor training data and a lack of grounding in real sources among the main causes. When the data has a hole, the model fills it with whatever fits the pattern.

Vague Prompts Invite Guessing

A prompt like “tell me about this university’s policies” gives the model no source and no permission to admit ignorance. Settings that add randomness, such as a higher temperature, make answers more varied, which can also make them less reliable on factual questions. Prompt quality matters for images too.

When Hallucinations Cost Real Money


Start creating Verdict in seconds, and convert more of your visitors into leads.

In 2023, researchers asked ChatGPT-3.5 to write 30 short medical papers and checked all 115 references. 47% were fabricated, 46% were real but inaccurate, and only 7% were real and accurate. That was an older model, but the pattern is the lesson.

The same year, two New York lawyers filed a brief citing six cases that ChatGPT had invented. One of them asked the chatbot whether the cases were real, and it said yes. In Mata v. Avianca, the judge imposed a $5,000 sanction.

In 2024, a British Columbia tribunal held Air Canada responsible after its website chatbot gave wrong advice about bereavement fares. The tribunal found negligent misrepresentation and ordered the airline to pay $812.02 in total.

None of these were exotic failures. Each one took a confident answer and trusted it without checking.

Can Better Prompts Reduce Hallucinations? A Small Experiment


Start creating Verdict in seconds, and convert more of your visitors into leads.

Prompts are the cheapest lever you control, so I tested how far they go. I built a small demo called “Prompt Engineering: Can Better Prompts Reduce AI Hallucinations?” It asks one question three ways and shows the answers side by side.

The Setup

Every question goes through three prompts. The same model and the same settings are used for all three, so the only thing that changes is the prompt.

  • The basic prompt contains only the question.
  • The context-based prompt adds a reference passage and asks the model to answer from it.
  • The constrained prompt adds the same passage plus clear rules: use only the text, use no outside knowledge, make no assumptions, and say so if the answer is not in the text.

The reference is a short, invented attendance policy for  “University of Dundee,” so no model could have memorized it:

University of Dundee Attendance Policy. Students must attend at least 75% of scheduled classes in each course to appear in the final examination. Students with attendance between 65% and 74% may apply for condonation by submitting a medical certificate to the Dean’s office within 7 days of the notice. Attendance below 65% results in a mandatory course repeat. Absence for university-approved events counts as present. Arriving more than 15 minutes late is recorded as absent.

How the App Works

The app uses Python and Streamlit, with Pandas organizing the results. You type a question, paste a trusted reference text, and press one button. Three panels appear side by side, and a comparison table counts the unsupported claims in each answer.

I checked every claim against the reference text instead of trusting the model’s own confidence. A model can sound sure and still be wrong.

The demo app: one question, one trusted reference text, three prompts.
The demo app: one question, one trusted reference text, three prompts.

Test 1: The Answer Is in the Text

The question was: what is the minimum attendance needed to sit the final exam? The context-based and constrained prompts both answered 75% of scheduled classes in each course.

The basic prompt guessed. It said most universities require 75%, added that some labs ask for 80%, and called XYZ “usually” the same. That is two unsupported claims wrapped around one plausible number.

Test 2: The Answer Is Missing

The question was: how much is the fee for applying for attendance condonation? The policy never mentions a fee, which makes this the real hallucination test.

  • The basic prompt said XYZ charges around PKR 2,000 per course, paid at the accounts office, and that applications are usually reviewed within two weeks. All three details were invented.
  • The context-based prompt correctly said to submit a medical certificate to the Dean’s office within 7 days, then added “the fee is PKR 1,000.” The fee was invented.
  • The constrained prompt said the text does not state any fee, and repeated only what the policy says about the medical certificate and the Dean’s office.

The middle answer taught me the most. Context made the answer mostly accurate, and the model still filled the gap with a believable number. Context supplies information, but only an instruction gives the model permission to say “not provided.”

The fee is not in the policy. Only the constrained prompt admits that. 
The fee is not in the policy. Only the constrained prompt admits that. 

Test 3: The Question Is Ambiguous

The question was: what happens if I miss too many classes? “Too many” could mean below 75% or below 65%.

The basic prompt listed generic outcomes such as losing marks and notifying parents. The context-based prompt got the thresholds right, then added a warning letter that the policy never mentions. The constrained prompt laid out all three attendance levels and noted that the text does not define “too many.” It then tacked on a tip to apply early, which the policy never says.

Even the constrained prompt slipped in one unsupported tip. 
Even the constrained prompt slipped in one unsupported tip. 

What the Results Show

TestBasic promptContext-based promptConstrained prompt
1. Answer in text200
2. Answer missing310
3. Ambiguous question211
Total unsupported claims721

I counted a claim as unsupported if I could not trace it to the reference text, even when it sounded reasonable. This is a three-question demo with one model, so treat it as an illustration, not a benchmark.

Three things stood out:

  • Adding context reduced guessing but did not stop it.
  • A clear instruction to admit missing information made the biggest difference.
  • Even the best prompt let one small guess through, which is why prompting alone cannot be the whole answer.
Even the constrained prompt slipped in one unsupported tip. 
Even the constrained prompt slipped in one unsupported tip. 

Other Ways to Reduce Hallucinations


Start creating Verdict in seconds, and convert more of your visitors into leads.

Prompts work best as one layer in a stack. Here is how the main options compare.

MethodHow it helpsLimit
Clear prompts and permission to say “I don’t know”Removes the pressure to guess. Claude Academy advises telling the model that uncertainty is fineThe model can still add details, as in Test 3
Retrieval-augmented generationGives the model trusted documents at question time.Retrieval can fetch the wrong passage
Lower randomnessLess variation between runsDoes not fix a wrong fact
Ask for sources, then check themMakes unsupported claims easy to spotModels can invent sources, as the Cureus study showed
Self-verificationThe model drafts checks for its own answerCosts more, and can repeat the same mistake
Human reviewA final safety net for high-stakes workSlow, and needs a reviewer who knows the topic
Better evaluationOpenAI proposes penalizing confident errors more than honest uncertaintyNeeds industry-wide adoption
No single method stops hallucinations. Layers reduce the risk. Credit goes to Gemini Pro. 

Fine-tuning is often suggested as a fix. It is good at teaching a model a style or format, but it is not a reliable way to add new facts.

Researchers are also looking inside models. A study from Mila reported that hallucination-related signals appear in a model’s middle layers, and that suppressing them reduced hallucinated content.

How to Spot a Hallucination


Start creating Verdict in seconds, and convert more of your visitors into leads.

Some content deserves extra suspicion:

  • Exact numbers, dates, prices, and statistics.
  • Citations, links, quotes, and case names.
  • Obscure people, niche topics, and very recent events.
  • Answers that are oddly specific about something you never supplied.

The checks are simple. Open the sources it gives you. Ask the model how confident it is. Ask the same question in a fresh chat and compare. If two runs disagree on a fact, at least one of them is guessing.

Can Hallucinations Be Eliminated?


Start creating Verdict in seconds, and convert more of your visitors into leads.

Not completely. OpenAI’s researchers argue that accuracy will never reach 100%, because some real-world questions are simply unanswerable. They also argue that hallucination is not inevitable, because a model can choose to abstain when it is unsure. IBM makes the same practical point, you can reduce the problem, not delete it.

My Test 3 result shows this at small scale. The best prompt I wrote still let one guess through. That is why the fix is layers: grounding, clear instructions, verification, and review.

Final Verdict


Start creating Verdict in seconds, and convert more of your visitors into leads.

I think people argue about the wrong question. Of course models hallucinate. What matters is what happens when they do.

If a wrong answer costs you nothing, prompt casually. If it could cost money, marks, or trust, give the model the source text, tell it to say when the text is silent, and check the claims that matter. Prompt engineering is the cheapest first step, and you should always take it. Just do not mistake a better prompt for a guarantee.

I treat an AI model like a fast, confident colleague who rarely admits not knowing. Very useful, but you still read the contract before you sign. As models and evaluations improve, which I discuss in the future of artificial intelligence, that gap should narrow. I would not bet on it reaching zero.

Abdullah Zia

Abdullah Zia is a data science and analytics professional specializing in machine learning, Python, data analysis, visualization, Power BI, and Excel. He contributes practical insights, tutorials, and technology-focused articles to NogenTech, covering data, AI, analytics, and emerging technologies.

Related Articles

Leave a Reply

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

Back to top button