Baidu Unlimited OCR 2: 500M-Param Model Tops Long-Doc Benchmarks, Parses 5000+ Pages on Consumer GPU
Baidu open-sources Unlimited OCR 2, a 3B-parameter document parsing model with only 500M activated parameters, achieving state-of-the-art on MarathonDocBench (77.06) and MPDocBench (84.59), processing 5000+ page PDFs in one pass with 96% KV memory reduction via SR-SWA attention and unlimited decoding.
Baidu has released Unlimited OCR 2 , the second generation of its open-source document parsing model. The model contains 3B total parameters but activates only 500M parameters per inference step , yet it tops two authoritative long-document benchmarks:
MarathonDocBench (103–300 pages): 77.06 , ranking first.
MPDocBench (multi-page cross-page): 84.59 , ranking first.
By comparison, Gemini-3.1-Pro scores 26.97 on MarathonDocBench, and some general-purpose flagships crash at page 223. Unlimited OCR 2 outperforms the runner-up by 2.3× .
Real-world stress tests
The article demonstrates three extreme scenarios:
1. 5,026-page "Four Great Classics" compilation
The model ingested a single PDF merging Romance of the Three Kingdoms , Water Margin , Journey to the West , and Dream of the Red Chamber — 5,026 pages — without splitting. It processed the entire document continuously, and the final page (page 5,026) correctly output the closing verse of Dream of the Red Chamber . To rule out memorization, the authors created a 240-page, 173,000-character novel with 32 injected traps (e.g., "Ye Wenjie" → "Ye Wenqing" on page 2, page number 742 → 724 on page 237). Unlimited OCR 2 reproduced every trap exactly, proving it reads pixels rather than relying on training memory.
2. 300-page financial ledger with 176 negative reversals
A synthetic 300-page, 3,000-entry hotel ledger containing 176 negative reversal entries was parsed in one go. The model automatically stripped repeated table headers across pages. Script verification showed 3,000 records with 0 omissions, 0 duplicates, 9,000 numeric fields and 176 reversals all correct . The summed net amount 9,258,968.05 matched the source to the cent.
3. Complex layout: 15-page technical report + asymmetric three-column foldout
The model parsed Baidu's own 15-page technical report, correctly handling a sentence split across pages 7–8 by a half-page figure and caption: it extracted the figure separately and stitched the two sentence halves seamlessly. Formulas and algorithm pseudocode were converted to compilable LaTeX. A double-page asymmetric three-column foldout with dark sidebars, multiple tables, cross-page continuation tables, and 6.8pt footnotes was reproduced with correct reading order and all 60 table cells, inline formulas, and 4 footnotes matching the original.
Why general LLMs fail on long PDFs
Standard full attention forces the model to recompute all previous visual tokens for each new token. Each PDF page generates thousands of visual tokens; decoding latency grows from 3 ms (2 pages) to 27 ms (100 pages) , and irrelevant pixels flood the context, causing attention collapse.
Core innovation: SR-SWA (Sparse Reference Sliding Window Attention)
Inspired by human scribes who only glance at the current page and occasionally flip back, SR-SWA exploits the fact that intra-page information is dense, cross-page visual links are extremely sparse . It operates in two stages:
Page Gate — narrows the search from thousands of pages to a few candidate pages.
Token Sieve — scores tokens within candidate pages and selects only the most relevant visual blocks (e.g., "lightning scar" or "Horcrux") for attention.
Unlike distillation-based sparse methods, the routing scores participate directly in the forward pass, so OCR transcription gradients flow end-to-end. The model learns which page to turn to and which block to attend from the transcription task itself, keeping per-step visual computation constant regardless of document length.
Unlimited-Horizon Decoding
To eliminate the memory wall, the system processes the document in sliding windows. Adjacent windows share a single boundary page whose KV cache is reused, ensuring seamless cross-page sentence and table continuation. Once a window finishes, its KV cache is physically released from GPU memory — "read and discard, travel light." This reduces peak single-sequence KV memory by 96.2% , from 47.00 GB to 1.77 GB , enabling inference on a single consumer GPU.
Performance gains at 100-page scale
16-way concurrent throughput : 3.65× increase, from 360 TPS to 1,315 TPS.
Per-step decoding latency : 7.0× faster than standard full attention, 5.6× faster than the first-gen R-SWA.
Accuracy remains flat while general models plummet; latency stays flat while theirs spikes.
Open-source availability
Model weights and code are released on:
GitHub: https://github.com/baidu/Unlimited-OCR HuggingFace: https://huggingface.co/baidu/Unlimited-OCR-2 The technical report opens with a Fate/stay night "Unlimited Blade Works" chant adapted for OCR, crediting community member Snarcy. The authors frame this as the arrival of OCR 3.0 — where a small open model removes the page-limit ceiling for document understanding.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Machine Learning Algorithms & Natural Language Processing
Focused on frontier AI technologies, empowering AI researchers' progress.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
