Baidu open-sources Unlimited OCR 2 for documents of any length
2026-10-29 · Pandaily
Baidu released and open-sourced Unlimited OCR 2, a document-parsing model meant to read documents of any page count in one pass. Code and weights are on GitHub and Hugging Face under the MIT license, and it is offered via Baidu AI Cloud and the AI Open Platform.
The core is Sparse Reference Sliding Window Attention (SR-SWA). Baidu compares it to copying a book: focus on the current page and look back only when cross-page information is needed. A page gate narrows each query's visual reference from the whole document to relevant pages, then top-scoring visual tokens are pulled in. Per the README, attention is compressed into a fixed working set (for example 512 tokens), so per-step latency and memory stay nearly constant regardless of length; with Unlimited-Horizon Decoding it can handle very long input in a finite context. Baidu demoed all seven Harry Potter books, 3,600+ pages, in one run.
Baidu reports 84.6 on MPDocBench and 77.1 on MarathonDocBench (released with the model), calling both state of the art for end-to-end parsing, and says SR-SWA decodes 7x faster than full attention and 5.6x faster than the earlier R-SWA at 100 pages. These are Baidu's own tests with no independent evaluations at the time.
It runs with Transformers for quick tests and SGLang for serving. The June first version has passed 10 million Hugging Face downloads and 28,500 GitHub stars per Baidu (as of the report). More will be shown at Baidu World on Nov. 12.
Limits: self-reported benchmarks await community verification, and real hardware needs depend on deployment.