Baidu Unlimited OCR Parses Dozens of Pages in One Pass
What Baidu Unlimited OCR Actually Is Baidu Unlimited OCR — the model described in the paper Unlimited OCR Works — landed on Hugging Face on June 22, 2026
Researched and drafted with AI assistance, then screened by automated editorial checks before publishing. How we work.

What Baidu Unlimited OCR Actually Is
Baidu Unlimited OCR — the model described in the paper Unlimited OCR Works — landed on Hugging Face on June 22, 2026 with a bold claim: transcribe dozens of dense document pages in a single forward pass, without the memory blowup that has derailed every other large-model OCR approach. According to the official model card, the model has drawn over 2.1 million downloads in the last month (2,122,848 at time of publication), spawned 35 community demo Spaces, and earned dedicated inference support from both vLLM and SGLang — signs that developers are treating this as a genuine architectural shift, not just incremental polish.
Released under the permissive MIT license, baidu/Unlimited-OCR is a 3-billion-parameter vision-language model built from the ground up for document parsing at scale. Weights ship in BF16 (bfloat16) safetensors format, and the model is tagged on Hugging Face as image-text-to-text, multilingual, unlimited-ocr, and feature-extraction. Loading requires trust_remote_code=True because the model ships custom Python classes — most importantly a novel logit processor named DeepseekOCRNoRepeatNGramLogitProcessor — that have not yet made it into mainline Transformers.
The accompanying research paper, Unlimited OCR Works (arXiv:2606.23050, posted June 23, 2026), comes from a 17-person team at Baidu led by Youyang Yin. It frames the model's mission in human-cognitive terms: emulating the working memory a skilled reader uses when scanning a long document, and making that process computationally constant — never slower or more memory-hungry on page 50 than on page 1.
Baidu positions the model explicitly as building on the DeepSeek-OCR lineage. The model card uses DeepSeek-OCR as its baseline, and the Acknowledgements section thanks DeepSeek-OCR, DeepSeek-OCR-2, and PaddleOCR "for their valuable models and ideas." The custom logit processor class even carries the DeepseekOCR prefix, making that genealogy impossible to miss. This puts Unlimited OCR in the same competitive cluster as Alibaba's push to punch above parameter weight with efficient architectures — a pattern that keeps recurring as Chinese AI labs compete to own practical, deployable document-AI tasks.
The Core Innovation: Reference Sliding Window Attention
The central technical contribution of Unlimited OCR Works is Reference Sliding Window Attention (R-SWA), a redesigned attention mechanism that, per the paper's abstract, replaces every standard attention layer in the decoder. Understanding why it matters means understanding the problem it was built to solve.
Standard LLM-decoder-based OCR models — including the DeepSeek-OCR family — generate text autoregressively. With each new token produced, the key-value (KV) cache grows. For a document parser whose output might run to thousands of tokens of verbatim transcription, this creates a double bind: memory consumption climbs steadily, and attention over an ever-longer cached sequence slows generation. Models that are theoretically capable of long outputs become impractical on real, multi-page documents.
R-SWA breaks that coupling. By redesigning attention so that the KV cache size stays constant throughout the entire decoding process, Baidu's researchers let the decoder run at the same memory footprint whether it is generating token 100 or token 30,000, while also reducing attention computation cost. Combined with a high-compression-rate visual encoder inherited from DeepSeek-OCR, the system can fit dozens of document pages — up to the model's 32,768-token context window — into a single forward pass, which is what the "one-shot long-horizon parsing" framing actually means.
Why constant KV cache matters: This is not merely an engineering nicety. It is the difference between a model that works in theory and one you can actually deploy on real enterprise document workloads — legal contracts, financial reports, academic papers — without needing server-class GPU memory or fragile multi-pass chunking pipelines.
The paper's abstract also describes R-SWA as a general-purpose parsing attention mechanism, explicitly citing applicability to automatic speech recognition (ASR) and translation tasks beyond OCR. If that claim holds up under independent scrutiny, the architectural contribution could outlive the specific model that introduces it, and derivative work targeting those modalities is plausible within months.
Inference Modes, Configs, and the "Gundam" Setting
The model card documents two named inference configurations for document parsing, each calibrated for different input characteristics. The colorful name gundam refers to the single-image, high-detail mode with cropping enabled; base covers full-page single images and, critically, all multi-page or PDF workloads.
| Config Name | base_size | image_size | crop_mode | ngram_window | Recommended Use Case |
|---|---|---|---|---|---|
| gundam | 1024 | 640 | True | 128 | Single image with fine-grained crops; maximises per-image accuracy on complex layouts |
| base | 1024 | 1024 | False | 1024 | Full-page single images and all multi-page / PDF workloads; expanded ngram window handles long output sequences |
base config (image_size 1024, no cropping, ngram_window 1024) is the only valid option for multi-page documents and PDFs.For multi-page documents and PDFs, only the base configuration applies, with ngram_window set to 1024 to handle the much longer output sequences. PDFs are pre-processed by converting each page to an image at 300 DPI using PyMuPDF before being passed to the model. The global no_repeat_ngram_size=35 parameter — enforced by the custom logit processor — stops the model from looping on repetitive document elements such as headers, watermarks, or table separators. The max_length ceiling of 32,768 tokens applies across all inference modes; at typical character-to-token ratios, this accommodates a substantial multi-page document in a single inference call.
Running Baidu Unlimited OCR: From pip to Production Containers
One of Unlimited OCR's strongest practical attributes is the breadth of its inference ecosystem at launch. Four distinct deployment paths are available, ranging from a simple Python script to enterprise-grade container deployments.
Path 1 — Transformers (Direct Python)
The reference implementation targets Python 3.12.3 with CUDA 12.9. Required packages include torch==2.10.0, transformers==4.57.1, einops==0.8.2, pymupdf==1.27.2.2, and addict==2.4.0. Model loading is straightforward:

from transformers import AutoModel, AutoTokenizer
import torch
model = AutoModel.from_pretrained(
"baidu/Unlimited-OCR",
trust_remote_code=True,
torch_dtype=torch.bfloat16
)
model = model.eval().cuda()
Note that trust_remote_code=True is mandatory. Without it, the custom logit processor and model architecture classes will not load, and inference will fail silently or raise an import error.
Path 2 — vLLM (OpenAI-Compatible Production Server)
Thanks to a contribution the model card credits to the vLLM community and Tianyu Guo ("our model now supports vLLM inference"), Unlimited OCR can be served through vLLM's OpenAI-compatible REST API. Baidu ships two dedicated Docker images to sidestep dependency conflicts between the custom model code and standard vLLM builds:
# Default CUDA 13.0 build (per Baidu's documentation):
docker pull vllm/vllm-openai:unlimited-ocr
# Hopper-generation GPUs (H100 / H200), CUDA 12.9:
docker pull vllm/vllm-openai:unlimited-ocr-cu129
A pip-based launch is also supported:
vllm serve "baidu/Unlimited-OCR"
This path suits teams already running vLLM infrastructure who want to expose document parsing as a microservice behind a standard REST endpoint — particularly relevant for RAG pipelines already consuming OpenAI-compatible completions APIs.
Path 3 — SGLang (High-Performance Fine-Grained Serving)
For operators who need fine-grained control over memory allocation and scheduling, SGLang support is fully documented (via the lmsysorg/sglang:latest image). The recommended server launch command exposes several production-critical flags:
python -m sglang.launch_server \
--model baidu/Unlimited-OCR \
--served-model-name Unlimited-OCR \
--attention-backend fa3 \
--page-size 1 \
--mem-fraction-static 0.8 \
--context-length 32768 \
--enable-custom-logit-processor \
--disable-overlap-schedule \
--skip-server-warmup \
--host 0.0.0.0 \
--port 10000
Two flags are non-negotiable for correct output. --enable-custom-logit-processor wires in the no-repeat NGram logic that prevents hallucination loops on repetitive document layouts, and --disable-overlap-schedule ensures the custom processor fires at the right point in the generation pipeline. Leave either out and you risk degenerate output on documents with repeated structural elements. SGLang also offers a Python streaming client that routes automatically to gundam mode for single images or base mode for multi-image and PDF inputs.
Path 4 — GGUF Quantizations: Ollama, LM Studio, and llama.cpp
The Hugging Face model repository lists 18 community quantization variants in its model tree, enabling deployment via llama.cpp, Ollama, and LM Studio — the consumer-grade local inference stack. For developers searching for baidu unlimited ocr gguf or ollama baidu unlimited-ocr, these quantizations lower the hardware floor considerably: a Q4 variant of a 3B model fits comfortably in 4–6 GB of VRAM, putting it within reach of mid-range consumer GPUs. Docker Model Runner is also documented:
docker model run hf.co/baidu/Unlimited-OCR
Those 18 GGUF variants represent active community effort rather than official Baidu packaging — an early signal that practitioners believe the model is genuinely useful in production rather than only academically interesting. This breadth of deployment options at launch reflects both the maturity of the open-source inference ecosystem and the degree to which Baidu prepared the release for immediate practical uptake, echoing the broader industry shift toward models designed for deployment rather than demonstration.
Benchmarks: Exceptional Text Content, Weak Formatting Fidelity
For developers evaluating baidu unlimited ocr benchmark data, the primary published reference is the llamaindex/ParseBench leaderboard, where Unlimited OCR runs under the pipeline name unlimitedocr. ParseBench evaluates document parsing models across multiple axes — "Text Content" measures how accurately raw words are recovered, and "Text Formatting" measures how faithfully structural markup (headings, lists, column layouts, tables) appears in the output.
| ParseBench Metric | Score | Interpretation |
|---|---|---|
| Mean (Overall) | 46.17 | Competitive mid-range for the 3B parameter class |
| Text Content | 86.81 | Exceptional — reliably recovers actual words from documents |
| Text Formatting | 0.97 | Near-zero — structural markup is largely not reproduced |
unlimitedocr), as reported on the model card. Additional sub-metrics were not fully published on the model card at time of writing; the complete breakdown is available on the ParseBench leaderboard directly.The 86.81 Text Content score is exceptional: the model reliably extracts the actual words from documents at a rate that meets or exceeds most competing parsers in its parameter class. The 0.97 Text Formatting score, though, reveals a significant current limitation — the model largely does not attempt to replicate original document structure such as headers, bullet points, column layouts, or nested tables.
The gap between near-perfect text extraction and near-zero formatting reproduction reads as a design trade-off, not a random bug. Unlimited OCR is optimised for content fidelity first. For search indexing, RAG ingestion pipelines, and translation workflows, that is exactly the right trade-off. For document reconstruction — generating clean Markdown from a scanned PDF, preserving spreadsheet structure, or producing accessible HTML from a regulatory filing — the formatting gap is consequential and, for now, likely rules the model out until it is addressed.
Worth noting: the arXiv paper (2606.23050) does not reproduce numerical benchmark tables in its abstract, which means detailed head-to-head comparisons with DeepSeek-OCR-2 and other baselines live in the full paper body. Practitioners who need those comparisons should read the paper directly rather than relying on the model card summary.
Interactive Demos and Community Uptake
For developers who want to test baidu unlimited ocr demo capabilities before committing to a local deployment, several options are immediately available. Within two days of the June 22, 2026 launch, Hugging Face community figure AK (akhaliq) published an interactive demo Space — credited in the official model card on June 24, 2026 — and vLLM support was acknowledged shortly after, on June 28, 2026. The model now powers 35 Hugging Face Spaces, including community-built comparison tools that pit it directly against DeepSeek-OCR-2 on identical document inputs.

On GitHub and in developer communities — under search terms like baidu unlimited ocr github and baidu unlimited ocr reddit — practitioners are probing its limits on handwritten Chinese documents, multi-column academic PDFs, financial tables, and mixed-language invoices. The 18 GGUF quantization variants signal sustained community investment in making the model accessible on consumer hardware rather than just cloud infrastructure.
The 2.1-million-plus downloads reported on the model card (a last-month figure) put Unlimited OCR among the fastest-adopted new OCR models on Hugging Face — a metric that carries real weight given how crowded the document-AI space has become. This velocity mirrors the pattern seen with other efficient, task-specific open models that lower the deployment barrier without demanding frontier-scale infrastructure, which is directly relevant to the growing population of developers building LLM-powered applications who need reliable document ingestion.
Frequently Asked Questions
Does baidu unlimited ocr work on handwritten documents?
The model card and paper focus on printed and digitally rendered document types — PDFs, scanned pages, financial tables, academic papers. Handwriting support is not explicitly claimed. Community reports from early adopters experimenting via Hugging Face Spaces suggest variable results on handwritten Chinese and Latin-script text: adequate for neat writing, degraded on cursive. Until Baidu publishes handwriting-specific benchmarks, treat handwriting support as unconfirmed.
Is baidu unlimited ocr multilingual?
Yes — it is tagged multilingual on Hugging Face, consistent with its DeepSeek-OCR lineage, which covers Chinese, English, and other languages. The training data composition and per-language benchmark scores are not detailed in the public model card.
Where can I find baidu unlimited ocr on Reddit?
Discussions appear in r/LocalLLaMA, r/MachineLearning, and r/singularity under searches for "Baidu Unlimited OCR" or "unlimited-ocr." Common topics include GGUF quantization performance, comparisons with Tesseract and DocTR, and vLLM deployment configurations.
Can baidu unlimited ocr run on a consumer GPU?
The BF16 reference weights require roughly 6 GB of VRAM at minimum for a 3B model. Community GGUF quantizations (Q4_K_M and below) cut this further, into the 3–4 GB range, putting the model within reach of an RTX 3060 or similar. Use Ollama or LM Studio with the appropriate GGUF variant for consumer deployments.
What is the difference between the gundam and base configs?
The gundam config uses a smaller image size (640 px) with cropping enabled (crop_mode=True) and an ngram_window of 128 — it breaks a single image into sub-regions to maximise detail extraction at the cost of slightly more computation. The base config uses a full 1024 px image without cropping (crop_mode=False) and an ngram_window of 1024, and it is the only valid option for multi-page documents and PDFs, where the larger window handles long outputs. These are the only two named configurations documented on the model card.
Key Takeaways
- Architecture: R-SWA (Reference Sliding Window Attention) keeps KV cache constant throughout decoding — directly targeting the memory-blowup problem that makes standard LLM decoders impractical for long-document OCR.
- Size and license: 3B parameters, BF16, MIT license — small enough for a single high-end consumer GPU; permissive enough for unrestricted commercial deployment.
- Context window: 32,768 tokens; parses dozens of document pages in a single forward pass at 300 DPI input resolution.
- Benchmark profile: Exceptional text content extraction (86.81 on ParseBench); near-zero formatting fidelity (0.97) — purpose-built for content-first pipelines such as RAG, search indexing, and translation, not document reconstruction.
- Deployment breadth: Transformers, vLLM (two dedicated Docker images), SGLang, llama.cpp / Ollama / LM Studio (18 community GGUF variants), and Docker Model Runner — all available at launch.
- Ecosystem velocity: 2.1M+ downloads (last-month figure, per the model card) and 35 Hugging Face Spaces since the June 22, 2026 launch — unusually rapid community adoption for a domain-specific model.
- Lineage and generalization: Explicitly builds on DeepSeek-OCR and PaddleOCR; R-SWA is claimed by the authors to generalize to ASR and translation tasks.
What Comes Next
The most pressing open question is whether the near-zero ParseBench formatting score reflects a fundamental architectural limitation of R-SWA's constant KV cache or a fine-tuning data problem that targeted supervised training on structured output formats could fix. Baidu's model card is sparse on training details, and the full Unlimited OCR Works paper (arXiv:2606.23050) — which likely contains ablation studies and per-task breakdowns — is the key document to watch as the research community works through it.
If R-SWA generalizes as the authors claim to ASR and translation, it represents not just a better OCR model but a new class of constant-memory sequence parsers. The next six months will reveal whether that promise survives contact with real-world benchmarks beyond document OCR.
Several near-term developments are worth watching:
- Official Ollama / LM Studio packaging: The 18 community GGUF variants prove the infrastructure is ready; official one-click profiles seem like a natural next step.
- Formatting fine-tune: Community fine-tunes targeting structured Markdown or HTML output could close the 0.97 formatting gap — watch Hugging Face for derivative models in the coming months.
- Handwriting and domain benchmarks: Official per-language and per-document-type breakdowns are absent from the launch materials; their publication will clarify where Unlimited OCR is and is not the right tool.
- ASR / translation derivatives: If R-SWA is as general as claimed, expect papers applying it to streaming speech recognition or document translation within the year.
- Enterprise integration: The vLLM OpenAI-compatible path positions Unlimited OCR as a drop-in document-ingestion backend for any RAG system already speaking that protocol; Baidu Cloud availability (documented from July 3, 2026) further lowers the barrier for managed use.
For the growing number of developers who need reliable, open, locally-runnable OCR at scale, Baidu may have released one of the most practically deployable options in the 3B parameter class — provided the workload prioritizes getting the words right over getting the formatting right. That is a meaningful qualification, but for the majority of LLM-powered document pipelines today, it is exactly the right trade-off.
All download counts, Space counts, and benchmark figures cited in this article reflect data reported on the Hugging Face model card and the llamaindex/ParseBench leaderboard at the time of publication. Figures may have changed materially since then; verify current metrics directly on the respective platforms.
Topics
Sources
Comments(0)
No comments yet. Be the first to share your thoughts.
Join the conversation
Your email stays private and comments are reviewed before appearing.


