Baidu has introduced and made public Unlimited OCR 2, the second version of its document analysis model. The goal of this development is to enable reading documents of any number of pages in one continuous pass.
The model's code and weights are available on GitHub and Hugging Face under the MIT license. Additionally, the model is provided through Baidu AI Cloud and Baidu AI Open Platform cloud services.
The first version of Unlimited-OCR, released in June, utilized a sliding window attention mechanism based on references to extend parsing capabilities from individual pages to dozens of consecutive ones. In the second version, this mechanism has been replaced by Sparse Reference Sliding Window Attention, or SR-SWA.
Baidu compares the new approach to how a human copies a book: it focuses on the current page and only refers to previous pages when information crossing pages is required. In practice, a specialized page gate first narrows the visual reference of each query from the entire document to relevant pages while modeling positions between pages. Then, the highest-rated groups of visual tokens are engaged to capture long-term dependencies.
According to the project description, SR-SWA compresses text-visual attention from ultra-long sequences into a fixed working set of references, such as 512 tokens. This allows the decoding latency at each step and memory consumption to remain almost constant, regardless of the document length. Combined with technology that Baidu calls Unlimited-Horizon Decoding, this enables the model to process very long input data within a finite context window.
In its own example, Baidu demonstrated that the model was able to process all seven Harry Potter books, exceeding 3600 pages, in a single session.
The reported metrics are based on the company's internal tests. Baidu reports achieving a score of 84.6 on MPDocBench, a benchmark for multi-page parsing, and 77.1 on MarathonDocBench—a benchmark for documents over a hundred pages, which Baidu published alongside the model on Hugging Face. The company claims both results are state-of-the-art for end-to-end parsing and surpass several general flash-tier models it tested.
In the 100-page scenario, Baidu's report indicates that SR-SWA decodes each step seven times faster than full attention and 5.6 times faster than the previous R-SWA construction. As of the writing of this article, independent evaluations have not yet been published.
The first version generated significant interest among developers. Baidu notes that the model has garnered over 10 million downloads on Hugging Face and 28,500 stars on GitHub. Currently, the model operates using Transformers for rapid testing and SGLang for serving. Baidu plans to present more information about the model at the Baidu World 2026 event, scheduled for November 12.


