Deployed Lab

Module 5 · Reliability, observability and cost · Chapter 18 · Free

Eval gates in CI/CD: shipping model and prompt changes safely

20 min1 clickable picture1 break-it lab1 predict, 2 quick quizzes, 5-question final quiz5-min video review
In 30 seconds

The picture: the gate is a weighbridge on the deploy road. The limit comes from the last good load, not hope.

What this chapter gives you
The cold open

Copperline is a made up B2B SaaS company. On a Friday, a prompt tweak for its support copilot merged with no eval run, because prompts were treated as text, not code. All figures are illustrative.

Chapter 12 promised this gate. Here we build it.

The plan for this chapter
  1. Model and prompt changes are code changes.
  2. The golden set: fixed, representative, versioned.
  3. What the gate runs, and thresholds from the baseline.
  4. Outcomes, overrides and flaky evals.
  5. Shadow and canary, then the break-it lab.

Next: why a prompt gets the same pipeline as a service.

Step 1: A prompt change is a code change

Three things change copilot behaviour: model weights, prompts and retrieval settings. All live in the repo, ship in one pipeline and carry a version.

Think of a prompt as a recipe card that changes the dish even when the chef stays the same. Where the picture breaks down:

Scoring basics live in the evals chapter. Here we wire the score into the pipeline.

Next: the fixed set.

Step 2: The golden set, fixed and owned like code

The golden set is a fixed set of representative requests, each with expected properties: facts the answer must contain, format it must follow, or a refusal it must give.

Next: what the gate runs.

Step 3: What the gate runs, and where thresholds come from

Every change runs four check groups on the set, in CI, before any traffic:

Thresholds come from the current version, measured on the same set, not from wishes:

  1. Run the current version three times. That spread is your baseline noise.
  2. Set the gate a small margin below the baseline mean, wider than that noise.
  3. Keep absolute floors for safety: refusal cases must pass at 100 percent, no margin.

Predict first:

A threshold the current version cannot reach blocks everything. A gate that always says no gets overridden or deleted, and then it protects nothing. Set the gate from the baseline: at or near 86 percent, minus a small margin for noise.

Next: what the gate does with a result.

Step 4: Block, warn, or ask a human

Overrides are narrow. Only Priya, as gate owner, can override a block, in the pull request, with a written reason and an expiry at the next release. Tom, the SRE, can override a warn. Nobody overrides a refusal floor. Every override is logged.

Next: why eval scores wobble.

Step 5: Flaky evals, judge variance and small numbers

Scores move when nothing real changed. The model varies run to run, and a judge model varies too: the same answer can pass on one run and fail on the next. Treat every score as a range.

Worked example, all figures illustrative. The first golden set had 20 cases. The current copilot passes 17 of 20: 85 percent. A prompt change passes 16: 80 percent.

1. One case is five points. 1 / 20 = 0.05. The scary five point drop is one case flipping.

2. One flip is normal. Tom reruns the unchanged version and gets 17, 16 and 18 passes. Variance alone swings two cases, or 10 points.

3. Grow the set. At 200 cases, one case is 1 / 200 = 0.5 points. A real five point drop now means about 10 cases changed, worth blocking on.

4. Set the margin from the swing. On 20 cases, a margin under 10 points blocks on noise. On 200, Priya sets 2 points: four times the one case step.

5. The lesson. One point on twenty cases is less than one case. Grow the set before you trust the gate.

Next: the last check before rollout.

Step 6: Shadow and canary evaluation before rollout

Passing earns a trial, not the whole fleet. Chapter 12, "Model deploys and rollouts: canary, shadow and rollback", set the stages:

  1. Shadow: the new version answers real requests unseen by users. Compare answers, latency and cost with the live version.
  2. Canary: an illustrative 5 percent of users gets the new version. Chapter 17 quality signals, errors and cost are watched against the rest.
  3. Promote or roll back: each stage has a pass bar set in advance. Miss it and the rollout rolls back.

Think of a dress rehearsal, then opening night in a small theatre. Where the picture breaks down:

Next: the picture, then the lab.

Step 7: The picture, a change crossing the gate

Press Next to walk a change to rollout.

A change crossing the eval gate A pull request runs the golden set, the gate decides, then shadow and canary stages precede full rollout. Pull requestmodel or prompt Golden setfixed and versioned Eval gatechecks and budgets Decisionblock warn review Shadow, canarysmall real slice Full rolloutall traffic
  1. A change opens as a pull request. Nothing ships around the pipeline.
  2. CI runs the versioned golden set, the same cases the current version faced.
  3. Correctness, format, refusals, latency and cost are scored against thresholds.
  4. Block, warn or review. Overrides are named and expiring.
  5. Passing earns shadow, then a canary slice.
  6. Each stage clears its bar, or the change rolls back.

Next: the break-it lab. This gate cannot fail.

Step 8: Break-it lab, the gate that cannot fail

Why this exercise: a gate that always passes is worse than no gate, because the team trusts it.

Lab: This is Copperline's eval gate, translated from the chapter's broken eval-gate.yaml into code. This lab runs in your browser and needs JavaScript enabled.

What to notice

Next: mix-ups.

Field note, November 2026

In production practice, eval gates often earn trust slowly: start with warnings, publish scores on every pull request, then make hard checks blocking once the set and thresholds prove stable on your own traffic. Judge scores tend to drift when the judge model changes, so pin the judge version and rerun the baseline when it changes.

Mix-ups to avoid

Chapter quiz

Five questions, 70% to pass.

Review this chapter in 5 minutes

Watch the whole chapter recapped: a fixed golden set, thresholds from the baseline, block warn and review outcomes, and shadow then canary rollout.

Decision rule: if the set is small, the bar is a wish, or the target moved with the change, green means nothing. Fix the gate first.

Review

Glossary

Eval gate
Pipeline check that runs an eval set and can block a change. Example: a low score stops the merge.
Golden set
Fixed, versioned set of representative requests with expected properties. Example: 200 cases, version 14.
Baseline
Current version's measured scores on the same set. Example: 86 percent across three runs.
Threshold margin
Small gap below the baseline allowing for noise. Example: gate at 84, baseline 86.
Judge model
Model used to score answers rules cannot check. Example: grading expected facts.
Judge variance
Score changes from the judge alone on the same answer. Example: pass one run, fail the next.
Refusal floor
Absolute pass rate on must refuse cases. Example: 100 percent, no override.
Shadow evaluation
New version answers real requests unseen by users. Example: one day before canary.
Canary evaluation
New version serves a small slice of users under watch. Example: an illustrative 5 percent slice.
Override
Named, reasoned, expiring exception to a block. Example: gate owner approves one release.

Next: "Incident response for AI systems: failure modes and runbooks".