Marker: The PDF-to-Markdown Tool Crushing Cloud Services at 25 Pages/Sec
What if I told you that your document processing pipeline is bleeding money—and you don't even know it?
Every day, engineering teams burn thousands of dollars on cloud-based PDF extraction services. Llamaparse. Mathpix. Docling. The bills stack up while the latency kills your user experience. But here's the dirty secret nobody talks about: you're paying premium prices for mediocre throughput.
What if you could process 25 pages per second on a single GPU? What if you could convert PDFs, images, PowerPoints, Word docs, and Excel files into pristine markdown, JSON, or HTML—without shipping your sensitive documents to a third-party API? What if the solution was completely open source, ran on your own hardware, and outperformed every cloud competitor in head-to-head benchmarks?
Enter Marker—the document intelligence tool that's making engineers rethink their entire data extraction strategy. Built by Datalab, Marker isn't just another PDF parser. It's a state-of-the-art deep learning pipeline that combines OCR, layout detection, table extraction, equation formatting, and optional LLM enhancement into one blazing-fast package.
And the kicker? It's free for research, personal use, and startups under $2M revenue.
If you're still piping your documents through expensive cloud APIs, stop. This article will show you exactly why Marker is the infrastructure upgrade your team needs—and how to deploy it in under 10 minutes.
What Is Marker?
Marker is an open-source document conversion engine that transforms PDFs, images, and office documents into structured, machine-readable formats. Created by Vik Paruchuri and maintained by Datalab, it represents a fundamental shift in how developers approach document intelligence.
Unlike traditional PDF parsers that rely on brittle heuristics or expensive cloud APIs, Marker employs a sophisticated pipeline of deep learning models:
- Text extraction & OCR: Powered by Surya, Marker's OCR engine handles 100+ languages with automatic script detection
- Layout detection: Identifies reading order, columns, headers, footers, and complex document structures
- Block formatting: Uses Texify for LaTeX equation conversion and specialized processors for tables, code blocks, and forms
- Optional LLM enhancement: Integrates with Gemini, Claude, OpenAI, Ollama, and more for highest-accuracy extraction
The project exploded in popularity because it solves a genuine pain point: existing tools force you to choose between speed, accuracy, and cost. Cloud APIs like Llamaparse charge per page and introduce network latency. Open-source alternatives like Docling sacrifice accuracy for flexibility. Marker delivers all three—and the benchmarks prove it.
Marker's licensing model is equally developer-friendly. The code is GPL-3.0, while model weights use a modified OpenRAIL-M license. This means startups and researchers can self-host without commercial licensing fees, while enterprises can purchase on-prem licenses for compliance requirements.
The project is actively maintained with a thriving Discord community, comprehensive documentation, and a public playground for quick testing.
Key Features That Separate Marker from the Pack
Speed that redefines expectations. Marker's projected throughput of 122 pages per second on an H100 (25 pages/second practical throughput) isn't a theoretical maximum—it's achievable in batch mode with proper worker configuration. Compare that to Llamaparse's cloud latency averaging 23+ seconds per page.
Multi-format mastery. Marker doesn't stop at PDFs. It handles:
- PDF (native digital text + OCR for scanned documents)
- Images (PNG, JPEG, TIFF with automatic text detection)
- Microsoft Office: DOCX, PPTX, XLSX
- Web & ebooks: HTML, EPUB
- All languages supported by Surya's recognition engine
Structural intelligence beyond simple text extraction. Marker preserves:
- Formatted tables with proper cell alignment and headers
- LaTeX equations (both block and inline math)
- Code blocks with syntax fence preservation
- Hyperlinks and references
- Image extraction with optional LLM-generated descriptions
- Footnotes and superscripts
- Reading order in multi-column layouts
Extensible architecture. Marker's pipeline is modular by design:
- Swap in custom processors for domain-specific formatting
- Write new renderers for proprietary output formats
- Add providers for unsupported input formats
- Override builders to modify document structure detection
LLM-powered accuracy boost. The --use_llm flag isn't marketing fluff. Benchmarks show table extraction F1 jumping from 0.816 to 0.907 when combining Marker with Gemini 2.0 Flash—outperforming either approach alone.
Hardware flexibility. Run on NVIDIA GPUs (CUDA), Apple Silicon (MPS), or CPU-only environments. Automatic device detection with manual override capability.
Real-World Use Cases Where Marker Dominates
1. RAG Pipeline Ingestion at Scale
Building a retrieval-augmented generation system? You need clean, structured text from thousands of documents. Marker's chunks output format flattens documents into RAG-optimized segments with full HTML reconstruction—no tree crawling required. Process entire document libraries overnight instead of waiting weeks for cloud API rate limits.
2. Academic Paper Mining
Research teams drowning in PDFs need equation extraction that actually works. Marker's inline math detection converts mathematical notation to proper LaTeX—critical for scientific literature analysis. The --force_ocr flag handles scanned legacy papers where digital text layers are corrupted.
3. Financial Document Processing
SEC filings, earnings reports, and prospectuses contain complex tables that break most parsers. Marker's TableConverter with --use_llm achieves 0.907 structure accuracy on FinTabNet benchmarks—essential for automated analysis where a misaligned cell means incorrect financial calculations.
4. Legacy Document Digitization
Organizations with decades of scanned documents face a nightmare: OCR that garbles text, layout detection that jumbles columns, and manual cleanup that consumes months. Marker's hybrid OCR+digital text pipeline automatically detects which pages need OCR versus which have extractable text layers, optimizing both accuracy and cost.
5. Compliance & Data Sovereignty
For healthcare, legal, and government use cases, shipping documents to cloud APIs creates regulatory risk. Marker's self-hosted deployment with zero data retention (when using Datalab's managed platform) or complete on-prem control satisfies HIPAA, GDPR, and custom BAA requirements.
Step-by-Step Installation & Setup Guide
Prerequisites
Marker requires Python 3.10+ and a working PyTorch installation. GPU acceleration strongly recommended for production workloads.
Basic Installation
# Install core package for PDF conversion
pip install marker-pdf
# Full installation for multi-format support (DOCX, PPTX, XLSX, etc.)
pip install marker-pdf[full]
The [full] extra installs additional dependencies for office document parsing. If you only process PDFs and images, the base package suffices.
Environment Configuration
Marker auto-detects your compute device, but you can force specific backends:
# Force CUDA GPU
export TORCH_DEVICE=cuda
# Apple Silicon
export TORCH_DEVICE=mps
# CPU-only fallback
export TORCH_DEVICE=cpu
For LLM-enhanced mode, configure your preferred service:
# Gemini (default for --use_llm)
export GOOGLE_API_KEY=your_key_here
# Or configure other providers via CLI flags
marker_single input.pdf --use_llm --llm_service marker.services.claude.ClaudeService --claude_api_key YOUR_KEY
Interactive Testing
# Install Streamlit dependencies for GUI testing
pip install streamlit streamlit-ace
# Launch interactive converter
marker_gui
The GUI lets you experiment with options before committing to batch pipelines.
API Server Deployment
# Install FastAPI dependencies
pip install -U uvicorn fastapi python-multipart
# Start local API server
marker_server --port 8001
Access docs at http://localhost:8001/docs for endpoint specifications.
Multi-GPU Production Setup
# Scale across 4 GPUs with 15 workers each
NUM_DEVICES=4 NUM_WORKERS=15 marker_chunk_convert /input/pdfs /output/markdown
Each worker consumes ~5GB VRAM peak, 3.5GB average. An H100 handles 22 parallel processes given its 80GB memory.
REAL Code Examples from the Repository
Example 1: Basic Python API Usage
The simplest programmatic conversion uses PdfConverter with default settings:
from marker.converters.pdf import PdfConverter
from marker.models import create_model_dict
from marker.output import text_from_rendered
# Initialize converter with pre-trained model weights
converter = PdfConverter(
artifact_dict=create_model_dict(), # Loads all neural network components
)
# Convert PDF to structured output
rendered = converter("FILEPATH") # Replace with actual file path
# Extract text content, metadata, and images
text, metadata, images = text_from_rendered(rendered)
# 'text' contains the markdown string
# 'metadata' includes page stats, table of contents, extraction methods
# 'images' is a dict of base64-encoded images keyed by block ID
What's happening here? create_model_dict() downloads and caches the Surya OCR, layout detection, and Texify models. The PdfConverter orchestrates the full pipeline: text extraction → layout analysis → block formatting → markdown rendering. text_from_rendered() provides a convenience wrapper for the default markdown output.
Example 2: Custom Configuration with JSON Output
For structured data extraction, override defaults via ConfigParser:
from marker.converters.pdf import PdfConverter
from marker.models import create_model_dict
from marker.config.parser import ConfigParser
# Define custom configuration dictionary
config = {
"output_format": "json", # Switch from markdown to JSON tree
"force_ocr": True, # Re-OCR everything (fix corrupted digital text)
"strip_existing_ocr": False, # Keep digital text, don't strip
"TORCH_DEVICE": "cuda" # Explicit GPU selection
}
# Parse and validate configuration
config_parser = ConfigParser(config)
# Build converter with full customization
converter = PdfConverter(
config=config_parser.generate_config_dict(), # Resolved settings
artifact_dict=create_model_dict(),
processor_list=config_parser.get_processors(), # Custom processing pipeline
renderer=config_parser.get_renderer(), # JSON renderer instead of markdown
llm_service=config_parser.get_llm_service() # None unless --use_llm configured
)
# Execute conversion
rendered = converter("FILEPATH")
# JSON output has different structure: children, block_type, metadata
# Access via rendered.children for document tree traversal
Critical insight: The ConfigParser resolves interdependent settings. For instance, setting output_format: json automatically swaps the renderer and adjusts processor behavior. This prevents configuration errors that would break the pipeline.
Example 3: Structured Extraction with Pydantic Schemas (Beta)
Marker's extraction mode uses LLMs to populate typed data structures—game-changing for automated form processing:
from marker.converters.extraction import ExtractionConverter
from marker.models import create_model_dict
from marker.config.parser import ConfigParser
from pydantic import BaseModel
# Define your target data schema
class Links(BaseModel):
links: list[str] # Extract all URLs from the document
# Generate JSON Schema for LLM prompt engineering
schema = Links.model_json_schema()
# Configure extraction parameters
config_parser = ConfigParser({
"page_schema": schema, # Schema guides LLM extraction
"use_llm": True, # Required for extraction mode
"llm_service": "marker.services.gemini.GoogleGeminiService"
})
# Initialize extraction converter
converter = ExtractionConverter(
artifact_dict=create_model_dict(),
config=config_parser.generate_config_dict(),
llm_service=config_parser.get_llm_service(),
)
# Extract structured data
rendered = converter("FILEPATH")
# Access results
extracted_links = rendered.extracted_data # Typed dict matching Links schema
original_markdown = rendered.original_markdown # Full document text preserved
# Optimization: pass original_markdown back as existing_markdown to skip re-parsing
Why this matters: Traditional regex-based extraction fails on complex documents. By combining Marker's layout understanding with LLM reasoning, you get context-aware data extraction that handles variations in form design, multilingual content, and implicit structure.
Example 4: Table-Only Extraction
For spreadsheet-like processing of tabular data:
from marker.converters.table import TableConverter
from marker.models import create_model_dict
from marker.output import text_from_rendered
# Specialized converter for table extraction
converter = TableConverter(
artifact_dict=create_model_dict(),
)
# Process document
rendered = converter("FILEPATH")
text, metadata, images = text_from_rendered(rendered)
# CLI equivalent with LLM enhancement for merged cells:
# marker_single FILENAME --use_llm --force_layout_block Table \
# --converter_cls marker.converters.table.TableConverter --output_format json
The TableConverter skips non-tabular content, optimizing throughput for data extraction pipelines. Combine with --output_format json to receive cell-level bounding boxes for verification workflows.
Advanced Usage & Best Practices
Memory optimization for large batches. Marker uses 3.5GB VRAM average per worker, spiking to 5GB. On consumer GPUs (12-24GB), limit workers to 2-3. For H100/A100 deployments, scale to 15+ workers per GPU with NUM_WORKERS.
Accuracy troubleshooting hierarchy:
- Garbled text? →
--force_ocr(fixes corrupted digital text layers) - Broken tables? →
--use_llm(merges multi-page tables, handles complex structure) - Inline math errors? →
--force_ocr --redo_inline_math(LaTeX conversion) - Form extraction failures? →
--use_llmwith custom--block_correction_prompt
Custom prompt engineering. The --block_correction_prompt flag lets you inject domain-specific instructions:
marker_single contract.pdf --use_llm \
--block_correction_prompt "Preserve all dollar amounts with exact formatting. Flag any percentage changes with [REVIEW] tag."
Incremental processing optimization. For repeated extractions from the same document, cache original_markdown and pass as existing_markdown to skip parsing—massive speedup for schema iteration.
Debugging visualizations. Enable --debug to generate annotated page images showing detected layout blocks, text regions, and reading order. Essential for tuning custom processors.
Comparison with Alternatives
| Feature | Marker | Llamaparse | Mathpix | Docling |
|---|---|---|---|---|
| Throughput (pages/sec) | 25 (H100) | ~0.04 (cloud latency) | ~0.16 | ~0.27 |
| Heuristic Accuracy | 95.67% | 84.24% | 86.43% | 86.71% |
| LLM Judge Score | 4.24/5 | 3.98 | 4.16 | 3.70 |
| Self-hosted | ✅ Free | ❌ Cloud only | ❌ Cloud only | ✅ Free |
| Multi-format input | ✅ PDF, image, Office | ❌ Limited | ❌ PDF/image only | ✅ Limited |
| Table accuracy (F1) | 0.907 (with LLM) | N/A | N/A | Lower |
| Open source | ✅ GPL-3.0 | ❌ Proprietary | ❌ Proprietary | ✅ MIT |
| Custom processors | ✅ Full pipeline access | ❌ Black box | ❌ Black box | ⚠️ Limited |
| LLM integration | ✅ 6+ providers | ✅ Built-in | ❌ None | ❌ None |
| Cost at scale | Hardware only | $$$ API charges | $$$ API charges | Hardware only |
The verdict: Cloud services lose on speed, cost, and privacy. Docling offers open-source flexibility but sacrifices accuracy. Marker delivers cloud-beating performance with open-source control—the best of both worlds.
FAQ
Q: Is Marker really free for commercial use? A: The code is GPL-3.0; model weights are free for startups under $2M revenue/funding. Larger enterprises need a commercial license from datalab.to/pricing.
Q: How does Marker handle scanned PDFs with poor OCR?
A: Use --force_ocr to re-process with Surya's state-of-the-art OCR engine, or --strip_existing_ocr to remove corrupted text layers before re-extraction.
Q: Can I use Marker without a GPU? A: Yes—CPU and Apple Silicon (MPS) are supported. Expect 5-10x slower throughput. For production workloads, GPU strongly recommended.
Q: What languages does Marker support? A: 100+ languages via Surya OCR. Non-OCR digital text works with any language. See Surya's language list.
Q: How do I process thousands of documents efficiently?
A: Use marker (batch CLI) with --workers tuned to your VRAM, or scale across multiple GPUs with marker_chunk_convert and NUM_DEVICES/NUM_WORKERS.
Q: Does Marker preserve document formatting?
A: Yes—tables, equations (LaTeX), code blocks, headers/footers, images, and reading order are all preserved. Use --use_llm for highest fidelity on complex layouts.
Q: What's the difference between Marker and Datalab's managed platform? A: Marker is the open-source engine. Datalab's platform runs newer models (Chandra) with SOC 2 Type 2 compliance, zero data retention, and managed infrastructure—including 200M+ pages/week batch processing.
Conclusion
The document processing landscape has been stuck in a false dichotomy: expensive cloud APIs that own your data, or janky open-source tools that break on real-world documents. Marker shatters that compromise.
With 25 pages per second throughput, 95.67% heuristic accuracy crushing Llamaparse and Mathpix, and a modular architecture that adapts to your pipeline, Marker isn't just another PDF parser—it's infrastructure you can build on.
The open-source model means you're never locked into pricing changes or API deprecations. The optional LLM integration means accuracy improves as models improve. And the permissive licensing means startups can ship production document AI without legal review.
I've seen too many teams burn engineering hours and budget on document pipelines that should be solved problems. Marker is the first tool I've encountered that genuinely delivers on the "it just works" promise—while keeping you in control.
Your next step: Clone the repository, process your most troublesome PDF, and watch the benchmark numbers speak for themselves.
👉 Get Marker on GitHub — star it, test it, and join the Discord to shape its future.
The 25 pages/second revolution starts with pip install marker-pdf. What are you waiting for?