An AI hallucination is an answer that reads as confident and well formed and is not supported by anything the AI system had in front of it. The refund window that the policy document never mentions. The order number the AI agent fills in because the user did not give one. The citation to a section of the manual that does not exist. The problem for anyone shipping an AI system is that nothing on the surface of the text separates these answers from the correct ones. The grammar is the same, the tone is the same, the formatting is the same, and the user, who asked precisely because they did not know, has no way to tell which kind of answer they received. A support bot that hallucinates on 5 percent of questions is not 95 percent useful; it is a system whose every answer now needs checking.
This post is about one problem, how to define an AI hallucination precisely enough to measure it, and then how to catch it in a test run and on live traffic. We will start with the definition, because most teams argue about hallucination rates without agreeing on what counts as one. Then we go through the AI evaluation metrics that catch each kind, with Faithfulness first because it was built for exactly this, and the companion metrics that cover the cases Faithfulness cannot see. We end with the dataset that provokes hallucinations on purpose, how to read the results, and what none of these methods catch.
What is an AI hallucination
The working definition we use is an ungrounded claim, a statement in the AI output that the evidence available to the AI system does not support. The evidence is whatever the system was actually given, the retrieved passages in a RAG pipeline, the conversation so far, the results of a tool call, and the user's own message. A claim is grounded when you can point to the place in that evidence that supports it. A claim is a hallucination when you cannot. This definition is narrower than "the answer is wrong" and that narrowness is what makes it measurable, because a reader, or an LLM judge, can check each claim against a fixed body of text without needing to know the truth of the world.
Two consequences follow, and both surprise people the first time. First, a claim can be true and still be a hallucination. If the model states the correct refund window from what it absorbed in pretraining, while the retrieved policy page says nothing about refunds, the claim is ungrounded. We count it as a hallucination at the evaluation level because the AI system had no way to know it was right, and the same mechanism that produced a true claim today will produce a false one when the policy changes. Second, a wrong answer that faithfully repeats a wrong document is not a hallucination. It is a data problem or a retrieval problem, and it needs a different fix, which is why the metric that catches hallucinations has to be read next to the metric that checks retrieval.
In practice, hallucinations come in three shapes, and it helps to name them because each one is caught by a different check. A fabricated fact has no evidence behind it at all, such as a product feature the catalogue never lists. A distorted claim has evidence that the answer stretches, so "refunds within 30 days for unworn items" becomes "refunds within 60 days", or "may be eligible" becomes "is eligible". A fabricated specific fills a gap the user left, such as an AI agent that calls a cancellation tool with an order number nobody provided. The third shape is the most dangerous in tool-using agents, because the fabricated value does not stay in the text; it becomes the argument of an action.
The unit of measurement is the claim, not the response. A 6-sentence answer with 5 grounded claims and 1 ungrounded one is a response containing a hallucination, and for most products that single claim is what the user will remember and act on. Every metric in this post scores at claim level or compares against a reference at claim level, and the thresholds you set are statements about how many ungrounded claims per response you are willing to ship.
Why AI systems hallucinate
A language model produces the most plausible continuation of its input, not the most supported one. Plausibility was learned from text in which confident, complete answers are the norm and "I do not have that information" is rare. So when the input leaves a gap, the model's default is to fill it with something shaped like an answer. Nothing in the model distinguishes a fact it read in the retrieved passages from a fact it absorbed during training from a fact it is composing now; they are all tokens with a probability. This is why a stronger model reduces hallucinations without removing them, and why the rate changes every time you change the prompt, the retriever, or the tools around the model.
Gaps are where hallucinations grow, and an AI system has several places to open one. Retrieval returns passages that are on-topic but do not contain the answer, and the model bridges from what it has to what was asked. The user omits a detail, an order number, a date, a product name, and the model supplies a plausible one rather than asking. A conversation runs for 12 turns and a fact stated in turn 2 is no longer attended to in turn 11, so the AI agent contradicts it. A system prompt that says "always provide a helpful answer" closes the one honest exit the model had. Each of these is an engineering decision, which is the good news, because each can be tested.
It follows that hallucination is a property of the whole AI system, not of the model alone. The same model behind a retriever that reliably brings back the right passage will hallucinate far less than behind one that returns three near-miss chunks. The same model with a prompt that permits "I need the order number to proceed" will fabricate fewer tool arguments than with one that forbids clarifying questions. When we evaluate for hallucination we therefore evaluate the system end to end, with real retrieval, the real prompt, and the real tools, and we separate the measurement into parts so that a failing score points at the part that failed.
Why reading outputs is not enough
The first instinct is to read the outputs. For 20 rows that works, and you should do it, because reading is how you learn what your system's hallucinations look like. For 300 rows it stops working, and not only because of time. Checking a claim takes longer than reading it, since you must find the supporting sentence in the retrieved context, and reviewers stop looking after the first 10 answers come back clean. Fluency makes this worse. A hallucinated paragraph is, by construction, the most plausible paragraph the model could produce, so it is exactly the paragraph a tired reader waves through.
What you want instead is a procedure. Take the response, split it into claims, check each claim against the evidence, and report the share of claims that were supported. That procedure is mechanical enough to hand to an LLM judge, a second model prompted to do the checking and to write down its reasoning. The judge does not need to know the truth; it needs to know whether the claim is in the context, which is a reading task a strong model does well. A judge metric is one judge call per row per metric, so it costs money and is slightly non-deterministic, two facts that shape how you use it. But it scales to 300 rows, it runs on every release, and it writes a reason you can audit.
The reason column matters more than the score. When a hallucination metric fails a row, the judge's reasoning names the claim it could not find, and that is the thing you fix. We read the reasoning on 3 to 5 failing rows per metric after every run, and the pattern across them, say "the model keeps adding a shipping refund the policy does not mention", is what turns into a prompt change or a retrieval change. A score of 0.6 without the reason is a number; with the reason it is a bug report.
Faithfulness, the grounding metric
Faithfulness is the metric built for the definition above. It asks the LLM judge whether every claim in the response is supported by the retrieval context, and scores from 0 to 1, where 1.0 means all claims are grounded and anything less means at least one claim was fabricated or brought in from outside the provided context. It needs the input, the actual output, and the retrieval context, which EvaliQA reads from your AI system's response through the connector's Retrieval context path, or from a retrieval_context column in the dataset when the response has none. The default threshold is 0.7, and the docs suggest raising it to 0.9 or 0.95 for medical, legal and financial products where any ungrounded claim is a bug.
Here is an illustrative example, not a measured result. The retrieved context says "Items may be returned within 30 days of delivery if unworn, with the original receipt." The AI system answers "You can return the jacket within 30 days as long as it is unworn, and we will also refund the original shipping cost." The judge extracts the claims, finds the first two in the context, and does not find the shipping refund anywhere. The row scores below 1.0, and the reason says which claim was unsupported. Whether that row fails depends on your threshold, and this is why the threshold is a product decision. On a returns bot, one invented refund is a complaint and a chargeback, so 0.95 is right. On a brainstorming assistant, a looser bar is defensible.
Two mechanics are easy to miss. Faithfulness only sees the retrieval context it is given. If your pipeline passes passages inside the system prompt or through a tool result, and you have not mapped them with the path or copied them into the column, the metric has nothing to check against. According to the metrics catalog, a row with no retrieval context shows n/a for Faithfulness, with no score, no judge call, and no effect on the row's verdict or the run's averages, so a run full of n/a is a configuration problem, not a clean bill of health. The second mechanic is the direction of the penalty. A true claim from outside the context is penalised, which is correct for a grounding check and a false alarm for a product that is meant to add commentary beyond its sources. The docs say to skip Faithfulness for summarisation plus commentary for that reason.
What Faithfulness does not catch is a faithful answer to a wrong or incomplete context. If retrieval brought back last year's policy, the answer can score 1.0 and still be wrong. This is why the docs pair it with Contextual Recall, which scores the share of claims in the expected output that the retrieved context supports. Faithfulness looks from the answer back to the context; Contextual Recall looks from the gold answer forward to the context. Read together, they tell you whether generation drifted or retrieval fell short, and the combinations below are the ones we look for first on a RAG run.

Catching hallucinations without retrieved context
Many AI systems have no retrieval context to check against, and many hallucinations in RAG systems are about the user's own details rather than the documents. For these you need a reference or a rubric instead of a context. When the correct answer is a short, predictable value, a number, a date, a code, Answer Precision compares the actual output to the expected output as text, with a tolerance for numbers, makes no judge call, and defaults to a strict 0.8 threshold. A distorted claim such as 60 days where the expected output says 30 fails it outright. For free-text answers it is the wrong tool, since a correct answer in other words scores low.
For free text with a gold answer, Semantic Similarity compares meaning with an embedding model that runs inside EvaliQA, free and reproducible, which makes it the right choice for large regression sets. It has one limit that matters enormously for hallucinations. With the default model, "Refunds are available within 30 days" and "Refunds are not available within 30 days" score 0.93 against each other, so a negated or inverted claim sails through. When correctness hinges on one fact, the docs recommend a judge metric that names the fact. A G-Eval or Custom Eval criterion such as "The answer states the refund window is 30 days and adds no conditions that are not in the policy" is a hallucination check you can write in plain words, and it catches the distortion that similarity misses.
Fabricated specifics need a different setup, because the right answer is often a question back to the user. The metamorphic relation MR8, partial information, pairs a full input ("How do I refund order #12345 from last week paid by Visa?") with one that omits the details ("How do I refund an order?") and scores the second with a custom judge that penalises hallucinated specifics. A graceful "I need the order number to proceed" is a pass. MR7, ambiguity, does the same for inputs with several readings, where confidently picking one without saying so is a fail. For AI agents that act, Tool Correctness compares the tools called and their arguments against an expected_tools column, with argument keys to compare, so a cancellation fired with an invented order number fails on the argument rather than on the prose.
In multi-turn conversations the AI agent has two more ways to hallucinate, and two metrics for them. Failure Rate scores how the agent handles not knowing, where an honest fallback scores 1.0 and a made-up answer scores 0, and the docs pair it with Faithfulness for high-stakes agents. Knowledge Retention catches the agent contradicting a fact the user stated earlier, which is a hallucination against the conversation rather than against a document. It needs multi-fact conversations to have anything to detect; on single-fact dialogues it scores trivially high.
A dataset that provokes hallucinations
Happy-path rows do not provoke hallucinations, because the evidence is there and the model has no gap to fill. If your dataset is 200 well-formed questions with a clean answer in the knowledge base, your hallucination rate will look excellent and tell you nothing about Tuesday afternoon's traffic. The rows that matter are the ones where the evidence is missing on purpose. Questions your knowledge base cannot answer, with an expected output that is a decline or a referral. Questions with a plausible false premise, such as "Since you offer 60-day returns, can I send back a worn jacket?", where the right answer corrects the premise. Questions about things that changed, where the index still has the old version. Each of these has an honest answer that is short and a hallucinated answer that is long, and your metric should prefer the short one.
The metamorphic recipe from the docs is a cheap way to generate these systematically. Take 10 to 20 representative happy-path inputs, generate pairs across 3 or 4 relations that matter for your product, typically MR2 paraphrasing, MR4 negation, MR7 ambiguity and MR8 partial information for AI agents, and you end up with 60 to 100 rows that run on every release. A pattern of failures on one relation, say 10 failures on partial information, is a structural signal that the AI agent fabricates missing values as a habit, which no single prompt tweak will fully fix.
Red teaming covers the adversarial side. Among the red teaming dataset vulnerabilities, Hallucination inducement provokes confident false claims and Misinformation probes for confidently false factual claims, and the generator delivers each through its catalogue of attack techniques. Red teaming plans score every row automatically per vulnerability and attack technique rather than through attached metrics, so this is a separate run from the evaluation plan, and a deeper one. We run the evaluation plan on every release and the red teaming plan when the prompt, model or tool set changes.
The best rows come from production. A real conversation in which the AI system hallucinated is a test case nobody would have thought to write, and the trace page has Add trace to dataset for exactly this. You pick the test plan and the dataset version, the input and output are pre-mapped, and any column can take a custom value you type, such as the expected output you now know the AI agent should have produced. Doing this weekly for the traces online evaluation flagged grows the golden set from what users actually asked rather than from imagination.
Reading the results
A finished run gives you a pass rate per metric and a verdict per row, and the first thing to understand is that the row verdict is the AND of every metric on the plan. A row fails if Faithfulness fails even when everything else passes, so the overall pass rate drops faster than any single metric, and the per-metric KPI tiles are where you find out what specifically fell over. Rows where a metric crashed are marked errored and excluded from the denominator, and rows with no retrieval context show n/a for the RAG metrics. Check both counts before you trust the headline number, because a run with 40 n/a rows on Faithfulness has measured grounding on fewer rows than you think.
Then read the reasoning. Open 3 to 5 failing rows per metric, read what the judge said, and ask whether the judge failed the row for the reason you meant the metric to catch. A Faithfulness failure that names an invented shipping refund is a real hallucination. A Faithfulness failure that names a claim which is in the context, phrased differently, is judge noise, and a cluster of those means the judge model is too weak for the task. The docs recommend a GPT-4o or Claude 4 class judge, pinned for the life of the experiment, because the judge is part of the measurement instrument and rotating it makes runs incomparable.
Use the table above to split the failures. Faithfulness low with Contextual Recall high means the evidence was present and the model drifted, so the fix is in the prompt or the model. Faithfulness low with Contextual Recall low means retrieval missed and the model filled the gap, so fix the retriever first and let the prompt permit a decline in the meantime. The bottleneck patterns page covers the same split by category and persona, which is how you discover that the hallucinations cluster on one product line whose documents were never indexed.
Thresholds are yours to tune, and a metric that passes 100 percent of a golden set is usually set too low. If Faithfulness passes everything at 0.7, tighten it to 0.85 or 0.9 and re-run, and keep tightening until the metric starts separating rows you consider acceptable from rows you do not. The right threshold is the one at which the failing rows are the ones a careful reviewer would also reject, and you can only find it by reading.
Catching hallucinations in production
Offline runs test the scenarios you thought to write; production is where the ones you did not think of arrive. Online evaluation scores live sessions with the same metrics as they arrive. You bind a metric to the project with a threshold, a trace field mapping, and an optional rule scope. For Faithfulness the mapping is the part to get right, since the metric needs the retrieval context from the trace, which usually means a dotted path or a JSONPath into the trace's metadata or spans. The picker shows a sample trace from the project and tells you whether it would match, so you can confirm the passages are reaching the metric before you save.
Each binding is one judge call per trace it matches, so the rule scope is your cost control. Scope the binding to the traces that carry retrieved passages and skip greetings, health checks and tool-only turns. The Overview tab then shows the pass rate against your threshold over time, and an alert rule can watch that number and post to Slack, email or a webhook when it dips. The rule builder lists exactly the metrics you have bound, so bind the metric you would alert on first. On the trace page, the Trace metrics card shows each metric's score, threshold and the judge's reasoning, which is the same reason column you read offline, now attached to a real conversation.
Production scoring is detection, not experiment. Traffic shifts, so a moving pass rate can reflect your AI system or your users, and a drop is a prompt to investigate rather than a verdict. The investigation is the loop closing. Open the flagged sessions, read the reasoning, and promote the genuine hallucinations into the dataset with Add trace to dataset, so the next offline run covers them and the regression cannot return unnoticed.
What these methods do not catch
Faithfulness cannot see a faithful answer to a wrong source. If the indexed document is out of date or simply mistaken, the AI system repeats it, scores 1.0, and misleads the user. Only a correctness metric against a gold answer, Answer Precision or a G-Eval criterion that names the fact, catches that, and only on rows where you wrote the gold answer. Keeping the gold answers current is maintenance work that no metric does for you.
The judge can be wrong. It can miss a claim, misread a paraphrase as unsupported, or accept a subtle distortion, and the same judge scoring the same row twice can give slightly different numbers. The defences are a strong pinned judge, reading the reasoning, and treating a score as a sample rather than a measurement. Where the stakes justify it, Custom Eval supports several judge runs with a majority or median aggregation, at a multiple of the cost.
Semantic Similarity misses inversions, as the 0.93 negation example shows, so it is a regression check and not a hallucination check on its own. Answer Precision penalises correct paraphrases, so it is only for short predictable answers. And every method here measures what the system was given. If the passages reach the model through a path you did not map, or the AI agent reports a whole dialogue in a way the conversation metrics cannot assemble, the metrics score something other than what you think, and n/a rows and errored rows are the symptom to watch for.
Summary
An AI hallucination is an ungrounded claim, a statement the AI system had no evidence for, and defining it that way is what makes it measurable without knowing the truth of the world. It comes in three shapes, fabricated facts, distorted claims and fabricated specifics, and each has its own check. Faithfulness scores grounding against the retrieval context, Contextual Recall tells you whether that context was enough, and reading the two together is how you decide whether to fix the prompt or the retriever. Answer Precision, Semantic Similarity and a G-Eval criterion that names the fact cover the cases with a gold answer, MR8 and Tool Correctness cover invented specifics, and Failure Rate and Knowledge Retention cover conversations.
The rate you measure is only as honest as the dataset, so build rows where the evidence is missing on purpose, from metamorphic pairs, from the Hallucination inducement vulnerability in a red teaming run, and above all from production traces promoted into the golden set. Read the judge's reasoning on the failing rows after every run, tune thresholds until the failures are the ones you would reject yourself, and bind the same metric in online evaluation so the hallucinations you did not anticipate are the next rows in the dataset rather than the next complaint.




