MinerU: The Open-Source Tool That Turns Any Document Into LLM-Ready Data
MinerU is an open-source document parsing engine that converts PDFs, Office docs, and images into LLM-ready Markdown/JSON. Learn how to use it for RAG pipelines and AI agent workflows.
Why Document Parsing Is the Bottleneck in Every AI Pipeline
You've built a killer RAG pipeline. Your embeddings are tuned, your vector store is blazing fast, and your retrieval logic is solid. But there's a dirty secret hiding in plain sight: your documents are garbage in, garbage out.
PDFs are notoriously hostile to machines. Tables span multiple pages. Formulas mix with body text. Scanned documents have no text layer at all. And that polished DOCX report? It probably has nested headers, footnotes, and images that break every naive parser.
This is where MinerU enters the picture. It's not just another PDF-to-text tool — it's a full document understanding engine built specifically for the AI era.
What Makes MinerU Different
Dual VLM + OCR Engine
Most document parsers pick one approach: either extract raw text (fast but inaccurate on complex layouts) or use vision models (accurate but slow). MinerU runs both in parallel.
- Pipeline backend: Fast, stable, runs on CPU or GPU, no hallucinations. Scored 86.2 on OmniDocBench v1.5.
- VLM backend: High accuracy using models like MinerU2.5-Pro-2605-1.2B, supports image and chart interpretation.
- Hybrid backend: Combines native text extraction with VLM verification for the best of both worlds.
The hybrid engine's new effort parameter lets you dial between speed and accuracy. At medium effort, you get 35–220% faster parsing with only 0.13 points accuracy loss compared to high.
Real Document Understanding, Not Just Text Extraction
MinerU doesn't just dump text. It understands document structure:
- Formulas → LaTeX: Inline and block math preserved perfectly
- Tables → HTML: Accurate layout reconstruction, including cross-page table merging
- Multi-column layouts: Correct reading order detection
- Scanned docs & handwriting: OCR with 109-language support
- Headers/footers: Automatically removed from output
Every Format, One Pipeline
As of version 3.4 (released June 2026), MinerU natively supports:
- PDF (text-based and scanned)
- Images (JPG, PNG, TIFF)
- DOCX (native parsing, no PDF conversion needed — 10x faster)
- PPTX and XLSX (added in v3.1)
- Web pages
Integration: From CLI to Production RAG
MCP Server for AI Coding Tools
MinerU ships with an official MCP server. That means you can feed it documents directly from Cursor, Claude Desktop, or Windsurf and get structured output without leaving your editor.
# Install MinerU
pip install mineru
# Parse a document via CLI
mineru -p input.pdf -o output/
# Start the MCP server
mineru --mcp-server
Native RAG Framework Support
If you're building RAG pipelines, MinerU plugs directly into the tools you already use:
- LangChain — Use as a document loader
- LlamaIndex — Native reader integration
- Dify, FastGPT, RAGFlow — Built-in connectors
- Flowise — Visual pipeline builder support
from langchain_community.document_loaders import MinerULoader
loader = MinerULoader(file_path="research_paper.pdf")
documents = loader.load()
# documents[0].page_content is clean Markdown
# with formulas in LaTeX and tables in HTML
REST API and Docker for Production
For high-throughput production deployments, MinerU provides a REST API with async task support:
# Submit a parsing task
curl -X POST http://localhost:8000/tasks -F "file=@document.pdf"
# Check status
curl http://localhost:8000/tasks/{task_id}
# Get results
curl http://localhost:8000/tasks/{task_id}/result
The mineru-router component handles multi-GPU deployment with automatic load balancing, making it trivial to scale horizontally.
Real-World Example: Building a Research Paper RAG System
Let's say you're building a Q&A system over 500 arXiv papers. Here's how MinerU fits into the pipeline:
import os
from mineru.converter import Converter
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.vectorstores import Chroma
from langchain_openai import OpenAIEmbeddings
# Step 1: Batch convert all papers
converter = Converter(backend="hybrid", effort="medium")
results = converter.batch_convert(
input_dir="./papers/",
output_dir="./parsed/"
)
# Step 2: Load parsed Markdown files
all_docs = []
for result in results:
with open(result.markdown_path) as f:
all_docs.append(f.read())
# Step 3: Split into chunks (Markdown-aware)
splitter = RecursiveCharacterTextSplitter(
chunk_size=1000,
chunk_overlap=100,
separators=["## ", "### ", "
", "
", " "]
)
chunks = splitter.create_documents(all_docs)
# Step 4: Embed and store
vectorstore = Chroma.from_documents(
chunks,
OpenAIEmbeddings(model="text-embedding-3-small")
)
The key advantage: because MinerU preserves document structure (headers, lists, tables, formulas), your text splitter can make intelligent decisions about where to chunk. A section header becomes a natural boundary. A table stays intact. A formula isn't split mid-expression.
Key Benefits
- Accuracy: State-of-the-art on OmniDocBench, beating most commercial alternatives
- Speed: Hybrid medium mode is 35–220% faster than high mode with negligible accuracy loss
- Format coverage: PDF, DOCX, PPTX, XLSX, images, web pages — one tool
- 109-language OCR: Truly multilingual document processing
- Offline-capable: Fully private deployment, no data leaves your infrastructure
- Production-ready: REST API, async tasks, multi-GPU routing, Docker support
- Open source: Custom Apache 2.0-based license, commercial-friendly
- MCP native: Works directly with Cursor, Claude Desktop, and Windsurf
Getting Started in 5 Minutes
# Install
pip install mineru
# Parse a single PDF
mineru -p document.pdf -o ./output/
# Check the output
cat ./output/document.md
# That's it. You now have clean, structured Markdown
# ready for your LLM pipeline.
For GPU acceleration with the VLM backend:
pip install mineru[vlm]
# Use the hybrid engine for best results
mineru -p document.pdf -o ./output/ --backend hybrid --effort medium
FAQ
Is MinerU free to use commercially?
Yes. As of version 3.1, MinerU uses a custom license based on Apache 2.0, which explicitly allows commercial use. You can integrate it into proprietary products and SaaS platforms.
How accurate is MinerU compared to commercial tools like Unstructured or LlamaParse?
MinerU scores 86.2 on OmniDocBench v1.5 with the pipeline backend, which is competitive with or better than most commercial alternatives. The hybrid engine with VLM verification pushes accuracy even higher on complex documents.
Can MinerU run without a GPU?
Yes. The pipeline backend runs on CPU and is suitable for most document types. The VLM and hybrid backends benefit significantly from GPU acceleration but can still run on CPU for smaller workloads.
Does MinerU support scanned PDFs and handwritten documents?
Yes. MinerU includes OCR support for 109 languages. The latest v3.4 release upgraded to PP-OCRv6, improving OCR accuracy by approximately 11% on benchmarks. It handles scanned PDFs, handwritten notes, and images with text.
How does MinerU handle tables that span multiple pages?
MinerU supports cross-page table merging. When it detects a table continuing across pages, it reconstructs the complete table as a single HTML structure rather than fragmenting it.
Can I use MinerU with my existing LangChain or LlamaIndex pipeline?
Yes. MinerU has native integrations with LangChain (as a document loader), LlamaIndex (as a reader), and several other RAG frameworks including Dify, FastGPT, and RAGFlow.
What's the difference between pipeline, vlm-engine, and hybrid-engine backends?
The pipeline backend is fast and stable with no hallucinations — best for batch processing. The vlm-engine uses vision-language models for highest accuracy on complex layouts. The hybrid-engine combines native text extraction with VLM verification, offering the best balance of speed and accuracy for production use.