Overview

A hallucination is fluent, confident model output that is not supported by the input or by facts: a fabricated citation, a nonexistent API method, a wrong date, or a summary that contradicts its source. Models predict plausible text, not verified truth, so mitigation lowers the rate but never reaches zero.

Plan for it in any feature whose output a user will not check by hand. Ground answers in retrieved sources and require citations (retrieval-augmented-generation); let the model say it does not know; constrain outputs with schemas and enums (structured-output); and verify in code that cited URLs, IDs, and function names exist.

Hallucination rate is the share of outputs with at least one unsupported claim: flagged outputs divided by outputs evaluated. Measure it on a fixed golden-set against ground truth or human review; llm-as-judge scales the grading but adds its own biases. Compare rates only across runs with the same eval set and grading method. Set a release threshold for the domain, block upgrades that exceed it, and sample production traffic for spot checks.

Example

A model asked to summarize a paper cites “Smith et al. (2023)” with a plausible title and journal. The paper does not exist, and the error surfaces only when a reviewer checks the reference list.