Baidu has released Unlimited OCR 2, an open-source model designed to parse documents spanning hundreds of pages in a single request. The 3.34 billion parameter system runs under the MIT license with code available on GitHub. Its core innovation is SR-SWA, a sparse attention scheme that maintains nearly flat decoding costs regardless of sequence length.
In this article
Technical specifications and hardware
The model operates on 131,072 tokens. Baidu tested it on an NVIDIA A800-80GB GPU using BF16 precision, where the weights total approximately 6.7 GB. The architecture follows a DeepSeek-OCR style layout, combining a SAM ViT-B encoder with a CLIP-L encoder to feed a 12-layer mixture-of-experts decoder. Each token routes to 6 of 64 experts, alongside 2 shared experts.
In multi-page mode, the system processes 273 image tokens per page. While the model card does not disclose the active parameter count, the configuration pairs a 128-token local window with top-16 selection over 32-token blocks to manage the 512-token reference budget.
The SR-SWA mechanism
Standard attention costs grow quadratically as sequence length increases. During decoding, each new token scans a longer KV cache. At 273 image tokens per page, a 100-page document adds 27,300 input tokens before any output is generated.
SR-SWA, or Sparse Reference Sliding Window Attention, compresses text-visual attention into a fixed set of working references. This approach keeps per-step latency and memory usage nearly constant as documents expand. The result is described as unlimited-horizon parsing within a finite context window. However, image encoding and total runtime still rise with the number of pages.
Performance on benchmarks
Baidu evaluated the system on MPDocBench, which contains dozens of pages per document, and MarathonDocBench, which features hundreds. The public MPDocBench-Parse dataset includes 433 documents and 3,246 pages. A public release for MarathonDocBench was not found.
According to Baidu’s leaderboard chart, Unlimited OCR 2 scores 84.6 on MPDocBench. Qwen3.8-Max follows at 78.3, then Qwen-3.8-Flash-Next at 77.4. On MarathonDocBench, the model scores 77.1. The next model, Kimi-K3, scores 33.7, with Gemini-3.8-Flash at 28.6.
The drop between benchmarks is the most significant metric. Qwen3.8-Max falls from 78.3 to 22.9 on hundred-page documents. Unlimited OCR 2 falls 7.5 points. Its predecessor, Unlimited-OCR, scores 0.0 on MarathonDocBench.
Sub-scores (MPDocBench / MarathonDocBench):
- Text: 94.8 / 89.6
- Formula: 89.4 / 87.9
- Reading order: 92.3 / 85.3
- Tables: 87.8 / 74.8
- Heading hierarchy: 60.1 / 48.2
Single-metric margins on MPDocBench are thin. Qwen3.8-Max scores 94.3 on text and 89.2 on formulas. All figures are self-reported and appear only in a chart image.
Comparison with other open OCR models
The following table compares Unlimited OCR 2 against its predecessors and competitors.
| Feature | Unlimited OCR 2 | Unlimited-OCR | DeepSeek-OCR-2 | PaddleOCR-VL-1.6 |
|---|---|---|---|---|
| Developer | Baidu | Baidu | DeepSeek | Baidu PaddlePaddle |
| Parameters | 3.34B | 3.34B | 3.39B | 0.96B |
| Active parameters | Not disclosed | Not disclosed | Not disclosed | Not disclosed |
| License | MIT | MIT | Apache 2.0 | Apache 2.0 |
| Paper / release | Oct 2026 (report) | Jun 2026 (arXiv) | Jan 2026 (arXiv) | Jun 2026 (arXiv) |
| Long-document mechanism | SR-SWA, 512-token reference set | Multi-page infer_multi, no SR-SWA | Not disclosed | Not disclosed |
| MPDocBench overall | 84.6 (Baidu) | 61.9 (Baidu) | Not reported | Not reported |
| MarathonDocBench overall | 77.1 (Baidu) | 0.0 (Baidu) | Not reported | Not reported |
| Serving | Transformers, custom SGLang | Transformers, vLLM, SGLang | Transformers, SGLang | PaddleOCR, Transformers |
Parameter counts and licenses are sourced from each model’s Hugging Face page. Benchmark scores come from Baidu’s chart.
Implementation details
The model card lists Transformers for quick tests and SGLang for serving. In Transformers, the infer function handles 1 page with dynamic tiling, known as gundam mode. The infer_multi function parses every page of a document in 1 request, allowing the model to keep cross-page context. Loading requires trust_remote_code=True, which executes Python code from the repo.
SGLang serving uses a customised wheel from Baidu, not the upstream version. Baidu’s example schedules 10 pages per window and reuses the previous window’s KV tail. Smaller windows cut peak memory but weaken cross-page merging. Baidu warns a default bias setting can trigger a 462 MiB allocation and cause an out of memory error.
What it means
For users processing long documents, the ability to handle hundreds of pages in a single request reduces the need for chunking. The system maintains context across the entire file, which is vital for maintaining reading order and table structure. However, the weak performance on heading hierarchy suggests users should not rely on it for complex document structuring without manual verification.

