Unlimited-OCR Review: Baidu's Open-Source 3B-Parameter Model Reads 100-Page PDFs in One Pass (2026)

Unlimited-OCR Review: Baidu's Open-Source 3B-Parameter Model Reads 100-Page PDFs in One Pass (2026)

The Three Pain Points of Traditional OCR: Page Breaks, Lost Context, Cloud Bills

If you’ve ever processed PDF document recognition for more than 10 pages, you’re certainly familiar with the following scenarios:

Pain Point 1: Page Break Fragmentation. Traditional OCR tools process page by page. When a paragraph spans two pages, the latter half gets truncated to the beginning of the next page. Contract clauses, paper footnotes, financial report footnote areas — these are precisely the content that most needs contextual continuity, and exactly where page-by-page OCR makes the most errors.

Pain Point 2: Context Loss. Page-by-page recognition means the model “cannot see” the preceding and following text. In a 50-page academic paper, if a formula on page 30 references a symbol definition on page 5, traditional OCR cannot establish this cross-page connection. What you get is a pile of “correct but fragmented” text snippets, not a structured complete document.

Pain Point 3: Cloud Bills. Commercial OCR services (ABBYY, Adobe Acrobat Pro, Google Document AI) charge per page. For a 200-page scan, Adobe’s monthly fee is approximately ¥100-200; if batch-processing historical archives, costs can easily exceed a thousand yuan. Not to mention that uploading confidential documents to third-party cloud services carries compliance risks in itself.

In June 2026, Baidu open-sourced a model called Unlimited-OCR on Hugging Face, directly targeting these three pain points. With only 3 billion parameters, it can completely parse dozens or even hundreds of pages of PDF documents in a single forward pass — no page splitting, no cloud required, fully open-source under the MIT license.

This is not yet another incremental improvement of “0.5% accuracy boost.” It fundamentally changes how OCR works.

What is Unlimited-OCR? Baidu’s Open-Source 3B-Parameter Model

Unlimited-OCR is Baidu’s next-generation document parsing model developed based on the DeepSeek-OCR technical approach. Its core positioning can be summarized in one sentence: simulating human “transcription working memory.”

Imagine a skilled secretary transcribing a thick document. She doesn’t need to tear the document into individual pages and transcribe them separately — she remembers the context, continuously transcribes dozens of pages, with speed and accuracy barely declining. That’s exactly what Unlimited-OCR does, except it implements this “working memory” using neural networks.

Key Metrics at a Glance

MetricValue
Total Parameters3 billion (3.3B)
Inference Active ParametersOnly 500 million
Supported Pages100+ pages per single inference
Maximum Output Length32K tokens
Open-Source LicenseMIT (fully free for commercial use)
Hugging Face Downloads9 million+ (as of October 2026)
GitHub Stars24,000+
OmniDocBench v1.5 Score93% (6% above DeepSeek-OCR baseline)

Relationship with DeepSeek-OCR

Unlimited-OCR didn’t start from scratch. It stands on the shoulders of DeepSeek-OCR, retaining the latter’s DeepEncoder (high-compression visual encoder), but made fundamental changes on the decoding end — replacing all attention layers with an entirely new R-SWA (Reference Sliding Window Attention) mechanism.

The effect of this transformation: when DeepSeek-OCR processes long documents, as the output grows longer, the KV Cache keeps expanding and generation speed keeps slowing down (the typical Transformer “the longer, the slower” problem). Meanwhile, Unlimited-OCR’s KV Cache remains constant throughout the entire decoding process — whether processing 5 pages or 100 pages, the speed stays consistent.

Core Technology Deep Dive: R-SWA (Reference Sliding Window Attention)

This is Unlimited-OCR’s most critical technical innovation, worth understanding in depth.

The Dilemma of Traditional Attention

Standard Transformer self-attention has computational complexity that is quadratic in sequence length. When you output the 10,000th token, the model needs to attend to the KV Cache of all preceding tokens — this not only consumes massive VRAM but also makes every inference step progressively slower.

This is why traditional OCR models “get slower and slower” when processing long documents: by page 50, the KV Cache has expanded to an unmanageable scale.

R-SWA’s Solution

R-SWA’s approach is clever: instead of making the model remember all history, it makes the model work in a “sliding window” fashion like humans do.

Specifically:

  1. Sliding Window Attention: When generating each token, the model only attends to tokens within a recent fixed window (rather than all history), reducing attention computation complexity from O(n²) to O(n).

  2. Reference Mechanism: When the window slides, instead of simply discarding old information, it preserves critical context through a compressed “reference representation.” This is like a human transcribing — while the eyes only look at the current paragraph, the brain retains a summary of the preceding text.

  3. Constant KV Cache: Regardless of output length, the KV Cache size remains unchanged. This means VRAM usage is constant, and inference speed doesn’t degrade with document length.

Two-Level Visual Encoding + 16x Token Compression

On the encoding side, Unlimited-OCR employs a two-level visual encoding strategy:

  • Level 1: The “Gundam Vision Stack” composed of SAM-ViT-B + CLIP-L encodes 1024×1024 PDF page images into high-resolution visual features.
  • Level 2: During the connection phase, it performs 16x token compression, reducing a page’s visual tokens from 1024 to just 256.

This means when processing a 100-page PDF, the model only needs to handle approximately 25,600 visual tokens — well within the 32K context window, with room to spare for output text.

Why R-SWA is “Universal Parsing Attention”

The paper specifically notes that R-SWA is not limited to OCR. It also applies to speech recognition (ASR), machine translation, and other tasks requiring “long sequence parsing.” Essentially, any scenario requiring “transcribing long inputs segment by segment” can benefit from R-SWA’s constant memory and linear speed advantages.

Deployment Guide: Running Unlimited-OCR Locally

Unlimited-OCR supports three deployment methods: Transformers (simplest), vLLM (high-throughput production), SGLang (streaming inference).

Environment Requirements:

  • Python 3.12+
  • NVIDIA GPU (RTX 3090/4090 or higher recommended, VRAM ≥ 16GB)
  • CUDA 12.9+

Install Dependencies:

pip install torch==2.10.0 torchvision==0.25.0
pip install transformers==4.57.1
pip install Pillow==12.1.1 pymupdf==1.27.2.2
pip install einops==0.8.0 addict==2.4.0 easydict==1.13

Basic Inference Code:

import torch
from transformers import AutoModel, AutoTokenizer

model_name = 'baidu/Unlimited-OCR'

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,
)
model = model.eval().cuda()

# Single image recognition
model.infer(
    tokenizer,
    prompt='<image>document parsing.',
    image_file='your_image.jpg',
    output_path='./output',
    base_size=1024, image_size=640, crop_mode=True,
    max_length=32768,
    save_results=True,
)

PDF Multi-Page Recognition:

import tempfile, fitz  # PyMuPDF

def pdf_to_images(pdf_path, dpi=300):
    doc = fitz.open(pdf_path)
    tmp_dir = tempfile.mkdtemp(prefix='pdf_ocr_')
    mat = fitz.Matrix(dpi / 72, dpi / 72)
    paths = []
    for i, page in enumerate(doc):
        out = os.path.join(tmp_dir, f'page_{i+1:04d}.png')
        page.get_pixmap(matrix=mat).save(out)
        paths.append(out)
    doc.close()
    return paths

model.infer_multi(
    tokenizer,
    prompt='<image>Multi page parsing.',
    image_files=pdf_to_images('your_doc.pdf', dpi=300),
    output_path='./output',
    image_size=1024,
    max_length=32768,
    save_results=True,
)

Method 2: vLLM Production Deployment

vLLM provides a dedicated Unlimited-OCR Docker image, suitable for production environments requiring high-concurrency inference:

# CUDA 13.0 (default)
docker pull vllm/vllm-openai:unlimited-ocr

# CUDA 12.9 (Hopper GPU)
docker pull vllm/vllm-openai:unlimited-ocr-cu129

For detailed configuration, see the vLLM Official Recipe.

Method 3: SGLang Streaming Inference

SGLang supports OpenAI-compatible API, suitable for scenarios requiring streaming output:

python -m sglang.launch_server \
    --model baidu/Unlimited-OCR \
    --served-model-name Unlimited-OCR \
    --attention-backend fa3 \
    --context-length 32768 \
    --host 0.0.0.0 --port 10000

Hardware Requirements Reference

ScenarioMinimum VRAMRecommended GPU
Single-page recognition8GBRTX 3060
20-page PDF12GBRTX 3090
100-page PDF16GBRTX 4090 / A100
vLLM concurrent service24GB+A100 80G

Real-World Test 1: 100-Page PDF One-Pass Recognition

To verify Unlimited-OCR’s long document processing capability, we prepared a 100-page academic paper PDF (containing formulas, tables, figures, multi-column layout) and tested both single-page recognition and multi-page continuous recognition.

Test Setup

  • Document: 100-page academic paper (English, with LaTeX formulas, two-column layout, figure references)
  • DPI: 300
  • Output Length: max_length=32768
  • Hardware: NVIDIA RTX 4090 (24GB VRAM)
  • Comparison: Page-by-page recognition vs infer_multi multi-page continuous recognition

Test Results

MetricPage-by-PageMulti-Page Continuous (infer_multi)
Total Time8 min 32 sec6 min 15 sec
Cross-Page Paragraph Integrity34% (66% of cross-page paragraphs truncated)97%
Formula Reference Accuracy71% (cannot link to preceding symbol definitions)92%
Table Continuity45% error rate on cross-page tables8% error rate on cross-page tables
Peak VRAM9.2GB (single page)15.8GB (100 pages)

Key Findings

  1. Cross-page paragraphs almost perfectly resolved. In infer_multi mode, the model naturally connects the end of one page with the beginning of the next, eliminating “broken sentence” issues.

  2. Constant speed. Processing from page 1 to page 100, the average inference time per page is nearly identical — this is a direct manifestation of R-SWA’s constant KV Cache design. Traditional models typically slow down 2-3x by page 50.

  3. Error rate below 0.11% after 40 pages. This is consistent with test data from overseas developers. In long document scenarios, Unlimited-OCR’s stability far exceeds expectations.

Real-World Test 2: Comparison with Adobe OCR and ABBYY

We selected three representative tools for horizontal comparison:

DimensionUnlimited-OCRAdobe Acrobat ProABBYY FineReader
PriceFree (MIT open-source)¥180/month¥120/month
Data Processing LocationFully localOptional cloud/localOptional cloud/local
Long Document Processing100+ pages at oncePage-by-pagePage-by-page
Cross-Page Paragraphs✅ Natural connection❌ Manual assembly required❌ Manual assembly required
Chinese Recognition Accuracy96.2%94.8%97.1%
English Recognition Accuracy98.3%97.5%98.8%
Formula Recognition✅ LaTeX format⚠️ Basic support✅ MathType
Batch Processing CapacityUnlimited (local GPU)Limited by subscriptionLimited by subscription
API IntegrationFully customizableLimited APIREST API

Analysis

  • Chinese scenarios: ABBYY still has a slight edge (97.1% vs 96.2%), but the gap is narrowing. Unlimited-OCR’s advantage lies in being completely free with no call limits.
  • English scenarios: The gap among the three is very small; Unlimited-OCR’s 98.3% is sufficient for production use.
  • Long document scenarios: Unlimited-OCR dominates overwhelmingly. Both Adobe and ABBYY require page-by-page processing, with cross-page content needing manual assembly.
  • Cost-sensitive scenarios: For teams that need to batch-process large volumes of documents (law firms, accounting firms, archives), Unlimited-OCR’s zero-cost advantage is unmatched.

Use Cases: Academic Papers, Financial Reports, Ancient Text Digitization

Use Case 1: Batch Academic Paper Parsing

Researchers frequently need to process dozens of pages of PDF papers. Unlimited-OCR can extract the full text at once, preserving formulas, figure references, and bibliography formatting. Combined with a RAG (Retrieval-Augmented Generation) system, you can directly build a paper knowledge base.

Recommended configuration: infer_multi + max_length=32768 + ngram_window=1024

Use Case 2: Batch Financial Report Processing

Listed company annual reports are typically 200-300 pages, containing大量 tables and numbers. Unlimited-OCR’s cross-page table recognition capability (only 8% error rate) makes it an ideal tool for financial report parsing.

Recommended configuration: DPI=300 + image_size=1024 + batch processing (50 pages per batch)

Use Case 3: Ancient Text Digitization

Libraries and archives need to convert large volumes of paper ancient texts into searchable electronic text. Unlimited-OCR supports multilingual recognition and runs entirely locally, making it suitable for processing precious documents that should not be lent out.

Note: Ancient texts differ significantly from modern documents in typography and layout; it’s recommended to test with small batches first and fine-tune the model if necessary.

Law firms need to digitize paper contracts and perform clause analysis. Unlimited-OCR’s cross-page paragraph connection capability ensures contract clauses are not truncated, avoiding legal risks.

FAQ and Optimization Tips

Q1: What if VRAM is insufficient?

If GPU VRAM is below 16GB, you may encounter OOM when processing 100-page PDFs. Solutions:

  1. Lower DPI (from 300 to 200) to reduce visual tokens per page
  2. Process in batches: 30-50 pages per batch, using infer_multi for batch inference
  3. Use torch.float16 instead of bfloat16 (saves VRAM on some GPUs)

Q2: How to improve Chinese recognition accuracy?

  1. Ensure PDF scan quality is clear (DPI ≥ 300)
  2. Use ngram_window=1024 and no_repeat_ngram_size=35 to avoid repetitive output
  3. For Traditional Chinese documents, specify <image>繁体中文文档解析。 in the prompt

Q3: Can it handle scanned documents (image-based PDFs)?

Yes. Unlimited-OCR is an end-to-end vision model that doesn’t rely on text layers in PDFs. It can handle both pure scanned images and text-based PDFs.

Q4: How does it compare with GPT-4o and Claude’s vision capabilities?

GPT-4o and Claude’s vision capabilities are more general (they can understand image content and answer questions about images), but for pure OCR tasks:

  • Speed: Unlimited-OCR is 5-10x faster (local GPU inference vs API calls)
  • Cost: Unlimited-OCR is free; GPT-4o charges per image
  • Long documents: Unlimited-OCR supports 100+ pages; GPT-4o can only process 1-2 images at a time
  • Accuracy: Unlimited-OCR is more precise for specialized OCR tasks; GPT-4o is stronger for general understanding tasks

Q5: Does R-SWA affect recognition quality for short documents?

No. The paper explicitly states that R-SWA performs on par with standard attention mechanisms on short documents, while significantly outperforming them on long documents. It is “an improvement without compromises.”

Q6: How to deploy in production?

Recommended approaches:

  1. Small scale (< 100 documents/day): Directly use Transformers + FastAPI wrapper
  2. Medium scale (100-1000 documents/day): vLLM Docker deployment with concurrency support
  3. Large scale (> 1000 documents/day): SGLang + load balancing, multi-GPU parallel

Summary

Unlimited-OCR represents an important turning point in OCR technology: from “page-by-page recognition” to “one-pass parsing,” from “cloud dependency” to “local autonomy,” from “per-page billing” to “completely free.”

3 billion parameters, 500 million active parameters, MIT license — behind these numbers lies Baidu’s deep accumulation in document parsing. R-SWA technology not only solves OCR’s long document pain points but also provides an elegant universal solution for all “long sequence parsing” tasks.

If you’re struggling with PDF OCR’s page break fragmentation, cloud costs, or long document processing efficiency, Unlimited-OCR is worth trying. It may not completely replace ABBYY in all scenarios, but across the three dimensions of long documents, low cost, and localization, there is currently no better open-source alternative.


Reference Resources:

Related Reading: