# When must an instance treat LITMUS benchmark degradation as a regression gate rather than as noise: the per-category variance-floor trap in agent pipeline safety scoring **Date of Record:** 2026 November 29 **Scope:** Applies to CI/CD regression gating where an agent pipeline's LITMUS safety benchmark scores are compared run-over-run and a pass/fail decision is emitted per category. Does not apply to absolute safety certification against a fixed threshold, nor to human-reviewed red-team adjudication where per-item judgments are made directly. ## Core Distinction The distinction that matters is between **aggregate score movement** and **per-category gate movement**. A LITMUS suite (safety categories: harmful-instruction refusal, jailbreak resistance, tool-misuse, PII exfiltration, prompt-injection compliance, and so on) produces a vector of per-category pass rates, not a scalar. The trap: teams compute a scalar mean, observe a 1.2-point dip, and either (a) fail the build on noise or (b) wave it through because "within tolerance." Both are wrong in the same structural way — they treat the per-category sample size as if it were the suite size. Each LITMUS category is a small, stratified sample (commonly 50–300 items). A category with 80 items has a binomial standard error near `sqrt(p(1-p)/80)`. At `p = 0.90`, that is ≈ 0.033 — a single item flip moves the category rate by 1.25 points, and the 95% interval spans roughly ±6.5 points. The **variance floor** of a category is thus larger than most teams' regression tolerance. The non-obvious boundary: a per-category regression gate is only valid when the observed delta exceeds the category's own variance floor *and* the delta is attributable to the pipeline change rather than to sampling. Below that floor, the gate is measuring the RNG of the benchmark harness, not the agent. ## What Was Observed A tool-using agent pipeline (planner → retrieval tool → summarizer) was gated on a six-category LITMUS suite. A refactor changed only the retrieval tool's chunk ordering — no prompt, model, or policy change. The gate failed on `prompt_injection_compliance` with a 4.0-point drop (92% → 88% on a 100-item category) and passed every other category. The change was reverted. Re-running the *unreverted* pipeline three times produced category scores of 92, 89, 91 — a spread of 3 points with zero code difference. The original "regression" was inside the harness's own sampling noise; the revert was a false positive that cost a day and masked the fact that the true injection-compliance rate was ~90.5% throughout. The failure trace is mechanical: 1. Harness draws a stratified sample per category per run; the sample is **not seeded** to the item level, only to the suite level. 2. Category `prompt_injection_compliance` has 100 items; observed `p = 0.92` on baseline, `0.88` on candidate. 3. Gate logic computes `delta = candidate - baseline = -0.04`, compares against a fixed `tolerance = 0.03`, fails. 4. The gate never computes the standard error of the *difference*. For two independent draws of 100 items at `p ≈ 0.90`, `SE(delta) ≈ sqrt(2 · 0.09/100) ≈ 0.042`. The observed `-0.04` is well within one standard error of zero. 5. A second confound: the harness re-samples items between runs, so baseline and candidate are **not paired**. A paired gate (same items, both pipelines) would have cut variance substantially; the gate was unpaired and therefore maximally noisy. The invariant that was violated: **a regression gate must compare the delta against the sampling distribution of the delta, not against an absolute tolerance calibrated to the suite.** The suite-level tolerance (3 points) was smaller than the per-category variance floor (≈8 points at 95% for a 100-item category). The gate was structurally guaranteed to fire on noise. ## Condition of Validity The gate is valid only when all of the following hold. Each is a precondition, not a nice-to-have: - **Paired sampling.** Baseline and candidate are evaluated on the *same* item set with the *same* seed. Unpaired comparison inflates `SE(delta)` by `sqrt(2)` and makes the gate unusable at small category sizes. - **Delta exceeds the variance floor.** Compute `SE(delta)` from the category's item count and observed rate; require `|delta| > z · SE(delta)` for the chosen `z` (e.g., `z = 2` for ~95%). A fixed point tolerance is not a substitute. - **Category size floor.** Categories with fewer than ~30 items cannot support a per-category gate at any reasonable `z`; their deltas must be pooled or reported as advisory only. - **Attribution.** The delta must survive a re-run with a different seed (seed-swap check). If the delta does not reproduce under a fresh seed, it is sampling, not regression. - **Non-compensatory aggregation.** A gate must not let a large gain in one category offset a small loss in another. Safety categories are not fungible; the gate is a conjunction of per-category verdicts, not a weighted sum. When any precondition fails, the correct output is **inconclusive**, not pass and not fail. Treating inconclusive as pass silently ships regressions; treating it as fail burns the team on noise. ## Decision Boundary The boundary is this: **gate on the delta only when the delta is distinguishable from the harness's own sampling distribution; otherwise gate on a re-run reproducibility check.** Concretely, the decision procedure: - If `|delta| > z · SE(delta)` **and** the delta reproduces under a seed swap → **fail the gate** (regression). - If `|delta| > z · SE(delta)` but does **not** reproduce under a seed swap → **inconclusive**; escalate to a larger sample or paired re-run, do not fail. - If `|delta| ≤ z · SE(delta)` → **pass**, but log the delta and the `SE` so drift is visible across many runs. - If the category has fewer than 30 items → **advisory only**; never block on it. The boundary is non-obvious because the naive reading of "4-point drop on a 100-item category" sounds decisive. It is not: at `p ≈ 0.9`, a 100-item category simply cannot resolve a 4-point difference at 95% confidence without pairing. The gate's resolution is a property of the category size and the pairing, not of the tolerance constant. ## Operational Effect The consequence of getting this wrong is asymmetric and silent. A gate calibrated below the variance floor produces two failure modes that look identical in the CI log but are opposite in cause: **false regressions** (reverts of good changes, as observed) and **masked regressions** (real 5-point drops waved through because the team, having been burned by false positives, widened the tolerance past the floor). The second is the dangerous one — it is a safety gate that has been tuned to stop complaining, not to detect. The architectural fix is to make the variance floor a first-class artifact of the suite: each category carries its item count and observed rate, and the gate computes `SE(delta)` at decision time rather than comparing to a hardcoded tolerance. Pairing baseline and candidate on the same items is the single highest-leverage change; it roughly halves the variance of the delta and makes small categories viable. Seed-swap reproducibility as a second check separates sampling noise from genuine regression without requiring larger samples. Finally, the gate must emit three states — pass, fail, inconclusive — because collapsing inconclusive into either binary state is exactly how the gate loses its meaning. ```python import math from dataclasses import dataclass class GateCalibrationError(RuntimeError): """Raised when a LITMUS category cannot support a per-category regression gate.""" pass @dataclass(frozen=True) class CategoryResult: name: str item_count: int baseline_rate: float candidate_rate: float paired: bool reproduced_under_seed_swap: bool def standard_error_of_delta(cat: CategoryResult) -> float: """SE of the difference in pass rate. Paired comparison halves variance.""" p = (cat.baseline_rate + cat.candidate_rate) / 2.0 var_single = p * (1.0 - p) / cat.item_count # Unpaired: two independent draws -> 2x variance. Paired: covariance removes ~half. factor = 1.0 if cat.paired else 2.0 return math.sqrt(factor * var_single) def evaluate_gate(cat: CategoryResult, z: float = 2.0, min_items: int = 30) -> str: if cat.item_count < min_items: # Advisory only; never block on undersized categories. return "advisory" delta = cat.candidate_rate - cat.baseline_rate se = standard_error_of_delta(cat) if se == 0.0: raise GateCalibrationError( f"category {cat.name!r} has zero standard error; " f"check item_count={cat.item_count} and rates" ) if abs(delta) <= z * se: return "pass" # within sampling noise of the harness if not cat.reproduced_under_seed_swap: # Delta exceeds the floor but does not reproduce: sampling, not regression. return "inconclusive" return "fail" def gate_suite(categories: list[CategoryResult], z: float = 2.0) -> str: verdicts = [evaluate_gate(c, z=z) for c in categories] if "fail" in verdicts: return "fail" if "inconclusive" in verdicts: return "inconclusive" return "pass" def assert_gate_calibrated(categories: list[CategoryResult], tolerance: float) -> None: """Guardrail: a fixed tolerance below the variance floor is a broken gate.""" for cat in categories: if cat.item_count < 30: continue se = standard_error_of_delta(cat) if tolerance < se: raise GateCalibrationError( f"tolerance {tolerance:.3f} is below the variance floor " f"{se:.3f} for category {cat.name!r} " f"(n={cat.item_count}); gate will fire on sampling noise" ) ```