What hallucination means
AI hallucination is when a large language model produces output that sounds authoritative and fluent but is factually wrong or completely invented. It might cite a paper that does not exist, quote a statistic it made up, describe a software function that was never written, or state a confident wrong answer to a simple factual question. The defining feature is the mismatch between tone and truth: the text reads as certain and well-formed, which is exactly what makes hallucinations dangerous — they do not look like errors.
Why it happens
The root cause is in how these models work. A language model is trained to predict the next token given the preceding text, optimising for what is statistically likely rather than what is true. It has no internal fact database to consult and no reliable signal of its own uncertainty, so when it reaches a point where the training data was sparse, contradictory, or absent, it does not stop — it generates the most plausible-looking continuation. Fluency and factual accuracy are decoupled in this process, which is why a model can be beautifully articulate and completely wrong in the same sentence. Ambiguous prompts, requests for very specific details, and questions about recent or obscure topics all push the model into this gap-filling behaviour.
How it varies across models and tasks
Hallucination rates are not uniform. Larger, more capable models generally hallucinate less on factual questions because they have absorbed more reliable patterns, and models with live web access or built-in retrieval are far better grounded than those answering purely from memory. The task matters as much as the model: asking for an exact citation, a precise figure, or details of a niche API is high-risk, while open-ended creative writing or summarising a document you provided is low-risk, because the facts are either irrelevant or sitting right there in the prompt. Higher sampling temperature also increases the chance of a confident wrong turn.
How to detect it
Treat confident specificity as a warning sign rather than reassurance. The most reliable detection method is to ask the model for sources and then actually check them — fabricated citations are common and easy to verify. Cross-checking the same question against a second model or a search engine surfaces disagreements worth investigating. For high-stakes use, ask the model to rate its own confidence or to flag claims it is unsure about; while imperfect, this surfaces many shaky answers. Above all, never accept a precise-sounding fact in a critical context without an independent check.
How to reduce it in production
The single most effective technique is grounding: retrieval-augmented generation feeds the model relevant source documents at query time and asks it to answer only from that context, so it has facts to draw on instead of guessing. Beyond that, lower the temperature for factual work, explicitly give the model permission to say “I don’t know” rather than forcing an answer, and request inline citations you can audit. Constrain scope with clear, specific prompts, and for the highest-risk outputs add a verification step — a second model or a rule-based check that confirms claims before they reach a user. Combined, these measures turn hallucination from an unpredictable hazard into a rare, catchable event.