Advanced

Regression evals

Most model work is a change to something that already worked: a new prompt, a new chunk size, a new model. A regression eval asks one question, did anything that used to pass start failing.

What you will see

q2. One line, and that line is the fix for this change.

About 1 min of reading

Try It

Diff two runs case by case

1

Store the before run

printf 'q1 pass\nq2 pass\nq3 fail\n' > /tmp/before.txt; cat /tmp/before.txt

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

What it prints
Three graded cases from the old system.
2

Store the after run

printf 'q1 pass\nq2 fail\nq3 fail\n' > /tmp/after.txt; cat /tmp/after.txt

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

What it prints
The same set after a change.
3

List the regressions

join <(sort /tmp/before.txt) <(sort /tmp/after.txt) -o 'auto,2.2,2.3' | awk '$2=="pass" && $3=="fail" {print $1}'; echo

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

What it prints
q2. One line, and that line is the fix for this change.

Data Flow

A change to a regression verdict
1 The previous run is stored
↓
2 The changed system runs the same set
↓
3 Results are diffed case by case
↓
4 Pass to fail cases are listed as regressions
Why this works
Why regressions gate a change

A change with regressions is not finished. Shipping it moves the bug to a user who cannot tell it came from a change.

The flaky case problem

A case that passes and fails at random shows as a regression every run. It must be stabilised or marked noisy before it can gate anything.

Examples

The regression list is the bug list

Cases that passed before and fail now are the whole output. That list is short, and it is always actionable.

Why new passes do not cancel regressions

A score can rise while a case you rely on breaks. Users see the broken case, not the score.

Storing the previous run

A regression needs a before. The previous run is stored as a file, so the comparison is reproducible months later.

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.

← Pairwise comparison
Previous Lesson
Pairwise comparison
Next Lesson
Grading faithfulness
Grading faithfulness →