DEV Community

Discussion on: Zero Repeat Regressions: The Golden Metric & The Future of Agentic Trust

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

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:

  1. 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 before git 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.
  2. 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!

Collapse
 
aiapikey profile image
HAOHAOnovai •

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.

Thread Thread
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

Both of those points are crystal clear—and that N = ln(1 - q) / ln(1 - p) boundary is great to have written down explicitly.

  1. 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.
  2. 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 concrete git 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.

Collapse
 
aiapikey profile image
HAOHAOnovai •

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.

Thread Thread
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

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?

Thread Thread
 
aiapikey profile image
HAOHAOnovai •

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.

Thread Thread
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

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!