Skip to content

feat(bench-canonical): calibrate v2.0.0 from 3-run pass (#437) - #489

Merged
robotrocketscience merged 2 commits into
mainfrom
feat/issue-437-canonical-calibration
May 8, 2026
Merged

feat(bench-canonical): calibrate v2.0.0 from 3-run pass (#437)#489
robotrocketscience merged 2 commits into
mainfrom
feat/issue-437-canonical-calibration

Conversation

@robotrocketscience

@robotrocketscience robotrocketscience commented May 8, 2026

Copy link
Copy Markdown
Owner

Closes #437.

What

Calibrates the v2.0.0 canonical reproducibility artifact from a fresh
3-run pass against the full 11/11 invocation set (now that #473 fixed
StructMemEval's temporal_sort kwarg and #477/#479 closed the
gate-commit follow-ups).

Two atomic commits:

  1. fix(bench/run) — adds per_case to _DETAIL_FIELDS_TO_STRIP.
    StructMemEval emits a per_case list whose context strings bloat
    the canonical JSON to 6.4 MB on a clean 11/11 run. The detail isn't
    band-checked, so it's pure diff weight. Test extended to assert both
    per_question and per_case are stripped.

  2. feat(bench-canonical) — replaces the partial first-pass canonical
    (6/11 invocations on bce8311) with the calibrated 11/11 canonical
    on 9e3f8de. metric_overrides = {} because the default bands
    already cover observed variance.

Calibration evidence

Three back-to-back canonical runs on 9e3f8de (post-#473), each 11/11
ok. Total wall time ~62 min (run-1: 24 min sequential, runs 2+3:
~20 min wall in parallel with isolated TMPDIRs).

Adapter / sub_key run-1 run-2 run-3 range required pct default override?
All MAB metrics × 4 splits (f1, em, sub_em) (identical) (identical) 0.0000 0% F1 ±7%, EM ±10% no
StructMemEval accuracy × 4 tasks (identical) (identical) 0.0000 0% ±10% no
longmemeval avg_latency_ms 5.55 5.95 6.04 0.49 13% latency ±25% no
LoCoMo overall_f1 0.0212 (identical) (identical) 0.0000 0% F1 ±7% no
AMA-Bench counts (identical across runs) no

Self-check: tolerance.check_report(canonical, canonical) → 36/36 pass.
Cross-check: run-2 and run-3 against this canonical → 36/36 pass each.

Out of scope (followups)

  • LoCoMo, LongMemEval, AMA-Bench results land under the _ no-sub_key
    sentinel. tolerance._walk_leaves skips keys starting with _ to
    avoid _status / _elapsed_sec, but that also skips the entire
    single-invocation adapter branch. Their accuracy metrics aren't
    band-checked. The 36-leaf count above only covers the per-sub_key
    adapters (mab × 4, structmemeval × 4 — minus a few zero-only metrics
    the floor classifies as ±0.02 absolute). Filing a separate issue.

Test plan

  • uv run pytest tests/test_bench_dispatcher.py -q → 11 passed
  • tolerance self-check (canonical vs canonical) → 36/36 pass
  • tolerance cross-check (run-2/run-3 vs canonical) → 36/36 pass each
  • CI staging-gate green
  • Reviewer eyeballs the new headline numbers and _calibration_notes

Summary by Sourcery

Calibrate the v2.0.0 benchmark canonical results to a full 11/11 successful invocation run and tighten output stripping for non-essential detail fields.

New Features:

  • Update the v2.0.0 canonical benchmark results file to reflect a full 11/11 successful run on the latest calibration commit.

Bug Fixes:

  • Strip newly introduced per_case detail lists from merged benchmark outputs to prevent canonical result files from bloating with non-band-checked data.

Tests:

  • Adjust the benchmark badge sanity test to expect 11/11 successful checks and assert the success badge, and extend dispatcher tests to verify both per_question and per_case fields are removed from merged outputs.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed benchmark adapter errors; all 11 adapters now report successful results instead of partial failures.
  • Updates

    • Completed v2.0.0 benchmark suite calibration with canonical baseline results and performance metrics.
    • Refined benchmark output format to remove redundant per-case details.

Mirror of the per_question strip rule — structmemeval emits a
per_case list whose context strings bloat the canonical JSON to
6.4 MB on a clean 11/11 run. The detail isn't band-checked
(tolerance.check_report walks summary leaves only), so it's pure
diff weight.

Test extended to assert both per_question and per_case are
stripped from the merged output.
Replaces the partial first-pass canonical (6 of 11 invocations on
git_commit bce8311, captured 2026-05-07) with a fully calibrated
canonical from three back-to-back `aelf bench all --canonical` runs
on git_commit 9e3f8de2 (after #473 fix shipped).

Headline numbers (run-1, source of truth):
  mab/Conflict_Resolution    f1=0.0065  sub_em=0.7025   N=800
  mab/Test_Time_Learning     f1=0.0001  sub_em=0.0929   N=700
  mab/Long_Range_Understand. f1=0.1811  sub_em=0.0234   N=171
  mab/Accurate_Retrieval     f1=0.0106  sub_em=0.1530   N=2000
  locomo                     overall_f1=0.0212          N=1986
  longmemeval                avg_latency_ms=5.55        N=500
  structmemeval/location     accuracy=0.9048            N=42 cases
  structmemeval/accounting   accuracy=0.0000            N=15 cases
  structmemeval/recommend.   accuracy=0.1540            N=84 cases
  structmemeval/tree         accuracy=0.0000            N=22 cases
  amabench                   total_episodes=208 / qa=2496

Tolerance bands: spec called for observed range × 1.5 → metric
override when required pct exceeds the default band. Across 3
runs, MAB and StructMemEval metrics are bit-deterministic
(range = 0.0); LongMemEval avg_latency_ms varies 5.55–6.04 ms
(well inside the default ±25% latency band). Result:
metric_overrides = {} — defaults cover observed variance.

Self-check: tolerance.check_report(canonical, canonical) → 36/36
pass. Cross-check: run-2 and run-3 against the canonical → 36/36
pass each.

The earlier partial canonical's _calibration_notes referenced
"missing /tmp/ data dirs" as the LoCoMo blocker and "_status:
error" for StructMemEval × 4 (the #473 retrieve_v2 temporal_sort
bug). Both are resolved at github/main HEAD.

Closes the v2.0 reproducibility ship-gate. Per #437 acceptance:
on a fresh clone, `uv sync --extra benchmarks && aelf bench all
--canonical --out PATH` reproduces every published number within
the documented bands.
@sourcery-ai

sourcery-ai Bot commented May 8, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates the benchmarks pipeline by stripping an additional detail field from merged outputs and recalibrating the v2.0.0 canonical benchmark results from a full 11/11 invocation pass, including tests that ratchet on the new canonical status and detail-stripping behavior.

Sequence diagram for updated benchmark run and detail stripping

sequenceDiagram
    actor Dev
    participant BenchDispatcher
    participant BenchmarkRunner
    participant StructMemEval
    participant ResultsMerger
    participant DetailStripper
    participant CanonicalStore
    participant ToleranceChecker

    Dev->>BenchDispatcher: trigger_benchmarks()
    BenchDispatcher->>BenchmarkRunner: run_all_adapters()
    BenchmarkRunner->>StructMemEval: run_structmemeval()
    StructMemEval-->>BenchmarkRunner: raw_results(per_question, per_case, metrics)
    BenchmarkRunner-->>ResultsMerger: submit_results(raw_results)

    ResultsMerger->>DetailStripper: strip_details(raw_results, _DETAIL_FIELDS_TO_STRIP)
    DetailStripper-->>ResultsMerger: cleaned_results(no per_question, no per_case)
    ResultsMerger-->>CanonicalStore: write_v2_0_0_canonical(cleaned_results)

    Dev->>ToleranceChecker: check_against_canonical(run_results)
    ToleranceChecker->>CanonicalStore: load_v2_0_0_canonical()
    CanonicalStore-->>ToleranceChecker: canonical_results
    ToleranceChecker-->>Dev: report(36_of_36_checks_pass)
Loading

File-Level Changes

Change Details Files
Strip StructMemEval-style per-case detail from merged benchmark outputs to keep canonical JSON small and focused on band-checked metrics.
  • Extend the detail-stripping whitelist in the benchmark runner to remove per_case objects in addition to per_question from merged results.
  • Augment the dispatcher test payload to include a synthetic per_case list and assert it is removed from all relevant adapter outputs while preserving summary metrics.
benchmarks/run.py
tests/test_bench_dispatcher.py
Recalibrate and ratchet the v2.0.0 canonical benchmark artifact to a full 11/11 passing invocation set on commit 9e3f8de.
  • Replace the previous partial (6/11) canonical JSON file with a new 11/11 calibrated artifact generated from three consistent runs and no metric overrides.
  • Update the benchmarks badge test to expect 11/11 ok, add historical context in the docstring, and assert the badge shows a green reproducibility status with the new headline numbers.
benchmarks/results/v2.0.0.json
tests/test_benchmarks_badge.py

Assessment against linked issues

Issue Objective Addressed Explanation
#437 Provide a new CLI command aelf bench all that runs the full academic benchmark suite (MAB, LoCoMo, LongMemEval, StructMemEval, AMA-Bench) and writes a single JSON report. The PR only adjusts detail-stripping in the benchmark runner, updates tests, and replaces the canonical benchmarks/results/v2.0.0.json artifact. It does not introduce or modify a CLI entry point aelf bench all or any related command wiring.
#437 Maintain a canonical benchmark baseline in benchmarks/results/v2.0.0.json with documented tolerance bands per fixture such that uv sync && aelf bench all can reproduce the documented headline numbers within those bands.
#437 Set up reproducibility automation: (a) CI workflow that runs the harness nightly on main, commits benchmarks/results/v2.0.0-cron-<date>.json, and regression-checks against the canonical with explicit tolerance thresholds for fail vs warning, and (b) a README badge reporting reproducibility status (e.g., "reproducibility: ✅ as of $DATE"). The PR does not modify CI workflows, add any cron-based execution or commit logic, implement regression checks in CI, or update the README with a reproducibility badge. It only updates tests and the canonical JSON data plus stripping of per_case fields.

Possibly linked issues

  • #v2.1: PR performs the 3-run full 11/11 calibration (including StructMemEval) and updates v2.0.0.json as the issue requests.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@robotrocketscience robotrocketscience added the author-Setr PR coordination mutex label May 8, 2026
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR completes the v2.0.0 canonical benchmark calibration run from 2026-05-08, updating the baseline results file to reflect a full 11/11 adapter pass (upgrading from 6/11 partial). It extends output processing to strip per_case detail fields, updates dispatcher and badge tests to verify stripping and all-ok rendering, and fixes structmemeval from prior error state to successful completion.

Changes

v2.0.0 Canonical Calibration Completion

Layer / File(s) Summary
Canonical Calibration Baseline
benchmarks/results/v2.0.0.json
Metadata updated to 2026-05-08 with 3/3 full canonical runs and specific tolerance bands. Adapter results transitioned from partial/error to ok: amabench timing reduced (266.921→189.73s), locomo filled with F1 metrics (0.85 category / 0.83 overall), longmemeval latency/ingest times recalibrated, mab splits updated with revised F1/substring metrics, structmemeval fixed from error (missing $TMPDIR) to ok outputs for all four categories (accounting, location, recommendations, tree).
Output Stripping Configuration
benchmarks/run.py
The _DETAIL_FIELDS_TO_STRIP set is extended to include per_case so merged canonical reports omit per-row detail structures alongside existing per_question filtering.
Dispatcher Test Coverage
tests/test_bench_dispatcher.py
Test test_per_question_detail_stripped_from_merged_output extended to verify both per_question and per_case stripping: stub payload now includes per_case list, docstring documents the addition, and assertions check that per_case is absent from merged mab and amabench outputs.
Badge Integration Test
tests/test_benchmarks_badge.py
Canonical test renamed from test_canonical_v200_partial to test_canonical_v200_full_pass; assertions upgraded to expect 11/11 ok (from 6/11 ok) and verify output starts with green check-icon prefix "reproducibility: ✅".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • robotrocketscience/aelfrice#465: This PR completes the canonical v2.0.0.json baseline and test updates initially introduced in PR #465 (bench dispatcher, skeleton results file, and related test infrastructure).
  • robotrocketscience/aelfrice#481: Badge test assertions updated to expect all-ok/✅ rendering, directly related to the badge generator and icon logic introduced in PR #481.

Suggested labels

attn:review

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: calibrating v2.0.0 canonical results from a 3-run pass, which directly corresponds to the primary objective of completing the reproducibility harness ship-gate.
Description check ✅ Passed The description comprehensively covers the PR objectives, includes linked issue reference (#437), type of change (feat/fix), calibration evidence with detailed tolerance analysis, and test plan with explicit verification steps.
Linked Issues check ✅ Passed The PR directly addresses issue #437 by shipping the canonical v2.0.0 results file with tolerance bands documented in calibration notes, implementing the CLI harness (via adapters), and providing reproducibility status. All core acceptance criteria are met except CI nightly workflow and badge, which are infrastructure-dependent follow-ups.
Out of Scope Changes check ✅ Passed All changes directly support the PR objectives: v2.0.0.json calibration, per_case detail stripping (necessary to reduce canonical file bloat), test updates for merged output validation, and badge test alignment. One noted limitation (LoCoMo/LongMemEval/AMA-Bench tolerance checking) is explicitly scoped as a separate follow-up issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-437-canonical-calibration

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.

@robotrocketscience robotrocketscience added the attn:review Needs review (PR open, awaiting reviewer) label May 8, 2026

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_benchmarks_badge.py`:
- Around line 93-109: In the test_canonical_v200_full_pass docstring replace the
Unicode multiplication sign "×" (U+00D7) with a plain ASCII "x" to satisfy Ruff
RUF002; locate the triple-quoted string inside the test_canonical_v200_full_pass
function and edit the phrase "StructMemEval × 4" to "StructMemEval x 4" (no
other changes required).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7574a99e-4eff-4c10-ae90-eda7d040b9e8

📥 Commits

Reviewing files that changed from the base of the PR and between b11512e and 1d9b6e2.

📒 Files selected for processing (4)
  • benchmarks/results/v2.0.0.json
  • benchmarks/run.py
  • tests/test_bench_dispatcher.py
  • tests/test_benchmarks_badge.py

Comment on lines +93 to 109
def test_canonical_v200_full_pass(tmp_path):
"""Sanity: today's checked-in canonical reports 11/11 ok.

Was 6/11 during the partial first-pass calibration on 2026-05-07
(LoCoMo data missing + StructMemEval × 4 hitting the #473
temporal_sort kwarg bug). Calibrated to 11/11 on 2026-05-08 once
#473 shipped and /tmp/LoCoMo + /tmp/StructMemEval data dirs were
populated. Ratchets to detect regression — flip back to a partial
cut would surface here.
"""
canonical = Path(__file__).parent.parent / "benchmarks" / "results" / "v2.0.0.json"
if not canonical.exists():
pytest.skip("canonical baseline not present")
text = badge.compute_badge_text(canonical, today="2026-05-08")
assert "6/11 ok" in text
assert "11/11 ok" in text
assert text.startswith("reproducibility: ✅")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Replace ambiguous × (MULTIPLICATION SIGN) with x in the docstring.

Ruff RUF002 flags line 97: StructMemEval × 4 uses U+00D7 (×) which is visually ambiguous with the Latin letter x. A simple substitution silences the lint warning.

🔧 Proposed fix
-    (LoCoMo data missing + StructMemEval × 4 hitting the `#473`
+    (LoCoMo data missing + StructMemEval x 4 hitting the `#473`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def test_canonical_v200_full_pass(tmp_path):
"""Sanity: today's checked-in canonical reports 11/11 ok.
Was 6/11 during the partial first-pass calibration on 2026-05-07
(LoCoMo data missing + StructMemEval × 4 hitting the #473
temporal_sort kwarg bug). Calibrated to 11/11 on 2026-05-08 once
#473 shipped and /tmp/LoCoMo + /tmp/StructMemEval data dirs were
populated. Ratchets to detect regressionflip back to a partial
cut would surface here.
"""
canonical = Path(__file__).parent.parent / "benchmarks" / "results" / "v2.0.0.json"
if not canonical.exists():
pytest.skip("canonical baseline not present")
text = badge.compute_badge_text(canonical, today="2026-05-08")
assert "6/11 ok" in text
assert "11/11 ok" in text
assert text.startswith("reproducibility: ✅")
def test_canonical_v200_full_pass(tmp_path):
"""Sanity: today's checked-in canonical reports 11/11 ok.
Was 6/11 during the partial first-pass calibration on 2026-05-07
(LoCoMo data missing + StructMemEval x 4 hitting the `#473`
temporal_sort kwarg bug). Calibrated to 11/11 on 2026-05-08 once
`#473` shipped and /tmp/LoCoMo + /tmp/StructMemEval data dirs were
populated. Ratchets to detect regressionflip back to a partial
cut would surface here.
"""
canonical = Path(__file__).parent.parent / "benchmarks" / "results" / "v2.0.0.json"
if not canonical.exists():
pytest.skip("canonical baseline not present")
text = badge.compute_badge_text(canonical, today="2026-05-08")
assert "11/11 ok" in text
assert text.startswith("reproducibility: ✅")
🧰 Tools
🪛 Ruff (0.15.12)

[warning] 97-97: Docstring contains ambiguous × (MULTIPLICATION SIGN). Did you mean x (LATIN SMALL LETTER X)?

(RUF002)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_benchmarks_badge.py` around lines 93 - 109, In the
test_canonical_v200_full_pass docstring replace the Unicode multiplication sign
"×" (U+00D7) with a plain ASCII "x" to satisfy Ruff RUF002; locate the
triple-quoted string inside the test_canonical_v200_full_pass function and edit
the phrase "StructMemEval × 4" to "StructMemEval x 4" (no other changes
required).

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[claim:review:Gylf:2026-05-08T15:38:02Z]

@robotrocketscience
robotrocketscience merged commit 1d9b6e2 into main May 8, 2026
29 of 36 checks passed
@robotrocketscience
robotrocketscience deleted the feat/issue-437-canonical-calibration branch May 8, 2026 15:39
@robotrocketscience

Copy link
Copy Markdown
Owner Author

[release:review:Gylf:2026-05-08T15:39:08Z]

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

Labels

attn:review Needs review (PR open, awaiting reviewer) author-Setr PR coordination mutex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v2.0] Reproducibility harness — benchmarks/results/v2.0.0.json is canonical, uv sync && aelf bench all

1 participant