Unlimited-OCR-2
by baidu
Baidu's 3.3B-parameter document parser that keeps attention cost bounded, so it can read documents hundreds of pages long, under the MIT licence
baidu/Unlimited-OCR-2Deploy Unlimited-OCR-2
Single-tenantMixpeek has no managed extractor for this model. On a single-tenant deployment you upload the weights and a custom plugin serves them next to the rest of your pipeline.
Overview
Unlimited-OCR-2 is a document parsing model from Baidu, released on October 27, 2026. It has about 3.3B parameters and turns page images into text. Its Sparse Reference Sliding Window Attention (SR-SWA) keeps the attention between the text and the page images to a fixed-size set of working references, 512 tokens in the model card's example, so cost no longer grows with the square of the document's length and a document of hundreds of pages parses within a finite context. It is MIT licensed.
Architecture
A vision-language document parser in the line of DeepSeek-OCR: Baidu describes the first Unlimited-OCR as an attempt to push DeepSeek-OCR one step further. Version 2 adds SR-SWA, which compresses text-visual attention over ultra-long sequences into a fixed set of working references, removing the quadratic growth of attention cost and memory with document length.
Mixpeek SDK Integration
# Parse a multi-page document with Unlimited-OCR-2 (usage from the model card).
# pip install -U transformers torch
import torch
from transformers import AutoModel, AutoTokenizer
model_name = "baidu/Unlimited-OCR-2"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModel.from_pretrained(model_name, trust_remote_code=True, use_safetensors=True,
torch_dtype=torch.bfloat16).eval().cuda()
pages = [f"your_doc/page_{i}.jpg" for i in range(1, 8)]
text, num_tokens = model.infer_multi(tokenizer, image_files=pages,
output_path="output/multi", save_results=True)Capabilities
- Page images to text for long, multi-page documents
- Bounded attention cost through Sparse Reference Sliding Window Attention
- Multilingual documents (per the model card)
- Loads with Hugging Face Transformers (trust_remote_code)
- Fine-tuning supported through ms-swift
Use Cases on Mixpeek
Performance
We have not measured it. Baidu reports state-of-the-art results on MPDocBench and on MarathonDocBench, a benchmark for ultra-long document parsing that it released alongside the model; both are vendor-reported.
Common Pipeline Companions
Frequently Asked Questions
What is Unlimited-OCR-2?
A 3.3B-parameter document parsing model from Baidu, released on October 27, 2026 under the MIT licence. It turns page images into text and is built to read very long documents: its Sparse Reference Sliding Window Attention keeps attention to a fixed set of working references, so a document of hundreds of pages parses within a finite context.
How does Unlimited-OCR-2 handle very long documents?
Ordinary attention costs grow with the square of the sequence, so long documents run out of memory or context. SR-SWA compresses the attention between text and page images to a fixed-size set of working references (512 tokens in the model card's example), which bounds compute and memory however long the document is.
Can I use Unlimited-OCR-2 commercially?
Yes. The weights are published under the MIT licence, which allows commercial use with the licence notice kept.
How accurate is Unlimited-OCR-2?
Baidu reports state-of-the-art results on MPDocBench and on MarathonDocBench, a hundred-page benchmark it released with the model. Those are vendor-reported, and we have not measured it, so test it on a sample of your own documents before switching.
How do I use it with Mixpeek?
Run the parser on your side and upsert the text it returns into a collection, where Mixpeek's text extractor embeds it for search, or index the page images directly with a visual document retriever. Either way the documents stay in your own bucket.
Specification
Research Paper
Model paper or technical report
arxiv.orgBuild a pipeline with Unlimited-OCR-2
Add this model to a processing pipeline alongside other extractors. Combine with retrieval stages for end-to-end search.
Run it on your own data, free