Launch Week 02 wrapped — explore all five launches
Back

LLM Regression Testing: How to Gate Every Change with CI/CD Evals

Kritin Vongthongsri, Co-founder @ Confident AI

LLM Evals & Safety Wizard. Previously ML + CS @ Princeton researching self-driving cars.

LLM regression testing is the practice of evaluating your application's outputs against a baseline dataset every time anything changes — a prompt, a model version, a retrieval configuration, an agent workflow — and blocking the change if quality drops below defined thresholds. It is the mechanism that turns "we think this prompt is better" into a gated, evidenced decision.

The reason it exists as its own discipline is that traditional software testing breaks down for probabilistic systems. A unit test asserts one deterministic output; an LLM produces different valid outputs for the same input, and a change that improves ten cases can silently break five others. Regression testing for LLMs therefore asserts quality scores over a dataset, not exact outputs — and the whole practice reduces to five decisions: what goes in the dataset, which metrics score it, what thresholds gate it, where in the pipeline it runs, and how it extends to agents.

This guide walks those five steps in order, then covers the tooling capabilities that matter, real outcomes from teams running this loop, and the mistakes that most often undermine it. It is the CI/CD companion to dev, staging, and production, which covers where regression testing sits in the broader environment strategy.

What is LLM regression testing and why does it matter?

LLM regression testing evaluates every candidate change against a fixed set of test cases — the golden dataset — using quality metrics, and compares the results to the current baseline. If the candidate scores worse than the baseline beyond tolerance, the change is blocked. The unit of assertion is the metric verdict, not the output string, because probabilistic systems cannot be tested by exact matching.

The failure it prevents is the most common one in LLM engineering: the confident regression. A team tweaks a prompt to fix one complaint, the fix works, everyone moves on — and three unrelated behaviors quietly degrade, surfacing weeks later as user churn with no obvious cause. Without a regression gate, every prompt edit is a bet placed blind. With one, a prompt edit is a deploy: tested, compared, and either passed or bounced.

The practice matters more the faster you ship. Teams that change prompts weekly without regression coverage accumulate silent quality debt at exactly the rate they ship improvements — which is why the teams with the best-looking velocity and no gate are usually the ones about to have a very bad month.

Step 1: Build a golden dataset that reflects real usage

The golden dataset is the fixed set of input cases — with expected outputs or expected behaviors where they exist — that every change is tested against. Its job is to represent reality: common scenarios in proportion to their traffic, the edge cases that have actually occurred, adversarial inputs, and every production failure you have confirmed and fixed.

Composition guidance that holds up in practice:

  • Start from real failures. Every bug you have caught by hand, every complaint you have root-caused — these are the first entries, because they are proven ways your application breaks. A fix without a regression case is a fix on a timer.
  • Cover the traffic, not the imagination. Draw common scenarios from what users actually ask, in rough proportion to volume. A dataset that is 40% edge cases for a product whose traffic is 95% routine will gate releases on the wrong risk.
  • Include the inputs you hope never arrive — malformed requests, off-topic questions, prompt-injection attempts. Happy-path-only datasets pass changes that break exactly where breaking is most expensive.
  • Start small enough to read. Fifty to a hundred cases you have personally reviewed beat five hundred you haven't. Grow toward several hundred as production supplies real cases.
Confident AI dataset editor showing curated golden test cases, expected outputs, context, filters, versioning, and evaluation controls.
Confident AI dataset editor for benchmark curation

The staleness problem is the one that kills golden datasets over time: the product evolves, traffic shifts, and the dataset keeps testing last year's usage. The fix is structural, not disciplinary — production traces should flow into the dataset continuously, with confirmed failures and representative new scenarios added as they occur. Confident AI automates this curation from production traces, which is the difference between a dataset that evolves with usage and one that decays into a museum.

Step 2: Choose the right evaluation metrics

Metrics are chosen by use case, because each use case has a distinct dominant failure mode: faithfulness and hallucination checks for RAG, answer relevancy for Q&A, tool-selection and argument correctness for agents, coverage and consistency for summarization. A regression suite scores each case with the two to four metrics that catch its use case's failures — more metrics add noise faster than signal.

Use case

Primary regression metrics

What they catch

RAG / grounded Q&A

Faithfulness, answer relevancy

Hallucinated claims; answers that ignore the question

Summarization

Coverage, faithfulness

Omitted critical content; fabricated details

Agents / tool use

Tool correctness, task completion

Wrong tool or arguments; competent-looking non-completion

Chatbots (multi-turn)

Role adherence, conversation completeness, knowledge retention

Cross-turn drift, forgotten context, unresolved goals

Classification / routing

Per-class accuracy

Localized regressions hidden by aggregate accuracy

Policy-bound outputs

Custom criteria judges

Violations of your product's specific rules

Layer the metric types. Deterministic checks (format validity, required fields, banned phrases) run first — they are free and unambiguous. Statistical and semantic checks run next. Criteria-based LLM-as-a-judge metrics — the ones that encode your definition of good in written criteria — carry the nuanced quality judgments. The layering matters for regression specifically because it localizes the diagnosis: a deterministic failure is a different bug than a judge-metric failure, and knowing which layer failed is half the debugging.

One prerequisite carried over from evaluation fundamentals: metrics must be validated against human judgment before they gate anything. An unvalidated judge blocking deploys is a random number generator with merge permissions. The validation methodology is covered in what makes a good eval.

Step 3: Set pass/fail thresholds that block bad deploys

Each metric gets an explicit, calibrated threshold, and each case gets a binary verdict against it. Judge-score thresholds are not portable across models, rubrics, or datasets, so derive them from human-labeled cases; policy violations can still have zero tolerance where one violation is unacceptable. Binary pass/fail per case, aggregated into a pass rate per run, is more reliable for gating than comparing raw score averages, because averages let one severe regression hide inside twenty mild improvements.

Calibrate thresholds empirically, not aspirationally. Run the current production version against the golden dataset to establish the baseline; the thresholds sit at or slightly below that baseline, tightened over time as quality improves. Thresholds set above what the current system achieves block every deploy and get deleted within a month. Thresholds set generously below baseline pass everything and protect nothing.

Two refinements worth adopting early. First, tier the cases: a subset of non-negotiable cases (safety, policy, your worst historical incidents) must pass at 100% — one failure blocks the deploy regardless of the aggregate. The rest gate on pass-rate regression against baseline, with a small tolerance for judge-model noise. Second, gate on regression, not absolutes: the question is "did this change make anything worse," which means comparing the candidate run to the baseline run case by case, and flagging cases that flipped from pass to fail — those flips are the regression, whatever the aggregate says.

Step 4: Wire regression tests into CI/CD

The suite protects you only if it runs on every change without anyone remembering to run it — which means it belongs in the same pipeline as your unit tests, triggered on every pull request that touches prompts, models, retrieval logic, or agent configuration. A change that regresses quality fails the PR the same way a broken build does.

The pipeline shape that works: on each candidate change, the CI job runs the application against the golden dataset, scores the outputs with the validated metrics, compares verdicts to the baseline run, and fails the check if any non-negotiable case fails or the pass rate drops beyond tolerance. Results attach to the pull request as a test report — which cases flipped, which metrics moved, with the judge reasoning per failure — so the review conversation is about evidence, not vibes.

Confident AI test run performance dashboard showing metric trends, benchmark breakdowns, and CI/CD quality analytics across datasets.
Confident AI CI/CD analytics dashboard

Two operational details determine whether the gate survives contact with the team. Runtime: keep the PR-blocking suite fast — minutes, not an hour — by reserving the full dataset for nightly or pre-release runs and gating PRs on a representative subset plus all non-negotiables. Slow gates get bypassed, and a bypassed gate is worse than none because it launders confidence. History: every run should be stored and comparable — per-case, per-metric, over time — so that when quality drifts across ten small changes, you can find which one moved it. Confident AI's regression testing keeps this history as first-class test runs, with per-case diffs between any two runs and results shared with the whole team rather than trapped in CI logs.

The same reports double as the deployment evidence trail — which change shipped, what it scored, who approved it — the record that governance frameworks increasingly expect for AI systems.

Step 5: Regression test AI agents, not just single-turn outputs

Agent regression testing evaluates the execution path, not just the final answer: did the agent select the right tools, pass correct arguments, sequence steps sensibly, avoid loops, and complete the task? An agent can produce a fine-looking final response while having taken a broken path to it — and the broken path is what regresses when you change a prompt or swap a model.

This changes the test design in three ways. First, assertions move to the span level: tool-correctness metrics score each tool call (right tool, right arguments) inside the trace, and task-completion metrics score the outcome against the user's goal — the trace model this relies on is covered in What Is LLM Tracing?. Second, the golden dataset becomes scenario-based for multi-turn agents: instead of fixed input/output pairs, cases define a scenario, a user persona, and an expected outcome, and each test run simulates the conversation fresh against the candidate version. Replaying last month's transcripts against a new prompt is not a regression test — the new version would have steered the conversation differently from turn two onward. Third, the suite needs failure simulation: cases where a tool times out, returns an error, or yields empty results, asserting the agent degrades gracefully instead of hallucinating past the failure.

Simulation is what makes this practical. Manually re-testing twenty conversational scenarios after every prompt change costs hours per change, which is why nobody sustains it; simulated multi-turn runs compress the same coverage into minutes and make conversational regression testing something that actually happens on every PR. The full agent-side methodology is in evaluating AI agents.

What to look for in regression testing tooling

Whether you assemble the pipeline from components or adopt a platform, the capability checklist is the same — and it is the fair way to compare tools in 2026:

Capability

Why it matters for regression testing

CI/CD integration with pass/fail exit codes

The gate must block merges natively, not via manual review of dashboards

Validated, customizable metrics

Generic scores can't encode your product's rules; unvalidated judges can't be trusted with merge rights

Golden dataset management with versioning

The dataset is a living artifact — it needs history, review workflows, and tags

Production-to-dataset curation

The structural fix for dataset staleness; failures become regression cases automatically

Run-to-run comparison and history

"Which cases flipped since baseline" is the core regression question; CI logs can't answer it

Span-level and multi-turn support

Agents regress in the execution path and across turns, not just in final outputs

Results non-engineers can review

PMs and QA own quality definitions; a gate only engineers can read becomes an engineer-only practice

The last row is the one most teams discover late. Regression verdicts drive product decisions — ship or hold — and when the evidence lives in CI logs, every ship decision routes through whoever can read them. Confident AI covers this checklist end to end, including the shared review layer; whatever you choose, hold it to the table, not the feature list.

Real-world results

The economic case for regression testing is cycle time, not just caught bugs. Finom, a European fintech, compressed agent improvement cycles from 10 days to 3 hours by moving from manual re-testing to automated regression runs on Confident AI — the bottleneck was never writing the fix, it was proving the fix didn't break anything else. Amdocs used a four-person QA team to scale evaluation for an internal knowledge assistant at a company with more than 30,000 employees, replacing repeated manual expert review with reusable metrics and shared evaluation workflows. And Humach shipped deployments 200% faster once regression evidence replaced manual sign-off as the release criterion.

The pattern across all three: the gate did not slow shipping down — it removed the fear that was slowing shipping down.

Common mistakes that undermine LLM regression testing

  • Vibe-gating. Running evals but deciding ship/hold by eyeballing outputs anyway. If the threshold doesn't block the merge mechanically, you have a dashboard, not a gate.
  • The static golden dataset. A dataset frozen at launch tests last year's product. Wire production failures and new scenarios into it continuously, or watch pass rates stay green while users churn.
  • Happy-path-only coverage. Suites built from demo scripts pass changes that break on malformed input, adversarial phrasing, and tool failures — the inputs that actually page you.
  • Manual runs. "We run evals before big releases" means small changes ship untested, and the regressions arrive through the small changes. Every PR, automatically, or the coverage is theater.

Frequently Asked Questions

How do I set up regression testing for an LLM application?

Build a golden dataset of 50–100 real cases (growing toward several hundred), choose two to four metrics per use case and validate them against human judgment, and calibrate pass/fail thresholds against your current baseline. On each relevant pull request, run all non-negotiable cases plus a fast representative subset; run the complete dataset nightly or before release, failing the gate when critical cases fail or quality regresses beyond tolerance.

How do I run LLM evals automatically in a CI/CD pipeline?

Trigger an evaluation job on every relevant pull request: run the candidate version against all non-negotiable cases plus a representative fast subset, score outputs with validated metrics, compare per-case verdicts to baseline, and return a failing exit code if quality regressed. Run the complete dataset nightly or before release. Results should attach to the PR as a report showing which cases flipped and why, so review is evidence-based.

How many test cases does a golden dataset need?

Start with 50–100 cases you have personally reviewed — drawn from real usage and confirmed production failures — and grow toward several hundred as production supplies new cases. Size matters less than freshness and composition: a small dataset that reflects current traffic and known failures outperforms a large stale one testing scenarios users stopped hitting a year ago.

How do I set pass/fail thresholds for LLM evaluations?

Calibrate against reality: run your current production version on the golden dataset to establish a baseline, set thresholds at or slightly below it, and tighten over time. Tier the cases — safety and policy cases must pass at 100%, the rest gate on pass-rate regression versus baseline. Gate on per-case verdict flips, not score averages, so one severe regression cannot hide inside twenty mild improvements.

How do I handle non-deterministic outputs in regression tests?

Assert quality verdicts, not exact strings. Metrics score each output against criteria — groundedness, relevancy, policy compliance — and return pass/fail against a threshold, which tolerates valid variation while catching genuine degradation. For borderline judge-model noise, allow a small pass-rate tolerance on non-critical cases and re-run flipped cases before failing the build.

How do I regression test an AI agent when I change prompts or models?

Test the execution path, not just the final output: score tool selection and argument correctness at the span level, assert task completion against the scenario's expected outcome, and include failure-simulation cases where tools error or return nothing. For multi-turn agents, use scenario-based simulation — fresh conversations generated against the candidate version each run — because replaying old transcripts does not test how the new version would have steered the conversation.