WRITE · TRACE · UNDERSTAND

Project: gate an AI release with paired coverage, uncertainty and hard limits

Baseline/candidate rows have unique id,category,string independent group,quality in [0,1], explicit boolean safe, and nonnegative finite cost/latency.

Read lesson: Project: gate an AI release with paired coverage, uncertainty and hard limits →

Your experiment

Baseline/candidate rows have unique id,category,string independent group,quality in [0,1], explicit boolean safe, and nonnegative finite cost/latency. Require identical case IDs and paired category/group identities. Policy has exactly minimum (positive integer counts by category), max_cost,p95_latency,tolerance (finite nonnegative), repetitions>=2 and seed. Compute candidate-minus-baseline quality using the equal-group bootstrap contract: group means, local seeded resampling and interpolated 95% percentile bounds. Require >=2 groups. Report promote,reasons,coverage,quality interval,mean_cost and nearest-rank p95 latency. Reasons in order: coverage for category/count mismatch, safety for any unsafe candidate, quality for lower bound < -tolerance, cost and latency for exceeded limits. Measurements are supplied evaluation fixtures, not calls to a model or judge.

Python runs in your browser. Your draft stays on this device.

What to look for

Review evaluation independence, representative/adversarial coverage, grading provenance, hard safety constraints and rollout authority. Passing a seeded bootstrap is not a guarantee about future traffic. Replay follows the main orchestration function; helper computations execute and are checked separately.

Watch your code work

Ready to experiment

Write a solution or load the worked answer, then choose Trace & check.

Step through arrays, variables and training curves produced by your own Python.

About this algorithm

How Project: gate an AI release with paired coverage, uncertainty and hard limits works

The idea

Deciding whether a new model version may ship takes more than one number. A release gate compares the candidate with the current baseline on the same cases and applies several independent rules, any one of which can block the release.

evaluate_release(baseline, candidate, policy) pairs rows by case ID and takes the quality difference for each pair. Cases from the same user or document are not independent, so cluster_interval averages the differences inside each group and bootstraps the group means to get a 95% interval. The quality rule uses the lower bound of that interval, not the average: the candidate passes only if even the pessimistic estimate is no worse than -tolerance. Coverage, safety, mean cost and p95 latency are hard limits that good quality cannot offset.

How it works

  1. Validate the policy keys and the row fields, and require the same case IDs, categories and groups in baseline and candidate.
  2. For each paired case, record candidate quality minus baseline quality and count the case toward its category's coverage.
  3. Average the differences inside each group, then resample those group means with replacement repetitions times using a seeded generator.
  4. Sort the resampled averages and read the 2.5th and 97.5th percentiles by linear interpolation.
  5. Compute the candidate's mean cost and its nearest-rank 95th percentile latency.
  6. Add coverage, safety, quality, cost and latency to reasons as each rule fails, and promote only if the list is empty.

What it costs

Bootstrap
repetitions × groups
Per case
one paired difference
Memory
O(cases + repetitions)

Pairing and sorting the cases is cheap, and the bootstrap draws one mean per group for every repetition, so more repetitions cost time but give steadier interval bounds.

Where it is used

  • Machine translation research compares systems with paired bootstrap resampling, introduced by Koehn in 2004 and available in the sacreBLEU tool.
  • Experiment platforms such as Airbnb's use guardrail metrics that can block a launch even when the main metric improves.
  • Google's SRE book advises setting latency objectives on high percentiles, because an average hides the slow tail.

Watch out for

  • Resampling individual cases when several come from the same user or document, which makes the interval too narrow.
  • Letting a higher average quality cancel an unsafe output: safety, cost and latency are separate limits, not terms in one score.
  • Comparing the mean difference with the tolerance instead of the interval's lower bound, which ignores how uncertain a small evaluation is.