Introduction
As Large Language Models (LLMs) continue to evolve, the primary bottleneck for performance improvement has shifted from model architecture to data quality. While web-scraped text is abundant, a vast repository of high-quality human knowledge remains locked in the "graveyard" of complex PDF documents. These files, often containing multi-column layouts, intricate mathematical formulas, and dense tables, present significant challenges for standard extraction tools.
Existing methods typically fail in one of three ways: OCR-only tools treat formulas as noise; library-based parsers (like PyMuPDF) fail on scanned or complex layouts; and academic-focused models struggle with non-standard formats like textbooks or financial reports. To bridge this gap, the authors introduce MinerU, an industrial-grade, open-source pipeline designed to extract clean, structured data from diverse PDF sources with high precision.
The MinerU Pipeline
MinerU adopts a multi-module strategy rather than a single end-to-end model, allowing it to leverage specialized tools for distinct tasks while maintaining lower inference costs. The workflow is divided into four critical stages:
- Preprocessing: The system utilizes PyMuPDF to filter unprocessable files and determine if a document is text-based or scanned.
- Content Parsing: This core stage employs the PDF-Extract-Kit, which includes a fine-tuned LayoutLMv3 for region identification, a YOLO-based model for formula detection, and the self-developed UniMERNet for LaTeX recognition.
- Post-Processing: This stage resolves overlapping bounding boxes, removes irrelevant headers and footers, and applies a sophisticated "human reading order" algorithm to ensure logical text flow.
- Format Conversion: The final output is rendered into clean, LLM-ready Markdown or JSON formats.
Key Technical Innovations
Specialized Formula Handling
One of MinerU's standout features is its approach to mathematical content. To handle inline formulas, the system uses a "masking trick": it detects the formula, masks it out to perform OCR on the surrounding text, and then re-inserts the recognized LaTeX formula. This prevents OCR engines from generating garbled text when encountering mathematical symbols. The underlying UniMERNet model was trained on UniMER-1M, a massive dataset of 1 million formula samples, allowing it to approach the accuracy of commercial industry standards.
Robust Layout Analysis
The authors identified that models trained solely on academic papers (like arXiv) are brittle when faced with the decorative elements and varied margins of textbooks or magazines. By clustering documents by visual features and sampling from these clusters, they created a training set of 21,000 annotated data points that cover a wide spectrum of document types, including PPTs and exam papers.
Performance and Results
MinerU significantly outperforms popular open-source alternatives like DocXchain and Surya, particularly on non-academic content:
- Layout Detection: On the challenging Textbook validation set, MinerU achieved a 67.9 mAP (mean Average Precision), while competitors typically scored between 13 and 34.
- Formula Recognition: UniMERNet achieved a 0.968 CDM (Formula Accuracy Metric), outperforming Texify (0.755) and nearly matching the commercial leader, MathPix (0.951).
- Qualitative Success: The pipeline excels at merging cross-page paragraphs and maintaining reading order in multi-column layouts, which are common failure points for simpler parsers.
Conclusion and Future Work
MinerU provides a robust solution for turning complex PDFs into high-quality training data for LLMs. While currently optimized for English and Chinese, future iterations aim to expand language support, optimize inference speed, and introduce even more sophisticated modules for chaotic layouts. The project is fully open-source, inviting community contribution to further unlock the world's PDF-based knowledge.
Summary updated