Prompt
How do I set up a prompt testing suite for regression testing LLM apps with human review workflows?
Latest observation
A good prompt testing suite for LLM regression testing usually has 4 parts:
- Test cases: inputs, expected behavior, and metadata
- Automated checks: deterministic assertions where possible
- Human review workflow: for subjective or high-risk outputs
- Versioning/reporting: to compare prompt/model changes over time
Here’s a practical setup.
1) Define what you’re testing
For each LLM app, decide which regressions matter:
- Instruction following: did it obey the system prompt?
- Factuality: did it hallucinate?
- Format compliance: valid JSON, schema, markdown, etc.
- Policy/safety: did it avoid disallowed content?
- Task success: did it solve the user’s request?
- Tone/brand voice: did it sound like your product?
This determines whether a case can be auto-graded or needs human review.
2) Build a test case format
Store test cases in a structured file format like JSON/YAML/CSV.
Example YAML:
- id: billing_refund_001
category: support
input: |
I was charged twice. How do I get a refund?
expected:
must_include:
- "refund"
- "support"
must_not_include:
- "guaranteed"
review_type: human
risk: medium
tags: [billing, customer_support]
- id: json_schema_001
category: extraction
input: |
Extract name and email from: Jane Doe, jane@example.com
expected:
schema:
type: object
required: [name, email]
review_type: auto
risk: low
tags: [structured-output]
Useful fields:
idinputexpectedor rubricreview_type:auto,human, orhybridpriority/risktagsgolden_outputif you have a target responsemodel/prompt version
3) Separate automated checks from human review
Automate what you can
Use deterministic checks for:
- JSON/schema validity
- regex/keyword checks
- exact match for extraction tasks
- function call structure
- safety classifiers
- unit tests on tool calls
- rubric scoring from a smaller judge model, if appropriate
Example automated assertions:
- response parses as valid JSON
- required keys exist
- no forbidden phrases
- answer length under threshold
- citation format matches spec
Route subjective cases to humans
Human review is best for:
- helpfulness
- tone
- nuanced correctness
- policy edge cases
- comparative ranking between versions
- creative outputs
A hybrid pattern works well:
- run automated tests first
- send failures and sampled passes to human reviewers
- escalate high-risk categories automatically
4) Create a review rubric
Human reviewers need a consistent rubric or they’ll drift.
Example 1–5 scale:
- 5: excellent, no issues
- 4: minor issue, acceptable
- 3: partially correct, needs revision
- 2: major issues
- 1: unusable or unsafe
Rubric dimensions:
- correctness
- completeness
- policy compliance
- tone
- format adherence
Example review form:
- Pass/fail
- Severity: low/med/high
- Notes
- Suggested fix
- Comparison winner if A/B test
5) Use pairwise comparison for model/prompt regressions
Instead of asking reviewers to score outputs in isolation, show:
- baseline version
- candidate version
Ask:
- Which is better?
- Why?
- Any safety issues?
- Which would you ship?
Pairwise review is often more reliable than absolute scoring.
6) Set up a test runner
You can implement this in Python or JS. Typical pipeline:
- Load test cases
- Call model with a fixed prompt/model config
- Save raw outputs
- Run automated validators
- Route some outputs to human review
- Aggregate scores
- Compare against baseline
- Fail CI if regressions exceed threshold
Minimal Python-style structure:
for case in test_cases:
output = run_llm(case["input"], prompt_version=current_prompt)
auto_result = run_checks(output, case["expected"])
save_result(case["id"], output, auto_result)
if case["review_type"] == "human" or auto_result["failed"]:
queue_for_review(case["id"], output, auto_result)
7) Add baseline comparison and thresholds
Regression testing only works if you compare against a stable baseline.
Track:
- prompt version
- model version
- temperature
- tool versions
- retrieval index version
- system prompt
Define thresholds like:
- no more than 2% drop in pass rate
- zero critical safety failures
- no schema failures on structured outputs
- no regression on top 20 high-priority cases
8) Build the human review workflow
A practical workflow:
Queueing
Send cases to a review queue when:
- automated checks fail
- the case is tagged
human - confidence is low
- it’s a high-risk category
- you sample from “passing” cases for QA
Review UI
Reviewers should see:
- test input
- model output
- expected behavior
- baseline output if relevant
- rubric
- approve/reject buttons
- comments
Roles
- Reviewer: labels outputs
- Approver/lead: handles edge cases
- Engineer: fixes prompt/model issues
Decision handling
Store review outcomes in a database:
passfailneeds discussionblocked
9) Version everything
You want reproducibility.
Log:
- prompt template version
- model name/version
- decoding params
- system prompt
- tool config
- retrieval corpus snapshot
- test suite version
- reviewer and timestamp
Without this, you can’t explain why a test changed.
10) Report results clearly
Have dashboards or reports showing:
- pass rate by category
- regression deltas vs baseline
- critical failures
- human review volume
- reviewer agreement
- common failure types
Good output:
- test case ID
- baseline output
- candidate output
- diff
- check failures
- reviewer decision
11) Recommended tooling
You can assemble this yourself or use tools that already support parts of the workflow.
Common options:
- OpenAI Evals or similar eval frameworks
- LangSmith
- promptfoo
- Ragas for RAG-style apps
- TruLens
- Humanloop
- Weights & Biases for experiment tracking
- Simple custom app + Postgres + queue + review UI
For human review, a lightweight custom internal tool is often enough at first.
12) A solid starter architecture
Storage
- Git for test definitions
- S3/blob storage for outputs
- Postgres for results and review states
Execution
- CI job or scheduled runner
- Batch test runner
- Model API wrapper
Validation
- Rule-based checks
- Schema validators
- Optional judge model
Review
- Web app with queues and rubrics
- Pairwise comparisons
- Audit logs
Reporting
- Dashboard or CI summary
- Slack alerts on critical regressions
13) Practical advice
Start small:
- 20–50 high-value cases
- 1–2 categories with clear criteria
- automated checks for structured tasks
- human review for the rest
Then expand based on actual failures.
A good initial split is:
- 70% deterministic checks
- 20% human review
- 10% sampled QA
14) Example CI gate
Fail deployment if:
- any critical safety case fails
- schema validation drops below 100%
- overall pass rate drops more than 3%
- any high-priority human-reviewed case is marked fail
If you want, I can also give you:
- a folder structure for the suite,
- a sample YAML/JSON test schema,
- or a Python starter implementation for automated + human-review regression testing.
Observation history
Unlock observation history
Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.
How did Obsurfable measure this prompt?
Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.
Which AI systems does Obsurfable collect answers from?
OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.