Open-source inference server and production cluster for all the models your agent needs.
Python bgecolbertdata-pipelinedeep-learningembeddingsinferenceinference-serverinformation-retrievalllmmlmlopsnatural-language-processingnlppythonrerankingretrievalretrieval-augmented-generationsemantic-searchspladevector-search
feat(examples): document-to-markdown-olmocr prints the score without the math files (#459)
svonava37e13808c412
diff --git a/examples/document-to-markdown-olmocr/README.md b/examples/document-to-markdown-olmocr/README.mdindex 8fce597fc..ce355f983 100644--- a/examples/document-to-markdown-olmocr/README.md+++ b/examples/document-to-markdown-olmocr/README.md@@ -48,6 +48,13 @@ leaderboard. Pooling every test into one rate gives a different, higher number| Azure Document Intelligence Layout, published | 48.7 | 0.0 | 99.1 | 21.7 | 85.5 | 67.4 | 28.3 | 0.0 | 87.6 || AWS Textract, published | 40.2 | 0.0 | 100.0 | 26.8 | 65.8 | 19.7 | 23.6 | 0.0 | 85.3 |+Without the two math files, where neither service emits LaTeX, the six other+files average 71.1 for SIE LightOnOCR-2-1B, 64.9 for Azure and 53.5 for+Textract; `score.py` prints both. Azure's Markdown wraps page headers and+footers in HTML comments, which the scorer reads as text, so its 21.7 on+headers and footers is likely an underestimate; with every one of those tests+passed its Overall would be 58.5.+The two rival rows are [Unsiloed's run](https://github.com/Unsiloed-AI/unsiloed-olmocr-benchmark/blob/main/reports/preliminary_2026-05-19.md)on olmocr 0.4.27 (19 May 2026), not ours: Azure `prebuilt-layout` with Markdownoutput, and Textract `AnalyzeDocument` with `TABLES`. Neither service emitsdiff --git a/examples/document-to-markdown-olmocr/score.py b/examples/document-to-markdown-olmocr/score.pyindex 76feef19c..8fd52efea 100755--- a/examples/document-to-markdown-olmocr/score.py+++ b/examples/document-to-markdown-olmocr/score.py@@ -79,6 +79,15 @@ def rates(rows: list[dict]) -> dict[str, tuple[int, int]]:return out+# Azure Document Intelligence and AWS Textract emit no LaTeX, so they score 0 on the two math files. The mean of the+# other six is reported beside Overall as the comparison without equations.+WITHOUT_MATH = ("baseline", "headers_footers", "long_tiny_text", "multi_column", "old_scans", "table_tests")+++def without_math(rates: dict[str, float]) -> float:+ return sum(rates[f] for f in WITHOUT_MATH) / len(WITHOUT_MATH)++def overall(by_file: dict[str, tuple[int, int]]) -> float:return sum(passed / total for passed, total in by_file.values()) / len(by_file)@@ -87,7 +96,7 @@ def recorded() -> int:manifest = verified()rivals = json.loads((EVIDENCE / "rivals.json").read_text(encoding="utf-8"))print(f"olmOCR-Bench, {manifest['pages']} pages, {manifest['scorer']}, run {', '.join(manifest['run_dates'])}\n")- header = f"{'':44}" + "".join(f"{f[:10]:>11}" for f in FILES) + f"{'Overall':>9}"+ header = f"{'':44}" + "".join(f"{f[:10]:>11}" for f in FILES) + f"{'Overall':>9}{'No math':>9}"print(header)problems = []results = {}@@ -106,10 +115,14 @@ def recorded() -> int:problems.append(f"{arm}: Overall {score:.4f} per test, {summary['overall']:.4f} from the scorer")results[arm] = scorecells = "".join(f"{100 * p / t:>11.1f}" for p, t in by_file.values())- print(f"{name[:43]:44}{cells}{100 * score:>9.1f}")+ no_math = without_math({f: p / t for f, (p, t) in by_file.items()})+ print(f"{name[:43]:44}{cells}{100 * score:>9.1f}{100 * no_math:>9.1f}")for row in rivals["systems"]:cells = "".join(f"{100 * row['score']['files'][f]:>11.1f}" for f in FILES)- print(f"{(row['name'] + ' (published)')[:43]:44}{cells}{100 * row['score']['overall']:>9.1f}")+ no_math = without_math(row["score"]["files"])+ print(+ f"{(row['name'] + ' (published)')[:43]:44}{cells}{100 * row['score']['overall']:>9.1f}{100 * no_math:>9.1f}"+ )results[row["id"]] = row["score"]["overall"]print("\n$ per 1,000 pages, cheapest public tier:")