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 two layers:
- Automated checks for fast, repeatable regressions
- Human review workflows for subjective or high-risk cases
Here’s a practical way to set it up.
1) Define what “regression” means for your app
Before tooling, decide what you want to protect.
Typical categories:
- Correctness: factual accuracy, task success
- Format: JSON schema, markdown structure, tool-call shape
- Safety/compliance: policy violations, disallowed content
- Style/brand: tone, verbosity, persona
- Robustness: behavior under adversarial or ambiguous prompts
- Latency/cost: response time, token usage
This matters because each category needs a different test and scoring approach.
2) Create a test case format
Store each test case as structured data, not just plain text. A common schema:
{
"id": "support_refund_policy_001",
"description": "Respond to refund request per policy",
"input": {
"messages": [
{"role": "user", "content": "I bought this 10 days ago and want a refund."}
]
},
"expected": {
"must_include": ["refund policy", "10 days"],
"must_not_include": ["guaranteed refund"],
"format": "markdown"
},
"tags": ["support", "policy", "high_priority"],
"severity": "high"
}
Useful fields:
idinputprompt/messagesexpectedassertionstags/severitymodelorconfigunder testhuman_review_required: true/false
3) Separate automated vs human-reviewed tests
Automated tests are best for:
- JSON/schema validation
- Exact or fuzzy string assertions
- Presence/absence of key phrases
- Regex checks
- Deterministic tool-call behavior
- Safety classifiers or policy rules
Human review is best for:
- Tone/brand quality
- Helpfulness and nuance
- Open-ended reasoning
- Edge cases where no single “right” answer exists
- Safety decisions requiring context
A good pattern is:
- Run everything automatically
- Auto-pass/auto-fail where possible
- Send ambiguous or failed cases to human review
4) Build an evaluation harness
Your test runner should:
- Load the dataset
- Execute the LLM app with fixed configuration
- Capture outputs, tool calls, metadata, token counts, latency
- Score automatically
- Queue human review items
- Store results for comparison against previous runs
Minimum result record:
{
"test_id": "support_refund_policy_001",
"run_id": "2026-10-22T12:00:00Z",
"model": "gpt-4.1",
"prompt_version": "v12",
"output": "Sorry, our refund policy allows refunds within...",
"passed_auto": false,
"auto_fail_reasons": ["missing_required_phrase: refund policy"],
"needs_human_review": true
}
5) Add scoring rules
Use a mix of rule-based and model-based evaluation.
Rule-based
Good for deterministic requirements:
- output is valid JSON
- fields exist
- no forbidden words
- contains required sections
- matches regex
- tool call parameters are correct
LLM-as-judge
Useful for subjective criteria:
- helpfulness
- completeness
- politeness
- reasoning quality
- policy compliance in ambiguous cases
Best practice:
- Use a separate judge prompt/model
- Provide a rubric
- Ask for structured output like:
- score 1–5
- pass/fail
- rationale
- cited evidence from the answer
Example rubric dimensions:
- Correctness
- Completeness
- Conciseness
- Safety
- Tone
6) Design the human review workflow
A practical workflow looks like this:
Triage
Automatically route cases into buckets:
- Pass: no review needed
- Fail: obvious issue
- Review: borderline, high severity, or low-confidence judge score
Reviewer UI
Give reviewers:
- input prompt
- model output
- expected behavior/rubric
- tags/severity
- previous version output, if available
- buttons for pass/fail/needs discussion
- comment box
- optional side-by-side comparison
Review actions
Reviewers should be able to mark:
passfailneeds rewriteexpected behavior changedfalse positivefalse negative
Consensus
For high-stakes cases:
- require 2 reviewers
- use majority vote
- escalate disagreements to an expert reviewer
7) Version everything
You want to know what changed when something breaks.
Version these separately:
- prompts
- system instructions
- tools/function schemas
- model/version
- retrieval corpus
- test dataset
- judge rubric
- app code
This lets you answer:
- Did the prompt change break behavior?
- Is the model update responsible?
- Did retrieval changes affect outputs?
8) Compare runs over time
Your regression system should support:
- baseline run
- current run
- diff view
Track metrics such as:
- pass rate
- fail rate by tag
- human agreement rate
- safety violations
- average latency
- token/cost per test
A common dashboard pattern:
- overall score trend
- top failing test cases
- regressions introduced since last release
- tests newly requiring human review
9) Use representative test coverage
Don’t only test “happy paths.” Include:
- normal cases
- edge cases
- ambiguous prompts
- adversarial prompts
- jailbreak attempts
- multilingual inputs
- long context / truncation cases
- tool failures / empty retrieval
- outdated knowledge / stale policies
Start with a small curated suite, then expand based on production incidents.
10) Integrate into CI/CD
A good setup:
- PR checks: quick subset of critical tests
- Nightly run: full suite
- Release gate: high-severity tests must pass
- Manual review gate: unresolved high-risk failures block release
In CI:
- run a deterministic seed where possible
- pin model versions or allow controlled canary testing
- fail builds on critical regressions
11) Recommended architecture
A simple architecture:
- Test cases in Git or a DB
- Runner executes app against cases
- Scorer applies rules + judge
- Review queue stores uncertain cases
- Reviewer app records human decisions
- Analytics dashboard compares runs
Storage options:
- Git repo for small suites
- SQLite/Postgres for results and review state
- Object storage for traces/artifacts
12) Tooling options
You can build this yourself or use existing tooling:
Build your own
Good if you need custom workflows and tight app integration.
Common libraries/frameworks
- pytest for orchestration
- LangSmith for tracing/evals/review
- OpenAI Evals-style patterns
- promptfoo for prompt regression testing
- DeepEval / Ragas for evaluation helpers
- Weights & Biases or custom dashboards for tracking
If you already have an app framework, connect the test runner to your app’s entry point, not just raw prompts.
13) A practical implementation pattern
Pipeline
- Load test cases
- Run app
- Capture output and traces
- Apply deterministic assertions
- Run judge model for subjective scoring
- Queue borderline cases for human review
- Store results and diffs
- Block or approve release based on policy
Decision policy example
- Auto-pass if all rules pass and judge score ≥ 4
- Auto-fail if any critical safety rule fails
- Human review if judge score is 3 or if severity is high
- Release requires 100% pass on critical tests
14) Keep reviewers calibrated
Human review is only useful if it’s consistent.
Do this:
- provide clear rubrics with examples
- do calibration sessions using gold-standard cases
- periodically measure inter-rater agreement
- maintain an “issue taxonomy” for failures
- update guidelines when reviewers disagree often
15) Start small
A good first version:
- 50–100 high-value test cases
- one judge rubric
- one reviewer UI or even a spreadsheet
- baseline comparison against last release
- severity tags
- CI gate on critical tests only
Then iterate:
- add more edge cases from production logs
- improve judge prompts
- add consensus review for high-risk items
- build dashboards and trend analysis
Suggested minimum stack
If you want the simplest workable setup:
- Dataset: JSON/YAML in Git
- Runner: Python + pytest
- Automated checks: regex/schema/rule assertions
- LLM judge: separate evaluation prompt/model
- Human review: lightweight web app or Airtable/Notion/Sheet initially
- Storage: Postgres or SQLite
- CI: GitHub Actions
If you want, I can also provide:
- a sample folder structure for the suite,
- a Python pytest example for running prompt regressions, or
- a human-review rubric template you can copy.