Regression Tests & Release Gates
Test every change, set thresholds and roll out with shadow runs, canaries and rollbacks.
Prompts, models, documents and settings are all code, so test every change. A release gate blocks a change that fails must-never-happen cases or lowers quality, or raises cost or delay. Roll out with shadow runs and canaries, and keep a rollback ready.
- Release gate
- A rule that stops a change from shipping if it makes quality worse.
- Canary
- Sending a small share of live traffic to a new version first.
- Rollback
- Switching back to the old version quickly.
A test set only helps if it is used on every change. Regression testing makes this automatic. A release gate is a rule that stops a change from shipping if it makes quality worse. This lesson shows how to put evaluation into the build process, set thresholds, and roll out changes safely.
What can change
Many things can change an AI system's behavior: the prompt, the model version, the documents, the tools, the code and the settings. Any of these can lower quality in a way that nobody notices by eye. So treat all of them as code. Put them in version control. Test every change.
Regression testing
A regression is when something that worked before stops working. Your test set is a set of things that must keep working. Run it on every change. Compare the new scores with the last good version. Look at case-level differences, not only the average.
RELEASE GATE for {{feature}}
RUN: full test set + must-never-happen set + cost and speed checks
BLOCK THE RELEASE IF
- Any must-never-happen case fails
- Overall pass rate drops by more than {{agreed amount}} compared with the current version
- Any important group (slice) drops by more than {{agreed amount}}
- Average cost per task rises by more than {{agreed amount}}
- 95th-percentile response time rises above {{agreed limit}}
REVIEW BY A PERSON IF
- More than {{n}} individual cases changed from pass to fail, even if the average is fine
RECORD: version, date, scores, who approved, link to the reportSet thresholds with care
Test scores are noisy, especially with small sets. A drop of one case may be chance. Decide thresholds with the team, based on how much a drop would hurt. Be strict on must-never-happen cases, and allow a small margin elsewhere. Review thresholds when the set grows.
Put it in the pipeline
- Run a fast check set on every code or prompt change.
- Run the full set before a release, or each night.
- Block merges that fail the gate, and show the failing cases in the report.
- Store results with the version, so you can chart quality over time.
Roll out in steps
Even good tests miss things. Roll out gradually, so real traffic shows problems while few people are affected.
- Shadow: the new version runs on live traffic, but users still see the old one. Compare results.
- Canary: send a small share of traffic to the new version. Watch quality and cost.
- A/B test: split traffic between two versions to measure which does better on a business measure.
- Rollback: keep the old version ready, and switch back quickly if a problem appears.
Model and provider changes
Providers update and retire models. Behavior can shift even when you change nothing. Pin the model version where you can. Re-run the full test set when you move to a new version. Never switch the model on a Friday afternoon without a rollback plan.
- ✓Treat prompts, models, documents and settings as code. Test every change against the test set.
- ✓A release gate blocks a change on must-never-happen failures, drops in quality or slices, and rises in cost or delay.
- ✓Set thresholds with the team, strict on must-never-happen cases and allowing a small margin elsewhere, since scores are noisy.
- ✓Roll out with shadow runs, canaries and A/B tests, and keep a rollback ready. Pin and re-test model versions.
Write a release gate
- Pick an AI feature. List everything that can change its behavior.
- Write a release gate with at least five rules and the numbers you would choose.
- Describe how you would roll out a model upgrade: shadow, canary and rollback steps.
- Write what you would do when a change passes the average but fails one important group.
Q1Why look at case-level changes and not only the average?show answer
An average can stay steady while several cases flip from pass to fail. Case-level views show real regressions.
Q2What is a canary release?show answer
Sending a small share of live traffic to the new version first, so problems show up while few people are affected.
Q3Why pin the model version?show answer
Providers update models, and behavior can change even when your code does not. A pinned version keeps tests meaningful.