A Developer’s Guide to OmniParseBench: Leaderboard Benchmarks and OCR Testing
In this tutorial, we implement OmniParseBench, Datalab’s open benchmark for document parsers, which grades a parser’s output with 16,288 small pass-or-fail tests across 2,937 pages, from scanned forms and handwriting to arXiv math and dense tables.
Rather than trust the leaderboard, we rebuild it from the verdicts Datalab released for 27 parsers, after feeding the scorer a hand-made page to see which mistakes flip a verdict.
We then measure ranking certainty, slice it by document type, test whether the two models the card names as helping build tests behave differently on tests a model corrected, and run Tesseract and Indra OCR ourselves on a 50-page sample.
Along the way, we find that the top two parsers are statistically tied, the leader changes on most slices, and one launch figure doesn’t match the released files.
Copy CodeCopiedUse a different Browserimport os import re import sys import json import time import html import shutil import platform import traceback import subprocess import collections import urllib.
request from pathlib import Path RESULTS = {} # step -> one-line result, for the summary table CLAIMS = [] # (step, claim, held) CURRENT = ["1"] def banner(title): print("\n" + "=" 78) print(title) print("=" 78) def section(name): def wrap(fn): def run(a, kw): CURRENT[0] = name.split(".
")[0] banner(name) t0 = time.time() try: out = fn(a, kw) RESULTS[name] = out if isinstance(out, str) else "ok" return out except Exception as e: RESULTS[name] = f"SKIPPED / FAILED -> {type(e).name}: {e}" print(f"\n[!] {name} did not complete: {type(e).name}: {e}") traceback.
printexc(limit=3) return None finally: print(f"\n[{time.time() - t0:.1f} s]") return run return wrap def claim(text, held): CLAIMS.append((CURRENT[0], text, bool(held))) return held banner("1.Install omni-parse-bench 1.0.0rc1 and Tesseract, and pin the dataset revision") SYSTEM = platform.
system() OPBVERSION = "1.0.0rc1" # a pre-release: a bare pip install omni-parse-bench resolves to 0.2.0, whose API differs REPO = "datalab-to/omniparsebench" REV = "961c0f89a2da701f5ce53afbd5e80aa469b0369a" # the dataset with the published verdicts of 27 parsers INDRA = ["indra-ocr==0.3.
2", "numpy==2.5.4", "onnxruntime==1.31.0", "opencv-python-headless==5.0.0.93", "pypdfium2==5.14.0", "huggingfacehub==2.2.0"] # the pins of the package's own Indra server image WORK = Path(os.environ.get("OPBWORK") or ("/content/opb" if os.path.isdir("/content") else "opbwork")).resolve() WORK.
mkdir(parents=True, existok=True) subprocess.run([sys.executable, "-m", "pip", "install", "-q", f"omni-parse-bench[benchmark]=={OPBVERSION}", "uv"], check=True) if SYSTEM == "Linux" and shutil.
which("tesseract") is None: scripts = ("arab armn beng cans cher cyrl deva ethi frak geor grek gujr guru hang hang-vert hans hans-vert hant " "hant-vert hebr jpan jpan-vert knda khmr laoo latn mlym mymr orya sinh syrc taml telu thaa thai tibt viet").split() subprocess.
run(["apt-get", "-qq", "update"], check=True) subprocess.run(["apt-get", "-qq", "install", "-y", "tesseract-ocr", "tesseract-ocr-eng", "tesseract-ocr-osd"] + [f"tesseract-ocr-script-{s}" for s in scripts], check=True, stdout=subprocess.
DEVNULL) import numpy as np import pandas as pd import importlib.metadata as md from huggingfacehub import snapshotdownload from omniparsebench import benchmark, data, harness, markdown, vocab from omniparsebench.scorers import unittests print(f"omni-parse-bench {md.
version('omni-parse-bench')}, Python {platform.pythonversion()}, {SYSTEM} {platform.machine()}, " f"{os.cpucount()} CPU cores") if SYSTEM == "Linux": print("os:", open("/etc/os-release").read().split('PRETTYNAME="')[1].split('"')[0]) tess = subprocess.
run(["tesseract", "--version"], captureoutput=True, text=True) print("tesseract:", (tess.stdout or tess.stderr).splitlines()[0]) TESSMAJOR = int((tess.stdout or tess.stderr).split()[1].split(".")[0]) print("test families:", {f: [t for t, g in vocab.FAMILIES.items() if g == f] for f in dict.
fromkeys(vocab.FAMILIES.values())}) print(f"dataset {REPO} @ {REV[:7]}; work folder {WORK}") RESULTS["1.Install omni-parse-bench 1.0.0rc1 and Tesseract, and pin the dataset revision"] = ( f"omni-parse-bench {md.version('omni-parse-bench')}, tesseract {(tess.stdout or tess.stderr).
split()[1]}, dataset @ {REV[:7]}") We install omni-parse-bench pinned to 1.0.0rc1, because a bare pip install still resolves to 0.2.0, an older release with a different API.
The benchmark extra brings the parser adapters, the Hugging Face client, and pyarrow for the manifest, and on Colab we add Tesseract with its script models through apt.We also pin the dataset to one commit, since the repository changes as parsers are added.
Printing the families shows the structure the benchmark rests on: present, order, and repeat tests form the text family; tablecell forms the tables family; and layoutkind forms the layout family.Copy CodeCopiedUse a different Browser@section("2.
How the scorer decides: one hand-built page, five test types, one change at a time") def scoreranatomy(): T = lambda i, tt, out, tags, args, st=None: {"id": i, "testtype": tt, "outputtype": out, "derivation": "authored", "tags": tags, "args": args, "settings": st or {}} exact = lambda s: {"text": s, "maxdiffs": 0} gold = [ T("title", "present", "html", ["heading"], {"content": exact("Quarterly Report")}), T("total", "present", "html", ["eng"], {"content": exact("Total due")}), T("growth", "present", "html", ["eng"], {"content": {"number": "-4.
8%"}}), T("amount", "present", "html", ["eng"], {"content": {"number": "1,240.
00"}}), T("eqratio", "present", "html", ["math"], {"content": {"latex": r"\alpha{1} + \beta"}}), T("eqhalf", "present", "html", ["math"], {"content": {"latex": r"\frac{1}{2} \to x"}}), T("order", "order", "html", ["eng"], {"before": exact("Introduction: this report covers the second quarter.
"), "after": exact("Conclusion: the plan holds.
")}), T("repeat", "repeat", "html", ["eng"], {"content": exact("Revenue")}, {"expectedcount": 2}), T("celltop", "tablecell", "html", ["table"], {"cell": exact("1,240"), "topheading": exact("2024")}), T("cellleft", "tablecell", "html", ["table"], {"cell": exact("1,240"), "leftheading": exact("Income")}), T("cellprice", "tablecell", "html", ["table"], {"cell": exact("9.
50"), "topheading": exact("Price"), "left": exact("Widget")}), T("blocktitle", "layoutkind", "blocks", ["heading"], {"content": dict(exact("Quarterly Report"), place=[[0.10, 0.04, 0.90, 0.
09]])}, {"kind": "heading"}), T("blocktotal", "layoutkind", "blocks", ["eng"], {"content": dict(exact("Total due"), place=[[0.10, 0.12, 0.90, 0.16]])}, {"kind": "text"}), ] goldfile = WORK / "fixture" / "gold" / "demo-p1.json" # a gold file is named after its page goldfile.parent.
mkdir(parents=True, existok=True) goldfile.writetext(json.dumps({"tests": gold}, indent=1)) page = data.Page(pageid="demo-p1", document="demo", suite="demo", docpath=WORK / "fixture" / "demo-p1.pdf", gtpath=goldfile, outputs=("blocks", "html")) tests = unittests.
gold(page) tablea = ("20232024Income1,0001,240" "Costs600700") tableb = "ProductPriceWidget9.50" mdtableb = "| Product | Price |\n|---|---|\n| Widget | 9.50 |" parts = {"title": "Quarterly Report
", "total": "Total due: 1,240.00 USD.
", "growth": "Growth was -4.8% year on year.
", "ratio": r"Ratio: 1+ holds.
", "half": r"Half: 12x in the model.
", "intro": "Introduction: this report covers the second quarter.
", "revenue": "Revenue is shown in thousands. Revenue grew in the second quarter.
", "tablea": tablea, "conclusion": "Conclusion: the plan holds.
", "tableb": tableb} blocks = [{"label": "heading", "bbox": [0.10, 0.04, 0.90, 0.09], "text": "Quarterly Report
Related
相關文章
一加 Ace 7 Pro 火爆熱銷:首銷銷量同比上漲 225%
10月29日,「性能直升跨代之作」一加 Ace 7 系列發佈即開售,憑藉“性能直升一代、遊戲橫掃全場”的超旗艦體驗首銷告捷,一加 Ace 7 Pro 首銷銷量同比一加 Ace 6上漲225%,同時,一加 16 和一加 Ace 7 Pro 包攬2026 年安卓手機首銷銷量冠軍和亞軍。一加中國區總裁李傑表示:“一加 Ace 7 系列性能、屏幕、影像全面領先,好產品自己會說話。 一加 Ace 7 系列的實際體驗,相信大家上手之後會更加驚喜。
腦景中心啟幕、四款新品齊發!熵基科技加碼非侵入式腦機接口全棧技術與應用平臺
10月29日,以"BE THE CHANGE MAKER"為主題的熵基科技全球合作伙伴大會2026在東莞啟幕,會期將持續至10月31日。本屆大會聚焦原生AI發展趨勢,圍繞空間智能、腦機接口與人工智能融合創新,以及全球產業生態協同展開,集中呈現熵基科技在技術創新、產品研發與場景應用方面的最新進展。大會期間,ZKBrainScape腦景中心正式啟幕,MarsLume火星慧知AI全域解決方案全球發佈,熵基科技攜手生態夥伴聯合發佈四款腦機接口新品,並通過產業合作與技術交流,探索創新技術走向真實場景的更多路徑。
推理蒸餾開始改寫教師解題軌跡
Computer Science > Artificial Intelligence arXiv:2610.36445 (cs) [Submitted on 27 Oct 2026] Title:From Solver Trajectories to Teaching Trajectories: Cognition-Aligned Reasoning Distillation Authors:Yashuo Luo, Qianren Ma。
OpenAI官宣數學與物理學三大突破:AI攻克百年猜想,攜手全球學者開啟科學驗證新模式
為了將這些前沿的原始研究數據轉化為真正的科學理解,OpenAI創新性地嘗試了與外部學術社區進行深度合作的新模式,並針對不同領域的成果制定了多元化的發佈策略。在調和分析領域,模型成功給出了各維度下局部光滑(local smoothing)猜想的證明,從而在所有維度上直接解決了數學界的 Kakeya 猜想與 Stein 限制猜想。
Reddit 開源社區 r/opensource 封殺 AI 項目,開發者另起爐灶
管理團隊稱,當下 AI 的發展模式與開源理念相沖突,須以限制護住社區價值取向。一條新規,邊界模糊這條禁令迅速引爆爭論,因為它沒說清"AI 參與"的紅線在哪。如今開發普遍用 AI 輔助編程、代碼補全和自動測試,主體由人寫的項目也可能夾帶 AI 生成的片段;用戶甚至點出,Linux 內核也已出現 AI 生成代碼——若按字面執行,海量主流開源軟件都可能被擋在門外。
全球互聯網經歷“黑色十月”,這個中國AI在風暴來臨前留了後手
作者 | Saul 編輯 | 漠影 過去48小時,全球互聯網經歷“黑色十月”:支撐七成網站的PHP代碼,被AI挖出存在兩個CVSS9.2分的嚴重漏洞。更棘手的是,漏洞細節在補丁發佈前就遭洩露:據The Register報道,亞馬遜的威脅情報團隊在公開前四天就捕獲了利用嘗試; Cloudflare的監測數據顯示,攻擊嘗試在公開後兩小時內從數千次漲到數百萬次。