#21 of 25

Hallucination

Understanding why it happens tells you how to reduce it — and what to never trust a model with alone

What is hallucination

A language model hallucinates when it generates text that is confident, fluent, and wrong.

Not wrong in an obvious way. Wrong in the way a very convincing person is wrong — specific details, plausible context, authoritative tone. A citation that does not exist. A fact that is almost right but not quite. A date that is off by a year. A function that looks like valid code but does not compile.

The term is borrowed from psychology, where a hallucination is a perception without a stimulus. The model generates a plausible token sequence that has no correspondence to reality.

Why it happens

A language model does not know things the way a database knows things. A database looks up a fact. A language model generates the next most plausible token, given everything before it.

Most of the time, the most plausible next token is also the correct one — because accurate information dominated the training data. But plausibility and accuracy are not the same thing. When the model reaches the edge of what its training data confidently covered, it continues generating plausible-sounding text rather than stopping or flagging uncertainty.

It does not know it is wrong. It is doing exactly what it was trained to do.

What it does not mean

Hallucination does not mean the model is unreliable in general. It means the model is unreliable for specific tasks in specific conditions — primarily tasks where accuracy of specific facts is critical and verification is not built in.

For tasks where the model reasons over information you provide — summarisation, extraction, analysis, generation based on a document you supply — hallucination is rare because the information is present in the context. The model does not need to recall from training.

For tasks that require recalling specific facts from training — names, dates, citations, numerical data — hallucination risk is real. Not universal. Real.

How to reduce it

Provide the information in the prompt rather than asking the model to recall it. If you need a fact, give the fact and ask the model to use it — do not ask the model to generate the fact from memory.

Build verification into any workflow where accuracy is critical. Model output is a strong starting point. It is not a verified source.

On sourc.dev, every data point is sourced and verified before publication. The model generates structure and language. The data comes from primary sources.

Verified March 2026

← All terms