Skip to content
Series
11 posts

Document Parsing in Practice

The three-layer ladder for turning documents into LLM-readable content — conversion, extraction, and parsing. From picking the right layer to comparing MarkItDown, anydoc, MinerU, and the rest.

The Three-Layer Ladder of Document Parsing: Pick the Layer Before the Tool

The most common mistake in feeding documents to an LLM isn't picking the wrong tool — it's picking the wrong layer. Structure already in the file goes to the conversion layer (milliseconds); text without structure goes to extraction; only inferred structure needs parsing. anydoc's 4.7ms against Docling's 513.6ms is a 109× gap, and most people jump straight to the most expensive layer.

MarkItDown: Convert Any File to Markdown Before Feeding It to an LLM

A lightweight open-source tool from Microsoft that converts PDF, Office, images, audio, and more into Markdown — purpose-built for LLM pipelines.

anydoc: 14 Office Formats to Markdown, Firecrawl's Rust Answer

Firecrawl's open-source Rust conversion library turns 14 office formats (including legacy .doc / .ppt / .xls) into GFM at a 4.7ms median — 109× faster than Docling under the same timing basis. The trade-off: it does no OCR at all.

The Deterministic Extraction Layer: Solve 80% of Your PDFs With No Model At All

Digital-native PDFs already contain readable text — what's missing is structure, and heuristics can recover it. PyMuPDF, pdfplumber, pypdf, and Tika do this with zero GPU and zero inference cost. The biggest selection trap isn't accuracy; it's PyMuPDF's AGPL-3.0 license.

The Parsing Layer: When Structure Must Be Inferred — and Licensing Is the Real Selection Axis

Scans and complex layouts leave you no choice but to infer structure with a model. But the technical gap between MinerU, Marker, and Docling is far smaller than the licensing gap — MinerU needs a separate license past $20M monthly revenue, Marker's model weights need payment past a funding threshold, and only Docling is cleanly MIT. Read the LICENSE before the benchmark.

Scanned PDF Benchmark: How Did 10 Parsers Handle Graduate Entrance Exams?

I tested 10 open-source PDF parsing tools on four scanned NTU graduate entrance exams. VLM-based tools—Firecrawl, MinerU 3.4, and Marker v2—overwhelmingly beat conventional OCR on formulas and code, but installation was the real barrier: MinerU's old package name creates dependency hell, Marker's first model download takes 10 minutes, and PaddleOCR needs a separate engine. In practice, use RapidOCR for screening and MinerU or Firecrawl for close inspection.

Agentic Parsing: Letting Agents Decide How to Parse Documents

Traditional document parsing runs a fixed pipeline regardless of input, but contracts, financial reports, and technical manuals each need different strategies. Agentic Parsing lets LLM agents observe a document and dynamically choose tools — AgenticOCR parses only the regions that matter (70%+ visual token savings), and ParseBench shows even the best method scores only 84.9% across 2,000 enterprise pages. No silver bullet.

MinerU:從 PDF 到 Markdown 的開源文件解析引擎,為 RAG 與 LLM 訓練而生

MinerU(OpenDataLab / opendatalab/MinerU)是一個開源文件解析引擎,把 PDF、圖像、DOCX、PPTX、XLSX 轉成結構化 Markdown 與 JSON,內建公式識別、表格提取與 109 語言 OCR,起源於 InternLM 前訓練階段,適合 RAG 前處理與知識庫建構。

Docling: IBM's Open-Source, MIT-Licensed Document Parsing Standard Library Built on Structured JSON

Docling (IBM Research Zurich, now governed by the Linux Foundation AI & Data, MIT license, v2.100.0 released 2026-06-09) is an open-source document parsing standard library with structured JSON (DoclingDocument) as its core output. It supports PDF, DOCX, PPTX, XLSX, HTML, EPUB, Apple Pages, video (MP4/AVI/MOV with ASR transcription and keyframes), audio (WAV/MP3), email (EML/MSG), ODF, and XBRL financial reports, with a swappable-stage pipeline parser (pure CPU or GPU-accelerated), VlmPipeline option (GraniteDocling 258M VLM), MCP server and API server (docling-serve), and native integrations with LangChain, LlamaIndex, Crew AI, and Haystack.

Marker: Datalab's Open-Source Pipeline Parser — Faster, CPU-Ready, More Accurate

Marker (Datalab open source, Apache 2.0 license, v2.0.0 released 2026-07-20, 39.5k stars) is a pipeline-style document parsing standard library that outputs Markdown and JSON, supports optional LLM boost (`--use_llm`, default `gemini-3.5-flash`), custom formatting logic, table/formula/inline-math/link/reference/code formatting, image extraction and preservation, header/footer removal, and runs on pure CPU, GPU, or MPS (`Apple Silicon`). Unlike [Docling](/posts/tech/2026-09-06-docling-document-parsing) (structured JSON core, dedicated XML exports, pure MIT), Marker centers on Markdown/JSON under `Apache 2.0` with a separate model-weight license (`AI Pubs Open Rail-M`, $5M commercial threshold); unlike [MinerU](/posts/tech/2026-09-05-mineru-ocr-doc-parsing) (custom agreement with MAU/revenue thresholds + attribution obligations), Marker offers a simpler licensing story (`Apache 2.0` code) but requires accepting a separate model-weight license for weights. The series framework ([three-layer model](/posts/ai/2026-08-06-document-parsing-three-layers)) positions all three (`MinerU`, `Docling`, `Marker`) as pipeline-based parsing-layer options with distinct licensing, output, and speed trade-offs.

Commercial Document Parsing APIs Compared: Specialized Parsers, General VLMs, and the Big Three Clouds

Three routes to commercial document parsing: specialized parsers (Cohere Parse at $1.50/k pages, LlamaParse Agentic Plus at 90.2% on ParseBench), Big Three cloud prebuilts (Azure/Google/AWS for structured field extraction), and general-purpose VLMs (Fable 5.1 scores 78.92 on ParseBench and crushes specialized parsers on charts, but costs 3–16× more and hallucinates). At 100K pages/month, plain OCR runs ~$150 across providers; add tables and AWS jumps to $1,500, Claude Sonnet 5 to $900. The first question isn't 'which is most accurate' — it's 'do you need transcription or comprehension?'