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
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

Anthropic Founders Pledge Claude Will Remain Ad-FreeAnthropic Founders Pledge Claude Will Remain Ad-Free
Anthropic is heading for an IPO, yet it wants to keep Claude ad-free. Its founders say a clean environment for work and reflection takes priority over pressure for higher profits.
3 min read
30. 10. 2026
Liquid AI releases six small LFM3 models for text, vision, audio and decisionsLiquid AI releases six small LFM3 models for text, vision, audio and decisions
The open-weight model family is designed for fine-tuning on a single GPU. It includes text, multimodal and decision-making variants for devices and the cloud.
3 min read
30. 10. 2026
Azure Grew 48 Percent as AI Boosts MicrosoftAzure Grew 48 Percent as AI Boosts Microsoft
Microsoft’s cloud revenue is surging thanks to AI: Azure beat expectations, while OpenAI generated $10 billion for the company in one quarter. But its reliance on a single customer is growing.
5 min read
30. 10. 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