Expertise hub / Generative AI
Generative AI 9 min read

Hallucinations in LLMs: how do you measure it

The tricky thing about a hallucination is that it rarely looks uncertain. The model doesn't hesitate, it just answers wrong. How do you make that testable?

A language model that makes something up (a non-existent report, a wrong year, a quote that was never said) presents it with exactly the same confidence as a correct answer. There's no error message, no low-confidence warning. Just a confidently wrong answer.

For an experiment, that might still be acceptable. Once an LLM answers customer questions, advises staff, or supports decisions, every unmanaged hallucination becomes a quality and trust risk.

Two types of hallucination

// Intrinsic versus extrinsic
Intrinsiccontradicts the given source
Extrinsiccannot be verified against the source

Intrinsic hallucination is the easiest to spot: the model claims something that directly contradicts the source text it was given.

Extrinsic hallucinations are trickier. The model adds information that doesn't come from the source. That information might happen to be correct, but it isn't grounded in the context the answer is supposed to rely on. In domains where correctness matters, both forms are a problem.

How you make it measurable

Groundedness scoring

Every claim in the output is checked against the source documents: is this literally or logically derived from what was provided, or not?

Automatic fact-checking against a knowledge base

For closed domains (a product catalogue, internal documentation) you can automatically check claims against a trusted source.

Human review with sampling

For open, generative tasks, human evaluation remains necessary: automated metrics miss nuance and context.

With RAG systems (retrieval-augmented generation), there's an extra layer on top: a hallucination can arise because the model reasons incorrectly, but just as easily because the retrieved source documents themselves weren't relevant or weren't correct. Testing only the output and not the retrieval step misses half the problem.

A hallucination rate of 2% sounds manageable, until you realise it's 2% of every answer a user takes to be true.

What you build in practice

Eliminating hallucination entirely isn't realistic with the current generation of models. Making it measurable and manageable is, and that's exactly the difference between a demo and a production system.

An example from practice

For a customer-support bot that answers based on internal product documentation (a RAG setup), we tested a hundred questions against a fixed knowledge base. The share of answers that were correctly grounded started at 82%.

// Where the remaining 18% went wrong
Wrong source document retrieved11%
Correct document, misinterpreted7%

Most of the hallucinations didn't come from the model itself but from the retrieval step: the search function pulled the wrong product sheet, after which the model dutifully, and incorrectly, built an answer on that wrong source. A test that only judged the output would have missed the cause.

What we measure in this kind of project

// From gut feeling to a number

Do you know how often your LLM application hallucinates?

We build a test set and measurement method tailored to your domain, and show you the actual number.

Book a call
// Read also