Advanced

Grading faithfulness

An answer can pass every keyword rule and still be invented. Faithfulness grading checks that each claim in the output is supported by the source that was given to the model.

What you will see

One then zero. The claim appears in the answer and not in the source, so it is a fabrication.

About 1 min of reading

Try It

Grade one answer for fabrication

1

Write the answer and its source

printf 'source: A token is a text unit.\nanswer: A token is a text unit and costs two cents.\n' > /tmp/faith.txt; cat /tmp/faith.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One source line and one answer line.
2

Split the answer into claims

grep '^answer' /tmp/faith.txt | tr ',' '\n' | sed 's/ and /\n/g' | grep -c .

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Two. The answer carries two claims to grade.
3

Find the claim with no source

grep -c 'two cents' /tmp/faith.txt; grep -c 'two cents' <<< 'source: A token is a text unit.'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One then zero. The claim appears in the answer and not in the source, so it is a fabrication.

Data Flow

Output to a fabrication count
1 The output is split into claims
↓
2 Each claim is matched to a source passage
↓
3 Unmatched claims are marked unsupported
↓
4 The count of unsupported claims is the grade
Why this works
Why the source is required in the grade

Faithfulness without a source is a style check. The source is what makes the grade about truth instead of grammar.

The limit of a judge here

A judge can only check claims it can read against the source. Claims about things outside the source are marked uncheckable, not passed.

Examples

Splitting an answer into claims

One sentence can carry two claims. Grading the sentence hides that one claim was supported and one was not.

The supported and unsupported pair

Each claim is paired with the passage that supports it. A claim with no passage is a fabrication, whatever the wording.

Why numbers are graded first

A wrong number passes every wording rule. Numbers are the claims most users repeat without checking.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Regression evals
Previous Lesson
Regression evals
Next Lesson
Budgeting an eval run
Budgeting an eval run →