# Baidu open-sources Unlimited OCR 2 for documents of any length

> The 3B-parameter, MIT-licensed model parses a whole document in one pass and keeps memory use nearly flat as the output grows.

URL: https://claudegpt.si/news/baidu-unlimited-ocr-2-open-source  
Published: 2026-10-28T02:50:54.586Z  
Author: ClaudeGPT Si Newsroom  
Section: AI Models  
Topics: Baidu, OCR, Open-weight models, Hugging Face  
Publisher: ClaudeGPT Si

## Key takeaways

- Baidu released Unlimited OCR 2 on October 27 under the MIT license, with weights on Hugging Face and code on GitHub.
- The model has about 3 billion parameters and uses sparse reference sliding window attention to keep decoding cost nearly constant as documents grow.
- Baidu claims the best results on MPDocBench and MarathonDocBench, but the model card gives no numeric scores.

Baidu released Unlimited OCR 2 on October 27, an open-weight model that reads a long document in one pass instead of page by page. The weights are on [Hugging Face](https://huggingface.co/baidu/Unlimited-OCR-2) under the MIT license, and the code is on [GitHub](https://github.com/baidu/Unlimited-OCR).

OCR models that use a language model to write out the text usually slow down and use more memory as the output grows. Baidu's pitch is that Unlimited OCR 2 does not, which matters for anyone turning long PDFs, contracts or scanned books into text.

## How it keeps memory flat

A language model that writes text keeps a running memory of everything it has produced so far, called the KV cache. The longer the document, the bigger that cache gets, and the slower each new word comes out.

Unlimited OCR 2 uses what its model card calls Sparse Reference Sliding Window Attention (SR-SWA). It compresses the link between text and image tokens into a fixed-size set of working references, for example 512 tokens. Baidu says that keeps the cost of each decoding step and the memory use nearly constant as documents grow.

The idea comes from the first Unlimited OCR, released on June 22. Its [paper](https://arxiv.org/abs/2606.23050) took DeepSeek OCR as the baseline, swapped the decoder's attention layers for a sliding-window design with a constant cache, and reported that the model could transcribe dozens of pages in a single forward pass within a 32,000-token limit. Version 2 arrived alongside a new test set, MarathonDocBench, with documents of about a hundred pages.

## Size, license and how to run it

- **Size:** about 3 billion parameters, according to the model card.
- **License:** MIT, which allows commercial use.
- **Hardware tested:** the authors tested on an NVIDIA A800 with 80 GB of memory.
- **Serving:** Baidu recommends SGLang, an inference server, with a customized build. The model card also lists vLLM, Docker Model Runner and quantized GGUF builds for llama.cpp, Ollama and LM Studio.
- **Use in Python:** load the model with Hugging Face Transformers and `trust_remote_code=True`. One call parses all pages of a document in one request.

Memory settings matter. The model card warns that high concurrency can cause out-of-memory errors, and that a smaller page window uses less memory but merges content across window boundaries less well.

## What we don't know yet

Baidu says Unlimited OCR 2 gets the best results on two benchmarks, MPDocBench, which has documents of dozens of pages, and MarathonDocBench. The model card shows the comparison as an image and gives no numbers in text, so we can't report scores or say by how much it beats other models. Both benchmarks and the claim come from Baidu, and no independent test has been published yet.

Next step for anyone curious: run it on your own long documents and compare against your current OCR tool before switching.

## Sources

- [baidu/Unlimited-OCR-2 model card](https://huggingface.co/baidu/Unlimited-OCR-2), Hugging Face
- [Unlimited-OCR repository](https://github.com/baidu/Unlimited-OCR), GitHub
- [Unlimited OCR Works](https://arxiv.org/abs/2606.23050), arXiv
