Skip to content
AgenticAIWiki
  1. Learn
  2. Part 4
  3. 26. Evaluating RAG
  4. 26.2

Lesson 26.2 · 2 of 7 · 4 min read · Reviewed 24 Nov 2026

Answer metrics: faithfulness and relevance

By the end, you can

  • Measure answer faithfulness and relevance.
  • Use model graders for RAG answers.

Answer metrics

Metric Question How to score
Faithfulness Is every claim supported by the passages? Model grader with passages and answer
Answer relevance Does it answer the question? Model grader
Completeness Does it include what the sources say that matters? Model grader with reference answer
Citation accuracy Do cited ids support the claims? Code (ids exist) plus grader (support)
Correct refusal Says “not in the sources” when that’s true Labelled no-answer cases

A faithfulness grader

<passages>...</passages>
<answer>...</answer>

List each factual claim in the answer. For each, say whether the passages
support it (supported / not supported), quoting the supporting text.
Verdict: pass if all claims are supported, else fail.

Claim-by-claim checks are more reliable than one overall judgement (chapter 18).

Why faithfulness matters

An answer that’s true but unsupported came from the model’s memory. That may be fine today and wrong after your policy changes. For products that promise answers from your documents, faithfulnessFaithfulness: Whether every claim in an answer is supported by the retrieved context. is a must-pass criterion.

Separate the stages

Report retrieval metrics (26.1) and answer metrics together. Low faithfulness with high recall points at the prompt or model; low recall points at retrieval.

Key points

  • Faithfulness: every claim in the answer is supported by the retrieved passages.
  • Relevance: the answer addresses the question asked; completeness: it covers what the sources say.
  • Model graders with rubrics can score these; calibrate them against human labels.
Hands-on labRuns in the Playground

Grade an answer claim by claim

Split an answer into claims and check each one against the retrieved passages to get a faithfulness verdict.

You will have: A small faithfulness checker that labels each claim supported or not supported and prints a pass or fail verdict.

Steps

  1. Read the two passages and the answer.
  2. Split the answer into claims, one per sentence.
  3. For each claim, count how many of its key words appear in one passage; call it supported above a threshold.
  4. Print each claim with its label and the passage id that supports it.
  5. Print faithfulness as supported claims over all claims, and pass only if every claim is supported.

Done when

  • Three claims are supported and one, about refund timing, is not.
  • Faithfulness prints as 0.75 and the verdict is fail.
  • Changing the answer to drop the unsupported sentence makes the verdict pass.

Open in the Playground No API key needed.

Starter code (Python)
PASSAGES = {
    "pol-4.2": "Footwear may be returned within 30 days if unworn.",
    "pol-4.3": "Sale items are final sale unless faulty.",
}
ANSWER = ("Unworn footwear can be returned within 30 days. Sale items are final sale. "
          "Faulty sale items are an exception. Refunds arrive within five working days.")
STOP = {"a", "an", "the", "are", "is", "can", "be", "if", "within", "an", "of", "to"}

def words(text):
    return {w.strip(".,").lower() for w in text.split()} - STOP

def best_support(claim):
    # TODO: return (passage_id, share of the claim's words found in that passage) for the best passage
    return None, 0.0

claims = [c.strip() + "." for c in ANSWER.split(".") if c.strip()]
for c in claims:
    pid, share = best_support(c)
    print(f"{share:.2f}  {pid}  {c}")
# TODO: print faithfulness and a pass/fail verdict (threshold 0.5 per claim)
Show a solution
PASSAGES = {
    "pol-4.2": "Footwear may be returned within 30 days if unworn.",
    "pol-4.3": "Sale items are final sale unless faulty.",
}
ANSWER = ("Unworn footwear can be returned within 30 days. Sale items are final sale. "
          "Faulty sale items are an exception. Refunds arrive within five working days.")
STOP = {"a", "an", "the", "are", "is", "can", "be", "if", "within", "an", "of", "to"}

def words(text):
    return {w.strip(".,").lower() for w in text.split()} - STOP

def best_support(claim):
    cw = words(claim)
    scored = [(len(cw & words(p)) / len(cw), pid) for pid, p in PASSAGES.items()]
    share, pid = max(scored)
    return pid, share

claims = [c.strip() + "." for c in ANSWER.split(".") if c.strip()]
supported = 0
for c in claims:
    pid, share = best_support(c)
    ok = share >= 0.5
    supported += ok
    print(f"{'supported    ' if ok else 'NOT supported'}  {pid if ok else '-':8} {c}")
faith = supported / len(claims)
print(f"faithfulness = {faith:.2f}")
print("verdict:", "pass" if faith == 1 else "fail")
Quick checkAn answer is correct in the real world, but the retrieved passages don't support it. How should faithfulness score it?
How sure are you?
Pick an answer and how sure you are