Define hallucination first
"Hallucination" is used loosely to mean any output that is wrong. For measurement, you need a precise definition. A useful working definition: a hallucination is content presented as true that is not supported by the provided sources or by verifiable facts.
Two distinctions make this operational:
- Faithfulness — is the output supported by the context the model was given (a retrieved document, a contract, a patient record)? This matters most for RAG, summarization and document Q&A.
- Factuality — is the output true about the world, regardless of context? This matters for open-domain question answering and knowledge-heavy assistants.
A summary can be factually true yet unfaithful (it adds correct information not in the source), or faithful yet false (the source itself was wrong). Decide which you're measuring before you start.
Types of hallucination
| Type | Example |
|---|---|
| Fabricated entity | A citation, case, paper, API or person that doesn't exist |
| Incorrect attribute | Wrong date, dose, figure or version number for a real entity |
| Unsupported claim | A plausible statement absent from the provided source |
| Contradiction | Output conflicts with the source or with itself |
| Reasoning error | Correct premises, invalid conclusion presented confidently |
| False confidence | Speculation stated as fact instead of flagged as uncertain |
Tagging errors by type makes results actionable: fabricated citations call for different training data than reasoning errors.
Claim-level evaluation
Judging whole responses as "hallucinated or not" is coarse: a 400-word answer with one wrong number and a two-line answer that's entirely invented would score the same. Claim-level evaluation is more informative:
- Decompose the response into atomic, checkable claims.
- Verify each claim against the source (faithfulness) or trusted references (factuality).
- Label each claim: supported, contradicted, or unverifiable — and tag the error type.
- Weight by severity where relevant: a wrong drug dose is not equivalent to a wrong publication year.
Decomposition and verification can be partly automated, but verification in specialized domains needs people who can actually check the claim — a clinician for dosing, a lawyer for case law, an engineer for API behavior.
Metrics that matter
- Response-level hallucination rate — share of responses containing at least one unsupported or false claim. Simple and intuitive for tracking.
- Claim-level precision — share of claims that are supported. Useful for comparing verbose and concise models fairly.
- Severity-weighted error rate — errors weighted by potential harm. Essential in healthcare, legal and financial AI.
- Abstention quality — does the model say "I don't know" when it should, without over-refusing answerable questions?
- Citation accuracy — for systems that cite sources, do citations exist and actually support the claim?
Watch the trade-off: a model can lower its hallucination rate by saying less or refusing more. Always report hallucination metrics alongside helpfulness and abstention metrics.
Automated detection
Automated methods are valuable for scale and regression testing:
- NLI-based checks — natural language inference models test whether the source entails each claim.
- LLM-as-a-judge — a strong model verifies claims against the provided context with a structured rubric.
- Self-consistency — sampling multiple answers and flagging claims that vary across samples, which often signals low model confidence.
- Retrieval-based verification — checking claims against a trusted knowledge base.
- Programmatic checks — validating that cited URLs, identifiers or code references actually exist.
Each method has blind spots, especially in specialized domains where the checker knows less than the claim requires. Automated detectors should be calibrated against expert human labels — see how to evaluate LLMs.
Expert human review
Human review is the reference standard for hallucination measurement. To make it reliable:
- Use domain experts for verification — generalists tend to accept fluent, plausible errors.
- Provide the sources and require evaluators to cite the evidence for each label.
- Double-annotate a portion of items and track agreement (e.g. Cohen's kappa).
- Adjudicate disagreements with senior reviewers.
- Maintain a gold set of known hallucinations to monitor evaluator sensitivity.
Salyvian Evaluate provides expert factuality evaluation with this structure, delivered with claim-level labels and error taxonomies.
From measurement to reduction
Measurement pays off when it feeds training. Hallucination evaluations can be turned into:
- Preference pairs where the faithful answer is chosen over the hallucinated one — used for reward modeling or DPO via RLHF data.
- SFT demonstrations showing correct abstention and well-calibrated uncertainty.
- Targeted test sets that become regression gates for future releases.
Building a hallucination test set
Measurement is only as good as the prompts you measure on. A useful hallucination test set is designed to provoke errors, not to confirm that a model handles easy questions well:
- Long-tail entities. Questions about less common people, products, regulations or research, where training data is sparse and fabrication is more likely.
- False premises. Prompts that assume something untrue ("Why did the 2019 update remove feature X?" when it didn't) to test whether the model corrects the premise or invents an explanation.
- Unanswerable questions. Items where the correct behavior is to say the information isn't available — especially in RAG settings where the retrieved context doesn't contain the answer.
- Precise details. Requests for exact numbers, dates, citations, doses or code signatures, where small errors matter.
- Long-form generation. Summaries and reports where errors can hide in the middle of fluent text.
Keep the test set private to avoid contamination, version it, and refresh it as your model and product change. Pair each item with reference sources and, where possible, expert-verified answers so evaluators can label consistently. Over time, the hallucinations you find in production become the most valuable additions.
Frequently asked questions
What is a good hallucination rate?
There's no universal number: it depends on domain, task difficulty, definition and measurement method. Track your rate on a fixed, representative test set over time, and set thresholds based on risk.
Can hallucinations be measured automatically?
Partially. NLI checks, LLM judges and self-consistency scale well but need validation against expert human labels, especially in specialized domains.
Does RAG eliminate hallucinations?
No. Retrieval reduces some factual errors but introduces faithfulness errors — models can still misread, over-generalize or ignore retrieved sources.
What's the difference between faithfulness and factuality?
Faithfulness measures support by the provided context; factuality measures truth about the world. Many applications need both.