Unlimited-OCR: Baidu’s 3B-Parameter Open-Source OCR That Handles 100-Page PDFs in One Pass
Unlimited-OCR is a 3‑billion‑parameter, open‑source OCR model from Baidu that can process an entire 100‑page PDF in a single forward pass using a 32K context window, achieving 93% benchmark accuracy, sub‑0.11% error after 40 pages, multilingual support, and fully offline deployment on consumer‑grade GPUs.
Background
Unlimited-OCR, released by Baidu’s research team in June 2026, targets “one‑shot long‑horizon parsing” so that a model can ingest an entire document (e.g., a 100‑page PDF) in a single forward pass.
Compared with cloud OCR services (AWS Textract, Google Vision, Azure Document Intelligence) that charge $1.5–15 per 1 000 pages, Unlimited-OCR runs locally on a GPU, eliminating per‑page fees and keeping data offline.
Core capabilities
One‑shot long‑text parsing : 32 K token context window enables processing of a 100‑page PDF without page‑wise fragmentation.
Accuracy : Standard benchmark score 93 % (6 % above baseline) and error rate < 0.11 % after 40 pages.
Native multilingual support : Chinese, English, Japanese, Korean and other major languages work out‑of‑the‑box.
Fully offline operation : GPU‑only inference, no network traffic.
Compact model size : 3 B parameters; INT4‑quantized version runs on consumer‑grade GPUs such as RTX 3090.
Framework coverage : Compatible with Transformers, vLLM, SGLang, Ollama, llama.cpp and Docker.
Direct PDF handling : Built‑in PyMuPDF pipeline converts PDF pages to images and runs OCR in a single flow.
OpenAI‑compatible API : Deploy via vLLM or SGLang and call the model through the standard ChatGPT endpoint.
System requirements
GPU memory: ≥ 16 GB for bf16 model; ≥ 8 GB for INT4‑quantized model.
GPU: NVIDIA with CUDA 12.x.
Python: 3.12 or newer.
Dependencies: torch 2.10, transformers 4.57, PyMuPDF, Pillow, einops, etc.
Quick installation (Transformers)
pip install torch torchvision transformers Pillow einops pymupdf
python -c "
import os, torch
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained(
'baidu/Unlimited-OCR',
trust_remote_code=True,
torch_dtype=torch.bfloat16,
)
model = model.eval().cuda()
tokenizer = AutoTokenizer.from_pretrained('baidu/Unlimited-OCR', trust_remote_code=True)
# Single‑image OCR
model.infer(tokenizer,
prompt='<image>document parsing.',
image_file='your_image.jpg',
output_path='./outputs',
base_size=1024, image_size=640, crop_mode=True,
max_length=32768,
no_repeat_ngram_size=35, ngram_window=128,
save_results=True)
# Multi‑page PDF OCR (images pre‑converted with PyMuPDF)
model.infer_multi(tokenizer,
prompt='<image>Multi page parsing.',
image_files=['page1.png', 'page2.png'],
output_path='./outputs',
image_size=1024, max_length=32768,
no_repeat_ngram_size=35, ngram_window=1024,
save_results=True)
"Docker one‑click deployment (vLLM)
docker run --rm --gpus all --network host --ipc host \
vllm/vllm-openai:unlimited-ocr \
baidu/Unlimited-OCR \
--trust-remote-code \
--logits_processors vllm.model_executor.models.unlimited_ocr:NGramPerReqLogitProcessor \
--no-enable-prefix-caching \
--mm-processor-cache-gb 0After the container starts, the model is reachable via the OpenAI‑compatible endpoint:
POST http://127.0.0.1:8000/v1/chat/completionsRelated resources
GitHub: https://github.com/baidu/Unlimited-OCR
Hugging Face: https://huggingface.co/baidu/Unlimited-OCR
arXiv paper: https://arxiv.org/abs/2606.23050
vLLM recipe: https://recipes.vllm.ai/baidu/Unlimited-OCR
Online demo: https://huggingface.co/spaces/baidu/Unlimited-OCR
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.
Black & White Path
We are the beacon of the cyber world, a stepping stone on the road to security.
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.
