Session: rag-faithfulness-metric — 2026-09-04

eval-harness · Claude · branch feat/faithfulness · claude-opus-4-7 · 2026-09-04 16:00 · 1 msgs · 3 tools · 1 min read · updated 2 months ago

tools: Bash, Write
← eval-harness Download .md .txt .json
Tool calls
Write Write: 2 calls (66.7%) 2 Bash Bash: 1 call (33.3%) 1
Token usage145.6K total
Input15.6K
Cache creation31.2K
Cache read93.6K
Output5.2K
Cache hit ratio67%· warming up

Project: eval-harness · Branch: feat/faithfulness · Mode: default · Model: claude-opus-4-7

Summary

Added a faithfulness metric for RAG answers: claims are extracted from the answer, each claim is checked against the retrieved passages by an LLM judge with a fixed rubric, and the score is the supported-claim ratio with per-claim evidence in the report.

Conversation

Turn 1 — User

I want a faithfulness score for our RAG answers, with evidence I can inspect.

Turn 1 — Assistant

Two stages: claim extraction, then claim-vs-context judgment with a strict JSON rubric. Cache judge calls by hash so re-runs are free. Report keeps the supporting passage per claim.

def faithfulness(answer: str, contexts: list[str], judge: Judge) -> MetricResult:
    claims = extract_claims(answer)
    verdicts = [judge.supported(claim, contexts) for claim in claims]
    supported = sum(v.supported for v in verdicts)
    return MetricResult(
        name="faithfulness",
        score=supported / len(claims) if claims else 1.0,
        details=[v.as_dict() for v in verdicts],
    )

Tools used in this turn:

  • Write: harness/metrics/faithfulness.py
  • Write: harness/judge/rubrics/faithfulness.md
  • Bash: pytest tests/metrics -q — 14 passed

Connections

  • [[eval-harness]]
  • [[RAG]]
  • [[LLMAsJudge]]
  • [[Faithfulness]]

Keyboard shortcuts

⌘K / Ctrl+KOpen command palette
/Focus search
g hGo to home
g pGo to projects
g sGo to sessions
j / kNext / prev row (tables)
?Show this help
EscClose dialogs

Structured queries

Mix key:value filters with free text in the palette:

type:sessionOnly session pages
project:llm-wikiFilter by project name (substring)
model:claudeFilter by model name (substring)
date:>2026-03-01Sessions after a date
date:<2026-04-01Sessions before a date
tags:rustPages mentioning a tag/topic
sort:dateSort results by date (newest first)

Example: type:session project:llm-wiki date:>2026-04 sort:date