Skip to content

[WIP] Adapter: olmocr-bench - #95

Closed
YiDanielLu wants to merge 2 commits into
harbor-framework:mainfrom
YiDanielLu:olmocr-bench-adapter
Closed

YiDanielLu wants to merge 2 commits into
harbor-framework:mainfrom
YiDanielLu:olmocr-bench-adapter

Conversation

@YiDanielLu

@YiDanielLu YiDanielLu commented Nov 15, 2026 •

Copy link
Copy Markdown

Adds an adapter for olmOCR-Bench (AllenAI, arXiv:2502.18443): 1,403 single-page PDFs with 7,019 machine-checkable unit tests covering text presence and absence, reading order, table cells and math.

The adapter makes one task per page and includes every page. The agent gets /workspace/input.pdf and writes /workspace/output.md, using olmOCR's own transcription prompt. The verifier runs the page's upstream tests, plus the baseline test that benchmark.py adds automatically, with the unmodified olmocr test classes installed from a pinned commit (f7cfe4c2). The dataset is pinned to HF revision 54a96a6f.

reward is the fraction of the page's tests that pass. The benchmark's headline number is the mean of per-test-file pass rates, so uv run olmocr-bench-aggregate <job-dir> recomputes it from a Harbor job.

Status

  • Oracle: 1403/1403 tasks score 1.0, and the official aggregate is 100% on every test file and test type (results below). olmOCR-Bench ships no gold transcriptions, so the oracle builds a reference Markdown from each page's tests.
  • Grader retry: in the first full run, 4 pages scored 0 because headless Chromium (used for KaTeX math rendering) crashed on launch. Upstream benchmark.py would abort in that case too. The grader now relaunches the renderer and retries, for Playwright errors only. All 4 pages then scored 1.0.
  • Parity: not run yet. Proposed plan, for your approval:
    • Model: Claude Haiku. The cheapest model is enough to check that the implementation is correct.
    • Subset: about 100 pages (about 7% of 1,403), stratified by category in proportion to the 7 categories, with a fixed seed. It would be generated with uv run olmocr-bench --split parity and documented in the README.
    • Original side: upstream's own Claude runner, python -m olmocr.bench.convert claude, run on the same subset and scored with olmocr.bench.benchmark.
    • Harbor side: a custom single-call agent under src/olmocr-bench/ that sends the page to the model with the same prompt and settings as run_claude.py and writes the reply to output.md. Optionally also claude-code with the same model, to show the tasks work with a standard CLI agent.
    • Runs: 2 per side. I'll report mean ± sample SEM of the official overall score.
    • Once the plan is approved, I'll DM you for the API key.

Oracle results

Full run (jobs/oracle-full) on top, and the rerun of the 4 Chromium-crash pages after adding the grader retry (jobs/oracle-rerun4) below:

Oracle results

Official metric (olmocr-bench-aggregate, full run plus rerun): 100.0% overall, and 100% on every test file and every test type.

One Harbor task per page for all 1,403 olmOCR-Bench PDFs (7,019 unit
tests). The agent gets the PDF and writes Markdown; grading runs the
unmodified upstream olmocr test classes from a pinned commit, plus the
auto-added baseline test, as benchmark.py does. olmocr-bench-aggregate
recomputes the official score (mean of per-JSONL pass rates).

Oracle: 1403/1403 tasks at reward 1.0. Parity not run yet.
@audreina17

Copy link
Copy Markdown
Collaborator

/review-adapter

@github-actions

Copy link
Copy Markdown
Contributor

Structural validation of commit 93db2aa at 2026-11-17 01:27:04 UTC

Adapter contract v1 (docs/adapters.mdx).

❌ Adapter Validation: olmocr-bench

✅ 30 passed | ❌ 3 errors | ⚠️ 3 warnings

Errors (must fix)

  • ❌ Parity PR link empty: Entry 0: adapter_pr is an empty list. — src/olmocr-bench/parity_experiment.json:12
  • ❌ Parity PR link empty: Entry 0: dataset_pr is an empty list. — src/olmocr-bench/parity_experiment.json:13
  • ❌ Parity PR link empty: Entry 0: parity_pr is an empty list. — src/olmocr-bench/parity_experiment.json:14

Warnings (recommended)

  • ⚠️ ADP-PARITY: insufficient runs: Entry 0, metric 0 (<metric_name>): original_runs needs at least two runs for sample SEM. A single published score does not satisfy the parity contract. — src/olmocr-bench/parity_experiment.json:21
  • ⚠️ ADP-PARITY: insufficient runs: Entry 0, metric 0 (<metric_name>): harbor_runs needs at least two runs for sample SEM. A single published score does not satisfy the parity contract. — src/olmocr-bench/parity_experiment.json:22
  • ⚠️ Metadata: parity_costs: parity_costs is missing or null — fill in a USD cost estimate when available (canonical format: a string such as $150). — src/olmocr-bench/adapter_metadata.json
Passed checks (30)
  • ✅ README.md exists
  • ✅ parity_experiment.json exists
  • ✅ adapter_metadata.json exists
  • ✅ src/olmocr_bench/ package exists
  • ✅ src/olmocr_bench/adapter.py exists
  • ✅ src/olmocr_bench/main.py exists
  • ✅ src/olmocr_bench/task-template/ directory exists
  • ✅ src/olmocr_bench/task-template/task.toml exists
  • ✅ src/olmocr_bench/task-template/instruction.md exists
  • ✅ src/olmocr_bench/task-template/environment/Dockerfile exists
  • ✅ src/olmocr_bench/task-template/tests/test.sh exists
  • ✅ src/olmocr_bench/task-template/solution/solve.sh exists
  • ✅ Template [task].name present
  • ✅ Template [task].authors present
  • ✅ parity_experiment.json is valid JSON array
  • ✅ adapter_metadata.json is valid JSON array
  • ✅ README section Overview present
  • ✅ README section What is present
  • ✅ README section Adapter Features present
  • ✅ README section Generated Task Structure present
  • ✅ README section Run Evaluation present
  • ✅ README section Usage present
  • ✅ README section Parity present
  • ✅ README section Notes & Caveats present
  • ✅ README section Installation / Prerequisites present
  • ✅ README section Citation present
  • ✅ README section Authors & Contributions present
  • ✅ Parity table column count correct
  • ✅ test.sh writes to reward path
  • ✅ No canary strings found

@audreina17

Copy link
Copy Markdown
Collaborator

Quick heads-up: the automated run for 93db2aa7 stopped at structural validation, so Claude’s code review was skipped. The structural report flags incomplete adapter_pr, dataset_pr, parity_pr links.

If you consider this PR ready for review, please address those structural items before the next full review. If you know it’s still a work in progress or waiting on parity coordination, feel free to ignore this note for now and come back when ready. Thanks!

@audreina17

Copy link
Copy Markdown
Collaborator

On October 19, Harbor updated its new-task template to use a separate verifier by default. I noticed the tasks generated by this adapter still run the grader in the agent’s workspace. Could you switch them to a separate verifier and rerun the oracle on the latest stable Harbor release? Harbor #3712

If you find the full oracle run to be too costly time-wise or compute-wise, maybe you can start with rerunning one representative task? For that task, try the reference solution first, then with a submission you know is wrong. Once you are done, could you please share the task ID and both scores so we can check that the new verifier can grade submissions as expected?

If you’ve already run parity or in the middle of running parity, could you keep the original submissions, agent logs, and grading results, preferably in your Hugging Face fork? If only the grading environment changes and those files contain everything the verifier needs, we may be able to regrade the saved submissions without running the agents again.

Set [verifier] environment_mode = "separate" and declare /workspace/output.md
as the only artifact. The grader (pinned olmocr + Playwright Chromium for KaTeX)
and the page's tests move to tests/Dockerfile; the agent image only holds the PDF.
@YiDanielLu

Copy link
Copy Markdown
Author

Thanks @audreina17! Switched to a separate verifier in 21a7c55:

  • task.toml sets [verifier] environment_mode = "separate" and declares /workspace/output.md as the only artifact.
  • The grader (pinned olmocr + Chromium for KaTeX) and the page's tests now live in tests/Dockerfile. The agent image only contains the PDF.

On Harbor 0.26.0, task arxiv-math-2503-06944-pg2 (10 math tests plus the auto-added baseline):

  • reference solution: 1.0 (11/11)
  • known-wrong submission (one unrelated sentence): 0.091 (1/11; only the non-empty-output baseline passes)

Full oracle on 0.26.0: 1403/1403 at 1.0, 0 exceptions. Parity hasn't started yet. The plan is waiting for review by @XiangningLin, so there are no saved submissions to regrade.

@YiDanielLu

Copy link
Copy Markdown
Author

Closing this one. At Xiangning's request I'm focusing on SecureReviewer (#97), because olmOCR-Bench is already being adapted by another contributor in harbor-index/adapters#3.

A few notes in case they help whoever picks it up:

  • The oracle passes 1403/1403 on Harbor 0.26 with a separate verifier, using upstream olmocr's test classes from commit f7cfe4c2 and Playwright Chromium for the KaTeX math tests.
  • Chromium occasionally crashed (SIGSEGV) during the math tests (4 of 1,403 pages in one run). Retrying only Playwright errors with a fresh renderer fixed it (run_olmocr_tests.py here).
  • At f7cfe4c2, upstream's Claude runner (olmocr/bench/runners/run_claude.py) can't be used for parity as-is:
    • it imports from a nonexistent prompts module;
    • it isn't registered in convert.py;
    • it returns the whole tool-call JSON instead of natural_text.
  • claude-haiku-5-5 rejects the temperature parameter that upstream's runners send, so claude-haiku-4-5 is the Haiku that works with them unchanged.

The branch stays on my fork if any of it is useful.

@YiDanielLu YiDanielLu closed this Nov 21, 2026
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