Skip to main content

ocr-bench

There is currently no single best OCR model. Rankings change depending on your documents. Manuscript cards, printed books, historical texts all produce different winners.

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.

Model BPL card catalog Britannica 1771
GLM-OCR (0.9B) #2 (1535) #1 (1787)
LightOnOCR-2 (1B) #1 (1559) #2 (1780)
FireRed-OCR (2.1B) — #3 (1551)
DeepSeek-OCR (4B) #4 (1452) #4 (1437)
dots.ocr (1.7B) #3 (1453) #5 (945)

Rankings can flip completely between collections.

ELO vs Parameter Count — smaller models can win on the right documents

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.

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

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.5-35B-A3B via HF Inference Providers). 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 bootstrap 95% confidence intervals. Adaptive stopping halts early when rankings are statistically resolved.

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 5 OCR models ready to run:

Model Size Best for Notes
glm-ocr 0.9B Historical printed text Top performer on Britannica
lighton-ocr-2 1B Card catalogs, manuscripts Top performer on BPL
firered-ocr 2.1B Clean printed text Mid-pack on degraded docs
deepseek-ocr 4B Diverse documents Most consistent across types
dots-ocr 1.7B General Struggles on historical text

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

By default all 5 run. To pick specific models:

ocr-bench run <dataset> <output> --models glm-ocr lighton-ocr-2

Example results

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

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.

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.4

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.4
File Size Uploaded Provenance
ocr_bench-0.0.4.tar.gz 42.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 94.1 kB

Release files / ocr_bench-0.0.4.tar.gz

Download URL ocr_bench-0.0.4.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
45476e41cb8df8214c63fd9e290a75d44eaa16d9355ad4bad18e232e628f193d
BLAKE2b-256 checksum
How to use checksums
a61e79c27fa98b406621efd9b508f4a14fb08dea36aafc0df27bd656196a5e49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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.4-py3-none-any.whl

Download URL ocr_bench-0.0.4-py3-none-any.whl
Size 51.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
020c9d5f741c4c155ea6242c755c4ddcedcce9ad864339da5c6a86ba60ceb13e
BLAKE2b-256 checksum
How to use checksums
e4250475a4d756877654086c04cd50f36e16ff53431bfc8770b243f21afaa1e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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.4

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.

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