Skip to content

Withhold benchmark comparisons when either arm has unfinished or broken runs - #2219

Open
Harsh-pa-thak wants to merge 4 commits into
ClickHouse:mainfrom
Harsh-pa-thak:main
Open

Harsh-pa-thak wants to merge 4 commits into
ClickHouse:mainfrom
Harsh-pa-thak:main

Conversation

@Harsh-pa-thak

@Harsh-pa-thak Harsh-pa-thak commented Dec 5, 2026 •

Copy link
Copy Markdown

Summary

Addresses #1770.

Previously, paired_gate relied on correctness labels without checking whether the underlying benchmark runs completed successfully. As a result, failed ingestion or missing outputs could be interpreted as treatment regressions.

This PR adds run-health validation before computing the paired comparison.

Changes

  • Added RunHealth and WithheldResult to track unfinished items, broken runs, failure reasons and exclusion counts.
  • Withhold the comparison when either arm contains unfinished items or exceeds the configured broken-run limit.
  • Exclude unusable items from both denominators and report the total number of distinct excluded items.
  • Prevent withheld results from publishing headline statistics or being used for null-band calibration.
  • Added --gate-failure-limit to configure the maximum broken-item share per arm.
  • Integrated health validation into LoCoMo, LongMemEval, MemBench, relied-on sweep and route replay.
  • Updated the benchmark methodology with failure classification, historical observations and known limitations.

Testing

Added synthetic regression tests covering:

  • All three acceptance fixtures described in Withhold a benchmark comparison when an arm has unfinished or broken-run items #1770.
  • Missing results, empty labels and failed ingestion.
  • Zero evaluated evidence.
  • Symmetric exclusions and threshold boundary conditions.
  • Invalid failure limits.
  • Expected items missing from both arms.
  • Preservation of existing majority-voting behaviour.
  • Withheld comparisons even when --gate is not enabled.
  • Preservation of capture failures during route replay and rejudging, even when the new judge verdict is correct.

The added fixtures use synthetic data and mocked operations without requiring paid provider calls.

Failure threshold

I went through the available stored benchmark results to investigate a suitable failure limit.

The glossary curation results show a request-level failure rate of 2.11% per arm, while the parser downstream results show failed ingestion affecting 8.02% of queries. These observations use different comparison units and represent different types of failures, so they aren't sufficient to establish a calibrated item-level threshold.

For now, I've used 5% per arm as a provisional default and documented the reasoning, supporting observations and a script to reproduce them in docs/benchmarks/methodology.md.

Unfinished items always cause the comparison to be withheld, regardless of the configured limit.

@zlareb1, I'd appreciate your input here. Would you prefer to keep 5% as a provisional default or require an explicitly specified failure limit until we have enough historical evidence? If there are other stored benchmark results available for calibration, I'd be happy to investigate those as well.

Known limitations

  • Legacy outputs without expected-item inventories cannot identify items missing from both arms.
  • Missing historical health receipts limit the detection of previously unrecorded failures.
  • A per-arm failure limit does not eliminate selection bias. Disjoint failures of 5% in each arm can exclude up to 10% of paired items.

Related: #1459, #1232


Note

Medium Risk
Changes benchmark verdict semantics and CLI output for all gate consumers; incorrect failure classification could wrongly withhold valid comparisons or still allow biased deltas.

Overview
Adds run-health gating ahead of the shared paired_gate bootstrap so benchmark A/B comparisons are not published when arms are incomplete or too failure-heavy.

paired_gate now builds an item inventory (optional expected keys plus label maps and harness failure receipts via broken_a / broken_b), computes per-arm RunHealth, and returns a withheld WithheldResult—with health counts and reasons but no delta_pp, accuracy, or null-band calibration—when any arm has unfinished items, there are no usable pairs, or an arm’s broken share exceeds --gate-failure-limit (default 5%). Healthy runs still compare majority labels but report excluded items dropped from both denominators in GateResult output and gate lines.

Each harness wires its own receipts (ingest_errors, item error: rationales, execution/zero-evidence rows, capture errors, request errors) and strips headline compare output when withheld (e.g. LoCoMo compare JSON collapses to paired_by + gate, route replay’s validated_summary returns gates only, relied-on sweep skips vs_baseline metrics). Methodology docs and unit/harness tests document the policy and boundary cases.

Reviewed by Cursor Bugbot for commit af73203. Bugbot is set up for automated code reviews on this repo. Configure here.

Validate run health before publishing a paired bench comparison: unfinished
items, all-errored repeats, and harness failure receipts count as broken per
arm, and a comparison is withheld when the broken share exceeds the per-arm
failure limit (default 0.05) instead of emitting accuracy/delta/headline.

Wires run-health receipts into locomo_qa, longmemeval, membench,
relied_on_sweep and route_replay, documents the limit and its evidence in
the benchmark methodology, and adds unit tests for the gate and each harness.

Signed-off-by: Harsh Pathak <harphy45@gmail.com>
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Building Building Preview Dec 5, 2026 6:40am UTC
loom-telemetry Ready Ready Preview Dec 5, 2026 6:40am UTC

Request Review

@zlareb1 zlareb1 self-assigned this Dec 5, 2026
@Harsh-pa-thak

Copy link
Copy Markdown
Author

Hey @zlareb1, thanks for assigning me this issue.

I've opened a PR with the implementation, regression tests and methodology updates.

I went through the existing benchmark results, but couldn't find enough evidence to establish a reliable default failure threshold. For now, I've set it to 5% and documented the reasoning in the PR.

Do you think 5% is reasonable for now, or should we require an explicit threshold? If there are other historical benchmark results I should look at, please let me know.

Thanks!

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rejudging a limited replay withholds valid results. LongMemEval still prints failed runs in the accuracy column after withholding its delta.

Comment thread bench/route_replay.py
judge_cost += await _judge(rs, by_qid, a)
results[arm] = rs
summary = summarize(results)
summary = validated_summary(results, frozen, a)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — Replay a frozen file with two questions using --limit 1, then rejudge the saved output. This passes both frozen IDs to the gate, so it marks the intentionally unselected question unfinished in both arms and withholds a complete comparison. Reuse the saved replay inventory when validating rejudge, and cover a limited replay with healthy rows.

Comment thread bench/longmemeval.py
row["gate"] = g.as_dict()
row["gate_lines"] = g.lines()
if g.verdict == "withheld":
row["delta"] = "withheld"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — With one correct baseline row and one treatment row marked item error:, this branch prints a withheld delta but the table still shows 100% versus 0% under judge. The latter is a failed run, so the table still presents the accuracy regression that the gate is meant to withhold. Publish accuracy from the validated pair when it exists and omit accuracy for a withheld pair.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit af73203. Configure here.

Comment thread bench/route_replay.py
print(" " + line)
gates = {k: v for k, v in summary.items() if k.endswith("_gate")}
if any(g["verdict"] == "withheld" or g["excluded"] for g in gates.values()):
return gates

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unjudged replays withhold the summary

High Severity

validated_summary always runs the accuracy gate on _labels_of. An empty verdict (judging disabled, or no reference) normalizes to ERROR, so the arm looks fully broken. The comparison is withheld and the returned summary keeps only gate records, which drops cost, latency, citation, and routing results and skips _print_summary.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit af73203. Configure here.

Comment thread bench/route_replay.py
print(" " + line)
gates = {k: v for k, v in summary.items() if k.endswith("_gate")}
if any(g["verdict"] == "withheld" or g["excluded"] for g in gates.values()):
return gates

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under-limit exclusions drop published reports

Medium Severity

Route replay and LoCoMo discard the outer report when excluded is non-zero, even if the verdict is not withheld. A broken share within --gate-failure-limit is supposed to stay publishable. Route replay then returns only gate dicts, so cost, latency, and routing stats disappear along with the unadjusted accuracy delta.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit af73203. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants