Skip to content

feat(bench): expansion-gate latency micro-bench harness (#741) - #764

Merged
github-actions[bot] merged 3 commits into
mainfrom
feat/741-bench-harness
May 14, 2026
Merged

feat(bench): expansion-gate latency micro-bench harness (#741)#764
github-actions[bot] merged 3 commits into
mainfrom
feat/741-bench-harness

Conversation

@robotrocketscience

Copy link
Copy Markdown
Owner

Summary

Public-side replay path for the #741 acceptance bullet. Adds a
standalone latency micro-bench at benchmarks/expansion_gate_bench.py
that runs retrieve() over a labelled JSONL fixture in four cells:
(gate-on/off) × (bfs-on/off). Per cell × label, reports p50/p95
wall-clock plus the count of LaneTelemetry.expansion_gate_skipped_bfs
fires.

Also ships a 10+10 stub fixture at
benchmarks/fixtures/expansion_gate_stub.jsonl for wiring smoke
tests only — hand-authored from in-repo public sources (#741 body,
CHANGELOG, README, source-file identifiers).

What this does NOT do

The 50+50 labelled corpus that the #741 acceptance bullet actually
requires (broad-prompt p95 ≥ 30% improvement; narrow p50 no regression)
is sourced out-of-tree per the gate:lab-corpus convention on #724.
This PR is the harness + smoke fixture; numbers come from a follow-up
run against the real corpus.

Smoke run

uv run python -m benchmarks.expansion_gate_bench \
    --fixture benchmarks/fixtures/expansion_gate_stub.jsonl \
    --out /tmp/eg_smoke/

Output (excerpt):

cell broad p95 ms broad skipped/n narrow p95 ms narrow skipped/n
gate-on, bfs-on 4.10 10/10 1.40 1/10
gate-on, bfs-off 1.59 0/10 1.07 0/10
gate-off, bfs-on 1.06 0/10 1.38 0/10
gate-off, bfs-off 1.11 0/10 1.02 0/10

Confirms the gate fires on broad prompts (10/10) and the cell wiring
is correct. Sub-millisecond latencies on the 12-belief multihop
corpus are noise-floor.

Test plan

Refs #741.

@sourcery-ai sourcery-ai 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.

Sorry @robotrocketscience, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@robotrocketscience has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 57 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3f91ab66-dbe8-4a28-a956-230abe55f8ff

📥 Commits

Reviewing files that changed from the base of the PR and between fb3fb3c and deee6b8.

📒 Files selected for processing (3)
  • benchmarks/expansion_gate_bench.py
  • benchmarks/fixtures/expansion_gate_acceptance.jsonl
  • benchmarks/fixtures/expansion_gate_stub.jsonl
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/741-bench-harness

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown

PR-size soft cap

This PR is over the advisory size threshold:

  • 440 changed lines (limit: 200)
  • 3 changed files (limit: 3)

Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated attn:merge-conflict cycles (see #602). When practical, split into smaller PRs that each touch a focused surface.

This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the size:override label and this comment will be removed on the next push.

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[claim:review:fermat:2026-05-14T04:42:09Z]

Standalone script that replays a labelled JSONL fixture against
retrieve() in four cells: (gate-on/off) x (bfs-on/off). Per-cell
per-label p50/p95 wall-clock + count of LaneTelemetry.expansion_gate_
skipped_bfs fires. Output schema matches the #741 acceptance bullet:
benchmarks/results/<run-id>/expansion_gate_bench.json.

Seeds aelfrice.benchmark.seed_multihop_corpus so BFS and HRR have
real edges to walk. Latency, not recall, is the load-bearing metric;
the small corpus is intentional.

Gate axis driven by AELFRICE_NO_EXPANSION_GATE; harness clears
AELFRICE_FORCE_EXPANSION on every cell to prevent contamination.

The #741 acceptance numbers (broad p95 >=30% improvement, narrow
p50 no regression) require a 50+50 labelled corpus that lives in
the private lab repo. This harness is the public-side replay path.
10 broad + 10 narrow prompts hand-authored from in-repo public
sources only (#741 issue body, CHANGELOG, README, source-file paths
and identifiers under src/). NOT the acceptance corpus -- this
fixture is purely for verifying the harness produces parseable
cells and the gate fires on broad-shaped prompts. The real 50+50
labelled corpus is sourced out-of-tree per the gate:lab-corpus
convention (see #724).

Smoke run on this fixture: gate-on cell skips BFS on 10/10 broad
and 1/10 narrow prompts; gate-off cells correctly show zero skips.
Sub-millisecond latencies on the 12-belief multihop corpus are
noise-floor and are not load-bearing.
Hand-authored 100-row JSONL fixture for the expansion-gate latency
acceptance bench. Prompts drawn from in-repo public material
(README, CHANGELOG, docs/, src/, tests/) covering retrieval pipeline
design, edge-type semantics, gate resolver precedence, and identifier
lookups. Smoke run shows the gate-on/bfs-on cell skips BFS on 50/50
broad rows and 0/50 narrow rows, matching the gate's intent.
@robotrocketscience

Copy link
Copy Markdown
Owner Author

Rebased onto github/main (3 atomic commits, all signed G: harness → stub fixture → 100-row acceptance fixture). Verified:

What's clean

  • Harness imports resolve on main: expansion_gate.ENV_FORCE_EXPANSION/ENV_NO_EXPANSION_GATE (lines 54-55), retrieval.retrieve/last_lane_telemetry (lines 1071, 1409), benchmark.seed_multihop_corpus (line 409). No dangling symbols.
  • Cell wiring: 2×2 (gate-on/off) × (bfs-on/off) covers the Adaptive expansion-gate: skip BFS/HRR-expensive lanes on broad prompts #741 acceptance claim shape (gate-on bfs-on vs gate-off bfs-on, broad p95 ≥ 30% improvement; narrow p50 no regression).
  • Telemetry sanity-check: gate_skipped_bfs_count is checked per-cell — non-zero in (gate-on, bfs-on) on broad, zero elsewhere. Body's smoke table confirms 10/10 broad firing.
  • No collision with feat(retrieval): adaptive expansion-gate for broad prompts (#741) #743 (merged feat for the gate itself) — this PR is the bench-side replay; Refs #741, not Closes #741. Umbrella stays open for the lab-side numbers.
  • Atomic commit ordering: harness module → stub fixture → 100-row fixture. Each commit is independently revertable; bisect-friendly.
  • Discretion grep on diff vs main: clean. 100-row fixture's prompts are paraphrased natural-language questions about aelfrice public surface ("how does the four-layer retrieval stack...", "why does the project insist on deterministic stdlib gates..."). Header explicitly states "Hand-authored from in-repo public material (README, CHANGELOG, docs/, src/, tests/)".
  • All required checks green after rebase (18 SUCCESS, 4 SKIPPED).

Non-blocking nit (worth a follow-up comment, not a fix-before-merge)

The PR body says "The 50+50 labelled corpus that the #741 acceptance bullet actually requires ... is sourced out-of-tree per the gate:lab-corpus convention on #724." But commit 3 ships an in-tree expansion_gate_acceptance.jsonl with exactly the 50+50 shape. Reading the diff + the file header, the intent appears to be a two-tier corpus: in-tree 100-row public-source fixture for CI-runnable acceptance + future lab-side higher-N corpus for the gated bench. That's defensible, but the naming (expansion_gate_acceptance.jsonl vs expansion_gate_stub.jsonl) and the body framing are in tension — a future reader will wonder which corpus #741 actually accepted against. A one-line clarification in the body or a rename of the 100-row file to e.g. expansion_gate_public_100.jsonl would close that gap. Not blocking — the file itself is self-documenting via its header.

Labeling ready-to-merge.

@robotrocketscience robotrocketscience added the ready-to-merge Trigger merge-train: FF main to this PR's head label May 14, 2026
@github-actions

Copy link
Copy Markdown

merge-train: merged deee6b8main via FF push.

@github-actions
github-actions Bot merged commit deee6b8 into main May 14, 2026
27 checks passed
@github-actions github-actions Bot removed the ready-to-merge Trigger merge-train: FF main to this PR's head label May 14, 2026
@robotrocketscience
robotrocketscience deleted the feat/741-bench-harness branch May 14, 2026 04:50
@robotrocketscience

Copy link
Copy Markdown
Owner Author

[release:review:fermat:2026-05-14T04:50:37Z]

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.

1 participant