# Hallucination

> When an AI model states something false with total confidence.

- Level: Basic
- Topics: AI
- URL: https://tidbit.legios.com.ar/hallucination/
- In Spanish: [Alucinación](https://tidbit.legios.com.ar/es/hallucination/)

A **hallucination** is an answer from an AI model that sounds right and is wrong: a court case that never existed, a quote nobody said, a library function that does not exist, a wrong date delivered in a perfect sentence. The model is not lying; it has no idea it is wrong. It produced the most plausible-sounding text, and plausible is not the same as true.

It happens because of how an LLM works. It writes by predicting likely next tokens, based on patterns in its training data. When the fact was well represented in that data, the likely continuation is usually correct. When it was not (an obscure topic, a private detail, something after its training cutoff), the likely continuation is still fluent, just invented. There is no built-in step that checks against reality.

Hallucinations are the main reason you cannot use a chatbot as an encyclopedia. Lawyers have been sanctioned for filing briefs with made-up citations. The fixes are partial: giving the model the real documents (RAG), letting it search and cite its sources, asking it to say 'I don't know', and newer models trained to decline more often when unsure. None of them bring the rate to zero.

The practical rule: use models for drafting, summarizing, explaining and brainstorming, and verify any specific fact, number, name or citation before you rely on it.

## An analogy

A confident student in an oral exam who, instead of saying 'I don't remember', improvises an answer in the same assured tone as the ones they actually know. From the tone alone you cannot tell which is which.

## Keep in mind

- A hallucination is fluent, confident and false; the model cannot tell the difference.
- Most common with obscure facts, exact citations, numbers and recent events.
- Grounding the model in real documents (RAG) and letting it cite sources lowers the rate, but does not eliminate it.
- Verify names, numbers and sources before you act on them.

## Go deeper

- [Hallucination (artificial intelligence) on Wikipedia](https://en.wikipedia.org/wiki/Hallucination_(artificial_intelligence))
- [Anthropic: reduce hallucinations](https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/reduce-hallucinations)

## Related terms

- [Artificial intelligence](https://tidbit.legios.com.ar/artificial-intelligence/): Getting computers to do things that, until recently, only people could do.
- [LLM](https://tidbit.legios.com.ar/llm/): A neural network trained on huge amounts of text to predict the next word.
- [Token](https://tidbit.legios.com.ar/token/): The small chunk of text a language model actually reads.
- [Training and inference](https://tidbit.legios.com.ar/training-and-inference/): Training builds the model once; inference is using it, millions of times a day.
- [Chatbot](https://tidbit.legios.com.ar/chatbot/): A program you talk to by typing or speaking, as if it were a person.
- [RAG](https://tidbit.legios.com.ar/rag/): Let the model look things up in your documents before it answers.
