Compare prompt candidates against a baseline
Run a candidate prompt against the baseline on accuracy, format validity, latency and cost and decide with a pass threshold.
By Invicly Tech, , in Prompt Engineering and Vibe Coding. About 8 minutes to read.
In short
A regression workflow compares a new prompt, the candidate, with the current one, the baseline, on the same fixtures. You score accuracy, format validity, speed and cost, then decide with thresholds agreed in advance. This stops a change that fixes one thing from quietly breaking another.
Think of it like this: It is a before and after photo taken from the same spot with the same camera.
Explained simply
A regression is something that used to work and now does not. In prompts, it happens often: you improve one kind of answer and quietly harm another. A regression workflow catches this before users do.
The method is a fair race. Take your current prompt, called the baseline, and your new one, the candidate. Run both on the same fixtures with the same graders and the same settings.
Compare more than quality. Count how many answers are in the right format, how long each takes and how much each run costs. A tiny gain in accuracy may not justify double the cost.
Agree the pass rules before you look at the scores, for example accuracy must not drop and every output must be valid JSON. Then the decision is simple: pass or fail.
Press Play on a diagram to walk through it one step at a time.
- 1Freeze baseline
Prompt text, model, settings
- 2Run fixtures
Baseline and candidate
- 3Score
Accuracy and format validity
- 4Measure
Latency and token cost
- 5Apply thresholds
Pass or fail
- 6Record
Save results and notes
- Runner to Baseline: Send all fixtures1Send all fixtures
- Baseline to Runner: Outputs, time, tokens2Outputs, time, tokens
- Runner to Candidate: Send the same fixtures3Send the same fixtures
- Candidate to Runner: Outputs, time, tokens4Outputs, time, tokens
- 5Grade both and apply thresholdsRunner to Runner: Grade both and apply thresholds
In depth
Freezing the baseline
A baseline is only useful if you can run it again. Save the exact prompt text, the model name and the settings such as temperature. Store them with a version label. If your provider offers dated model snapshots, use a pinned one so the baseline does not change underneath you. Note that providers may retire or change models over time, so record the date of each run too. Without a frozen baseline, you cannot tell if a score changed because of your edit or because something else moved.
- Exact prompt text
- Model name or pinned snapshot
- Settings such as temperature
- Version label and run date
Scores and thresholds
Score each run on accuracy, using your graders, and on format validity, the share of outputs that match the required structure. Measure latency, the time per answer, and cost, usually from token counts. Then set thresholds before running. Examples: accuracy at least equal to the baseline, format validity 100 percent, median latency no more than 20 percent slower, cost no more than 10 percent higher. Also look at individual cases that flipped from pass to fail, because an average can hide a serious regression.
- Accuracy and format validity
- Latency and token cost
- Thresholds set in advance
- Inspect every case that flipped to fail
- Accuracy 34 of 40
- Valid JSON 40 of 40
- Median 1.8 s
- Cost 0.05 per 40
- Accuracy 37 of 40
- Valid JSON 39 of 40
- Median 2.1 s
- Cost 0.06 per 40
Reproducibility limits
Model outputs can vary between runs, even with the same input, and lowering temperature reduces but may not remove this. Providers also update models and may change behaviour. So treat one run as an estimate. For important decisions, repeat the run a few times and look at the spread. With only 40 fixtures, a one-case difference is within noise. Write down these limits in your report: model version, run date, number of runs, and fixture size. This keeps the team honest about how much a score proves.
- Outputs vary between runs
- Repeat runs for important choices
- Small fixture sets give noisy scores
- Record model version, date and run count
Learn it in 5 short steps
About 35m each. Track them with a timer in your plan.
- 1Freeze a baseline prompt and model~35m
- 2Score accuracy and format validity~35m
- 3Track latency and cost~35m
- 4Set pass thresholds~35m
- 5Note reproducibility limits~35m
Key points
- Freeze the baseline: save its exact prompt text, model name and settings.
- Score both versions on the same fixtures with the same graders.
- Track latency and cost next to quality. A tiny gain at double the cost may not be worth it.
- Set pass thresholds first, for example no drop in accuracy and format validity at least 99 percent.
- Model outputs vary between runs and providers can change models, so repeat runs and note the date and model version.
Key terms
Tap a card to flip it. 0/5 known
Examples
Baseline triage-v3 vs candidate triage-v4 (40 fixtures)
v3 v4
Accuracy 34/40 37/40
Valid JSON 40/40 39/40
Median latency 1.8s 2.1s
Cost per 40 $0.05 $0.06
Threshold: accuracy up, valid JSON 40/40.
Result: FAIL, one invalid JSON output.Numbers are made up to show the layout.
A pass or fail decision
Thresholds were set first: accuracy must not drop, format validity must be 100 percent, latency no more than 20 percent slower. The candidate improved accuracy, but one output was invalid JSON. That breaks the format rule, so the candidate fails. You look at the failing case, fix the prompt and run again.
Rule v3 v4 Result
Accuracy >= baseline 34/40 37/40 pass
Valid JSON 40/40 40/40 39/40 FAIL
Latency <= +20% 1.8s 2.1s pass (+17%)
Decision: reject v4, investigate the invalid output.A small comparison script outline
This outline shows the steps of a simple runner in pseudocode, not a specific library. For each fixture it runs both prompts, records time and tokens, and grades the result. It writes one results file named with the versions and date. Use your own provider's client where call_model appears.
for fixture in fixtures_v2:
for name, prompt in [("v3", p3), ("v4", p4)]:
start = now()
out, tokens = call_model(prompt, fixture.input)
row = grade(out, fixture) + [now() - start, tokens]
save(row, name)
report(thresholds) # accuracy, valid JSON, latency, cost
# file: results/2026-12-02_v3-v4_fixtures-v2.jsonQuick reference
- Freeze the baseline: prompt text, model and settings.
- Run baseline and candidate on the same fixtures.
- Score accuracy and format validity.
- Track latency and token cost beside quality.
- Set pass thresholds before you see any scores.
- Inspect each case that flipped from pass to fail.
- Record model version, date and run count.
Common mistakes
- Changing the model and the prompt together, so you cannot tell which caused the result.
- Choosing thresholds after seeing scores, which lets any result pass.
- Running once and treating a single score as exact, when outputs can vary.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
List the four things you freeze or record for a baseline.
- Exercise 2medium
Write four pass thresholds for a JSON-returning classifier prompt.
- Exercise 3hard
A candidate passes every threshold, but three fixtures that passed before now fail. Describe what you do and what you report.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Do I need special tools for this?
- No. A script, a results file and a table are enough to start. Some providers and open-source tools offer eval features if you want them.
- Why do scores change when I run the same prompt twice?
- Models can produce different outputs each time, and graders can vary too. Repeat runs and look at the range.
- What if the provider changes the model?
- Scores may shift. Pin a model version if offered, record the run date, and re-run your baseline when the model changes.