Skip to content

Prompt Regression Testing via Diff Outputs

Summary

Regression in prompts is caught by comparing outputs on a fixed set of inputs: exact diff for structured output and semantic diff for free text, with thresholds and CI runs.

Problem Statement

When a prompt or model version changes, it's necessary to understand what hasn't broken. Direct string comparison doesn't work: LLMs are non-deterministic. A set of baseline inputs, snapshots of outputs, and a proximity metric are needed.

See also Prompt Versioning, Evaluation, LLM-as-a-Judge.

Step 1. Input Set

At least 30-50 cases covering:

Category Example
Typical Request main scenario
Boundary Case empty input, very long input
Known Failure input on which previous version failed
Injection attempt to override instructions
Format request requiring strict schema

Store as JSONL: `{