AI hallucinations are cases where a language model gives false information in the same confident tone as true information: it invents a quote, a law, a link or a publication that does not exist. It is not a bug in the usual sense, but a result of how an LLM writes text - it predicts what sounds likely, rather than checking what is true.
In short
- A model has no built-in "fact checker" - it writes what fits the context.
- It most often makes up details: numbers, dates, names, quotes, website addresses and sources.
- Giving it sources, asking for quotes from them and - above all - checking the answer all help.
A confident student in an exam
Picture a student who does not know the answer but really does not want to hand in a blank sheet. So they write something that sounds like an answer: the right terms, a sensible structure, plus "as Professor Smith showed in 2019". There is no Professor Smith. But it looks convincing.
A language model is in a similar position, except it does not do it on purpose. It was trained to write text that fits the question. If there were plenty of similar texts in its training data, the answer will be right. If the topic is niche or recent, or the question assumes something false, the model will still write a fluent answer - because that is how it works.
When AI hallucinates most often
- Details and numbers - dates, statistics, software versions, section numbers of laws.
- Sources - titles of books, research papers, website addresses. They look credible and lead nowhere.
- Niche and local topics - a small company, a local regulation, a little-known programming library.
- Things after the training date - the model does not know about them, but happily "fills in".
- Trick questions - "Why did Copernicus write Hamlet?" may get an essay instead of a correction. Newer models are more careful here, but not infallible.
How to reduce hallucinations
You will not get rid of them completely, but you can cut the risk a lot:
- Give it a source. Paste a document, an article or data, and ask for an answer based only on it. A model with the text in front of it gets things wrong far less often than one that "remembers".
- Ask for quotes. "Give me the passage you are relying on" - then it is easy to check whether that passage exists.
- Let it say "I don't know". Add to your prompt: "If you are not sure, say you don't know". It really helps.
- Use search. A chat that searches the Internet gives links to its sources. Click them - sometimes the source says something different from the answer.
- Check what matters. Numbers, law, health, money, code that will run in production - always verify against the original source.
More on writing prompts that get better answers in What is a prompt and how to write one?.
When it matters to you
- You use AI for texts other people will read - articles, emails to clients, product descriptions. A made-up fact under your name is your problem, not the model's.
- You generate code - a function or library that does not exist is a common hallucination. Run and test it before you trust it.
- You are looking for legal, medical or financial advice - AI can help you understand the topic, but base decisions on the source and on a specialist.
Related terms
LLM, artificial intelligence, prompt, sources, fact checking.