Feed all seven Harry Potter books to a single open-source model: more than 3,600 pages in total, cross-page tables that never break, paragraphs that continue seamlessly across page turns, finished in roughly an hour and a half. That is the official demo behind Unlimited OCR 2, released and open-sourced by Baidu on October 27, 2026. Code and weights are both public: the repository lives at github.com/baidu/Unlimited-OCR, with weights mirrored on Hugging Face as baidu/Unlimited-OCR-2 and on ModelScope as PaddlePaddle/Unlimited-OCR-2. Repo address: github.com/baidu/Unlimited-OCR.
A quick note on scope: we have already covered a six-model open-source OCR comparison (/en/posts/opensource-ocr-models-comparison-review), a deep dive into the 0.9B GLM-OCR (/en/posts/glm-ocr-opensource-resource), and a deployment guide for DeepSeek-OCR's compression route (/en/posts/deepseek-ocr-local-deploy-sop). Those pieces deal with single pages and a few dozen pages. This article covers a different dimension entirely: ultra-long documents, any page count, a whole book in one shot.
Repo and License: MIT, No Strings Attached
The most practical question first. The LICENSE file, checked verbatim, is a standard MIT License with the copyright line "Copyright (c) 2026 Baidu" and no additional commercial restrictions. In plain terms: you can use it commercially, modify it, redistribute it, and deploy it offline on your own hardware; the only obligation is keeping the copyright and license notice. Among open-weight models that ship with "research only" strings attached, this is about as clean as it gets, though MIT's built-in disclaimer still applies, so do not oversell it as "no restrictions at all."
The timeline is worth a glance too. The repository was created on June 18, 2026; the first generation launched on June 22; the second generation arrived in the same repository on October 27, landing simultaneously on ModelScope and Baidu AI Cloud. As for heat, the official announcement cited 28,500 GitHub stars (Oct 27), and a direct check on Oct 30 counted 29,757 — three days of organic growth, still climbing. Baidu has also scheduled a deeper showcase at Baidu World 2026 on November 12.
Benchmarks: Two First Places and One Glaring Gap
According to the official announcement, Unlimited OCR 2 scored 84.6 on MPDocBench and 77.1 on MarathonDocBench, a hundred-page-class benchmark, both end-to-end best in class and clearly ahead of Qwen 3.8-Max, Gemini-3.8-Flash, GLM-5.3-Flash, and DeepSeek-4.1-Flash among the listed entrants. The technical report's precise values are 84.59 and 77.06; the announcement simply rounds them, so the two figures share one source and do not conflict.
The gap to second place is striking. Among the models listed in the report, the runner-up on MarathonDocBench, Kimi-K3, scored just 33.74 — more than forty points behind. On long-document parsing, the distance between a purpose-built architecture and the general-purpose giants is less a gap than a cliff.
But that score needs a qualifier attached: MarathonDocBench is a benchmark Baidu built itself — 100 documents, each 103 to 300 pages, 205,000 annotated elements, annotated with an in-house pipeline, with the benchmark not publicly downloadable at release. The report includes no "split the document and stitch the results" baseline, and as of writing every score is self-reported with no independent third-party reproduction. "First on both boards" is true on Baidu's own turf; independent verification remains pending.
The demo numbers can sit alongside: the official demo parsed all seven Harry Potter books, 3,600+ pages in total; third-party accounts give the precise figure of 3,623 pages, about 1 hour 30 minutes, roughly 1.5 seconds per page. Baidu also demonstrated a combined Four Great Classical Novels volume at 5,026 pages and The Three-Body Problem at 1,200-plus pages.
SR-SWA: Attention That Copies Notes Like a Human
Why is long-document parsing hard? Attention. Full Attention re-reads every visual token in front of it at every decoding step, so the cost grows with the document. Humans do not read that way — someone copying a book keeps their eyes on the current page and flips back only to verify a detail or chase a cross-page reference.
SR-SWA (Sparse Reference Sliding Window Attention) borrows exactly that habit: it compresses text-vision attention interaction into a fixed-size working reference set of about 512 tokens, so single-step decoding latency and VRAM usage barely change with document length. It works in two stages. A Page Gate first narrows each query's visual reference scope from the whole document down to the relevant pages, modeling cross-page positional relations; then Token Buckets pick the highest-scoring buckets of visual tokens to capture long-range dependencies. Third-party technical breakdowns add detail: within candidate pages, every 32 tokens are compressed into a summary key to compute relevance, top-k blocks enter the reference set, and the routing scores participate directly in end-to-end training — no separately distilled router needed.
Decoding pairs this with Unlimited-Horizon Decoding: the document advances in page windows, adjacent windows keep one boundary page whose KV cache is reused to stitch cross-page paragraphs and continued tables, and past windows release their cache from VRAM. At any instant, VRAM holds exactly one window — that is the foundation of the "any page count" claim.
The line separating this from the first generation's R-SWA: R-SWA compressed only the text history into a sliding window and left visual tokens growing with page count, capping input at roughly 40 pages. Generation 2 also bounds how many visual tokens each step sees, which is what licenses the word "unlimited." One more boundary note for context: DeepSeek-OCR, covered previously on this site, lowers token counts through visual compression; SR-SWA controls the attention scope through sparse references. Two different routes toward a similar goal.
Three Product Capabilities: Layout, Cross-Page Tables, Cross-Page Paragraphs
First, native layout parsing. Titles, paragraphs, tables, formulas, and images are segmented automatically, delivered with bounding boxes, block types, and structural hierarchy, with output order matching reading order — downstream RAG or structured ingestion does not need to reassemble the page.
Second, cross-page table merging. Financial reports routinely run consolidated tables across page breaks; the model recognizes the continuation and merges them into one complete table. On the report's T-Table sub-score it reaches 71.11 while no general-purpose model listed exceeds 27 — the lead here is wider than the headline total.
Third, cross-page paragraph continuation. The unbounded-horizon decoding paradigm reconnects paragraphs severed by page breaks at the semantic level, with the official claim of no dropped characters, no scrambled order, no duplication. At book scale, this matters more than single-page accuracy.
Efficiency: The VRAM and Speed Ledger
By official figures, in the hundred-page scenario SR-SWA's single-step decoding runs 7 times faster than Full Attention and 5.6 times faster than the first generation's R-SWA. According to the technical report, peak KV cache in a hundred-page single-sequence test fell from 47GB to 1.77GB, a reduction of about 96.2%, and end-to-end throughput at 16-way concurrency rose from 360 TPS to 1315 TPS, roughly 3.65 times. Two caveats: the 1.77GB covers only the KV cache, not the model weights, so do not convert it into "runs in 4GB of VRAM"; and all of these efficiency numbers are self-reported, with no third-party reproduction yet.
"Unlimited" deserves its quotation marks. Baidu itself acknowledges that image encoding and total runtime still grow with page count — what stays constant is the per-step cost, not the total time. One and a half hours for 3,600 pages is that boundary in plain numbers.
Community Traction: The Inheritance from Generation One
This family is not a newcomer. Generation one launched on June 22, 2026, and the next day topped four boards at once: GitHub Daily Trending overall and Python, plus Hugging Face's global model trending and multimodal trending charts. It crossed 10,000 GitHub stars within five days of open-sourcing. Per China Science Daily, the first generation has surpassed 10 million cumulative Hugging Face downloads, and it received a repost recommendation from Turing Award winner Yann LeCun. Generation two entered with that head start and added nearly 3,000 stars in three days.
Deployment: Two Routes and a Few Potholes
Two inference routes. Route one is native Transformers for quick tests: Python 3.10, torch 2.13.0, transformers 4.52.1; loading the model requires trust_remote_code=True because the custom modeling code lives in the repository, and that code should be audited before production use. Multi-page input goes through infer_multi, which takes the whole document in one request; single-page input defaults to the dynamic slicing "gundam" mode.
Route two is serving, where the official recommendation is a customized SGLang build with an OpenAI-compatible API and page-window scheduling of 10 pages per block, adjacent blocks sharing boundary-page KV. Do not confuse this with generation one: vLLM support is a June 28 record belonging to the first generation, and the generation-two README lists only Transformers and SGLang. Deployment requires installing the repository's custom SGLang wheel; use the latest version stated in the README and build a dedicated environment to avoid conflicts.
Several VRAM-related potholes come straight from the README notes: mem-fraction-static is recommended at 0.7 (0.75 leaves too little headroom above 32-way concurrency); the SAM attention bias defaults to 512-token chunks that permit a single allocation of roughly 462MiB and can OOM — setting SGLANG_OPT_UOCR_SAM_REL_POS_BIAS_MB=64 is equivalent with a lower peak; smaller page windows save VRAM but degrade cross-page merging quality, so block size is a knob to tune per document. One more curiosity: the page-window scheduling variable SGLANG_UOCR_EANABLE_DOC_LIMIT contains "EANABLE" exactly as written in the README — not a typo to fix.
On resource floors: the parameter count exists only as third-party reporting — roughly 3B total with about 500M activated per inference, officially unpublished and commonly read as a MoE structure. Quote it with that qualifier or not at all. The officially disclosed test environment is an NVIDIA A800-80GB; minimum VRAM requirements are unpublished, and a third-party estimate that a 12GB consumer card can run it (the 1.77GB KV cache plus roughly 3B of weights) remains unconfirmed. No official AWQ/GPTQ/int4 quantized releases exist as of writing.
Shortcomings and Boundaries: What the Authors Themselves Admit
Start with a point for honesty: the technical report concedes that MarathonDocBench's HeadingTEDS score for heading hierarchy is just 48.20, the lowest of all its metrics — sparse attention does not preserve global information, so document-level structural understanding is limited, and the stated next step is adding linear attention. If your pipeline depends heavily on heading trees, treat this version with care.
Single-page accuracy is not the selling point either: on OmniDocBench v1.6 it scores 94.02, only 0.1 above generation one, while specialized 0.8B to 4B OCR models score higher on the same board (TeleOCR 96.91, OvisOCR2 96.47). The value is length, not single-page precision — for that, see our six-model comparison.
Stack on the earlier caveats — a self-built benchmark with no independent reproduction, self-reported efficiency numbers — and the selection verdict writes itself: if you hold whole books, full financial report volumes, or entire ledgers that must be structured in one pass, and you can start from A800-class hardware or pressure-test VRAM yourself, Unlimited OCR 2 currently has almost no open-source rival. If your work is single-page tickets and a few-page contracts, it is a sledgehammer cracking nuts.
FAQ
Q1: Where can I download Unlimited OCR 2? What are the GitHub and Hugging Face links? Code and weights live in the GitHub repository github.com/baidu/Unlimited-OCR; weights are mirrored on Hugging Face as baidu/Unlimited-OCR-2 and on ModelScope as PaddlePaddle/Unlimited-OCR-2, with managed access on Baidu AI Cloud and the Baidu AI open platform.
Q2: Is Unlimited OCR 2 free for commercial use? What license does it use? The repository ships a standard MIT License (Copyright (c) 2026 Baidu): commercial use, modification, and redistribution are all allowed, with the sole obligation of keeping the copyright and license notice. MIT's disclaimer still applies.
Q3: How much VRAM do I need to run Unlimited OCR 2? The official test environment is an NVIDIA A800-80GB and the minimum VRAM requirement is unpublished. A third-party estimate suggests a 12GB consumer card may work, but it is unconfirmed. Note that the 1.77GB KV cache figure excludes model weights.
Q4: How is Unlimited OCR 2 different from traditional OCR pipelines like PaddleOCR? Traditional pipelines process page by page; Unlimited OCR 2 uses SR-SWA sparse attention to push the limit to any page count, with cross-page table merging and paragraph continuation as headline features. On single-page accuracy (OmniDocBench v1.6: 94.02) specialized small models still score higher — choose by your document length.
Q5: How many pages can Unlimited OCR 2 parse in one go? It is officially positioned for any page count, demonstrated on 3,600+ Harry Potter pages and a 5,026-page classics compilation. Total runtime still grows with page count — about 1.5 hours for 3,600 pages — so it is not infinitely fast.
Related reading