Skip to main content

ocr-bench

The best OCR model can depend on your documents. Manuscript cards, printed books and historical texts can favour different models, so ocr-bench measures each collection separately.

ocr-bench allows you to create per-collection leaderboards using a VLM-as-judge approach, so you can find what works best for your documents rather than relying on generic benchmarks. You can validate the VLM's judgement with human votes, and share results via the Hugging Face Hub.

The underlying OCR model inference uv scripts are available at uv-scripts/ocr. The majority of these use vLLM for efficient GPU inference, and are designed to run on a single consumer GPU (e.g. 24GB 3090/4090). The ocr-bench package orchestrates running these models at scale on the Hub, and judging outputs with a VLM. If you just want to run some OCR models on your data without the judging/leaderboard aspect, you can run the scripts directly.

Why?

Generic OCR benchmarks tell you which model wins on average. But if you're digitising 18th-century encyclopaedias, that average doesn't help — the best model for your documents might be the worst on someone else's. Inspired by Datalab's Benchmarks + Evals approach — pairwise VLM-as-judge with Bradley-Terry scoring on your own documents — ocr-bench brings this idea to the Hugging Face Hub as an open-source, self-serve tool.

ocr-bench lets you run the same set of OCR models on a sample of your collection, then uses a vision-language model to judge which produces the best transcription for each document. The result is a leaderboard specific to your data.

The two published example boards, as ELO with 95% confidence interval. Models whose intervals overlap are not separated by the run:

Model Britannica 1771 (50 pages) BPL card catalog (41 judged pages of 50)
GLM-OCR (0.9B) 1716 (1673–1769), top group 1535 (1471–1591), all four overlap
LightOnOCR-2 (1B) 1697 (1655–1749), top group 1559 (1497–1630), all four overlap
NuExtract3 (4B) 1649 (1604–1708), top group —
FireRed-OCR (2.1B) 1506 (1469–1548), below top group —
DeepSeek-OCR (4B) 1421 (1374–1465), below top group 1452 (1388–1514), all four overlap
dots.ocr (1.7B) failed run* 1453 (1385–1515), all four overlap

On Britannica, three models share the top group. On BPL, all four intervals overlap, so that run does not separate any model. Neither example establishes a single winner. Judging more pages gathers more evidence, and human votes in the viewer cross-check the judge on the overlapping pairs; neither guarantees separation.

* Every dots.ocr output in the Britannica run was an [OCR ERROR] placeholder. Current versions exclude such outputs and mark the run as failed.

Both boards predate page-level bootstrap intervals, which account for several comparisons coming from the same page. Updated intervals have not been computed yet; a re-run with the current version is pending.

Try the live viewer — browse the Britannica 1771 leaderboard, compare OCR outputs side-by-side, and vote on quality yourself.

Hub-native by design

The entire evaluation loop lives on the Hugging Face Hub:

  1. Your dataset on the Hub (images + optional ground truth)
  2. OCR models run via HF Jobs → outputs written as PRs on a Hub dataset
  3. VLM judge via HF Inference Providers — only needs an HF token
  4. Results published to a Hub dataset (leaderboard + pairwise comparisons)
  5. Viewer as a HF Space for browsing and human validation

No local GPU required. Everything is shareable via Hub URLs.

OCR outputs and results contain text from your pages, so they follow the source's visibility. When the source dataset is private or gated, run, judge and bench create the output and results repos as private, and stop before writing anything if one already exists as a public repo. Pass --private to require private repos for a public source too, or --public to allow public repos for a private source. An existing repo's visibility is never changed. A viewer Space for private results is created private, and needs an HF_TOKEN secret with read access to the results.

Quickstart

uv pip install ocr-bench[viewer]

# 1. Run OCR models on your dataset
ocr-bench run <input-dataset> <output-repo> --max-samples 50

# 2. Judge outputs pairwise with a VLM
ocr-bench judge <output-repo>

# 3. Browse results + validate
ocr-bench view <output-repo>-results

One command

Or chain all three stages in a single call — the fastest way to try ocr-bench on a new collection:

ocr-bench bench <input-dataset> <output-repo> --max-samples 50

bench runs the models (waiting for the jobs to finish), judges the outputs, then opens the viewer. It threads the shared flags through each stage: --models, --judge-model (repeatable for a jury), --max-samples, --seed, --adaptive-strategy, --size-tie-ratio, --no-publish, and --port/--host for the viewer. Reach for the individual subcommands when you want finer control over a single stage.

How it works

ocr-bench run launches OCR models on your dataset via HF Jobs. Each model writes its output as a PR on the same Hub dataset, keeping everything together without merge conflicts.

ocr-bench judge runs pairwise comparisons using a VLM judge (default: Qwen3.8-27B on Novita via HF Inference Providers; pass --model to choose another). The default is pinned to one provider because the same model can behave differently across providers. Boards judged with an earlier default resume only with that judge passed explicitly; the error message names it. For each document, the judge sees the original image and two OCR outputs (anonymised as A/B) and picks the better transcription. Results are fit to a Bradley-Terry model to produce ELO ratings with page-level bootstrap 95% confidence intervals. Adaptive stopping halts early when rankings are statistically resolved.

The historical balanced adaptive strategy judges every model pair in each five-page batch. Large model grids can opt into targeted allocation once the run has enough balanced evidence to compute an initial board:

ocr-bench judge <output-repo> \
  --adaptive-strategy targeted \
  --size-tie-ratio 3

targeted tops up only adjacent pairs whose confidence intervals remain unresolved. The optional size rule applies to either adaptive strategy: it can satisfy the whole-run stopping condition in balanced mode, while targeted also stops topping up that pair. It activates once the pair has at least 10 direct comparisons and one model has at least 3× fewer parameters. The leaderboard marks the smaller model as a practical deployment preference; this does not alter ELO/rank or claim the models are statistically equivalent. Unknown/custom model sizes simply remain unresolved. Both settings are recorded in results metadata.

Targeted allocation is experimental and remains opt-in because it conditions later sampling on interim rankings; ordinary bootstrap CIs do not fully account for that optional stopping and may be somewhat optimistic. The default remains balanced while targeted allocation is validated.

To avoid wasting judge calls on uninformative pairs, the judge skips comparisons where both outputs are shorter than --min-chars (default 20 — neither model produced meaningful text), and scores identical outputs as an automatic tie without calling the judge. Pass --min-chars 0 to disable the length filter.

ocr-bench view serves a local web viewer with a leaderboard, comparison browser, and human validation. Vote on comparisons to cross-check the automated judge with human judgement.

Available models

ocr-bench ships with 16 registered OCR models. Five form the default set:

Model Size Hub model
glm-ocr 0.9B zai-org/GLM-OCR
lighton-ocr-2 1B lightonai/LightOnOCR-2-1B
firered-ocr 2.1B FireRedTeam/FireRed-OCR
deepseek-ocr 4B deepseek-ai/DeepSeek-OCR
dots-ocr 1.7B rednote-hilab/dots.ocr

The example boards above do not show which model suits which document type, so run the set on a sample of your own pages.

The opt-in registry also includes compact models at different quality/cost points, including falcon-ocr (0.3B) and ovis-ocr2 (0.9B). List every available model with:

ocr-bench run --list-models

All model scripts are available at uv-scripts/ocr on the Hub.

By default all 5 models in the table run. To pick specific models:

ocr-bench run <dataset> <output> --models tesseract falcon-ocr ovis-ocr2

Example results

Leaderboard viewer with ELO ratings, confidence intervals, and human validation

The screenshot shows the viewer layout from an earlier Britannica run. Its numbers are out of date, and its dots.ocr row came from failed OCR outputs.

Browse these on the Hub:

Install

uv pip install ocr-bench            # Core (run + judge)
uv pip install ocr-bench[viewer]    # With web UI

Or with uv:

uv pip install ocr-bench[viewer]

Requires Python >= 3.11 and an HF token.

Upgrading from 0.0.4

uv pip install -U ocr-bench    # needs huggingface-hub >= 1.0
  • Results repos from 0.0.4 cannot be resumed. Their comparisons carry no resume provenance, and the new default judge and text normalisation change it anyway. Re-judge with ocr-bench judge <dataset> --full-rejudge (this costs a full judge run again), or write to a new results repo with --save-results. --full-rejudge is a judge option; bench has none.
  • The default judge is now novita:Qwen/Qwen3.8-27B. Boards judged with the old and new defaults are not comparable. To continue a provenance-stamped board judged with the old default, pass --model novita:Qwen/Qwen3.5-35B-A3B (--judge-model with bench).
  • Private or gated sources stay private. New output and results repos are created private, and run/judge/bench stop before writing to an existing public repo unless you pass --public. A viewer Space for private results is created private and needs an HF_TOKEN secret with read access to the results.

Status

Working proof of concept. The core pipeline (run → judge → view) is functional. Not polished production software — expect rough edges. This is an early-stage project to explore the idea of VLM-judged OCR leaderboards, and gather feedback on the concept and implementation!

Metadata

Release files for ocr-bench 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ocr-bench 0.0.5
File Size Uploaded Provenance Actions
ocr_bench-0.0.5.tar.gz 96.2 kB Without provenance Details for ocr_bench-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ocr-bench 0.0.5
File Interpreter ABI Platform Actions
ocr_bench-0.0.5-py3-none-any.whl Python 3 none any Details for ocr_bench-0.0.5-py3-none-any.whl

Total release size: 200.2 kB

Release files / ocr_bench-0.0.5.tar.gz

Download URL ocr_bench-0.0.5.tar.gz
Size 96.2 kB
Tags Source
SHA-256 checksum
How to use checksums
135a1c1c84b394498e8b1dfd99ebaa2ae25c3c33a718e7190a3f600b478da275
BLAKE2b-256 checksum
How to use checksums
ad9253206b9c383bdb926bc11fa236227522c62cfe22790990cb77d80473af61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ocr_bench-0.0.5-py3-none-any.whl

Download URL ocr_bench-0.0.5-py3-none-any.whl
Size 104.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f113a3c1421acf119e29f3c6e7ec6e3de442a3c939dc5cd0b04040e66ebc36a
BLAKE2b-256 checksum
How to use checksums
b1c021635929f3b341069783673ec0417f727b1f86b5eb1c6f39adecd8e1d5f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ocr-bench 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page