- AI
- Open source
Baidu open-sources Unlimited OCR 2 for very long documents
Baidu released Unlimited OCR 2, an open-weight vision-language model for parsing long documents, on Hugging Face under the MIT license.
·1 min read·AB

Baidu released Unlimited OCR 2, an open-weight vision-language model for parsing long documents, on Hugging Face under the MIT license. The model has about 3.3 billion parameters and is built around what Baidu calls Sparse Reference Sliding Window Attention, a technique that compresses text-visual attention over very long sequences down to a fixed-size set of working references, such as 512 tokens. Baidu says this keeps decoding latency and memory use nearly constant regardless of how long the document gets.
Baidu describes this as moving from long-horizon to what it calls unlimited-horizon document parsing, since the fixed-size attention avoids the usual quadratic scaling and memory bottlenecks that grow with document length. The company says the model achieves state-of-the-art results on both a dozens-of-pages benchmark and a new, harder hundred-page benchmark it released alongside the model called MarathonDocBench. These performance claims are Baidu's own.
The model supports multi-page inference, where all pages of a document are parsed in a single request so it can use context across pages, as well as single-page inference with dynamic tiling. It works with the Transformers library for quick tests and with the SGLang inference engine, which Baidu recommends for serving, including page-window scheduling options for handling very long documents. Code is available on GitHub.
Why it matters
Document AI that holds steady performance and memory use at book-length inputs removes a common bottleneck for OCR pipelines.
Source: Baidu on Hugging Face