Hallucination Detection in Production: Confidence Scores, Self-Check, and Human Review

Your chatbot just told a customer that your refund window is 90 days. It is 30. Nobody on your team wrote that answer, and the model sounded completely sure of itself. That is the problem hallucination detection in production exists to solve: catching wrong answers before they reach a user.

A hallucination is not a bug you can patch once and forget. Language models generate text by predicting what sounds plausible, and plausible text is sometimes false. In production that becomes a wrong price, a made-up policy, a fabricated citation, or a confident instruction that breaks something. Detection does not stop the model from generating false claims. It gives you a way to notice, measure, and intercept them.

What counts as a hallucination in production

Not every wrong answer is the same kind of failure, and the kind matters because each one needs a different check. A factual hallucination invents a fact: a date, a price, a name, a policy that does not exist. A grounding failure contradicts your own data, for example when the model answers from a retrieved document but states the opposite of what it says. A logic failure chains correct facts into a wrong conclusion. And a fabrication fills a gap the model should have admitted it could not fill, such as inventing a citation no source supports.

Log failures by type for a few weeks instead of lumping them together. If most failures contradict retrieved documents, grounding checks matter more than confidence thresholds. If most are invented facts with no source at all, citation requirements will help more than another round of prompt tuning.

That logging habit also connects detection to your evaluation work. If you already run eval sets, hallucination cases belong in them as a named category, not a vague “wrong answer” bucket; see how to test AI features with eval sets, regression tests, and human review.

How hallucination detection in production actually works

Detection in production is a pipeline, not a single tool. The model output passes through checks, each check votes or scores, and a routing rule decides what happens next: publish the answer, send it to a human, or refuse and fall back to a safe response. No single check is reliable enough to carry that decision alone, which is why working systems layer three of them: confidence scores, self-checks, and human review. Routing differs per use case: a support bot can queue uncertain answers for humans, while a code assistant needs stricter automatic thresholds and a fallback that says “I am not sure” instead of guessing.

Confidence scores: a useful signal, not a guarantee

LLM confidence scores come in two forms. Token logprobs measure how strongly the model preferred each token it generated. A separate approach asks a model, or a second model, to rate its own confidence in an answer. Both are cheap and fast, which makes them attractive as a first filter. Both also share the same weakness: models are often confident about false statements, especially on topics where the training data is thin or contradictory.

That does not make confidence scores useless. It makes them a sorting signal, not a verdict. Teams use them to rank answers by risk. Answers below a threshold get extra checks or human review; answers above it ship. The threshold is not something you can copy from a blog post. You set it by running your own eval set through the scorer and picking the point where the cost of false alarms balances the cost of missed hallucinations. Calibrate per task, since a threshold tuned on short answers misfires on long summaries, and re-check calibration after model or prompt changes, since old thresholds drift silently. Model switches also change cost, as the pricing comparison in how to compare LLM pricing across providers without a spreadsheet shows.

Self-check methods that catch real errors

Self-check hallucination detection means asking the model, or a second model, to verify its own output. The simplest version is sampling: generate the same answer two or three times at a higher temperature and compare. If the answers agree on the key facts, the claim is probably stable. If they contradict each other, at least one of them is wrong, and the answer should not ship as-is. Hallucinations are often unstable: the model does not “know” the invented fact, so a fresh sample tends to invent something different.

A stronger version checks claims against sources. Break the answer into individual claims, then ask a verifier model whether each claim is supported by the retrieved documents. This is the most effective self-check for retrieval-augmented systems, because the documents give the verifier something concrete to compare against. It costs extra model calls, so teams usually run it only on answers that matter: factual claims, numbers, names, and anything the user will act on. A related check looks for statements inside the answer that contradict each other or the provided context, such as a summary stating one deadline in one paragraph and a different deadline in the next.

Self-checks have real limits. A verifier built on the same model family shares the same blind spots as the generator, so it can confirm a hallucination it would have produced itself. That is why the strongest setups use a different model for verification, or a non-model check such as exact matching against a database for prices, dates, and policy text. The grounding-first approach is covered in how to stop AI hallucinations with grounding, citations, and guardrails, which walks through citation requirements and retrieval checks that pair well with self-checks.

Human review: where people still beat automation

Human review of AI outputs is the slowest layer and the most reliable one, so the job is to spend it where it counts. Reviewing every answer does not scale. The pattern that works is sampled review plus triggered review: a random sample of all answers, plus every answer that scored low on confidence, failed a self-check, or touched a high-risk topic such as refunds, medical information, or legal claims.

Reviewers need more than the answer. Give them the sources the model used, the confidence score, and which checks flagged the answer and why. A reviewer who sees only the final text will approve the same confident-sounding errors the automated checks missed. A reviewer who sees the source documents can spot a contradiction in seconds.

Review also produces the training data for everything else. Every confirmed hallucination a reviewer finds should go into your eval set, tagged by failure type, so the next round of threshold tuning and prompt changes is measured against real failures instead of guesses. That feedback loop is what turns human review from a cost center into the thing that makes the automated layers better. The measurement side of that loop is covered in how to measure task success, tool use, and cost for AI agents in production.

Putting the three layers together

A workable pipeline looks like this. The model generates an answer. Confidence scoring runs first because it is fast and cheap. Low-confidence answers go to self-checks. Answers that fail self-checks, or that touch high-risk topics regardless of score, go to a human or to a safe fallback response. Everything else ships, and a random sample of shipped answers still goes to human review so you can measure what slipped through.

Layer What it catches Cost When to use it
Confidence scores Unstable or low-probability answers Low Every answer, as a first sort
Self-check Contradictions and unsupported claims Medium Low-confidence and factual answers
Human review Subtle errors and high-risk claims High Flagged answers plus a random sample

Run the pipeline in shadow mode for one or two weeks first: log what each layer would have blocked, then compare the blocked set against human judgment before trusting the thresholds.

What detection cannot fix

Detection is a safety net, not a cure. It does not make the model more accurate, and it cannot catch errors that look exactly like correct answers. A hallucination that cites a real source for a different claim, or states a plausible number that happens to be wrong, will pass most checks. That is why detection belongs next to prevention: better retrieval, citation requirements, and prompts that tell the model to say it does not know instead of guessing.

Detection also degrades silently. Models change, prompts change, and the data your users ask about changes. A threshold tuned in January can be wrong by June. Re-run your eval set on a schedule, watch the rate of flagged answers, and investigate when the rate moves. A sudden drop in flags usually means a check broke, not that the model got perfect.

Start small. Pick one high-risk surface, such as answers about prices or policies, and add one layer: confidence scoring with a human queue for low scores. Measure what it catches for two weeks, then add self-checks for the failure type that shows up most. One monitored layer beats a three-layer pipeline nobody watches.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.