Skip to content

Add local benchmark harness for v0.2.2 - #13

Merged
HuRuilizhen merged 6 commits into
mainfrom
feat/0.2.2-benchmark-harness
Apr 14, 2026
Merged

Add local benchmark harness for v0.2.2#13
HuRuilizhen merged 6 commits into
mainfrom
feat/0.2.2-benchmark-harness

Conversation

@HuRuilizhen

Copy link
Copy Markdown
Owner

Summary

This PR is the benchmark-harness slice for v0.2.2.

The main goal is to add a lightweight, repeatable local benchmark workflow for comparing extractor behavior across heuristic, spaCy, and provider-backed LLM runs without coupling the package to one repository-managed raw dataset pipeline.

Included

  • adds a local benchmark runner under benchmark/

    • supports json and jsonl benchmark inputs
    • requires text for each record
    • accepts optional caller-provided id
    • supports heuristic, spacy, and llm benchmark runs
    • captures compact machine-readable summaries for each run
  • adds a benchmark result summarizer

    • aggregates multiple benchmark result files
    • emits either JSON or Markdown summaries
    • produces side-by-side run labels suitable for extractor and provider comparisons
  • adds focused benchmark harness coverage

    • input loading for json and jsonl
    • optional id handling with required text
    • summary generation and Markdown rendering

Validation

Repository checks:

  • ruff check .
  • pyright
  • pytest -q

Targeted checks:

  • pytest -q tests/test_benchmark.py

Notes

  • benchmark inputs and outputs remain local development assets and should live under experiment/
  • this PR intentionally does not add a repository-managed raw-dataset preparation script; benchmark inputs are treated as caller-provided local files
  • the top-level benchmark/ directory is development-only and remains outside the package build targets

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad0e23992a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread benchmark/run_benchmark.py Outdated
mention_map.setdefault(mention.paragraph_id, []).append(mention.normalized)

preview: list[dict[str, Any]] = []
for paragraph, labels in zip(paragraphs[:limit], result.paragraph_labels[:limit], strict=True):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Build preview from cleaned result paragraphs

build_preview zips the original input paragraphs with result.paragraph_labels using strict=True, but the pipeline can drop records during technical cleanup (for example, URL-only text becomes empty). In that case these lists diverge and the benchmark run crashes with ValueError when generating the summary preview; even before crashing, IDs/text can be paired with the wrong labels if any earlier paragraph was dropped. Use the post-cleaning paragraph list from the result when constructing preview rows.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 42d18c8.

The benchmark preview now uses result.paragraphs, which reflects the cleaned paragraph list that actually entered the pipeline, instead of zipping against the raw input list. That avoids both the strict=True length mismatch and any source/text-to-label misalignment when cleanup drops records. I also added a regression test that covers an input where one paragraph is removed during cleanup.

@HuRuilizhen
HuRuilizhen merged commit 0422e87 into main Apr 14, 2026
1 check passed
@HuRuilizhen
HuRuilizhen deleted the feat/0.2.2-benchmark-harness branch April 14, 2026 02:50
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