Build an automated regression testing system that detects quality degradation when AI models, prompts, or configs change.
## CONTEXT AI systems are uniquely fragile to silent regression — a model upgrade, prompt tweak, or even a dependency update can degrade output quality in subtle ways that are invisible to spot-checking but obvious to users over thousands of interactions. Unlike traditional software where regressions cause visible errors, AI regressions often manifest as slightly worse outputs that erode user satisfaction gradually. Organizations that deploy AI changes without automated regression testing discover problems through customer churn, not test failures. A comprehensive regression testing system catches these silent degradations before they reach production. ## ROLE You are a test automation engineer with 12 years of experience building regression testing systems, including 5 years focused specifically on AI and ML system quality assurance. You built the AI regression testing platform at a major search engine that validates every model and prompt change across 50,000 test cases before deployment, catching an average of 25 regression issues per week that would have degraded search quality for millions of users. Your testing systems cover deterministic assertions, semantic comparison, statistical distribution analysis, and human-evaluation-calibrated automated scoring. ## RESPONSE GUIDELINES - Design the regression suite to run automatically on every change with clear pass/fail results and no manual interpretation needed - Include both deterministic comparison (format, structure, required elements) and semantic comparison (meaning preservation, quality consistency) - Handle the non-deterministic nature of LLM outputs — identical inputs can produce different but equally valid outputs - Build tolerance for intentional improvements while catching unintended degradations - Do NOT design regression tests that fail on any output change — the goal is to catch quality degradation, not freeze outputs - Do NOT skip statistical comparison — individual test case results can be misleading without aggregate analysis ## TASK CRITERIA 1. **Baseline Snapshot System** — Define how to capture the golden baseline for [INSERT AI SYSTEM]: select a representative sample of inputs (minimum 500, stratified by input type and complexity), run through the current system, store outputs with metadata (model version, prompt version, timestamp), and version the entire baseline for rollback capability. 2. **Change Detection & Test Triggers** — Specify which changes trigger regression tests for [INSERT AI SYSTEM]: model version updates (automatic full suite), prompt modifications (automatic full suite), configuration changes (targeted tests for affected components), dependency updates (smoke test suite), and scheduled periodic regression (nightly full suite regardless of changes). Align triggers with [INSERT CHANGE FREQUENCY]. 3. **Deterministic Comparison Layer** — Design tests for objectively verifiable properties: output format compliance (JSON schema validation, required sections present), length within acceptable range, required elements present (specific keywords, structure elements), and prohibited content absent. These tests produce binary pass/fail results. 4. **Semantic Similarity Comparison** — Design tests for meaning preservation: embed baseline and new outputs using a sentence transformer model, compute cosine similarity per test case, flag any case where similarity drops below 0.82 (configurable threshold), and aggregate similarity scores per test category to detect systematic drift even when individual cases pass. 5. **Statistical Distribution Analysis** — Compare the distribution of quality metrics across the full test suite: compare output length distributions (KS test), compare quality score distributions (two-sample t-test), compare error rate distributions (chi-square test), and flag statistically significant shifts (p < 0.01) as potential regressions. This catches aggregate degradation that individual test cases miss. 6. **Critical Output Protection** — Define enhanced testing for [INSERT CRITICAL OUTPUTS]: stricter comparison thresholds, additional human-evaluation test cases, zero-tolerance for regression on safety-critical outputs, and separate reporting with immediate alerting for any degradation in critical outputs. 7. **Tolerance Threshold Framework** — Define acceptable variation per metric: format compliance (zero tolerance for regression), semantic similarity (accept above 0.85, investigate 0.80-0.85, fail below 0.80), quality scores (accept within 0.5 points of baseline, investigate 0.5-1.0 below, fail more than 1.0 below), and output length (accept within 20% of baseline median). 8. **Regression Report Generation** — Design the automated regression report: executive summary (overall pass/fail with confidence level), changed outputs inventory (side-by-side comparison of baseline vs. new for flagged cases), degraded metrics detail (which metrics, by how much, with statistical evidence), new failure analysis, and recommended action (approve deployment, investigate specific issues, rollback). 9. **Approval Workflow** — Define the decision process based on regression results: auto-approve if all metrics pass and no critical output changes detected, require human review if any metric is in the investigation zone, auto-block if any critical metric fails, and specify the reviewers and SLA for each decision tier. 10. **Baseline Evolution** — Design the process for updating baselines when intentional improvements are made: approve new outputs as the updated baseline after successful deployment, maintain baseline history for trend analysis, and handle the scenario where a prompt change intentionally changes outputs in a way that would fail similarity tests. ## INFORMATION ABOUT ME - My AI system: [INSERT AI SYSTEM — e.g., customer-facing chatbot, content generation pipeline, code completion model, document summarizer] - My change frequency: [INSERT CHANGE FREQUENCY — e.g., daily prompt updates, weekly model upgrades, monthly major releases] - My critical outputs: [INSERT CRITICAL OUTPUTS — e.g., financial calculations, medical information, legal citations, safety instructions] - My test infrastructure: [INSERT INFRASTRUCTURE — e.g., GitHub Actions, Jenkins, custom CI pipeline, AWS CodePipeline] - My current test coverage: [INSERT COVERAGE — e.g., no automated testing, basic smoke tests, manual review only] ## RESPONSE FORMAT - Begin with a regression testing strategy overview summarizing the testing layers and decision framework in 5-7 bullet points - Use labeled sections for each testing component with specific thresholds and comparison methods - Include a regression report template showing the output format for each section - Provide a decision matrix table showing test outcomes mapped to recommended actions - End with a baseline management guide and a phased implementation plan
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[INSERT AI SYSTEM][INSERT CHANGE FREQUENCY][INSERT CRITICAL OUTPUTS]