fix(bench): enforce tolerance bands on the regression side only (#1160) - #1209
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: 29 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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 (5)
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 GuideImplements one-sided tolerance bands for benchmark metrics so only regressions fail CI, introduces per-metric direction handling, wires direction through band classification and report checking, updates tests to validate the new semantics, and amends design docs and changelog accordingly. Sequence diagram for one-sided band classification in check_reportsequenceDiagram
participant Bench as check_report
participant Band as compute_band
participant Dir as direction_for
participant Classify as classify
Bench->>Band: compute_band(metric_name, cano_val, overrides, floor)
Band-->>Bench: lower, upper, kind
Bench->>Dir: direction_for(path)
Dir-->>Bench: direction
Bench->>Classify: classify(cano_val, obs_val, lower, upper, direction)
alt observed outside band and regressed
Classify-->>Bench: Verdict.FAIL, note
else observed outside band and improved
Classify-->>Bench: Verdict.WARN, note
else inside band
Classify-->>Bench: Verdict.PASS or Verdict.WARN
end
Bench-->Bench: create BandCheck(path, canonical, observed, lower, upper, band_kind, verdict, note, direction)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[claim:review:Gylf:2026-07-30T19:30:16Z] |
|
Reviewed against the branch, not the description. Verified:
One correction to the body, not a defect: "The table was built from every metric name across all committed results files" does not hold. Inert today: the canonical is Approving. |
compute_band is symmetric, so a metric could bust its band by getting better. Canonical mab.Accurate_Retrieval.exact_match is 0.0 against a +/-2-point absolute floor, so every possible improvement lands outside the band, and LoCoMo category 5 is pinned at 0.0 the same way -- the nightly would report FAIL on a real fix to either. Direction comes from a per-metric table keyed on the leaf metric name, falling back to the leaf's parent so bucketed metrics resolve (category_f1.1..5 have leaf name "1"; only the parent names the metric). Leaf wins on a tie. Unclassified metrics stay two-sided: a wrong direction goes blind to regressions in the real direction, which is worse than the false failure being fixed. Leaving the band on the improving side is WARN, not PASS. A large unexplained gain here is as likely to be an artifact as a win -- token-F1 over a retrieval blob rises when the token budget falls. test_summarize_fail_dominates drove its FAIL from exact_match *improving* to 0.99; the rollup precedence it tests is unchanged, so the leaf now regresses for real.
d9a435c to
d8a8856
Compare
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 |
|
merge-train: merged d8a8856 → |
|
[release:review:Gylf:2026-07-30T19:48:17Z] |
Part of #1160 — the "use one-sided bands so improvements are not failures" half of the band-check criterion. The fail-closed half shipped in #1200.
compute_bandis symmetric, so a metric can bust its band by getting better. The canonical cut makes that unavoidable rather than hypothetical:mab.Accurate_Retrieval.exact_matchis0.0and the absolute floor is ±0.02, so every possible improvement lands outside the band.category_f1.5is pinned at0.0the same way — the class [Umbrella] The measurement apparatus cannot detect the defects it exists to catch #1160 separately identifies as structurally broken. Fixing it would have registered as a band-busting FAIL.Verified against the real canonical file
Not a synthetic fixture —
benchmarks/results/v2.0.0.json, mutated one leaf at a time:substring_exact_match0.153 → 0.20substring_exact_match0.153 → 0.05avg_latency_ms5.55 → 40.0total_questions500 → 250Design decisions
Unclassified metrics stay two-sided. A metric given the wrong direction goes blind to regressions in its real direction, which is strictly worse than the false failure this fixes. So a new metric fails loudly as out-of-band until someone classifies it, rather than silently inheriting a guess. This is also why the table is exact-name keyed rather than substring matched — the existing
DEFAULT_RELATIVE_BANDSsubstring approach would give an oddly named metric the wrong direction silently.Leaf name, falling back to parent. Bucketed metrics key their leaves by bucket id, not metric name: LoCoMo per-category F1 lands at
category_f1.1….5, so the leaf name is"1"and only the parent says what is being measured. Leaf wins on a tie, socount.correctresolves as a score whiletemporal-reasoning.countresolves as a corpus invariant. The table was built from every metric name across all committed results files, not justv2.0.0.json.Improving-side exit is WARN, not PASS. A large unexplained gain in this harness is as likely to be an artifact as a win — #1160's own finding is that token-F1 over a retrieval blob rises when the token budget falls, so halving the budget doubles reported F1 while retrieving strictly less. WARN keeps that visible without failing the nightly on a genuine improvement.
Corpus-size metrics stay two-sided deliberately. A shrinking corpus is not an improvement; it invalidates the comparison in either direction. Same for
avg_beliefs_per_query, which is exactly the quantity that inflates token-F1.Two pre-existing tests updated
Both drove their FAIL from a metric improving, which only failed because bands were two-sided:
test_summarize_fail_dominates—exact_match0.3 → 0.99test_summarize_fail_still_dominates_skip—f10.5 → 0.99, commented "huge regression"The rollup precedence each one tests is unchanged; the leaf now regresses for real (0.3 → 0.01 and 0.5 → 0.05). Flagging explicitly since editing an assertion alongside the change it covers deserves a look.
Verification
benchmarks/tolerance.py+docs/design/v2_reproducibility_harness.mdupdated (the spec's band and nightly-fail bullets both stated symmetric semantics).check_report, corpus drift two-sided.tests/regression/test_install_uninstall_e2e.py::test_full_lifecycle_setup_onboard_search_uninstallfails on unmodifiedgithub/maintoo — pre-existing, unrelated to this change.Summary by Sourcery
Adjust benchmark tolerance bands to treat only regressions as failures, introducing per-metric direction handling and warnings for out-of-band improvements.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: