Unlimited OCR: Baidu's Open-Source Solution for Long Document Parsing

TL;DR
Unlimited OCR is Baidu's open-source vision-language model that parses 100+ page documents in one pass without memory blowup. How it works and when to use it.
Baidu has open-sourced Unlimited OCR, a vision-language model designed to transcribe long documents in a single pass. The project hit the Hacker News front page with 310 points and sparked a surprisingly heated debate about whether OCR is actually a solved problem.
Spoiler: it is not.
Last updated: June 23, 2026
For the broader runtime decision that compares this with Mistral's launch, read Mistral OCR 4 and Unlimited OCR make document parsing an agent runtime choice. This post stays focused on Baidu's open long-document approach.
What Unlimited OCR Actually Does#
The core innovation is architectural. When you feed a 100-page PDF to a typical vision-language model, the KV cache (the model's short-term memory of what it has already transcribed) grows linearly. This means memory consumption explodes and generation slows to a crawl. Developers have historically worked around this by chunking documents page-by-page, processing them separately, and stitching the text back together - a janky approach that loses cross-page context.
Unlimited OCR introduces Reference Sliding Window Attention (R-SWA) to split the model's attention into two paths:
- Global Reference: The model maintains full, uncompromised sight of the original document image. Context is never lost.
- Local Generation: The model restricts its memory of its own output to a tight, moving window (roughly the last 128 words) and forgets the rest.
The result: O(1) memory consumption for output generation, regardless of document length.
That claim matters most for document-agent workloads. A support agent, legal review tool, research assistant, or internal knowledge base does not only need text. It needs long documents parsed without quietly losing cross-page context. That is the same ingestion problem behind RAG with Claude: retrieval quality is capped by source preparation.
Technical Details#
The model supports two processing modes:
- Gundam config: base_size=1024, image_size=640, crop_mode enabled - optimized for multi-page documents
- Base config: base_size=1024, image_size=1024 - standard processing for single images
The system implements n-gram repetition blocking (window sizes of 128 for single images, 1024 for multi-page documents) to prevent the model from getting stuck in repetitive output loops.
Requirements:
- Python 3.12.3
- CUDA 12.9
- PyTorch 2.10.0
- Transformers 4.57.1
- An NVIDIA GPU with sufficient VRAM
You can run inference via HuggingFace Transformers directly or deploy an OpenAI-compatible API server via SGLang. The model is available on both HuggingFace (baidu/Unlimited-OCR) and ModelScope.
That makes Unlimited OCR more of a developer runtime surface than a packaged document platform. If you need workflow UI, validation queues, deployment controls, or business extraction templates, a higher-level parser like Unstract still sits above the OCR layer.
What HN Is Saying#
The Hacker News discussion immediately split into two camps.
The "OCR is solved" camp pointed to existing vision models:
"OCR has been solved long time ago with vision models. Solutions are consistent, reliable, and stable."
They were quickly corrected by practitioners who work with OCR daily:
"I've been working on Parseur for the last 10 years, and OCR has not been solved yet, let me tell you. OCR still sucks in 2026."
The most nuanced take came from commenters who distinguished between different OCR tasks:
"If you try to OCR hand-filled forms with a fixed structure, traditional OCR models are great. But if you are trying to ingest diverse documents with headings, multi-column layouts, headers and footers, ad space in the middle of your text, etc, vision-llms are a giant step forward."
The "OCR is too expensive" camp raised valid concerns about cost and speed:
"Traditional OCR is faster, cheaper, and much more reliable than LLMs"
But others countered with specific examples where LLM-based OCR works:
"I found that feeding it to Claude Sonnet 4.x via API gave me results that were perfect. No corrections required. So perfect, that Claude was reading along with the story, and actually pointed out a continuity error in the story."
The hallucination concern was raised multiple times. LLM-based OCR can "improve" text by filling in what it thinks should be there rather than what the document actually says:
"A simple example is words that are supposed to be in other languages being automatically translated to English, which ruins the effect"
One commenter reported Unlimited OCR working well for Japanese grammar PDFs: "It has converted about 200 pages in an hour" on a 4090.
The music notation thread was unexpected. A jazz musician derailed the conversation into a discussion of optical music recognition (OMR), which remains far behind text OCR. LLMs understand music theory well enough when described in text, but reading sheet music is still "basically a greenfield for AI wherever you look."
The Real Landscape: What to Use When#
Based on the discussion, here is a rough hierarchy:
For simple, structured forms with clean scans:
- Tesseract or PaddleOCR (also from Baidu) work well
- Fast, cheap, deterministic
For complex documents with mixed layouts:
- Azure Document Intelligence or AWS Textract are the commercial leaders
- About 85% accuracy - "but you have to run a test because they both fail in different ways on the 15%"
For multi-page documents where context matters:
- Unlimited OCR is worth testing
- Marker (with --force-ocr) gets good results
- Mistral OCR 4 (released today - timing)
For production pipelines:
- Expect to validate. Every OCR tool fails on edge cases
- Build verification into your pipeline, not just blind extraction
For general vision extraction, the Claude Vision API production guide covers the other side of the choice: use a broader multimodal model when the task is visual reasoning, not only page transcription.
Why This Matters#
The paper (arXiv:2606.23050) acknowledges that using an LLM decoder for OCR is a double-edged sword. The language prior helps correct errors and handle degraded inputs, but the accumulated memory load makes long documents impractical. R-SWA is an elegant architectural fix that keeps the benefits while eliminating the scaling problem.
For developers building document processing pipelines, this is another tool in the toolkit. The fact that it is open-source (Apache 2.0) and runnable locally is significant - you can actually iterate on edge cases rather than filing support tickets.
The HN discussion also surfaced a useful tool comparison: Marker, Mistral OCR, Docling, Azure Document Intelligence, Textract, and now Unlimited OCR. If you are in the market for document parsing, run your actual documents through a few of these before committing.
This is especially true for archives and search products. The SNEWPAPERS agentic search writeup is a good reminder that OCR is only one stage. Layout segmentation, indexing, metadata, retrieval, and source-visible UI all decide whether the final agent can be trusted.
FAQ#
What is Unlimited OCR?#
Unlimited OCR is Baidu's open-source vision-language model for long-document OCR. It is designed to parse multi-page documents without the generation memory growing linearly with document length.
What makes Unlimited OCR different from normal OCR?#
The key idea is Reference Sliding Window Attention. The model keeps access to the document image while limiting how much generated text history it carries forward, which targets long-document memory blowup.
Is Unlimited OCR production-ready?#
Treat it as a promising open model to benchmark, not a full production document platform. You still need serving, validation, confidence checks, human review for low-confidence fields, and operational monitoring.
Should I use Unlimited OCR or Mistral OCR 4?#
Use Unlimited OCR when open deployment and long-document experimentation matter. Use a packaged OCR or document API when you need pricing, SLAs, batch processing, model cards, and production support.
How does OCR affect RAG quality?#
OCR quality sets the floor for retrieval. If page structure, table boundaries, language, or references are lost during parsing, the retriever and final agent cannot reliably recover them later.
Sources#
Get the next deep dive like this in your inbox
One email a week on AI and the rest of the AI dev stack. Free.
Read next
Ornith-1.0: What an Open Source Self-Improving Coding Model Actually Means
Ornith-1.0 open-source coding models explained: what "self-improving" really means, the four model sizes, hardware needs, HN reactions and whether to try it.
7 min readGodot Bans AI-Authored Code Contributions - What It Means for Open Source
Godot bans autonomous AI agents and substantial AI-generated code in contributions. What the policy allows, why maintainers want it, and how HN reacted.
6 min readMistral OCR 4 and Unlimited OCR Make Document Parsing an Agent Runtime Choice
Mistral OCR 4 and Baidu's Unlimited OCR turn document parsing into a runtime choice for agents - cost per page, layout, confidence scores and self-hosting.
8 min readNew here? Start with
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.








