Category · Models and how they work
What is a hallucination?
A hallucination is a wrong answer given with confidence. The model produces the most plausible text, not necessarily the true one. It is limited by allowing the model to say “I don’t know”, by requiring sources and by checking the facts.
By Laurent Poupet, Claude trainer and artificial intelligence architect · Updated
How it works
- It comes from the very nature of the model, trained to produce plausible text; when information is missing, it fills the gap rather than stopping.
- The most costly hallucinations are the most believable ones, such as an invented procedure reference or a configuration setting that does not exist.
- The rate is measured on a set of questions, some of which have no answer in the documents, to check that the assistant knows how to say so.
The trap to avoid
The trap is believing a newer model no longer hallucinates; the rate goes down, but no model is free of it, hence permanent checks.
A concrete example
You ask for the reference of a legal article on a precise subject. The model confidently answers “article L. 1234-56”: the number has the right shape, but it does not exist. You guard against it by giving the model the legal text to read, requiring it to quote the passage, and allowing it to answer “I cannot find it”.
What is the difference with a calculation or code error?
| Criterion | Hallucination | a calculation or code error |
|---|---|---|
| What is wrong | An invented fact, presented as true | A badly computed result |
| How you spot it | By checking the source of the fact | By re-running the calculation or the tests |
| Remedy | Provide the documents, require sources | Test, let code do the calculation |
Related terms
- Generative artificial intelligenceModels and how they work
- Fine-tuningModels and how they work
- InferenceModels and how they work
Where this is taught
This idea comes up throughout the lessons; we work on it with your own examples during a lesson.
Lesson content (step-by-step instructions, exercises with solutions, quizzes) is for students only, with an access code received after the first lesson.