Baidu Open-Sources Unlimited OCR: 500M Activation Beats Trillion-Parameter Models
Last week, Baidu open-sourced its end-to-end OCR model **Unlimited OCR**, with a total of 3B parameters and only 500M activated. It achieved 93.92% on **OmniDocBench v1.6**, setting a new SOTA record. On GitHub, it gained over 10,000 stars in just 5 days, topping the Trending list. Its core innovation, the **R-SWA mechanism**, enables the model to read through 40-page documents in a single inference without memory loss.
Last Monday (June 22), Baidu quietly uploaded an end-to-end document parsing model called Unlimited OCR to GitHub.
3B total parameters, only 500M active during inference—when compared to today's vision-language models with tens or hundreds of billions of parameters, these numbers look like a typo.
And then this "typo" scored 93.23% on OmniDocBench v1.5 and 93.92% on v1.6, achieving end-to-end SOTA.
Competitors in the same benchmark include the 235B Qwen3-VL (89.15%), 72B Qwen2.5-VL (87.02%), Gemini-2.5 Pro (88.03%), and DeepSeek OCR (87.01%). And this model, with active parameters only a fraction of theirs, left them all behind.
The day after release, it topped both the GitHub Daily Trending overall list and Python list, ranked #1 on HuggingFace’s global model trending charts and multimodal trending charts simultaneously, and reached over 10K stars in 5 days—within the past year, you could count on your fingers the open-source projects hitting 10K stars this fast.

Long-document parsing headaches solved by a sliding window
To grasp the weight of this, you need to first understand the silly way OCR models have been handling long documents.
Books, papers, financial reports, contracts—anything over a few dozen pages—mainstream practice has been a “for-loop”:
An external scheduler slices the PDF into single pages, the model recognizes one page, clears its memory, then processes the next page, finally stitching results together mechanically via code. This shatters semantic continuity, and cross-page tables, formulas, and references have to be forcibly patched with post-processing.
It’s not that model teams don’t want to read a document in one shot—it’s that they can’t. Under standard attention mechanisms, each time a token is generated, the KV cache grows—longer output means higher GPU memory usage and longer step time, like a snowball rolling downhill. Models with a 32K context already slow down after generating a few thousand tokens, and hit a crawl at tens of thousands.
Baidu’s solution is Reference Sliding Window Attention (R-SWA), inspired by how humans copy books.
When copying a book with hundreds of pages, you don’t recall all past content—you keep your eyes on the source page, and only retain a small recent chunk in working memory—“forget when needed,” keeping cognitive load extremely low to handle ultra-long tasks.
R-SWA implements this in the attention layer:
- All reference tokens fully visible: For each generated token, attention can still fully access the image’s visual tokens and prompt—the original text remains in sight from beginning to end.
- Sliding window on generated tokens: On the decoding side, only the latest 128 generated tokens are kept in working memory, older ones are discarded.
- KV cache fixed to a constant size: Whether output is 10K tokens or 100K, cache usage remains unchanged.
All attention layers are replaced with R-SWA. Combined with DeepSeek OCR’s highly praised DeepEncoder—which compresses a 1024×1024 page into 256 visual tokens, a 16× compression—the effect is immediate.
Brutal performance numbers
In speed tests using the Flash Attention v3 kernel, DeepSeek OCR with standard MHA sees step latency steadily rise, curve going upward; Unlimited OCR with R-SWA stays perfectly flat from start to finish. At 6144-token output length, Unlimited OCR reaches 7847 TPS while DeepSeek OCR drops to 5822 TPS, a 35% difference. OmniDocBench real-document throughput is 5580 vs. 4951, a 12.7% improvement.
Long-document use cases are where it really shines. Inputting 20 pages at once, transcription vs. original text edit distance is only 0.057; over 40 pages, still under 0.11. The Distinct-35 metric for measuring repeated outputs is as high as 97%—it can transcribe dozens of pages in one shot with almost no “stuck repeating” issues. No previous OCR model has achieved this.
Accuracy comparisons are straightforward. Compared to baseline DeepSeek OCR:
- Text edit distance: 0.073 → 0.038
- Formula CDM: 83.37 → 92.61
- Table TEDS: 84.97 → 90.93
Across nine document types (PPT, newspaper, magazine, paper, books, etc.), Unlimited OCR surpasses DeepSeek OCR in text recognition and reading order for all, and leads in seven categories for reading order. This shows R-SWA isn’t picky—handling anything from colorful textbooks to dense tables.
Start with a single command
Model weights and code are available on GitHub and HuggingFace (and ModelScope). Recommended deployment with sglang:
pip install torch==2.10.0 torchvision==0.25.0
pip install transformers==4.57.1
pip install Pillow==12.1.1 matplotlib==3.10.8 einops==0.8.2
pip install addict==2.4.0 easydict==1.13 pymupdf==1.27.2.2 psutil==7.2.2
python -m sglang.launch_server \
--model PaddlePaddle/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
Note: --attention-backend fa3 uses Flash Attention v3—R-SWA’s speed advantage is fully realized under this backend.
500M active parameters means it can run on a single consumer-grade GPU, with virtually no barrier to deployment.
The mysterious technical director “YY”
There’s another detail making insiders restless.
The technical report references DeepSeek OCR over 40 times, with wording that carries no competitive sharpness—instead resembling reflection and continuation of their own prior work. HuggingFace’s project page thanks DeepSeek-OCR and DeepSeek-OCR-2 in the top two positions. Key contributors are Youyang Yin, Huanhuan Liu (project leader), and a technical director identified only as “YY.”
The core authors of DeepSeek OCR from version 1 to 2 have been Wei Haoran, Sun Yaofeng, and Li Yukun.
Wei Haoran came from StepStar, led the landmark end-to-end OCR open-source GOT-OCR2.0, then built DeepSeek’s entire OCR line, including the DeepEncoder and MoE decoder. By April this year at DeepSeek V4 release, his name was marked as “departed,” with destination unannounced.
China’s OCR circle is small; those familiar enough with DeepSeek OCR’s architecture to have “built it themselves” and able to make a breakthrough like R-SWA can be counted on one hand. Whether “YY” is Wei Haoran, Baidu hasn’t confirmed—but the technical continuity in the report strongly supports the idea.
Baidu’s research-production convergence
The broader backdrop is an important shift in Baidu’s OCR direction.
In recent years PaddleOCR has been almost synonymous with domestic OCR: open source, lightweight, widely deployed across mobile to embedded devices. But its focus has always been engineering stability and deployment cost, not “reshape OCR paradigms with cutting-edge research.”
Unlimited OCR fills that gap. From GOT-OCR2.0’s end-to-end paradigm, to DeepSeek-OCR’s visual compression, to R-SWA’s long-range parsing—this line now matches PaddleOCR’s engineering foundation. One side is the most mature industrial deployment matrix, the other is the forefront of end-to-end long-range parsing research.
This year Baidu upgraded its AIDU talent program to a group-level project with no salary cap.
For researchers wanting to close the research loop, Baidu’s long-developed deployment scenarios may be more persuasive than high pay alone—likely not a coincidence.
The paper’s outlook adds: next step is training with a 128K context window, building a prefill pool so the model learns to flip pages automatically. If successful, OCR will no longer be “a tool for recognizing one page” but “a general long-range parsing framework able to read an entire book.” Baidu states in the report that R-SWA is a general parsing mechanism—OCR is just the first stop, to be applied to long-sequence tasks like speech recognition and machine translation.
A more interesting direction
Looking back at R-SWA, its significance goes beyond OCR.
Over the past year, the large-model long-context race has been about expanding the window—8K, 32K, 128K, 1M, 10M—pushing it larger. But this raises GPU memory, inference time, and training costs, and still risks losing information inserted midway.
R-SWA takes another route: teaching models to “retain key references, selectively forget history,” and use more economical attention allocation for ultra-long tasks. In OCR, where reference info (original image) and generated content are clearly separated, it shines—but translation, transcription, and long-document summarization have similar structures. Baidu’s bet may be more worth watching than the OCR model itself.
Unlimited OCR is already open source, with weights free for commercial use.
If your business has long-document parsing needs, this is the most worthwhile update in the past year to replace old solutions.
OpenAI Hub has integrated the model—developers accustomed to calling multiple models via an OpenAI-compatible interface can use it directly from Hub without separate deployment.
References
- baidu/Unlimited-OCR · GitHub — Project homepage, source code, and deployment docs
- baidu/Unlimited-OCR · HuggingFace — Model weights, technical report, and acknowledgments
- Baidu open sources Unlimited OCR: Long-document parsing in one go · Zhihu — R-SWA mechanism details and performance comparison



