Baidu open-sources Unlimited-OCR 2: single-step decoding for hundred-page documents is 5.6 times faster, no need to view the entire book at each step
Beating AI News Flash: Baidu has released and open-sourced Unlimited-OCR 2, a model with approximately 3 billion parameters that activates only about 500 million parameters during inference.
The first version, launched in June, could already continuously parse documents of about 40 pages, but as the page count increased, each generated token still had to attend to the visual information of all pages, causing decoding to become progressively slower.
The second version introduces the SR-SWA sparse attention mechanism. The model no longer reviews the visual information of all pages each time; instead, it focuses on the current page, then selects a small amount of relevant visual information and combines it with recently generated text to continue recognition. In a hundred-page test, single-step decoding was about 5.6 times faster than the old R-SWA attention scheme and about 7 times faster than traditional full attention.
Memory savings are also significant. In a hundred-page document test, through chunked decoding and cross-page cache reuse, the peak KV cache memory for single-stream inference dropped from 47GB to 1.77GB. In another 16-stream concurrency test, generation throughput increased from 360 tokens per second to 1,315 tokens.
Baidu also established MarathonDocBench, containing 100 documents of 103 to 300 pages, to test models' long-document parsing capabilities. Unlimited-OCR 2 scored 77.06, Gemini 3.8 Flash scored 28.61, and Qwen3.8 Max scored 22.93. The above results come from tests on Baidu's self-built benchmark.
When actually processing ultra-long documents, the system can also process them in windows and reuse part of the cache from the previous window to further reduce memory overhead. However, if the window is too small, it may affect the continuity of cross-page content. The paper also acknowledges that the new mechanism cannot fully retain the document's global information, and overall structures such as multi-level headings may still be recognized incorrectly.