Baidu releases Unlimited-OCR-2 for unlimited-length document parsing
Baidu has released Unlimited-OCR-2 on Hugging Face, an OCR[1] model introduced with the tagline “Pioneering the OCR-3.0 Era: From Long- to Unlimited-Horizon Parsing.” The first version, Unlimited-OCR, was presented on 2026/06/22 as an effort to push Deepseek-OCR one step further, with a paper on arXiv on 2026/06/23; version 2 followed on 2026/10/27. The model card documents usage with Transformers, vLLM, SGLang and Docker Model Runner, includes Google Colab and Kaggle notebooks, and notes training support via ms-swift.
The headline feature of version 2 is Sparse Reference Sliding Window Attention (SR-SWA[2]), which compresses text-visual attention interactions from ultra-long sequences into a fixed-size set of working references, such as 512 tokens. This bounds computational complexity, keeping per-step decoding latency and memory footprint nearly constant regardless of document length. It enables unbounded document parsing within a finite context window, removing quadratic attention scaling and memory bottlenecks as documents grow. The authors report state-of-the-art performance on dozens-of-pages benchmarks such as MPDocBench and extreme hundred-page benchmarks such as MarathonDocBench.
For inference, the model runs natively under Transformers for quick tests, while SGLang is the recommended serving setup, tested with Python 3.10, torch==2.13.0 and transformers==4.52.1 on an NVIDIA A800-80GB. The infer_multi call parses all pages of a document in one request so the model can use cross-page context, while infer encodes a single page with dynamic tiling (gundam mode[3]) by default. The SGLang serving path uses a customized wheel plus PyMuPDF for PDF-to-image conversion, schedules very long documents in page windows of 10 pages with the KV cache[4] tail of the previous window reused, and caps output at 20000 tokens per page.
Read the original huggingface.coDiscussion on Hugging Face
Sources
-
Hugging Face
baidu/Unlimited-OCR-2
-
KRGeekNews KO
Unlimited-OCR 2 - 페이지 간 문맥을 이어 수백 페이지 문서를 파싱하는 OCR 모델
-
huggingface.co
baidu/Unlimited-OCR-2 · Hugging Face


