Baidu’s Unlimited OCR: Read 100 Page PDFs Locally, Free

A post going around says Baidu just open sourced an OCR model that swallows a 100 page PDF in one pass, runs on your own hardware, and costs nothing. Most of that holds up. A few details do not, and one of them changes which version you should download.

I checked every claim against Baidu’s paper, the model cards, and the pricing pages of the big cloud OCR services. Here is what is true, what needs fixing, and how to run it yourself this weekend.


What Unlimited OCR actually is

Unlimited OCR is a 3 billion parameter document parsing model from Baidu, released under the MIT license on GitHub. It builds on DeepSeek OCR, and the README says the goal was to push that model one step further. It is a mixture of experts design, so only about 500 million parameters are active at any moment. That is why it is cheap to run.

The interesting part is how it reads. Most OCR tools loop through a document one page at a time and forget everything between pages. The Baidu paper calls this a for-loop approach. Unlimited OCR takes many pages as one input and writes the whole transcription in a single run, inside a 32K token context window. Its attention design keeps the memory needed for the output constant, so it does not slow down as the text piles up.


Why page by page OCR loses the thread

Picture a table that starts at the bottom of page 12 and finishes on page 13. A page by page tool hands you two broken tables. The same thing happens with a sentence that crosses a page break, a footnote that points back to an earlier section, or a heading that sets the context for the next five pages.

If you feed that output into a search tool or a chatbot that answers questions from your documents, every seam becomes a chance for a wrong answer. Reading the document in one pass is a direct attack on that problem.


The claim check

Here is the viral post, line by line. Screenshot this table if you plan to share the original.

ClaimVerdictWhat the sources say
China just open sourced itNeeds a dateBaidu released it on June 22, 2026. Version 2 followed on October 27, 2026.
3B params, 32K contextTrue3B total, about 500M active, 32K tokens, per the paper.
93% on the standard benchmark, 6 points over baselineTrue93.23 on OmniDocBench v1.5 against 87.01 for DeepSeek OCR. It scores 93.92 on the newer v1.6.
Error rate under 0.11 past 40 pagesTrue, with a catchThe paper reports an edit distance of 0.1069 at 40+ pages on Baidu’s own test set. Lower is better. No independent test yet.
Multilingual out of the boxUnverifiedThe model is tagged multilingual on Hugging Face, but the paper does not list supported languages. Test yours.
Runs 100% locallyTrue, with hardwareOfficial support covers Transformers, vLLM, SGLang and Docker Model Runner. llama.cpp works through community conversions, and Ollama support depends on the build.
Cloud OCR costs $1.50 to $15 per 1,000 pagesUnderstatedPlain text starts at $1.50. Structured extraction runs from $10 to $50. Details below.
Free foreverLicense yes, running noThe MIT license has no fee. You still pay for a GPU and electricity.
1.9M downloads, most people have no ideaOutdatedThe Hugging Face page showed about 3.97 million downloads in the last month when I checked, and the GitHub repo has around 28.9k stars.
100 page PDFs in one passMostly version 2The version 1 paper tests up to 40+ pages. Version 2 targets 100 to 300 page documents.

The cost math, done properly

Here is what the big cloud services charge per 1,000 pages, based on their own pricing pages.

ServicePlain text OCRStructured extraction
Amazon Textract$1.50Tables $15, forms $50
Google Cloud Vision and Document AI$1.50 (first 1,000 units each month free)Form parser and custom extractor $30
Azure Document Intelligence$1.50 (Read model)Prebuilt about $10, custom about $30
Unlimited OCRNo per page feeNo per page fee, you pay for GPU time

Now the reality check. AWS’s own pricing example puts 100,000 pages of plain text extraction at $150. At that scale, a cloud API is probably cheaper than buying or renting a GPU for the month.

Local wins in three situations. You process large volumes of complex documents, your files are confidential and cannot leave your network, or you work somewhere with no reliable internet. One more thing to keep in mind. Cloud tools like invoice parsers return trained, structured fields. Unlimited OCR gives you parsed text with layout, so treat it as a parser, not a drop-in replacement for those.


How to try it, step by step

Step 1: Test it in your browser first

Open the official demo on Hugging Face Spaces, upload a PDF, and see what comes back. Use a document you do not mind sharing. A hosted demo sends your file to someone else’s server, which defeats the privacy benefit of running it locally.

Step 2: Run it on your own NVIDIA GPU

Baidu lists Python 3.12.3 with CUDA 12.9 on NVIDIA GPUs as the tested setup. The version 2 instructions mention an 80 GB datacenter card, and neither page gives a minimum memory figure. Start with a short document and watch your GPU memory.

  1. Create a fresh virtual environment and install the pinned packages from the model card:
pip install torch==2.10.0 torchvision==0.25.0 transformers==4.57.1 Pillow==12.1.1 matplotlib==3.10.8 einops==0.8.2 addict==2.4.0 easydict==1.13 pymupdf==1.27.2.2 psutil==7.2.2
  1. Save this script as ocr.py and put your PDF next to it. It converts each page to an image at 300 dpi, then sends all pages in one request.
import os, tempfile
import fitz # PyMuPDF
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()
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,
no_repeat_ngram_size=35,
ngram_window=1024,
save_results=True,
)
  1. Run python ocr.py. The first run downloads the weights, so give it time.
  2. Open the output folder and read the result.

One safety note. The flag trust_remote_code=True runs Python code that ships with the model repository. Skim that code first, or run everything inside a container.

Step 3: Switch to version 2 for long documents

If your documents run past 40 pages, use Unlimited OCR 2, released on October 27. Its README lists different pinned versions (torch 2.13.0 and transformers 4.52.1), so build a separate environment. The multi page call is simpler. Pass your page images in order:

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)

Baidu recommends SGLang for serving version 2 at scale. The GitHub README has the full server setup.

Step 4: No big GPU? Try a community build

Volunteers have converted the model to GGUF files that run in llama.cpp on far smaller machines. The sahilchachra GGUF repo lists a Q4_K_M file and a vision projector file, plus a command for turning a single page image into markdown. Follow the exact commands on that page.

Be clear about what you get here. These builds are not from Baidu. The examples I found handle single page images, and I could not find documented proof of full multi page one pass parsing on them. Use this route for quick page level jobs and the official stack for whole documents.

Step 5: Verify before you trust it

  1. Pick three pages with numbers, a table, and small print.
  2. Compare the output against the original page by eye.
  3. Check every figure that matters, such as dates, amounts and names.
  4. If errors cluster late in a long file, split the document and rerun.

On that last point, Baidu’s own table shows an edit distance of 0.0572 at 20 pages and 0.1069 at 40+. The trend is not perfectly smooth across the table, but batching long files into chunks of around 20 pages is a sensible starting point. That is my suggestion, not Baidu’s.


Honest limitations

  • The long document numbers are self reported. The 40+ page result comes from an in-house test set of novels, documents and papers. Baidu’s multi page training data was also built by joining single pages together, so real scanned books with messy layouts may behave differently.
  • Version 1 is not truly unlimited. The paper says a finite 32K context still caps how many pages fit, because the page images must be loaded first.
  • Small print is a weak spot. Baidu traced most repeated errors to tiny text read at the 1024 by 1024 setting used for multi page input.
  • Version 2 has its own trade-offs. An independent news summary notes that its 77.1 score on the MarathonDocBench is also Baidu’s own benchmark, with no outside evaluations published yet.
  • Odd PDFs can fail. At least one user reported a LaTeX generated PDF that returned nothing on the model’s discussion page. Test your real files, not just clean samples.
  • Languages are unproven. The model carries a multilingual tag, but I found no official language list. Run a sample in your language before committing.

Who should use it, and who should skip it

  • Use it if you digitize long reports, contracts, theses or scanned books, if privacy rules keep files off third party servers, or if you already own a capable NVIDIA card.
  • Stay on a cloud API if your volume is small, you need trained field extraction from invoices or forms, or you have no GPU and no time to maintain a setup.
  • Do both if you are cautious. Run a hundred pages through each and compare the results before you switch anything.

What this really means is simple. The headline is mostly right, the details are messier, and the best way to settle it is a ten minute test on your own documents.


Know someone who pays per page to read their own PDFs? Send them this before the next invoice lands.


Sources

Leave a Reply

Website Built by WordPress.com.

Up ↑