MinerU: An Open-Source Solution for Precise Document Content Extraction

Bin Wang, Chao Xu, Xiaomeng Zhao, Linke Ouyang, Fan Wu, Zhiyuan Zhao, Rui Xu, Kaiwen Liu, Yuan Qu, Fukai Shang, Bo Zhang, Liqun Wei, Zhihao Sui, Wei Li, Botian Shi, Yu Qiao, Dahua Lin, Conghui HearXiv 2024 · DOI

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:

  1. Preprocessing: The system utilizes PyMuPDF to filter unprocessable files and determine if a document is text-based or scanned.
  2. 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.
  3. 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.
  4. Format Conversion: The final output is rendered into clean, LLM-ready Markdown or JSON formats.
The four-stage MinerU workflow: Preprocessing, Content Parsing, Post-Processing, and Format Conversion.

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.

MinerU demonstrates robust layout detection across diverse document types including academic literature, financial reports, textbooks, 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

BibTeX
@misc{wang2024mineru,
  author = {Bin Wang and Chao Xu and Xiaomeng Zhao and Linke Ouyang and Fan Wu and Zhiyuan Zhao and Rui Xu and Kaiwen Liu and Yuan Qu and Fukai Shang and Bo Zhang and Liqun Wei and Zhihao Sui and Wei Li and Botian Shi and Yu Qiao and Dahua Lin and Conghui He},
  title = {{MinerU: An Open-Source Solution for Precise Document Content Extraction}},
  year = {2024},
  eprint = {2409.18839},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.18839},
}
Figure