cv.cm

AI · AI basics

What is AI hallucination, and how do you stop it?

6 min read

Short answer

AI hallucination is when a model states false or invented information as if it were true, such as a fake citation, a wrong date or a quote nobody said. It happens because language models generate the most plausible text, not checked facts. You cannot remove it fully, but you can reduce it by giving the model sources, allowing it to say it does not know, and verifying key details.

What counts as a hallucination

The US National Institute of Standards and Technology calls this confabulation: generative AI producing confidently stated but erroneous or false content. The word hallucination is the common name. It also covers answers that contradict the material you supplied, or contradict what the model said earlier in the same chat.

TypeExampleWhy it is risky
Invented factA wrong founding year, population or priceLooks precise, so people trust it
Fake citationA real-sounding paper title, journal and DOI that do not existHard to spot without opening the link
Fake quoteWords attributed to a real person who never said themCan damage reputations
Unfaithful summaryA summary that adds a claim not in the source documentYou assume the source said it
Invented codeA function or library option that does not existCode fails or behaves unexpectedly
Outdated answerDescribes a rule or product as it was before the training cutoffCorrect once, wrong now

In images and video, odd details such as extra fingers or melting objects are sometimes also called hallucinations. They are a quality problem rather than a false claim. In creative work, inventing things that do not exist is often the goal. Hallucination is a problem when you need facts.

Why language models hallucinate

A language model writes by predicting the next token, a small piece of text, from the text so far. It is trained to produce text that is likely, not text that is true. Most of the time likely and true overlap, which is why models are useful. The failures come where they do not overlap.

  • No built-in fact check. Nothing in next-token prediction compares the output with the real world.
  • Rare facts are weakly learned. A fact that appeared only a few times in training is easy to blur with similar facts, for example the birth year of a minor public figure.
  • Guessing is rewarded. Research published in 2025 argues that common training and benchmark scoring give credit for a confident guess but none for saying I do not know, so models learn to guess.
  • Imitating common mistakes. Models trained on human text can repeat popular misconceptions, which the TruthfulQA benchmark was designed to measure.
  • Pressure from the prompt. A question that assumes something false, such as asking for the 2019 sequel to a film that has no sequel, invites the model to play along.
  • Long or messy context. Details in the middle of a long input are easier to miss or mix up.
  • Knowledge cutoff. The model knows nothing after its training data ends unless search or documents are added.

Which tasks are most at risk

The risk depends less on the model and more on what you ask it to do.

TaskHallucination riskWhy
Rewrite, translate or shorten text you provideLowThe facts are in the prompt
Summarize a document you attachLow to mediumMay add or merge details, especially in long files
Explain a well-known conceptLow to mediumCommon knowledge is well learned
Specific numbers, dates, names, statisticsHighSmall details are easy to blur
Lists of sources, papers, court cases, linksVery highPlausible titles are easy to generate
Recent events or current pricesVery high without searchNot in the training data
Niche topics, local laws, small companiesHighLittle training data

Legal research is a well-known danger area. Courts have sanctioned lawyers for filing documents that cited court cases invented by chatbots.

Prompts that reduce hallucination

The most effective method is grounding: give the model the source material and tell it to answer only from that material. This is also the idea behind retrieval-augmented generation (RAG), where a system searches documents first and puts the best passages into the prompt.

Weak prompt:
What is the refund period in our store policy?

Grounded prompt:
Answer using only the policy text below.
If the answer is not in the text, reply: Not stated in the policy.
Quote the exact sentence you used.

Policy:
<paste the policy text here>

Question: What is the refund period?

Each line of the grounded prompt has a job. Only the policy text limits the source. The fallback sentence gives the model a safe answer other than guessing. Quote the exact sentence lets you check the answer in seconds.

Other habits that help:

  1. Ask narrow questions. One fact per question is easier to get right than a long list.
  2. Allow uncertainty. Add a line such as: If you are not sure, say so and explain what would confirm it.
  3. Turn on search or browsing for current facts, then open the links the answer cites.
  4. Ask for the reasoning or steps on multi-part problems, and check each step.
  5. Do not ask for sources from memory. Ask it to find sources with a search tool, or find them yourself and paste them in.
  6. For code, give the library version and paste relevant documentation, then run the code.

How to check an AI answer

Use this checklist before you rely on or publish anything factual:

  1. Open every link and DOI. Confirm the page exists and says what the answer claims.
  2. Search exact quotes. If a quote cannot be found in a primary source, do not use it.
  3. Check every number against a primary source, such as an official statistics site, a standard or the original paper.
  4. Look for warning signs: very precise figures with no source, author lists that look generic, references you cannot find, and answers that change when you ask again.
  5. Get a second, independent source for any claim that matters, not a second chatbot.
  6. For legal, medical or financial questions, have a qualified person review the result.

Limits of the fixes

No current method removes hallucination completely. Grounding and RAG cut the rate sharply for questions the documents can answer, but a model can still misread a passage, merge two passages, or fill a gap the documents leave. Search tools can return poor pages, and the model may trust them.

Lowering the temperature makes answers more repeatable, not more accurate. If the most likely answer is wrong, the model will repeat the same wrong answer consistently.

Newer models often hallucinate less on common questions, and some are trained to admit uncertainty more often. Rates still differ by topic and language, so test a model on your own kind of question before you rely on it, and keep a human check where errors are costly.

FAQ

Can AI hallucinations be completely eliminated?

Not with current methods. Grounding in sources, search tools and better training reduce them a lot, but because models generate likely text rather than checked facts, some errors remain. Verification is still needed.

Why does ChatGPT make up references and citations?

A reference is a pattern of author names, a title, a journal and a year, which the model can generate fluently without having a real paper in mind. Unless the app looks the source up with a search tool, the citation may not exist.

Which AI hallucinates the least?

Rankings change with every model release and differ by topic and language. Test a few models on questions from your own work where you know the answers, and prefer tools that show their sources.

Is an AI hallucination the same as lying?

No. Lying means knowingly saying something false. A model has no intent; it produces the continuation that looks most plausible. The effect on the reader can be the same, which is why checking matters.

Does web search stop AI from hallucinating?

It helps for current and specific facts, because the answer can be based on retrieved pages. The model can still misread or misquote those pages, so open the cited links for anything important.

All AI tutorials