cheap-ocr is a high-throughput VLM-based OCR tool that converts PDFs with complex layouts to markdown and JSON, achieving over 14 pages per second on a single L40S GPU.

Stars

62

7-day growth

No data

Forks

4

Open issues

1

License

Apache-2.0

Last updated

2026-07-07

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It combines layout detection (PP-DocLayoutV3) and VLM text recognition (GLM-OCR) to deliver state-of-the-art speed and cost efficiency for batch OCR, with built-in cloud storage support and one-click deployment on Modal.

Who it is for

  • Developers needing fast, cheap OCR for large PDF corpora
  • Data engineers processing complex business documents from cloud storage
  • Researchers working with VLM-based document understanding
  • Enterprises requiring scalable OCR pipelines with minimal infrastructure

Use cases

  • Batch conversion of regulatory PDFs (e.g., EMA documents) to structured markdown/JSON
  • Resumable OCR from S3, Azure, or GCS buckets to cloud targets
  • Integration into data pipelines with Python API for streaming or in-memory processing

Strengths

  • Measured throughput of 14.26 pages/sec vs 5.29 for GLM-OCR SDK on a single L40S
  • Supports complex layouts (headings, tables, images) via dedicated layout detection
  • One-line CLI deployment on Modal (no local GPU required) and bare-metal Docker support
  • Cloud-native: reads/writes from/to S3, Azure, GCS with detached runs

Considerations

  • Requires a powerful NVIDIA GPU (L40S or similar) for optimal performance
  • Dependent on specific model versions (PP-DocLayoutV3, GLM-OCR) which may change
  • Not designed for simple text-only documents where lighter OCR alternatives suffice

README quick start

cheap-ocr

cheap-ocr was born from the need to OCR a large corpus of PDF documents with complex layouts quickly and at low cost. It converts PDF documents to markdown and json, including documents with complex layouts and tables. It uses pp-doclayout-v3 for layout detection and GLM-OCR to recognize text. We measured throughput at more than 14 pages per second on our benchmark. For other datasets, we reached up to 20 pages per second. It runs on a single L40S GPU (or similar).

Read our blog to learn all about the optimizations that we apply.

Benchmarks

We use 100 PDF documents from the European Medicines Agency to benchmark throughput. The documents are typical business documents with a mix of tables, text, and some figures. All metrics are reported end-to-end including download and upload. Warm-up (model loading and initialization) is excluded from our measurements. We compare cheap-ocr against the official GLM-OCR SDK. The benchmarks ran on a single L40S for both solutions.

MetricGLM-OCR SDKcheap-ocr
Pages/sec5.2914.26
Output tokens/sec4,31611,801
Page regions/sec75205.4

Features

FeatureDescription
Fast & cheapFastest and cheapest VLM-based OCR that we know of.
VLM-based OCRState-of-the-art text recognition that handles difficult text extraction well.
Layout detectionRecognizes bounding boxes for headings, paragraphs, images, tables, and more.
OCR from cloud storageProcesses PDFs from and writes outputs to S3 buckets, Azure storage containers, or Google Cloud buckets.
One-line deploymentRuns the full pipeline on Modal with a single CLI command.
Bare-metal deploymentRuns on any machine with an NVIDIA GPU.

Use on Modal (easiest, no local GPU required)

Log into Modal or register a new account. If you are already logged in, skip this step.

uvx --python 3.12 modal login

Then run cheap-ocr directly with uvx; no project files or persistent install are needed. The local command only needs the modal extra. The GPU stack is installed in the remote Modal image.

# run with local files
# startup takes a few minutes because models need to be loaded and CUDA graphs c

Description

OCR with VLMs running on a single GPU with high throughput

Related repositories

Similar projects matched by category, topics, and programming language.

lopopolo
Featured
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI & Machine LearningAI Agents
2,390
slvDev
Featured
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI & Machine LearningLarge Language Models
1,960
littledivy
Featured
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI & Machine Learning
1,482