Retrieval-augmented generation (RAG) systems
Think of the RAG pipeline as three connected stages: retrieval supplies the reference, generation writes a response from that reference, and factual checking tests whether the response agrees with the reference.
A Smooth Answer Is Not Always a True One
Imagine a tool that writes a summary of a long report. The summary reads smoothly, uses correct grammar, and sounds confident. Yet one sentence in it claims something the original report never said. The quality of the writing tells you nothing about whether that sentence is true to the source. This gap between how good a response sounds and whether its claims agree with the facts is the problem this article addresses.
What do you think happens?
A response is written fluently, with correct grammar and a confident tone. Does that guarantee that every claim in it agrees with the source?
Reveal answer
No, fluency and factual consistency are separate properties
A response can read smoothly while one of its claims disagrees with the reference it should be based on. Factual consistency is judged by checking claims, not by judging style.
What Consistency With a Reference Means
Factual consistency asks whether a response's claims agree with a reference or with known facts. It is a different question from whether the response sounds good.
The question a factual consistency evaluation asks is simple to state: does the output agree with what is known, or with the reference it should be based on? Answering it is harder than it sounds, because a model can produce a claim with no obvious signal that anything is wrong. For this reason, evaluators increasingly use AI itself as a judge, using more sophisticated techniques than simply asking a model whether an answer looks right. The two approaches this article focuses on are self-verification and knowledge-augmented verification.
A response is consistent with a reference when its claims agree with that reference. The reference might be a passage the model was given, or it might be known facts. Consistency is a property of the claims, not of the writing.
Self-Verification and Sampled Agreement
Self-verification starts from a simple intuition. If you ask a model the same question several times and it keeps giving different answers, then at least some of those answers are probably unreliable. A response that the model's other attempts contradict is suspect. The method turns this intuition into a measurement.
SelfCheckGPT is the method the source describes. It rests on an assumption: if a model generates multiple outputs that disagree with one another, the original output is likely hallucinated. To evaluate a response R, the method generates N new responses and then measures how consistent R is with respect to those N responses. The original response is never judged in isolation. Its standing depends on how well the freshly sampled responses support it.
- 1Start with the response R that you want to evaluate.
- 2Generate N new responses to the same prompt from the model.
- 3Measure how consistent R is with those N responses.
- 4If the new responses disagree with R, treat R as a likely hallucination.
Four Steps of Knowledge-Augmented Verification
Knowledge-augmented verification changes the source of evidence. Instead of comparing a response with other samples from the same model, it checks individual claims against search results. SAFE, the Search-Augmented Factuality Evaluator, is the method the source describes. It was introduced by Google DeepMind in the paper Long-Form Factuality in Large Language Models, and it verifies a response by leveraging search engine results.
SAFE works in four steps. The pipeline is easiest to understand as a sequence in which a long response is gradually broken down into claims that a search engine can actually test. The diagram traces a response from start to finish and shows where the search engine sits between the claims and the verdict.
Read the pipeline as a chain of hand-offs. The response is decomposed into individual claims. Each claim is then made self-contained. A fact-checking query is proposed for each claim. The search engine returns results that serve as evidence, and a judgment compares each claim with that evidence to produce a verdict. The search engine is the point where outside information enters the process, which is what separates this method from self-verification.
Entailment, Contradiction, and Neutral Labels
Checking whether a statement is consistent with a given context can also be framed as textual entailment, a long-standing task in natural language processing. Textual entailment is the task of determining the relationship between two statements. One statement is the premise, which here is the context. The other is the hypothesis, which is the output or part of the output being evaluated. The task asks which of three categories the hypothesis falls into.
The three labels map directly onto factual consistency. Entailment implies factual consistency, contradiction implies factual inconsistency, and neutral means consistency cannot be determined. The third label matters because it prevents a forced verdict. When the context simply says nothing about a claim, a neutral result is the honest answer.
The evaluator is not asking whether the hypothesis is true in the real world. It is asking whether the premise supports it. The same hypothesis can be an entailment for one premise and neutral for another, which is why the context matters so much.
Classifying three hypotheses against one premise
Premise: 'The report was published in March 2021 by the finance team.' Classify each hypothesis as entailment, contradiction, or neutral.
- 1Hypothesis 1
'The finance team published the report.' The premise states this directly, so the premise supports it. Label: entailment.
- 2Hypothesis 2
'The report was published in 2015.' The premise gives a different year, so the premise conflicts with it. Label: contradiction.
- 3Hypothesis 3
'The report contains a chart of quarterly revenue.' The premise says nothing about charts, so the premise neither supports nor conflicts with it. Label: neutral.
Entailment maps to consistent, contradiction maps to inconsistent, and neutral means consistency cannot be determined from this context.
Trained Scorers and the TruthfulQA Benchmark
Instead of relying on a general-purpose AI judge, you can train scorers that specialize in factual consistency prediction. These scorers take in a pair of premise and hypothesis as input and output one of the predefined classes, such as entailment, contradiction, or neutral. Once the task is framed this way, factual consistency becomes a classification task. The source gives one example, DeBERTa-v3-base-mnli-feveranli, a 184-million-parameter model trained on 764,000 annotated (hypothesis, premise) pairs to predict entailment.
A benchmark gives evaluators a shared test set so that different methods can be compared fairly. TruthfulQA is the benchmark the source names for factual consistency. It comprises 817 questions that some humans would answer incorrectly because of a false belief or misconception. The questions span 38 categories, including health, law, finance, and politics.
What makes these questions hard is that a plausible-sounding answer is often the wrong one. A system that writes fluent text can still produce the false answer that a misconception suggests. TruthfulQA also comes with a specialized AI judge, GPT-judge, which was finetuned to automatically evaluate whether a response is factually consistent with the reference response. The source reports a human expert baseline of 94% on this benchmark. It also shows the performance of several models in a plot taken from the GPT-4 technical report. That plot compares models against one another on the benchmark, so the learner should read it as a comparison between systems rather than as a single score.
Why Consistency Matters in RAG Systems
Factual consistency is a crucial evaluation criterion for retrieval-augmented generation, or RAG, systems. Given a query, a RAG system retrieves relevant information from external databases to supplement the model's context. The generated response should then be factually consistent with the retrieved context. Retrieval adds a second source of truth, so the question shifts from whether the model knows the answer to whether its answer reflects the material it was handed.
Think of the RAG pipeline as three connected stages: retrieval supplies the reference, generation writes a response from that reference, and factual checking tests whether the response agrees with the reference. Because the checking stage uses the retrieved context as its standard, a failed consistency check means the generated answer is not supported by what the system retrieved. That failure affects the whole system's output, not only one sentence of it.
| Feature | Self-verification | Knowledge-augmented verification |
|---|---|---|
| Direction | Looks inward at the model's own outputs | Looks outward at search results |
| Evidence used | Other sampled responses from the same model | Search results for individual claims |
| Main drawback noted in source | Can be prohibitively expensive because of many AI queries | Depends on the quality of search results and of judgments at each step |
| Typical unit checked | The whole response against samples | Individual claims after decomposition and revision |
The two methods answer the same question from different directions.
Neither method is declared the winner in the source. Self-verification is conceptually simple but can be prohibitively expensive. Knowledge-augmented verification depends on the quality of the search results and on the AI judgments made at each step. A practical evaluator chooses based on what evidence is available and what the evaluation can afford.
Mistakes Beginners Make With Consistency
Common mistake Judging a response by how well it is written
What it looks likeA summary is grammatical and confident, so it is assumed to be accurate.
Why it failsFactual consistency concerns whether the claims agree with the reference or known facts. Writing quality does not measure that.
Do this insteadCheck each claim against the reference or against search evidence.
Common mistake Treating a neutral label as a false claim
What it looks likeThe premise does not mention a chart, so the hypothesis about a chart is marked as wrong.
Why it failsNeutral means consistency cannot be determined from the premise. It is not the same as contradiction.
Do this insteadReport neutral as undetermined rather than forcing an entailment or contradiction verdict.
Common mistake Checking a vague sentence directly
What it looks likeSearching for 'It opened in the 20th century' without knowing what 'it' refers to.
Why it failsThe search engine cannot resolve the pronoun, so the claim is not testable as written.
Do this insteadRevise the claim so its subject is named explicitly before searching.
Common mistake Assuming the context is irrelevant to the label
What it looks likeLabeling a hypothesis as entailment without considering which premise it was paired with.
Why it failsThe same hypothesis can be an entailment for one premise and neutral for another.
Do this insteadAlways state the premise alongside the hypothesis when classifying.
Common mistake Running self-verification on every response without considering cost
Practice: Classify a Hypothesis
Premise: 'The conference was held in Lisbon in June.' Hypothesis: 'The conference was held in June.' Decide whether the hypothesis is an entailment, a contradiction, or neutral, and explain which label it maps to for factual consistency.
Hints
- Ask whether the premise directly supports the hypothesis, conflicts with it, or says nothing about it.
- Judge against the premise, not against what you know about the real world.
- Entailment implies factual consistency; contradiction implies factual inconsistency; neutral means consistency cannot be determined.
Write a vague sentence from a short summary, such as one that uses 'it' or 'they' without a clear subject. Rewrite it so the subject is named explicitly, and explain how the rewrite makes the claim testable by a search engine.
Hints
- Replace each pronoun with the noun it refers to in the source.
- Make sure the rewritten claim could be checked without seeing the surrounding text.
Key Takeaways
- Factual consistency asks whether a response's claims agree with a reference or known facts; a fluent, confident response can still fail this test.
- Self-verification flags a likely hallucination when freshly sampled responses disagree with it, but it can be prohibitively expensive because it requires many AI queries.
- Knowledge-augmented verification (SAFE) decomposes a response, makes each claim self-contained, proposes fact-checking queries, and judges consistency against search results.
- Entailment implies consistency, contradiction implies inconsistency, and neutral means consistency cannot be determined from the premise.
- In RAG systems, the retrieved context is the reference, so a failed consistency check shows the generated answer is not supported by what was retrieved.