Egor Urvanov

Hallucination

Model and prompts · LLM hallucination, AI hallucination

An LLM hallucination is a confident but invented answer from a model: a nonexistent fact, function or link. In code it is, for example, a call to a function that does not exist or installing a package that is not there. It appears where part of the answer has no support in the data, and the model fills the empty spot with a plausible guess. The opposite case, where every part of the answer has support, is called an epimorphism. It is reduced by grounding in reliable sources and by checking the result.

no sourceno dataagent?a confident inventionfunctions, links, facts that do not existwith a source and a checksourcechecka supported answer● model, people, systems, data  ● agent and harness  ● risk, stop, boundaryWithout support in a source the model confidently invents; a source and a check restore the support

Hallucination examples and how to reduce them

  • An invented function · the agent calls a method the library does not have, or a parameter the function does not take. The code looks plausible and fails when run.
  • A nonexistent package · the agent suggests installing a package that does not exist on npm or PyPI. Models often repeat the same invented names, and attackers register packages under them to slip in their code (slopsquatting).
  • A dead link · a link to an article, doc or section that does not exist.
  • “Done” with no changes · the agent reports work it did not do.
  • How to reduce it · ground the model: give it sources and context and require a supporting reference for each claim (that is an epimorphism); allow “I don’t know” in the prompt.
  • How to detect it · with checks: tests, builds and linters catch invented code, an allow-list of packages catches invented packages, following links catches invented sources.

Frequently asked questions

What is an LLM hallucination?

A confident but made-up model answer: a fact, function or link that does not exist.

Why do hallucinations happen?

Where part of the answer has no support in the data, the model fills the gap with a plausible guess.

How do you reduce hallucinations?

Give the model data from reliable sources and check the result.

Source: Wikipedia: AI hallucination

Where it appears · 4

Related terms

Whole glossary

© 2026 Egor Urvanov