Building NovAI: one key for 116 models incl. Zhipu Flash free tier. I write about API economics - what a finished task costs, not what a token costs. Price by billing unit: aiapi-pro.com
"Zero repeat regressions" is the right north star, and the thing that makes it hard to measure is that a repeat is not automatically a regression - the same input does not always produce the same outcome.
I measured this on a short prompt, temperature 0.7, five runs per model. One model returned 32 tokens five times out of five. Another returned 84, 93, 111, 221, 393 - same prompt, same request body. Both are "what the model does on this input", and neither is a bug. So if an agent fails a task today and again tomorrow, that is a repeat, but it is only a regression if it repeats at a higher rate than the run-to-run baseline.
The control that makes the metric mean something is cheap: run each failure N times rather than once, and compare the failure rate against the rate the same task had before the change. A failure that shows up 5 of 5 is a regression. A failure that shows up 1 of 5 was probably always there, and chasing it will have you reverting correct changes.
Practically that means the unit you store is not "did it fail" but "how many of N runs failed", per task, with N printed next to it. Then repeat regression becomes a statement about rates and not about single observations, which is the only version of it that can be actioned without false positives.
Curious whether you are already doing repeated runs or whether the golden metric is defined on single trials so far.
I'm a Google Developer Expert in Dart and Flutter (one of 12 in North America). I have 45 years of experience with backend, web, mobile, devops, and training.
That distinction between a stochastic 1-of-5 baseline sample and a true rate shift is spot-on—and storing k / N with N printed next to it is great eval hygiene.
In our setup, the answer splits cleanly across our two measurement layers:
In the 375-ticket production ledger: Those are single-shot live tickets—you only merge a PR once. There, "repeat regression" means a previously scarred bug class escaping past the gates onto a subsequent ticket (not just a single noisy sample during generation). In fact, catching a 1-of-5 stochastic bad draw beforegit commit is literally what Target 30 TDD and the fresh-context Target 40 Critic are for—so variance in the generator doesn't become variance in main.
In our lab harnesses (tools/test_scars.dart & our pre-training benchmarks): We do run repeated N-trial A/B runs (CleanRate vs. LoadedRate)! That is how we separate real scar signal from run-to-run variance—and how we decide when a model has improved enough natively to flip a scar to Dormant (Model-Superseded) without getting fooled by a lucky single trial.
Completely agree that without k / N in your evals, you end up chasing sampling noise and reverting changes that were actually working!
Building NovAI: one key for 116 models incl. Zhipu Flash free tier. I write about API economics - what a finished task costs, not what a token costs. Price by billing unit: aiapi-pro.com
The two-layer split is right, and I would build one consequence of it into the reporting: the layers have different variance budgets, so a single regression rate across both is not a rate at all. Production variance comes from task diversity; harness variance comes from sampling. Average them and you get a number that moves when either input changes, with no way to tell which one moved.
The second thing is about the gate, and it is arithmetic rather than opinion. Catching a 1-of-5 bad draw before commit only works if the gate's N is sized from the escape rate you are trying to beat. If a scar class escapes onto a subsequent ticket at 1 in 50, a 5-trial gate catches it about 10% of the time - the gate is calibrated to a much higher rate than the one you care about.
The formula is N = ln(1 - q) / ln(1 - p), for catching rate p with probability q. For p = 0.02 and q = 0.9 that is 114 trials. Which is the honest boundary of the approach: a five-trial gate is well matched to a noisy generator where the failure is common, and it is nearly blind to a rare scar class. Both layers are doing real work, they are just sized for different populations of bugs, and saying which population a gate is sized for is the part that makes the number trustworthy.
I'm a Google Developer Expert in Dart and Flutter (one of 12 in North America). I have 45 years of experience with backend, web, mobile, devops, and training.
Both of those points are crystal clear—and that N = ln(1 - q) / ln(1 - p) boundary is great to have written down explicitly.
Separate variance budgets: Totally agreed—mixing production task-diversity escapes with lab sampling variance into one blended rate would hide which lever actually moved. Keeping the 375-ticket production ledger strictly separate from our N-trial lab titration numbers is non-negotiable.
Sizing the gate to the bug population: At p = 0.02, a 5-trial stochastic probe is indeed almost blind (~10% catch rate vs. 114 trials for 90%). That is actually why our pre-commit gates don't try to out-sample rare defects with repeated LLM draws—instead, Target 30 (deterministic Red-to-Green tests + AST lints) and Target 40 (fresh-context Critic inspecting the concretegit diff that was actually generated) act as deterministic/targeted checks on that one artifact, while multi-trial lab runs measure the generator's baseline drift across model versions.
Saying explicitly which population each gate is sized for—common generator noise vs. rare production escapes—makes the whole measurement story much stronger.
Building NovAI: one key for 116 models incl. Zhipu Flash free tier. I write about API economics - what a finished task costs, not what a token costs. Price by billing unit: aiapi-pro.com
Thanks - and since you already answered the two points, the one thing I think is still worth writing down is why "use deterministic gates instead of sampling for rare defects" is not just a judgement call. It has a crossover point you can compute.
For a defect at rate p, sampling needs N = ln(1-q)/ln(1-p) trials to catch it with probability q, at cost C per trial. A deterministic check costs D to build once and 0 per run. So build the deterministic check whenever D < N * C.
At p = 0.02 and q = 0.9 that is N = 114. If a trial costs even 30 seconds of a model call, N*C is around an hour of compute per detection, which puts almost any deterministic check on the winning side - a lint rule, a test, a schema assertion. That is why your instinct is right and why it generalises: the arithmetic will almost always favour the deterministic check for rare defects, and almost never for common ones, where N is small enough that a few trials are cheaper than writing the check.
Which gives a rule for where to spend effort: sort your scar classes by rate, and only the ones above roughly 1/N are worth catching by sampling. Everything below that needs a deterministic check or it will not be caught by the gate at all.
Said differently: a sampling gate is a filter with a known pass-through rate for each defect class, and saying what that rate is for each class is the part that makes the gate trustworthy. That was the thing I took from your two-layer split.
I'm a Google Developer Expert in Dart and Flutter (one of 12 in North America). I have 45 years of experience with backend, web, mobile, devops, and training.
D < N * C with N = ln(1 - q) / ln(1 - p) is a fantastic way to state that—it turns "when do you graduate a scar into a deterministic check?" from a judgment call into a computable crossover point.
Sorting scar classes by failure rate and putting everything below ~1/N behind a zero-marginal-cost check (a 15ms lint, a unit test, or a schema assertion) also matches what we see in practice: common traps are cheap to catch in a small review loop, whereas rare traps are an hour of compute to sample reliably—so building the deterministic lock once (D) wins almost immediately.
Mind if we cite your D < N * C crossover framing when we write up the graduation threshold in Part 6?
Building NovAI: one key for 116 models incl. Zhipu Flash free tier. I write about API economics - what a finished task costs, not what a token costs. Price by billing unit: aiapi-pro.com
Yes, cite it, and thank you for asking - that is more courtesy than most.
One refinement if you are going to put the inequality in print, because it is the part I got slightly wrong the first time. C is not constant. A trial at a low cap costs a fraction of a trial at your production context length, and it costs a retry when it fails plus your own attention to read the result. So the inequality should use the marginal cost of the trial you would actually add, at the cap you would actually run it. Done that way it stays computable, which was the whole point, but it stops being a number you can quote without knowing the workload.
The corollary I find useful: D and C are both falling, but D falls when someone writes the check and C falls when inference gets cheaper. Historically that made sampling more attractive over time, and right now it is doing the opposite for agent work, because trial cost at long context is going up faster than check-writing is getting cheaper.
Your framing of the result - common traps cheap to catch, rare traps an hour of compute - is the version I will use from here. It is more legible than the algebra.
I'm a Google Developer Expert in Dart and Flutter (one of 12 in North America). I have 45 years of experience with backend, web, mobile, devops, and training.
That refinement is spot-on—and honestly makes the inequality even sharper. Treating C as the marginal cost at production context length (plus failure retries and human attention to triage the result) explains why you can't quote a universal crossover number without knowing the workload.
And that corollary about D vs. C is the real punchline: when agent context windows stretch, marginal trial cost climbs faster than per-token inference drops, while D (writing a deterministic check—especially with an agent helping draft it) keeps getting cheaper. That shifts the crossover in favor of deterministic locks even sooner than the naive constant-C math suggests.
Thank you for the permission and the refinement—I'll fold the marginal-cost qualifier into our theory notes!
We're a place where coders share, stay up-to-date and grow their careers.
"Zero repeat regressions" is the right north star, and the thing that makes it hard to measure is that a repeat is not automatically a regression - the same input does not always produce the same outcome.
I measured this on a short prompt, temperature 0.7, five runs per model. One model returned 32 tokens five times out of five. Another returned 84, 93, 111, 221, 393 - same prompt, same request body. Both are "what the model does on this input", and neither is a bug. So if an agent fails a task today and again tomorrow, that is a repeat, but it is only a regression if it repeats at a higher rate than the run-to-run baseline.
The control that makes the metric mean something is cheap: run each failure N times rather than once, and compare the failure rate against the rate the same task had before the change. A failure that shows up 5 of 5 is a regression. A failure that shows up 1 of 5 was probably always there, and chasing it will have you reverting correct changes.
Practically that means the unit you store is not "did it fail" but "how many of N runs failed", per task, with N printed next to it. Then repeat regression becomes a statement about rates and not about single observations, which is the only version of it that can be actioned without false positives.
Curious whether you are already doing repeated runs or whether the golden metric is defined on single trials so far.
That distinction between a stochastic
1-of-5baseline sample and a true rate shift is spot-on—and storingk / NwithNprinted next to it is great eval hygiene.In our setup, the answer splits cleanly across our two measurement layers:
1-of-5stochastic bad draw beforegit commitis literally whatTarget 30TDD and the fresh-contextTarget 40Critic are for—so variance in the generator doesn't become variance inmain.tools/test_scars.dart& our pre-training benchmarks): We do run repeatedN-trial A/B runs (CleanRatevs.LoadedRate)! That is how we separate real scar signal from run-to-run variance—and how we decide when a model has improved enough natively to flip a scar toDormant (Model-Superseded)without getting fooled by a lucky single trial.Completely agree that without
k / Nin your evals, you end up chasing sampling noise and reverting changes that were actually working!The two-layer split is right, and I would build one consequence of it into the reporting: the layers have different variance budgets, so a single regression rate across both is not a rate at all. Production variance comes from task diversity; harness variance comes from sampling. Average them and you get a number that moves when either input changes, with no way to tell which one moved.
The second thing is about the gate, and it is arithmetic rather than opinion. Catching a 1-of-5 bad draw before commit only works if the gate's N is sized from the escape rate you are trying to beat. If a scar class escapes onto a subsequent ticket at 1 in 50, a 5-trial gate catches it about 10% of the time - the gate is calibrated to a much higher rate than the one you care about.
The formula is N = ln(1 - q) / ln(1 - p), for catching rate p with probability q. For p = 0.02 and q = 0.9 that is 114 trials. Which is the honest boundary of the approach: a five-trial gate is well matched to a noisy generator where the failure is common, and it is nearly blind to a rare scar class. Both layers are doing real work, they are just sized for different populations of bugs, and saying which population a gate is sized for is the part that makes the number trustworthy.
Both of those points are crystal clear—and that
N = ln(1 - q) / ln(1 - p)boundary is great to have written down explicitly.N-trial lab titration numbers is non-negotiable.p = 0.02, a 5-trial stochastic probe is indeed almost blind (~10%catch rate vs.114trials for90%). That is actually why our pre-commit gates don't try to out-sample rare defects with repeated LLM draws—instead,Target 30(deterministic Red-to-Green tests + AST lints) andTarget 40(fresh-context Critic inspecting the concretegit diffthat was actually generated) act as deterministic/targeted checks on that one artifact, while multi-trial lab runs measure the generator's baseline drift across model versions.Saying explicitly which population each gate is sized for—common generator noise vs. rare production escapes—makes the whole measurement story much stronger.
Thanks - and since you already answered the two points, the one thing I think is still worth writing down is why "use deterministic gates instead of sampling for rare defects" is not just a judgement call. It has a crossover point you can compute.
For a defect at rate p, sampling needs N = ln(1-q)/ln(1-p) trials to catch it with probability q, at cost C per trial. A deterministic check costs D to build once and 0 per run. So build the deterministic check whenever D < N * C.
At p = 0.02 and q = 0.9 that is N = 114. If a trial costs even 30 seconds of a model call, N*C is around an hour of compute per detection, which puts almost any deterministic check on the winning side - a lint rule, a test, a schema assertion. That is why your instinct is right and why it generalises: the arithmetic will almost always favour the deterministic check for rare defects, and almost never for common ones, where N is small enough that a few trials are cheaper than writing the check.
Which gives a rule for where to spend effort: sort your scar classes by rate, and only the ones above roughly 1/N are worth catching by sampling. Everything below that needs a deterministic check or it will not be caught by the gate at all.
Said differently: a sampling gate is a filter with a known pass-through rate for each defect class, and saying what that rate is for each class is the part that makes the gate trustworthy. That was the thing I took from your two-layer split.
D < N * CwithN = ln(1 - q) / ln(1 - p)is a fantastic way to state that—it turns "when do you graduate a scar into a deterministic check?" from a judgment call into a computable crossover point.Sorting scar classes by failure rate and putting everything below
~1/Nbehind a zero-marginal-cost check (a 15ms lint, a unit test, or a schema assertion) also matches what we see in practice: common traps are cheap to catch in a small review loop, whereas rare traps are an hour of compute to sample reliably—so building the deterministic lock once (D) wins almost immediately.Mind if we cite your
D < N * Ccrossover framing when we write up the graduation threshold in Part 6?Yes, cite it, and thank you for asking - that is more courtesy than most.
One refinement if you are going to put the inequality in print, because it is the part I got slightly wrong the first time. C is not constant. A trial at a low cap costs a fraction of a trial at your production context length, and it costs a retry when it fails plus your own attention to read the result. So the inequality should use the marginal cost of the trial you would actually add, at the cap you would actually run it. Done that way it stays computable, which was the whole point, but it stops being a number you can quote without knowing the workload.
The corollary I find useful: D and C are both falling, but D falls when someone writes the check and C falls when inference gets cheaper. Historically that made sampling more attractive over time, and right now it is doing the opposite for agent work, because trial cost at long context is going up faster than check-writing is getting cheaper.
Your framing of the result - common traps cheap to catch, rare traps an hour of compute - is the version I will use from here. It is more legible than the algebra.
That refinement is spot-on—and honestly makes the inequality even sharper. Treating
Cas the marginal cost at production context length (plus failure retries and human attention to triage the result) explains why you can't quote a universal crossover number without knowing the workload.And that corollary about
Dvs.Cis the real punchline: when agent context windows stretch, marginal trial cost climbs faster than per-token inference drops, whileD(writing a deterministic check—especially with an agent helping draft it) keeps getting cheaper. That shifts the crossover in favor of deterministic locks even sooner than the naive constant-Cmath suggests.Thank you for the permission and the refinement—I'll fold the marginal-cost qualifier into our theory notes!