Bookmarks

Language model hallucination

An answer from a language model that sounds confident but does not match reality: invented facts, sources, quotes or package names.

Also: AI hallucination, artificial intelligence hallucination, hallucination in AI

checked 9 Nov

All terms

A language model speaks in the same tone about what it knows and what it does not: it fills the gaps with plausible text. A confident, fluent answer is therefore not a sign that it is correct, and important decisions are not taken on the model’s word.

Why the model makes things up

The model does not look up facts; it predicts the next token, having been trained to continue text plausibly. OWASP puts the cause of hallucinations this way: the model fills the gaps in its training data with statistical patterns, without understanding the content — and the result is an answer that sounds right but is backed by nothing.

  • gaps and noise in the training data: there are no facts about the topic, or they contradict each other;
  • reliance on plausibility rather than on a source — the model does not verify its claims;
  • narrow context: the model makes up details that are not in the prompt;
  • in systems with retrieval — the retrieved fragments do not cover the question in full.

What it looks like

ManifestationReal-world example
Wrong factan airline chatbot promised a passenger compensation that was not in the rules — the company lost the dispute
Non-existent sourcea lawyer filed a document with the court citing judicial cases the assistant had invented
Invented packagea coding assistant named a non-existent library — attackers managed to publish a malicious package under that name

What these manifestations share is confident delivery: the model does not mark what it has invented. And hallucination is not the only cause of wrong answers: OWASP lists it as one of the main causes of misinformation, alongside bias in the training data and incomplete information.

How the risk is reduced

Confident falsehoods cannot be switched off, so the risk is reduced in ways that do not make the user pay for the mistake:

  1. answer from retrieved documents: RAG replaces the model’s “memory” with fragments from a trusted database;
  2. fine-tuning and prompting: the model is trained on examples from the target domain, and a complex task is broken into steps;
  3. checking the answer: automatic verification against sources, and a human for important decisions;
  4. automated validation of critical outputs and warning users about limitations.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • prompt injection

    Prompt injection is a deliberate attack through the input text, while hallucination is the model’s own error with no malicious intent.

In depth in the references

where the topic is covered in detail