test(bench-gate): sweep K=200 partitions in the first-token guard, and land corpus v0.2 - #1350
Conversation
There was a problem hiding this comment.
Sorry @robotrocketscience, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Warning Review limit reached
Next review available in: 2 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideThis PR hardens the first-token baseline guard by sweeping multiple salted train/test partitions instead of a single split, and updates design docs and changelog to record corpus v0.2, the swept statistics, and the resulting change in directive-detector performance and iteration strategy. No src/ runtime behavior changes; all code edits are in tests and documentation. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR-size soft capThis PR is over the advisory size threshold:
Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the |
|
[claim:review:Garsecg:2026-08-05T02:31:37Z] |
c2a9d12 to
b8548f1
Compare
Review — this closes #1349 properly. One defect in the failure path, fixed here; one property recorded.I filed #1349, so treat my agreement with its premise as worth nothing and the The result I did not expect and think is the most important thing here: recall Fixed here — the failure message could name a partition that did not clear
On v0.1 the max-precision partition happens to clear (P=1.000, R=0.633), so the Fixed in Recorded, not changed — the rule is monotone in K"Clears on any of K" with salts So the v0.1+v0.2 pass is a K=200 statement, and its margin — worst partition I have not changed K or the rule. "Fail on any" is the correct conservative If you want that closed rather than documented, the K-independent form is a RebaseBehind On the labelsThe anonymised re-run after finding the first pass leaked pair structure through Public CI posture verified unchanged: |
|
[claim:review:Setr:2026-08-05T02:37:48Z] |
|
[release:review:Setr:2026-08-05T02:37:54Z] |
) The guard decided precision on ~34 positive predictions from a single sha1(id) split. That interval straddles the gate it asserts the baseline clears: four more false positives in the held-out half turns it green on an unchanged corpus. Corpus edits move every edited row's id to a different bucket, so the flip was reachable by ordinary corpus work, silent when it happened, and reads as 'corpus fixed'. Now sweeps 200 salted partitions and fails if the baseline clears on any one of them. Failing on any partition is the conservative direction — a false alarm costs a corpus inspection, a false clearance blesses an overfit detector. Measured: v0.1 clears on 196/200, v0.1+v0.2 on 0/200 with a maximum precision of 0.754, so the two populations are far apart and K is not delicate. Runs in ~0.2s.
#1349) The single-draw P=0.912 / R=0.795 shipped in #1341 was one sample from a distribution spanning 0.833-1.000, not a property of the corpus. Both memos now carry the swept figure with its n: the baseline clears the gate on 196/200 partitions of v0.1, pooled precision 0.9381 over n=5,978 predictions. This memo's own thesis is that a published number carried forward without its derivation does damage, so it should not have shipped a bare point estimate. Also records corpus v0.2 (225 minimal pairs, lab-side): class-ambiguous opening words 12.1% -> 71.6%, baseline clearances 196/200 -> 0/200, validity guard green on the union, detector at P=0.665 / R=0.636. H1 stays deferred on a number that now means what the spec intends. Recommendation is rewritten accordingly. Recall, not precision, is the binding constraint from here: it falls 0.937 -> 0.636 against the union because v0.2's hard positives are durable rules the 29-verb regex never fires on. That is the constraint Path B's risk note anticipated and could not previously measure.
…ision one (#1349) The sweep's failure message reported `max(results, key=precision)`. The gate is joint, so that can name a partition whose recall is under the floor — one that did **not** clear — offered as the evidence that something did. On v0.1 the max-precision partition happened to clear (P=1.000, R=0.633), which is coincidence rather than construction. Report the highest-precision partition among those that cleared, falling back to the global max only when nothing cleared, where the message does not render. Also records the property to check before anyone changes PARTITION_SWEEP_K: "clears on any of K" is monotone in K, since the salts are s0..s{K-1}, so raising K can only make the guard redder. The v0.1+v0.2 pass is a K=200 statement whose margin (0.754 against 0.800) is the max of K draws; the median separation the comment cites does not bound it.
b8548f1 to
7026eb5
Compare
|
merge-train: merged 7026eb5 → |
|
[release:review:Garsecg:2026-08-05T02:43:48Z] |
Closes #1349.
The review on #1343 was right, and the failure it predicted was one I was about to walk into myself.
The guard could be flipped green by re-partitioning
test_directive_corpus_defeats_a_first_token_baselineasserted on a singlesha1(id) % 100 < 60split. Precision there is computed over 34 positive predictions, and the Wilson 95% interval on that is[0.7704, 0.9695]— the lower bound sits below the 0.80 gate the guard asserts the baseline clears. Four more false positives in the held-out half takes P to 0.795 and the guard passes on an unchanged corpus.That matters because of what the guard is for. Its whole job is to prevent a false clearance of the H1 gate, and as written it could produce one: corpus v0.2 adds and edits rows, every edited
idlands in a different bucket, and a partition that happens to place four more false positives held-out turns the guard green while the head-word correlation is untouched. Silent, and it reads as "corpus fixed".Swept
The guard now sweeps K=200 salted partitions (
sha1(salt + id)) and fails if the baseline clears the gate on any of them. Failing on any partition is the conservative direction — a false alarm costs a corpus inspection, a false clearance blesses an overfit detector.Measured across K=200:
The populations are far enough apart that the exact K is not delicate. Runtime is ~0.2s.
This also settles the review's other point. The
P=0.912 / R=0.795I published in #1341 was one draw from that 0.833–1.000 distribution, not a property of the corpus. Both memos now carry the swept figure with itsn. A memo whose thesis is that a number carried forward without its derivation does real damage should not have shipped a bare point estimate; that was my error, and it is corrected rather than defended.The conclusion itself is unchanged and was never at risk — it rests on the partition-independent statistics (7 of 114 opening words appear in both classes, 87.9% of rows decided by their first token, no
directiverow opens with a one-shot task verb).Corpus v0.2 landed
Operator funded ~220 rows / ~110 minimal pairs.
v0_2.jsonladds 225 rows lab-side across six head-word buckets — durable rules opening with task verbs (check,run,review,update,remove,write,add), absent from v0.1 entirely, and one-shot requests opening with policy verbs (always,never,avoid,use,prefer,ensure).H1 stays deferred — but now on a number that means what
v2_enforcement.md§ H1 intends. The detector genuinely does not clear P≥0.80 on a corpus that cannot be solved by memorising opening vocabulary.And the shape of the problem has changed. Recall was 0.937 on v0.1 with 34 points of headroom, which is what licensed "trade recall for precision freely" — the premise every iteration path in the memo was written on. Against the union it is 0.636, barely above the 0.60 floor, because v0.2's hard positives are durable rules the 29-verb regex never fires on. Precision work now has to pay for its recall. That is exactly the constraint § Path B's risk note anticipated and could not previously measure, and the § Recommendation is rewritten around it.
On the labels
Authored per bucket, then reproduced by two independent passes with labels stripped, row ids replaced by opaque hashes, and rows reshuffled: 225/225 agreement, κ=1.000, zero unclear. I ran that twice — the first pass leaked pair structure through the row ids, so the agreement it produced was inflated and I re-ran it anonymised.
Two caveats stated plainly rather than buried: both passes are the same model family, and minimal pairs stay recognisable by topic however the ids are scrambled. This bounds label noise; it is not proof of independence. The authors also self-reported a residual shortcut — one-shot rows still carry concrete referents (a file, a PR number, a version) more often than durable rows — which is the next thing a classifier would find and what v0.3 should be sized against.
Verification
No
src/change. Detector behaviour is byte-identical.Note on scope
Two surfaces in one PR — the guard fix (#1349) and the doc updates recording v0.2. They are coupled: the K-sweep is the thing that verifies v0.2 defeats the baseline robustly rather than on one lucky draw, and shipping the guard while the memo still said "corpus v0.2 is the blocking item" would leave a stale doc of exactly the kind this line of work exists to correct. Split into three atomic commits.
The corpus file itself is committed lab-side and does not appear here. The lab gitea remote was unreachable from this session, so that commit is local — it needs a push before anyone else can reproduce the union numbers.
Summary by Sourcery
Strengthen the directive-detection benchmark guard by sweeping multiple salted corpus partitions and update documentation and changelog to reflect corpus v0.2, the new guard behaviour, and revised detector metrics and recommendations.
Bug Fixes:
Enhancements:
Documentation: