Unlimited OCR 2
Intro
Unlimited OCR 2 is Baidu Research’s document-parsing OCR model, released and open-sourced on 2026-10-27. Baidu frames it as moving end-to-end OCR from “dozens of pages” to unlimited-horizon parsing of arbitrarily long documents, with vendor-reported SOTA on MPDocBench and MarathonDocBench.
The first Unlimited OCR (2026-06-22) already went viral (Baidu cites 10M+ HF downloads and ~28.5k GitHub stars). Version 2’s headline change is Sparse Reference Sliding Window Attention (SR-SWA): it compresses text–vision attention over ultra-long sequences into a fixed working reference set (e.g. 512 tokens) so per-step decode latency and memory stay nearly flat as page count grows. Weights are on Hugging Face as baidu/Unlimited-OCR-2 (~3B, MIT); code lives at baidu/Unlimited-OCR. The @BaiduResearch launch post saw roughly thousand-scale impressions the same day.
Explain
What’s new (model card / Baidu materials)
- SR-SWA — Inspired by how people copy a book (focus on the current page, look back only when needed), it bounds attention cost instead of letting it grow quadratically with document length.
- Unlimited-horizon parsing — Parse arbitrarily long docs inside a finite context window. Baidu cites a full Harry Potter series (~3600+ pages) in one go and 5,000-page stress tests.
- Benchmarks (vendor-reported) — About 84.6 on MPDocBench and 77.1 on MarathonDocBench; up to ~7× faster decoding vs the prior generation. Compared models include Qwen 3.8-Max, Gemini-3.8-Flash, GLM-5.3-Flash, DeepSeek-4.1-Flash, etc. (not independently reproduced here).
Inference & product surface
- Open weights: Transformers for quick tests; SGLang recommended for serving (page-window scheduling, KV-tail reuse).
- Managed API: Baidu Cloud / Baidu AI Open Platform “Unlimited-OCR” async document-parse API with JSON/Markdown output.
Radar note
Gen-1 was never stored as its own lead. Gen-2 is a same-day, verifiable named release (new attention mechanism + unlimited-page narrative + new weight repo), so we track Unlimited OCR 2.
Usage
Try it
- Model card: https://huggingface.co/baidu/Unlimited-OCR-2
- Code: https://github.com/baidu/Unlimited-OCR
- Local: install deps from the card, then
AutoModel.from_pretrained("baidu/Unlimited-OCR-2", trust_remote_code=True)and callinfer/infer_multi; prefer SGLang for long docs. - Cloud: Baidu AI Open Platform Unlimited-OCR async tasks (submit → poll).
Who it’s for
- Doc-AI / RAG teams that need to ingest hundreds or thousands of pages in one pass
- Researchers comparing open OCR-3.0 / ultra-long document parsers
Caveats
- Scores and speedups are Baidu-reported
- Heading hierarchy on ultra-long docs still has acknowledged gaps
- Self-hosting requires
trust_remote_code; production should prefer SGLang or the cloud API