Hallucination
A hallucination is when a model produces confident, plausible-sounding output that is factually wrong or unsupported.
Hallucination happens because language models generate likely continuations, not verified facts. The output can be fluent and authoritative while being incorrect — inventing an API, a citation, or a number.
Mitigations include grounding the model with retrieved, citable context (RAG), constraining output with schemas, adding verification steps, and measuring with evals so hallucination rates are visible.
In agentic coding specifically, hallucinated APIs and dependencies are a real risk, which is why tests, type checks, and review hooks matter for AI-generated code.