Baidu Ships Unlimited-OCR-2: A 512-Token Window That Eats 200-Page Documents Whole
Sparse Reference Sliding Window Attention turns per-step OCR cost into a constant, removes the need to chunk long documents, and ships under MIT.
What happened
Baidu published Unlimited-OCR-2, a multilingual document-parsing model built around a mechanism called Sparse Reference Sliding Window Attention, to the Hugging Face hub. The page metadata shows a publication date of 2026-10-26; the model-card changelog and the same-day r/LocalLLaMA thread both date the v2 release to 2026-10-27, and the changelog is the more specific source.
Context
Unlimited-OCR 1.0 appeared on 2026-06-22 as an extension of DeepSeek-OCR. The arXiv paper (2606.23050) landed the next day, a community Space demo within a week, vLLM inference by June 28, and ms-swift training support by July 21. Four months on, v2 ships with a named attention architecture and a companion benchmark, MarathonDocBench, targeting documents in the dozens-to-hundreds-of-pages range. The jump from a research extension to a versioned model with a defined mechanism tells you Baidu is iterating on the core parsing loop, not just adding features.
How it works
Unlimited-OCR-2 takes document page images and produces structured text. Its core contribution is SR-SWA: instead of standard quadratic-complexity attention over the full token sequence, each decoding step attends to a fixed-size sliding reference window — 512 tokens in the model card's example. Per-step compute and memory stay roughly constant regardless of document length. The model card frames this as "true, unbounded document parsing within a finite context window," and MarathonDocBench, released the same day, tests documents in the dozens-to-hundreds-of-pages range.
The model loads through Hugging Face Transformers with trust_remote_code=True, runs in bfloat16, and was validated on a single NVIDIA A800-80GB GPU (Python 3.10, torch 2.13.0, transformers 4.52.1). A multi-page method, infer_multi, parses an entire document in one request with cross-page context. Serving options: SGLang for production, vLLM as an alternative, ms-swift for fine-tuning. At collection time: 189 likes, 513 downloads.
Our read
The tagline — "Pioneering the OCR-3.0 Era" — is doing more work than the mechanism supports. SR-SWA does not remove the context window; it changes what sits inside it. The model still processes 512 reference tokens per step. "Unlimited" means you do not need to pre-chunk a 200-page contract into fixed windows and stitch the results. That is a real win, but it is a different claim than infinite context, and the "unbounded" framing can read as the latter.
Two gaps the model card leaves. Minimum VRAM: the test rig is an A800-80GB, a datacenter card, and no parameter count is given. Whether a 24 GB or 48 GB workstation GPU can load the model in bfloat16 is not stated. Throughput: "nearly constant per-step latency" is a complexity-class claim, not a pages-per-second number. Both require a local benchmark before you plan around them.
The trust_remote_code=True flag means the model executes arbitrary Python from the repository at load time. If your inference host is shared or the pipeline ingests client-supplied documents, that is a supply-chain review item, not a footnote.
And 513 downloads hours after release tells you the ecosystem is still forming. SGLang and vLLM backends exist, but community tooling and edge-case coverage will take iterations.
What this changes
For a studio running ComfyUI and local models, this is an upstream text-extraction step, not a video model. It does not plug into a generation graph. What it does: ingest a 50-page production bible or a 200-page legal contract in a single infer_multi call, get structured text, and feed that into prompt pipelines or a RAG context for downstream video generation. No chunking logic required.
If you already run SGLang or vLLM, the serving path is the same infrastructure. The MIT licence means you can embed the model in client deliverables with no revenue-share obligation.
The tradeoff: validate the VRAM requirement on your own GPU first, and review the repository before pointing a shared inference host at a trust_remote_code model. Nothing changes in the video pipeline itself.
License
The Hugging Face page lists the licence as MIT. That permits unrestricted commercial use, including embedding the model in client deliverables and SaaS products, with no revenue-sharing or usage-ceiling obligation beyond the standard MIT attribution notice. The Baidu Cloud hosted API, if you use it instead of self-hosting, would carry its own service terms, which the sources do not describe.
Key takeaways
- SR-SWA replaces quadratic-complexity attention with a 512-token sliding reference window, making per-step compute and memory roughly constant regardless of document length.
- The model is image-text-to-text: it parses document images into structured text. It is not a video or image-generation model.
- MIT licence, no revenue share, no usage ceiling. Commercial use is permitted.
- The model was tested on an A800-80GB GPU; minimum VRAM for inference is not stated in the sources.
trust_remote_code=Truemeans arbitrary Python executes at load time. Review the repository before exposing the inference host to untrusted input.
Sources
How this post was made
Drafted from clustered primary sources by the models below, then read, edited and approved by a human before it was published. The sources are listed in full at the end of the article.
- Drafted
- Independent sources
- 2
- cluster pair
- clef:27b
- cluster label
- gemma4:12b
- radar brief
- gemma4:12b
- research brief
- qwen3.8:27b
- draft article
- qwen3.8:27b
- short script
- qwen3.8:27b
- seo pack
- gemma4:12b
- Run
- editorial-20261027T160538Z