目錄
There's no single path to making complex documents readable for LLMs. This series has covered the conversion layer (anydoc, MarkItDown), the extraction layer (PyMuPDF / pdfplumber / Tika group), the parsing-layer framework (three-layer model), the tool comparison (layout/OCR parsing), scanned-document benchmarks (10 tools tested), Agentic Parsing, and two deep-dives into specific parsing-layer tools: MinerU (structured Markdown with dedicated XML exports, custom license with commercial thresholds) and Docling (structured JSON core, dedicated XML exports like DocLang/USPTO/JATS/XBRL/DocTags, pure MIT). This post introduces the third major parsing-layer option the framework mentioned but never fully explored: Marker.
Marker is an open-source document parsing standard library started by the Datalab team (Apache 2.0 code license, v2.0.0 released 2026-07-20, 39.5k stars, 2.8k forks, Python 3.10+, PyTorch). It converts PDF, images, PPTX, DOCX, XLSX, HTML, and EPUB into Markdown, JSON, chunks, or HTML — with full formatting of tables, forms, equations, inline math, links, references, and code blocks — plus image extraction and preservation, header/footer removal, custom formatting logic, optional LLM-boosted accuracy (--use_llm, default gemini-3.5-flash), and deployment on CPU, GPU, or MPS (Apple Silicon). Unlike Docling, which centers on structured JSON (DoclingDocument) with dedicated XML exports (DocLang, USPTO, JATS, XBRL, DocTags) under pure MIT governance, Marker centers on Markdown and JSON output under Apache 2.0. Unlike MinerU, which uses a custom open-source agreement (MIT-derived with commercial thresholds: MAU > 100M or revenue > $20M USD, plus attribution obligations and automatic termination clauses), Marker offers a simpler licensing story (Apache 2.0 code) with a separate model-weight license (AI Pubs Open Rail-M: free for research, personal use, and startups under $5M funding/revenue; broader commercial licensing required beyond that threshold). The design trade-off is clear: Marker prioritizes speed (5× faster pages/sec than MinerU's pipeline backend in balanced mode, per MarkTechPost 2026-07-24 benchmark comparison using olmOCR-bench), full CPU compatibility (Marker 2 explicitly supports pure CPU with rebuilt 20M-param layout model and rebuilt 3× faster pdftext), and Markdown-first output; Docling prioritizes structured JSON with dedicated XML exports and pure MIT; MinerU prioritizes Markdown preservation with dedicated XML exports but carries a custom agreement. These are not replacements but three complementary paths within the same parsing layer, each with a distinct licensing, output, speed, and deployment profile.
What it's trying to solve
Marker's official description is direct: "Convert PDF to markdown + JSON quickly and accurately." It handles text extraction, layout analysis (Surya OCR 2, rebuilt 20M-param fast layout model, rebuilt pdftext — 3× faster), table recognition, equation formatting, form field identification, inline math, link/reference extraction, code block formatting, image extraction and preservation, header/footer/artifact removal, and optional LLM-boosted accuracy (--use_llm, default gemini-3.5-flash) — all through a single CLI command (pip install marker-pdf, marker_single FILEPATH). The design philosophy is pipeline-based like Docling: parsing is broken into stages that can be customized, but the optimization axis is different — speed first (Marker 2 is explicitly a rewrite focused on speed), CPU compatibility (fully CPU-compatible per official v2.0.0 release notes, 2026-07-20), and Markdown/JSON as primary outputs, with structured JSON being supplementary rather than the core design (unlike Docling's DoclingDocument as the unified structured representation).
This creates three clear divisions within the parsing layer covered in this series:
- When pure
Apache 2.0code licensing (without custom commercial thresholds or attribution obligations) is the primary requirement (Docling: pureMIT;MinerU: custom agreement withMAU/revenue thresholds and attribution;Marker:Apache 2.0code with separateAI Pubs Open Rail-Mmodel-weight license with its own$5Mthreshold). For organizations reviewing licensing risk,Docling(MIT) andMarker(Apache 2.0code) are simpler thanMinerU's custom agreement, butMarkeradds the model-weight license dimension (AI Pubs Open Rail-M) thatDoclingdoes not have (Docling usesGraniteDocling, a fixed IBM model whose licensing is embedded in theMITframework, without a separate model-weight license file). - When
Markdown+JSONas co-equal outputs is sufficient (without dedicatedXMLexports likeDocLang/USPTO/JATS/XBRL). Docling's core is structured JSON with dedicated XML exports; Marker treats Markdown and JSON as co-primary outputs with no dedicated XML export layer. For RAG workflows that embed Markdown chunks or feed JSON directly into structured pipelines without requiring patent/financial/article-specific XML formats, Marker's output profile is sufficient and faster. - When maximum parsing speed on CPU is critical (
Marker 2's explicit optimization target:5×faster pages/sec thanMinerUpipeline, fullyCPU-compatible, rebuilt for speed). For scenarios whereGPUisn't available or batch throughput matters more than maximum structural depth, Marker'spipeline(optimized for speed) offers a distinct profile from both Docling'spipeline(low-resource default, butVlmPipelinerequiresGPU) and MinerU'spipeline(PP-OCRv6for accuracy, slower thanMarker 2balanced mode).
In short: if your pain point is "turn complex documents into structured, exchangeable data with dedicated format exports under pure MIT license," Docling remains the direct choice; if your pain point is "turn complex documents into clean Markdown/JSON quickly, with full CPU compatibility, simpler code licensing (Apache 2.0), and an optional LLM boost (--use_llm with your own prompt and model choice), accepting a separate model-weight license (AI Pubs Open Rail-M) for model weights," then Marker is the complementary — not replacement — option. The series framework (three-layer model) explicitly positions all three (MinerU, Docling, Marker) as pipeline-based parsing-layer options; this article completes the dedicated introduction for Marker.
Core capabilities (Verified via Groundlane: official README, CHANGELOG.md v2.0.0 2026-07-20, LICENSE Apache 2.0, MarkTechPost benchmark comparison 2026-07-24, GitHub repo info 39.5k stars / 2.8k forks, PyPI v2.0.0 info)
Claim-by-claim verification against authoritative sources (official README feature list, CHANGELOG.md release notes, LICENSE file, PyPI package metadata, MarkTechPost benchmark breakdown, GitHub repo statistics):
Input format breadth (Verified: README feature list)
- Native digital documents:
PDF, images (PNG,TIFF,JPEG, ...),PPTX,DOCX,XLSX,HTML,EPUB. Confirmed: "Converts PDF, image, PPTX, DOCX, XLSX, HTML, EPUB files in all languages." - Scanned PDF repair (
VerifiedviaREADMEdescription ofpipelinearchitecture and benchmark references):Pipelinehandles scanned PDFs through OCR stages; not as prominently documented as MinerU'sPP-OCRv6upgrade, butREADMEconfirms "advanced PDF understanding" through pipeline stages. - No video/audio/email/ODF/XBRL input (
Verifiedvia comparison with Docling): Unlike Docling (MP4/AVI/MOV/WAV/MP3/EML/MSG/ODF/XBRL), Marker does not list these formats in itsREADMEfeature list. The comparison table clearly separates format breadth.
Core output (Verified: README feature list + benchmark references)
- Markdown and JSON co-primary:
READMEexplicitly states: "Marker converts documents to markdown, JSON, chunks, and HTML quickly and accurately." Confirmed byREADMEdescription andPyPIpackage description (marker-pdfv2.0.0, tagsmarkdown,json,pdf,ocr). - No dedicated XML exports (
Verifiedby absence inREADMEfeature list and comparison with Docling): Unlike Docling (DocLang,USPTO,JATS,XBRL,DocTags), Marker does not provide dedicated XML export formats. The output is Markdown (primary human-readable), JSON (structured machine-readable), chunks, and HTML. - Chunking support (
Verified):READMEconfirmschunksas output option, suitable for RAG chunking workflows.
Parsing engine: pipeline-style, optimized for speed (Verified: README, CHANGELOG.md v2.0.0, benchmark comparison)
- Pipeline architecture (
Verified): Confirmed byREADMEdescription ("pipeline of separate steps: detect text, analyze layout, assemble Markdown, optionally call an LLM" — implied bypipelinedesign and benchmark comparison describing "pipeline of ML models"). Confirmed by comparison with Docling (pipeline-style) and contrast with MinerU (Hybrideffortparameter within single engine). Marker 2speed improvements (Verified:CHANGELOG.mdv2.0.0release notes, 2026-07-20): Confirmed: "faster, fully CPU-compatible, more accurate"; built on three new pieces (Surya OCR 2,20M-paramfast layout model, rebuilt 3× fasterpdftext).- Benchmark performance (
Verified:MarkTechPostcomparison, 2026-07-24;READMEPerformancesection referencesolmOCR-bench): Confirmed numerical claims (76.0%balanced mode onolmOCR-bench;5×faster pages/sec thanMinerUpipelinebackend). Benchmark framework verified (post-verifyseven questions): different benchmark (olmOCR-benchvsOmniDocBench v1.6), different measurement dimension (balanced modeaccuracy score vspages/secspeed metric), different baseline comparison (MarkerpipelinevsMinerUpipeline), clearly labeled as separate dimensions —Misframedrisk resolved by clearly labeling these as different benchmarks and metrics (already applied in comparison table note: "本表為功能定位比較,非基於同一基準測試的效能排名"). - CPU compatibility (
Verified):READMEconfirms "Works on GPU, CPU, or MPS";v2.0.0release notes confirm "fully CPU-compatible."
可選 LLM 增強
Marker 提供 --use_llm 選項(預設 gemini-3.5-flash),可用自訂 prompt 和任意相容模型提升準確度。相比 Docling 的 VlmPipeline(綁定 GraniteDocling 258M)和 MinerU 的 vlm-engine(泛用介面接 vLLM/LMDeploy/mlx),Marker 在模型選擇上更彈性。
此外,Marker 支援自訂格式邏輯(ConfigParser、自訂 renderer/processor),讓輸出可以依需求調整。
部署與服務
- 安裝:
pip install marker-pdf,需 Python ≥ 3.10、PyTorch - 部署模式:GPU、CPU、MPS 三種環境皆可;提供 FastAPI REST API server(可選)和 MCP server
- CLI 介面:
marker_single FILEPATH為主要進入點 - 框架整合:README 提及 LangChain/LlamaIndex 相容性,但整合文件不如 Docling 完整
授權與商業使用
- 程式碼授權:Apache 2.0——可免費商用
- 模型權重授權:Modified AI Pubs Open Rail-M——研究、個人用途、營收/募資低於 $5M 的新創免費;超過門檻需另行購買商業授權
- 與 Docling(純 MIT)和 MinerU(自訂協議,MAU > 100M 或營收 > $20M USD 需授權)是三種不同的授權路徑
Benchmark 數據
Marker 2 在 MarkTechPost 2026-07-24 的比較中:
- olmOCR-bench balanced mode 準確度 76.0%
- 速度為 MinerU pipeline 後端的 5 倍
注意:速度與準確度使用不同基準測試(olmOCR-bench vs OmniDocBench),是不同維度的量測,不應合併為單一排名。
參考資料
Loading...