Baidu releases Unlimited OCR 2 for long documents

Baidu releases Unlimited OCR 2 for long documents

Ondřej Barták
Ondřej Barták
Entrepreneur and Programmer
29. 10. 2026
2 minutes reading · 8 views
Listen to the article
Audio version of the article
Baidu releases Unlimited OCR 2 for long documents

Baidu has released Unlimited OCR 2, an open-source model that converts page images into text. It processes ordered documents ranging from short files to hundreds of pages, preserving their structure and context across page boundaries.

Converting single pages and whole documents

The vision-language model has three billion parameters and produces text that retains headings, tables, formulas, figures and reading order. Its cross-page context helps maintain continuity in tables and references, which can be disrupted when a document is split into isolated chunks.

The Transformers interface offers the infer method for a single page and infer_multi for an ordered set of pages. The first divides a page into image regions; the second uses one global view per page and processes the sequence in a single call.

The Transformers interface accepts page images, so PDF pages must first be converted into images before they can be processed through it.

How the model retains context

For long documents, the model uses a mechanism called Sparse Reference Sliding Window Attention, or SR-SWA. It compresses text and visual interactions into a fixed-size pool of reference tokens that is updated as the model moves through the pages. Later output can draw on that summary without scanning the entire token history at every decoding step.

Baidu describes the processing as “unbounded” in the sense that the attention state is bounded: the company says memory use and decoding latency per token can remain nearly stable. Image encoding, output generation and total processing time still increase with the number of pages.

The summary of earlier content is lossy. The fixed reference-token pool can discard a detail that becomes important much later in the document.

Unlimited OCR 2 builds on DeepSeek-OCR, DeepSeek-OCR-2, PaddleOCR and the first Unlimited OCR. Applying similar attention mechanisms to long videos or large codebases remains a research direction.

Long-document benchmark comparison

Baidu says the model achieves state-of-the-art results on MPDocBench and MarathonDocBench. The former covers documents spanning dozens of pages, while the latter covers documents hundreds of pages long. The published comparison also includes the Qwen, Gemini, GLM, DeepSeek, MiniMax and Kimi model families.

Availability and requirements

Baidu has published the model weights, Transformers interface and code on GitHub under the MIT license. The release also includes deployment recipes for SGLang and vLLM.

The Transformers example assumes a GPU with CUDA and bfloat16 support. The bfloat16 weights alone require approximately 6 GB of memory, with more needed for processing and concurrent requests.

The trust_remote_code=True option executes Python from the model repository. The code should therefore be inspected and a reviewed revision pinned before deployment.

Configuring processing in SGLang

Baidu’s production recipe emphasizes SGLang and uses a customized package from the repository. It provides controls for page windows, output limits and static memory allocation.

When processing pages in windows, each new window reuses the tail of the previous window’s stored context, or KV cache. Smaller windows reduce peak memory use but can weaken continuity across their boundaries.

The SGLANG_UOCR_MAX_PAGE_TOKENS setting caps output tokens per page, preventing a single difficult page from consuming the generation budget for the whole document.

Advertisement

Content created with help from UpTier.

SEO and GEO on autopilot. UpTier’s multi-agent systems write and optimize content for search engines and AI answers.

Discover UpTier ↗

Category:AI
Did you enjoy this article?
Discover more interesting posts on our blog
Back to blog

Related posts

OpenAI Invites Businesses to ChatGPT, Offering Analytics and Custom AI Sales AgentsOpenAI Invites Businesses to ChatGPT, Offering Analytics and Custom AI Sales Agents
OpenAI is turning ChatGPT into a new marketplace, giving businesses control over profiles, analytics, and their own sales agents. While profiles will be available in Czechia, agents remain limited to the US.
3 min read
13. 11. 2026
US Airline Bans AI Agents From Buying Tickets, Citing Data and Mileage ConcernsUS Airline Bans AI Agents From Buying Tickets, Citing Data and Mileage Concerns
United Airlines has become the first major US carrier to ban AI agents from buying tickets, citing concerns over leaked passwords, stolen miles, and breaches of security rules.
3 min read
13. 11. 2026
ZONOS3-Mini: A new voice model from Zyphra that even runs in a browserZONOS3-Mini: A new voice model from Zyphra that even runs in a browser
Zyphra has released a fast voice model for free: it clones voices, speaks Czech, and runs locally on phones, laptops, and browsers without the cloud.
2 min read
13. 11. 2026
Přihlaste se k odběru našeho newsletteru
Zůstaňte informováni o nejnovějších příspěvcích, exkluzivních nabídkách, a aktualizacích.
CodedTrip

Operated by CodedTrip LLC, USA.

YouTube
TikTok