PARAS MADAN
All writing

Latest in AI

Baidu Unlimited-OCR-2: Long-Document Parsing, Downloads and Memory Limits

Baidu's new OCR model changes how it remembers long documents, but the serving setup still determines what survives across page boundaries.

Baidu released Unlimited-OCR-2 on October 27, a 3B-parameter document-parsing model designed to handle hundreds of pages without continually expanding its active attention state. MIT-licensed weights are downloadable, giving developers a new option for turning long documents into machine-readable text with cross-page context.

The useful question is what “unlimited” means when the document still has to fit through a real GPU and an inference server.

What changed in Unlimited-OCR-2

The official model card introduces Sparse Reference Sliding Window Attention, or SR-SWA. It selects a bounded set of relevant visual references instead of repeatedly attending to every page image. The release supports Transformers for experiments and a customized SGLang build for serving.

Baidu's technical paper explains the second part: overlapping page chunks are processed sequentially. The server reuses a shared boundary page's cached state and retains a text tail, while releasing inactive visual caches. That makes the working set manageable even when the document is much longer.

This matters for a report where a table continues onto another page. Running each page independently leaves the application to reconstruct that relationship afterward. A document-aware parser can carry some of that continuity through extraction, although the boundaries still need testing.

Benchmarks and the GPU-memory distinction

Baidu reports a 77.06 overall score on MarathonDocBench, its new benchmark covering 100-to-300-page documents. This is a developer-reported result on a benchmark introduced by the same team, rather than independent validation across every document type.

Its decoding comparison reports peak KV-cache memory falling from 47.00 GB to 1.77 GB for a single sequence. At batch size 16, reported throughput rises from 360 to 1,315 tokens per second. These are different measurement settings.

The 1.77 GB figure is cache memory, not the total GPU requirement. Model weights, image processing and temporary allocations still consume memory. Baidu's documented Transformers setup was tested on an NVIDIA A800 with 80 GB; that is a tested configuration, not a stated minimum.

How to run it and what is available

The public repository includes weights, configuration and custom model code. The model card lists an MIT license. The model page did not list a hosted Inference Provider when checked. Download availability should not be confused with a ready-made hosted API or a published per-page service price.

The implementation guide accepts ordered page images through infer_multi. For PDFs, its serving example renders pages into images first, then sends them to a self-hosted OpenAI-compatible endpoint. Review the custom code before enabling trust_remote_code=True.

SGLang users need the supplied custom wheel rather than assuming an ordinary installation has the required behavior. The documented recipe also controls page windows, output budgets and temporary allocations.

The tradeoff to test before replacing a pipeline

Baidu explicitly warns that smaller page windows reduce peak memory but can damage cross-page merging when a block continues across a window boundary. Memory efficiency and document continuity need to be evaluated together.

For a document-processing team, a useful first test is a long report with known table continuations, headings and footnotes. Compare the extracted structure with the original pages, then repeat with a smaller window. A server that finishes reliably can still lose the relationships that make its output useful downstream.

The practical opportunity is simpler extraction for long documents. Whether that reduces cleanup work depends on the structure preserved at page boundaries, not just the number of pages the model finishes.

I'm Paras. I work at the intersection of AI, engineering and distribution.

I help technical teams turn model releases and engineering decisions into clear stories that developers and founders can use and share.

Book a 30-minute call