Yuliang-Liu/MonkeyOCR

A lightweight LMM-based Document Parsing Model

What it solves

MonkeyOCR turns scanned or digital documents (PDFs and images) into clean, structured, machine-readable text. Traditional document parsing relies on a chain of separate tools — one for detecting page layout, another for reading text, another for formulas, another for tables — which is complex to set up and maintain. At the other extreme, large general-purpose vision-language models can handle whole pages but are slow and expensive. MonkeyOCR replaces the multi-tool pipeline with a single model that parses a full page end-to-end, covering text, formulas, tables, and reading order in one pass.

How it works

MonkeyOCR is built around a Structure-Recognition-Relation (SRR) triplet paradigm. Instead of orchestrating several specialised tools, the model simultaneously handles three things: detecting the document's structure (where blocks are and what type they are), recognising the content of each block (text, formulas, tables), and understanding the relationships between blocks (such as reading order). The output is a markdown file with the full parsed content, a layout PDF showing detected regions drawn on the original page, and a JSON file with detailed block information — coordinates, content, type, and inter-block relationships. It also supports single-task mode, where you ask it to extract only text, only formulas, or only tables.

Who it's for

Developers, researchers, and teams who need to convert documents into structured data — for example, to feed into downstream pipelines, search indexes, or knowledge bases. It is practical for people with modest hardware: the model runs on consumer GPUs (the README reports success on a 4060 with 8GB VRAM for quantized versions) and can be deployed via Docker, a Gradio demo, or a FastAPI service.

Highlights

  • Single-model end-to-end parsing — no need to stitch together separate layout, OCR, formula, and table tools.
  • Two model sizes — a 3B-parameter version and a leaner 1.2B version; the 1.2B is about 36% faster and improves Chinese-document accuracy by 7.4% over the 3B, with only a ~1.6% performance drop.
  • Strong benchmark results — on OmniDocBench, the 3B model reports the best overall performance on English and Chinese documents, ahead of closed-source and much larger models such as Gemini 2.0-Flash, Gemini 2.5-Pro, Qwen2.5-VL-72B, GPT-4o, and InternVL3-78B; on olmOCR-Bench the 1.2B model beats Nanonets-OCR-3B by 7.3%.
  • Flexible output — markdown, layout PDF, and detailed JSON block results, with optional page splitting and batch grouping.
  • Runs on modest hardware — tested on 3090, 4090, A6000, H800, A100, and even 8GB-VRAM GPUs, with community reports of success on 50-series, H200, L20, V100, 2080 Ti, and NPUs.
  • Deployment options — Docker images, a Gradio web demo, and a FastAPI service with automatic API documentation.
  • Quantization support — can be quantized with AWQ to reduce memory footprint.
  • Open license — released under Apache-2.0.

Related

  • Project
  • Project
  • Project
  • Project
  • Project