Deep Evaluation of Unlimited OCR 2: Baidu WENXIN's Open-Source End-to-End Long Document Parsing Model
Executive Summary:
Unlimited OCR 2 is an end-to-end document parsing model open-sourced by the Baidu WENXIN team. Its core breakthrough lies in supporting the parsing of ultra-long documents with any number of pages, ca...
1. What is Unlimited OCR 2
Unlimited OCR 2 is an end-to-end document parsing model open-sourced by the Baidu WENXIN team. Its core breakthrough lies in supporting the parsing of ultra-long documents with any number of pages, capable of processing thousands of pages of books in one go while maintaining accuracy and efficiency. The model employs a sparse reference sliding window attention mechanism (SR-SWA) and an infinite decoding mechanism, effectively reducing computational and memory overhead for long document parsing. It has achieved leading performance on long document benchmarks such as MPDocBench and MarathonDocBench, propelling OCR technology into the 3.0 era focused on long-context understanding.
Technical Positioning and Domain: Unlimited OCR 2 belongs to the field of document intelligence parsing at the intersection of natural language processing and computer vision. Its unique positioning is the shift from traditional single-page OCR recognition to end-to-end long document context modeling, addressing the common issue of context fragmentation in multi-page document parsing. The model is tailored for professional scenarios requiring the processing of ultra-long documents, such as library digitization, financial research report analysis, and legal compliance reviews, filling the gap in the open-source ecosystem for high-precision long document parsing tools.
Development Background: This model was developed and open-sourced by the Baidu WENXIN team, leveraging Baidu's years of technical accumulation in the OCR domain (such as the PP-OCR series) and the foundational capabilities of the WENXIN large model. The motivation for development stemmed from the limitations of traditional OCR solutions when handling documents with hundreds of pages or more, including page limits, fragmented context, and low computational efficiency. The team drew inspiration from the human reading behavior of "focusing on the current page and reviewing previous content when necessary," designing the SR-SWA attention mechanism to unify cross-page selection, reference review, and current page understanding within an end-to-end framework.
Core Value: The model addresses two major core issues in long document parsing: "page limitations" and "context fragmentation." Traditional approaches typically recognize each page individually and then concatenate the results, making it difficult to maintain the integrity of cross-page tables, chapter titles, and citation relationships. While the previous generation R-SWA mechanism extended parsing to dozens of consecutive pages, it still fell short when dealing with documents spanning thousands of pages. Unlimited OCR 2 reduces the visual reference scope from the entire document to only relevant pages through its sparse reference attention mechanism, significantly lowering computational costs while maintaining accuracy, shifting long document parsing from "engineering-heavy computation" to "algorithm-driven resource efficiency."
Technical Features: Its core technical advantages are reflected in three aspects: first, the SR-SWA attention mechanism dynamically selects relevant pages using a Page Gate and captures long-range dependencies through visual Token Buckets, achieving a 7x improvement in decoding speed compared to Full Attention; second, the infinite decoding mechanism breaks the hard limit on context length, enabling continuous parsing of thousands of pages; third, a unified end-to-end modeling framework integrates cross-page selection, reference review, and current page understanding into a single network, enhancing the consistency and completeness of long document parsing.
2. Key Features
Arbitrary Page Count Parsing: Breaks through the page limit of traditional OCR models, supporting the processing of long documents with thousands of pages in one go. In practical tests, it can fully parse books with over 3600 pages without requiring chunking or manual splitting, significantly simplifying the digitization workflow for long documents.
High-Precision Understanding of Long Documents: Maintains high parsing accuracy and processing efficiency even as the number of document pages increases substantially. This is made possible by the SR-SWA mechanism, which focuses attention on relevant pages and avoids interference from irrelevant ones, achieving a score of 84.6 on the MPDocBench benchmark and 77.1 on the MarathonDocBench.
Cross-Page Information Association: The model has the ability to "review previous content," enabling it to verify cross-page information and link tables, headings, and references scattered across multiple pages, reducing context fragmentation caused by multi-page concatenation and improving the structural integrity of long document parsing.
End-to-End Unified Modeling: Unlike traditional OCR's approach of page-by-page recognition followed by concatenation, Unlimited OCR 2 integrates cross-page selection, reference review, and current page understanding into a unified end-to-end framework, eliminating error accumulation between multiple modules in pipeline-based solutions.
Efficient Computation and Memory Control: The SR-SWA decoding speed per step is 7 times faster than Full Attention and 5.6 times faster than the previous generation R-SWA. The main benefit comes from replacing global full attention with sparse references, while the infinite decoding mechanism helps alleviate memory pressure.
Open Source and Multi-Platform Deployment: The code and model weights have been open-sourced on GitHub and Hugging Face, and the model is now available on Baidu Smart Cloud and Baidu AI Open Platform. It supports both local deployment and cloud API calling, adapting to various business scale requirements.
Structured Output Support: Supports selecting output formats based on pages or API parameters, allowing export of structured data such as text, Markdown, and JSON, facilitating integration with downstream RAG systems, knowledge bases, and business systems.
3. How to Use
Select Deployment Entry Point: Users can choose their deployment path based on their specific needs: download the code and model weights from the GitHub repository (https://github.com/baidu/Unlimited-OCR) for local deployment, or experience it online through the Hugging Face model library (https://huggingface.co/spaces/baidu/Unlimited-OCR-2). Alternatively, they can call the API service via Baidu Intelligent Cloud or the Baidu AI Open Platform.
Prepare Input Documents: Organize the PDFs, scanned documents, or long documents that need to be parsed, ensuring that pages are complete, images are clear, and orientation is correct. For documents with poor scan quality, it is recommended to perform image preprocessing (such as noise reduction, alignment correction, and contrast enhancement) to improve the accuracy of subsequent parsing.
Configure the Runtime Environment: For local deployment, prepare a GPU environment that supports PyTorch and install the Transformers library along with related dependencies. It is recommended to use GPUs with ample VRAM (such as NVIDIA A100 or V100) to fully leverage the performance advantages of long document parsing. After downloading the model weights from Hugging Face, the model can be quickly loaded using the pipeline interface provided by Transformers.
Set Up the Parsing Task: Configure parsing parameters according to your needs, including output format (text/Markdown/JSON), parsing range (all pages or a specific page range), table recognition toggle, and layout analysis options. When calling the API, you can control the parsing granularity and output structure through parameters.
Run and Verify: After submitting the parsing task, the model automatically performs cross-page understanding, content extraction, and structured generation. After parsing is complete, focus on checking cross-page headings, table boundaries, formulas, page numbers, citations, and paragraph continuity to ensure the long document's context remains intact.
Export and Integrate: Export the parsed results in the desired format or integrate them into batch processing workflows and business systems via API. For RAG/knowledge base scenarios, it is recommended to directly import the Markdown/JSON output into a vector database to build searchable knowledge assets.
4. Pros and Cons Analysis
| Pros |
|---|
| Ability to parse arbitrary page counts: Breaks through traditional OCR page limits, capable of processing long documents with thousands of pages in one go, significantly simplifying the digitization process of ultra-long documents and reducing manual segmentation costs. |
| Cross-page context understanding: The SR-SWA mechanism supports reviewing previous content and associating cross-page information, effectively reducing context fragmentation caused by multi-page concatenation and enhancing the structural integrity of long document parsing. |
| Significant improvement in computational efficiency: Sparse reference attention replaces full attention, resulting in a 7x increase in decoding speed compared to Full Attention and a 5.6x increase compared to the previous generation R-SWA, with lower memory consumption. |
| Open-source ecosystem and multi-platform support: Code and model weights are open-sourced, with over 10 million downloads on Hugging Face and 28,800 stars on GitHub; simultaneously launched on Baidu Smart Cloud and AI Open Platform, supporting flexible deployment. |
5. Comparative Analysis with Similar Tools
| Dimension | Wenxin Unlimited OCR 2 | MinerU | PP-OCRv6 |
|---|---|---|---|
| Core Positioning | End-to-end OCR/document parsing model, focusing on arbitrary page numbers and cross-page context | Document parsing framework, converting PDF/Office/images into structured Markdown/JSON | OCR recognition engine, emphasizing text detection and recognition accuracy |
| Long Document Capability | Can parse books with over 3600 pages in one go, with the core being SR-SWA + infinite decoding | Strong in layout, tables, formulas, and reading order; long documents rely more on engineered batch processing | Relies on external pipeline for page-by-page processing, no native cross-page modeling |
| Input Format | Focuses on image/PDF document parsing | Broader support including PDF, images, Word, PPT, Excel, EPUB, OFD, HTML, CSV, etc. | Primarily image input |
| Output Format | Document understanding results and long context parsing | Clear output of Markdown/JSON, serving RAG/Agent workflows | Text and detection box coordinates |
| Technical Mechanism | Page Gate narrows the visual reference range, Token Buckets capture long-range dependencies; SR-SWA reduces Full Attention redundancy | Multi-model pipeline including layout detection, formula detection/recognition, table recognition, and OCR; VLM backend handles complex pages | PP-OCRv6 upgrade increases OCR accuracy by ~11% and doubles processing speed |
| Deployment Method | Transformers for quick testing, custom SGLang for service | CLI, Python SDK, HTTP API, WebUI, Router; supports low-end CPU to high-end GPU/VLM | Python SDK and PaddleHub |
Selection Recommendations: For scenarios requiring processing of thousands of pages in ultra-long documents with high demands on cross-page context association (such as full book digitization, long-form report parsing), Unlimited OCR 2 is a more suitable choice due to its end-to-end long document modeling capability. Its SR-SWA mechanism demonstrates significant efficiency advantages in long documents, and its open-source license is friendly, making it suitable for deep customization.
For scenarios requiring handling of multiple input formats (Word, PPT, Excel, EPUB, etc.) and structured Markdown/JSON output to support RAG/Agent workflows, MinerU offers superior versatility and engineering maturity. Its multi-model pipeline has deep experience in layout, table, and formula recognition, and its multiple interfaces (CLI, Python SDK, HTTP API, etc.) reduce integration barriers.
6. Editor's Summary
The technical innovations in Unlimited OCR 2 are noteworthy. Traditional OCR has long remained in the "single-page recognition + post-processing stitching" paradigm, making it difficult to resolve the issue of context fragmentation when dealing with long documents. This model draws inspiration from human reading cognition, utilizing the SR-SWA sparse reference attention mechanism to dynamically focus the visual reference range on relevant pages. Combined with the unlimited decoding mechanism, it breaks the limitations of context length, achieving a paradigm shift from "page-by-page recognition" to "full-document understanding." The data showing a 7x improvement in single-step decoding speed compared to Full Attention indicates that its sparse design does not come at the expense of efficiency, but rather achieves a good balance between accuracy and computational cost.
In terms of practical value, this model directly addresses long-document processing challenges that have long existed in scenarios such as financial research report analysis, legal compliance reviews, and archival digitization. Its ability to parse thousands of pages at once, along with the associated understanding of cross-page tables, headings, and citations, can significantly enhance the efficiency and level of structuring in document digitization. The open-source strategy, paired with its simultaneous release on Baidu Smart Cloud and AI Open Platform, provides flexible options for users with varying technical capabilities.
In terms of target users, this model is suitable for three categories: first, institutions such as libraries and archives that require batch processing of ultra-long documents; second, professionals in industries like finance and law that have high requirements for the completeness of document context; and third, AI developers building RAG or knowledge base systems, who can leverage its long-document parsing capabilities to improve the retrieval quality of their knowledge bases.
It should be noted that claims such as "arbitrary page parsing" and "SOTA" are currently based primarily on the vendor's own reporting, and there has been no independent third-party large-scale replication and verification yet. It is recommended that users conduct thorough testing with their own business documents before deploying the model in a formal production environment, to evaluate whether its accuracy and efficiency meet expectations. As the open-source community continues to provide feedback and iterate on the model, its actual performance in the field of long-document parsing is worth further observation.
7. Application Scenarios
Long Book and Document Digitization: Entire novels, textbooks, and classical texts can be digitized in one go, without the need for page-by-page processing. The cross-page context retention capability ensures the integrity of elements such as chapter titles, footnotes, and references, making it suitable for bulk digitization projects in libraries, publishing houses, and academic institutions.
Research Reports and Financial Analysis: Hundreds of pages of research reports from securities firms and annual reports of listed companies can be read in one session, with core insights, financial metrics, and risk warnings extracted. The model's ability to understand cross-page tables and notes eliminates the need for analysts to manually piece together multi-page data, significantly improving the efficiency and accuracy of information extraction.
Legal and Compliance Review: When processing legal codes, contract files, and case documents, the model supports cross-page clause linkage and reference tracing. Lawyers and compliance officers can quickly locate key clauses scattered across multiple pages, reducing manual review time and minimizing the risk of omissions.
Archives and Invoice Digitization: Scanned archives, medical records, and historical documents can be converted in bulk into structured text for storage. The model's continuous parsing capability for long documents enables the processing of large-scale archives, and when combined with structured output formats, it can directly integrate with business systems.
RAG/Knowledge Base Construction: Convert ultra-long PDFs into searchable content to support question-answering, search, and intelligent agent calls. The model's ability to retain full semantic meaning from long documents significantly enhances the quality of knowledge base retrieval, making it especially suitable for enterprise knowledge management and intelligent customer service applications.
8. FAQ
Q: What is the core difference between Unlimited OCR 2 and the previous generation R-SWA mechanism?
A: The previous generation R-SWA only scaled to documents spanning a continuous dozen of pages, still being limited by context length when dealing with documents in the thousands of pages. Unlimited OCR 2 introduces Page Gate to dynamically narrow the visual reference scope of each query to only the relevant pages, and captures long-range dependencies through the highest-scoring visual Token Buckets. This allows the model to process documents of any length, while also achieving a 5.6x improvement in single-step decoding speed compared to R-SWA.
Q: What hardware configuration is required for local deployment?
A: It is recommended to use NVIDIA GPUs with ample VRAM (such as A100 or V100) and run them in a PyTorch environment. Specific VRAM requirements depend on the number of pages and resolution of the document being processed. For long documents spanning thousands of pages, it is advised that VRAM be no less than 32GB. The model supports quick testing with Transformers, and in production environments, SGLang service can be customized to optimize inference performance.
Q: What output formats does the model support? Does it support structured data?
A: The model supports output in plain text, Markdown, and JSON formats. JSON output includes document structure information and can be directly imported into RAG systems, vector databases, or business systems. Users can configure the output format, parsing scope, and table/layout recognition options via API parameters.
Q: How can users verify performance metrics such as "unlimited page parsing" and "SOTA"?
A: The current performance data, such as MPDocBench 84.6 and MarathonDocBench 77.1, are based on self-reported benchmarks from vendors. It is recommended that users test and validate these metrics using their own business documents before deployment. Users can refer to the evaluation scripts and benchmarking methods provided in the GitHub repository to reproduce accuracy and efficiency results on their own datasets.
Q: How does the model handle scanned documents and low-quality images?
A: The model is centered around parsing image/PDF-type documents and has a certain level of adaptability for scanned documents. However, the quality of the scan directly affects parsing accuracy. It is recommended to preprocess blurry, skewed, or low-contrast images (e.g., denoising, skew correction, enhancement) to improve subsequent parsing results. For handwritten documents and historical archives, it is advised to first conduct tests with small-scale samples.
Q: What distinguishes Unlimited OCR 2 from document parsing frameworks like MinerU?
A: Unlimited OCR 2 is an end-to-end long-document modeling architecture, with its core advantage being the ability to parse any number of pages and establish cross-page contextual relationships. MinerU is a general-purpose document parsing framework that supports a wider range of input formats (Word, PPT, Excel, EPUB, etc.) and outputs are explicitly designed for RAG/Agent workflows. The two have different use cases: choose Unlimited OCR 2 for long-document scenarios, and MinerU for multi-format general scenarios.
9. Project Links
- GitHub Repository: https://github.com/baidu/Unlimited-OCR
- Hugging Face Model Library: https://huggingface.co/spaces/baidu/Unlimited-OCR-2
© All Rights Reserved. Some content on this site is partially generated by AI with human review.




