esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

How Do You Regression-Test Prompts?

How to catch a prompt or model change that breaks what already worked, using a fixed test set, a baseline and a release gate, explained simply for your AI interview.

In short

Keep a fixed set of past cases with agreed good answers, run the whole set on every prompt or model change, and block the change if any case that used to pass now fails. It catches the quiet damage a fix does to behaviour that already worked.

12 min readIntermediateVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

A regression test checks that a change didn't break what already worked. I keep a fixed set of past cases, each with an agreed good answer. When I edit a prompt or swap a model, I run the whole set. If a case that passed before now fails, the change waits until we understand why. Every live failure that teaches us something gets added to the set.

What is regression testing for prompts, in plain words?

A prompt is the instruction text you send a model. Regression testing asks one question after every change: does the new version still handle everything the old one handled?

Without tests, the usual pattern is reactive. A user complains, someone reproduces the problem by hand, fixes it, and hopes nothing else moved. The fix often works, and the damage shows up a week later in another corner of the product.

Think of a payroll team that reruns last month's pay runs after changing a tax formula, to check that nobody's pay moved by accident. A claims triage prompt needs the same check. An edit that speeds up small hail claims can quietly stop the model flagging a repeat claim.

Key words

Golden set
A fixed list of past cases, each with an agreed good answer or pass rule.
Baseline
The results of the version you shipped last, kept to compare against.
Pass rule
What a good answer must do, written down before you see the output.
Grader
The code or the judge model that marks each answer pass or fail.
Gate
The rule that blocks a release if it breaks a case that used to pass.

How does a regression run work?

A run has four parts: the new version, the golden set, the same model settings and a grader. The output is a list of the cases that changed, with a pass or fail for each one.

How a regression run works

What goes in

New prompt or model

one thing changed at a time

Golden set

past cases with agreed answers

Run every case

same model, same settings

Judge

Grade each answer

code check or judge model

Diff against baseline

which past passes now fail?

Something broke

a past pass now fails

Ship it

no past pass failed

  1. 1You change one thing: the prompt or the model.
  2. 2The same fixed cases go in beside it.
  3. 3The model answers every case with the same settings.
  4. 4Each graded answer is compared with the baseline, case by case.
  5. 5A past pass that now fails means the release is blocked.
  6. 6No past pass has failed, so the change can ship.
A regression run sends the same fixed cases through the new version and grades every answer. Each result is compared with the baseline one case at a time. A past pass that now fails blocks the release.
  1. 1

    Freeze the baseline

    Keep the answers and grades of the version you run today. That is the baseline you compare against.

  2. 2

    Change one thing

    Edit one prompt or swap one model. Two changes at once make the cause hard to find.

  3. 3

    Run every case

    Send the whole golden set with the same model settings. A different setting is a different test.

  4. 4

    Grade each answer

    Code checks mark the cases with a clear answer. A judge model marks the rest against a written checklist of what a good answer does (a rubric).

  5. 5

    Gate the release

    Any case that passed in the baseline and fails now blocks the change. A gain elsewhere does not cancel it out. If a case is flaky, repeat it before you gate on it.

What makes a good regression set?

Start with what has already gone wrong in real use, then add the edge cases you fear. Anthropic's guide asks for evals (tests that score the AI's answers) that mirror your real-world task distribution, and it warns against forgetting edge cases.

A stable set is worth keeping. Anthropic describes capability tests that reach a high pass rate becoming a regression suite, run continuously to catch slow changes in behaviour (drift). The same idea holds for a prompt: once a case is solved, it stays in the set.

  • “Regression evals ask, "Does the agent still handle all the tasks it used to?" and should have a nearly 100% pass rate”

    Anthropic, on agent evals

  • “Set up continuous evaluation (CE) to run evals on every change, monitor your app to identify new cases of nondeterminism, and grow the eval set over time”

    OpenAI, evaluation best practices

Nondeterminism means the same prompt can give a different answer on a second run.

Here is a small worked case. An insurer's claims triage prompt labels each claim fast-track, needs-review or fraud-check. Four cases from real claims work form the set, and each row pairs a claim with its agreed label.

The team's new version is meant to speed up small hail claims. It also stops flagging a repeat claim such as "Third claim on this policy in 30 days". Here is the check in plain Python. Each version's labels are written out, so the gate is what gets tested.

Python
# A regression check for an insurance claims triage prompt. No real model: each
# prompt version's labels are written out, so the grader and the gate are tested.
GOLDEN = [
    {"id": "C-101", "claim": "Hail damage to a parked car, 1,850 USD", "want": "fast-track"},
    {"id": "C-102", "claim": "Third claim on this policy in 30 days", "want": "fraud-check"},
    {"id": "C-103", "claim": "Water leak, 14,000 USD, policy lapsed yesterday", "want": "needs-review"},
    {"id": "C-104", "claim": "Cracked windscreen, 320 USD", "want": "fast-track"},
]
RUNS = {
    "v1": ["fast-track", "fraud-check", "needs-review", "needs-review"],
    "v2": ["fast-track", "fast-track", "needs-review", "fast-track"],
}

def passed(run):
    return {c["id"] for c, label in zip(GOLDEN, run) if label == c["want"]}

for name, run in RUNS.items():
    print(f"{name}: {len(passed(run))}/{len(GOLDEN)} pass")
broke = sorted(passed(RUNS["v1"]) - passed(RUNS["v2"]))
fixed = sorted(passed(RUNS["v2"]) - passed(RUNS["v1"]))
print("v2 broke:", broke or "nothing")
print("v2 fixed:", fixed or "nothing")
print("gate:", "BLOCKED" if broke else "SHIP")

Output

v1: 3/4 pass
v2: 3/4 pass
v2 broke: ['C-102']
v2 fixed: ['C-104']
gate: BLOCKED

Both versions pass three of four cases, so the overall pass rate looks flat. A case-by-case list of what changed shows the problem: C-102 breaks and C-104 is fixed. The gate blocks the release, and the team fixes the repeat-claim rule before it ships.

How do you grade the cases, and how do you handle a model swap?

Pick the grader for each case. Anthropic's guide says to choose the fastest, most reliable, most scalable method for grading, and OpenAI's guide says to structure evals so they can be scored automatically.

  • Clear answer

    Code check

    An exact match, a string check or a schema check. Fast, cheap and the same on every run.

  • Needs judgement

    Judge model

    A model marks tone or helpfulness against a written rubric. Check it against people first, and expect some noise.

Tip

If a case flips between runs, the pass rule may be vague, or the model gives different answers on each run. Tighten the pass rule, and run that case several times before you trust one result.

A model swap needs the same test. Anthropic says it regularly retires older models, and once one is retired, requests to it fail. Run the full set on the replacement well before the switch-off date, and compare case by case.

  • “To help measure the performance of replacement models on your tasks, consider thorough testing of your applications with the new models well before the retirement date”

    Anthropic, model deprecations

How would you run this in a team's release process?

A pull request changes the prompt file. The team's CI job, the automatic checker that runs on every push, runs a small, quick set of checks on each change and the full golden set each night. Anthropic's guide agrees that automated evals belong in CI, running on each change.

  1. 1

    Small set on every change

    Keep the per-change run cheap, so people never skip it.

  2. 2

    Full set on a schedule

    Run every case each night and before each release, and keep the results.

  3. 3

    Block on a broken case

    Any past pass that fails stops the merge until the owner explains it.

  4. 4

    Grow the set

    Each fixed live failure becomes a new case, so it cannot come back unnoticed.

Full runs cost money in model calls, so the per-change set stays small and the bill is checked each month.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a change that breaks what already worked.
  • A fixed golden set of real cases, with agreed good answers.
  • Case-by-case comparison with a baseline, then a gate on the release.
  • Code checks where possible, and a judge model checked against people.
  • The full set re-run on every model swap, before the old model is retired.
  • The set grows with every live failure.

Common traps

  • Trap"Our average score went up, so it's fine."

    BetterAn average can hide a case that broke. Compare case by case, and gate on any past pass that fails.

  • Trap"We'll test it by hand after launch."

    BetterHand checks miss what nobody remembers to try. Keep the set saved in Git or a similar version history, and run it on every change.

  • Trap"The judge model is always right."

    BetterA judge is a grader, and it needs checking. Compare its marks with people on a sample, and watch for flips between runs.

Can you spot the regression?

Spot the regression

Your team changed the refund-policy prompt. Which result should block the release?

Quick check

Your claims triage prompt works well today, and the model behind it retires next quarter. What should you do first?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q100How do you test prompts systematically?12 min
  2. Q256Capability evals vs regression evals?10 min
  3. Q258How do you A/B test an LLM feature?12 min
  4. Q251How do you calibrate a judge against humans?11 min
  5. Q248What is a golden dataset, and how do you build one?11 min
  6. Q261How do you detect drift?12 min

Learn it in depth

Last updated on 26 November 2026

Changing prompts or models in a live product?

I design and build AI products and agents, including the test set and the release gate behind them. Book a short call and tell me what your system needs to do.