Baidu Unlimited-OCR-2: An Open Model for Parsing Very Long Documents
Baidu's Unlimited-OCR-2 is a 3B-parameter, MIT-licensed model for reading very long documents. Here is what it does, how to run it, and its limits.
Baidu has released Unlimited-OCR-2, an open model built to read very long documents without slowing down as the page count grows. It is a small model (about 3 billion parameters) with a permissive MIT licence, which makes it interesting for teams that process contracts, statements, filings or scanned files at volume. Below is what the model page says, what is claimed, and what we could not verify.
What OCR is and what is different here
OCR, short for optical character recognition, turns a picture of text into digital text. Older OCR reads one page at a time and loses the thread across pages. Newer "document AI" models try to keep structure such as tables, headings and references intact, which matters when page 40 refers back to page 3.
Baidu's headline idea is Sparse Reference Sliding Window Attention (SR-SWA). Think of reading a long report with a small window that slides forward while keeping a few bookmarks to earlier pages. According to the model card, this keeps per-step speed and memory use nearly constant as a document gets longer, so a hundred-page file should not cost dramatically more per page than a ten-page one.
Key facts from the model page
- Size and format: 3B parameters, distributed as Safetensors in BF16.
- Licence: MIT, which allows commercial use under its terms.
- Benchmarks: the page claims state-of-the-art results on MPDocBench (documents of dozens of pages) and MarathonDocBench (hundred-page documents). A newsletter reports author-stated scores of 84.59 on MPDocBench, against 78.30 for Qwen3.8-Max, and 77.06 on MarathonDocBench. The scores appear only in a leaderboard image on the page, and we have not verified them independently.
- Tested setup: the card lists torch 2.13.0 and transformers 4.52.1 on an A800-80GB GPU.
How to run it
You can load it with the Transformers library using trustremotecode=True, meaning you allow custom code from the repository to run. Use infermulti for whole documents and infer for single pages. For serving, the card recommends SGLang, but that needs a customised build. vLLM and Docker Model Runner are listed as options, and quantised versions exist. No hosted inference provider currently serves the model.
Limits to plan around
- Running custom remote code needs a security review before production use.
- Memory depends on settings; smaller page windows save memory but weaken context across page boundaries.
- Output per page is capped at 20,000 tokens by default.
- Benchmark claims come from the authors.
Where it could matter for lenders and fintechs
This is our inference, not a claim from Baidu: long loan files, bank statements and KYC bundles are exactly the kind of multi-page documents such a model might help extract data from. Before using any OCR model on customer data, test accuracy on your own samples, check data-protection obligations, and keep a human check for high-value decisions.
A simple way to test it
Pick twenty real documents of different lengths, including some scans with stamps, tables and handwriting. Run them through the model and through your current tool. Check three things: whether numbers in tables are read correctly, whether the order of sections is preserved, and whether accuracy holds up on the last pages of a long file, since that is where long-document tools tend to slip. Also measure time and GPU memory at ten, fifty and a hundred pages to see whether the near-constant cost claim holds on your hardware. Small, open models are cheap to trial, so a one-week bake-off is a reasonable first step before any procurement discussion.
Key takeaways
- Unlimited-OCR-2 is a 3B-parameter, MIT-licensed model designed to parse long documents with near-constant speed and memory.
- Benchmark scores are author-reported and appear only in an image, so test on your own documents.
- Running it needs a custom code setup and, for serving, a customised SGLang build.
Sources
- [Hugging Face: baidu/Unlimited-OCR-2](https://huggingface.co/baidu/Unlimited-OCR-2)
- [Sam on AI: AI Brief, October 27, 2026](https://samonai.substack.com/p/ai-brief-october-27-2026)
Tags: OCR Baidu open-source AI document AI product release