Shiqi Yang, Zhen Wu, Shu Wei, Hao Zou, Mingxin Huang, Jinyue Chen, Qunyi Xie, Shaohua Wang, Jingjing Wu, Tengyu Du, Youyang Yin, Huanhuan Liu, and 4 more
We lifted 3 functions out of this paper's own repositories and ran 1 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.
| Repository | Role | Ran |
|---|---|---|
| baidu/Unlimited-OCR | canonical | 1 of 3 |
| Function | Status | Where it lives |
|---|---|---|
| build_content | Ran | baidu/Unlimited-OCR/infer.py code served (permissive licence) · get_code("fe21348c7cf2f484") |
| encode_image | Not yet run | baidu/Unlimited-OCR/infer.py code served (permissive licence) · get_code("85dc65aa2564f6c1") |
| pdf_to_images | Not yet run | baidu/Unlimited-OCR/infer.py code served (permissive licence) · get_code("4ec3fcde05b0ddcd") |
Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.
Recently, end-to-end OCR models, exemplified by DeepSeek OCR, have once again thrust OCR into the spotlight. A widely held view is that employing a large language model (LLM) as the decoder allows the model to leverage the prior distribution of language, leading to improved OCR performance. However, the downside is equally evident: as the output sequence lengthens, the accumulated KV cache drives up memory consumption and progressively slows down generation. This stands in stark contrast to humans, who exhibit no such decline in efficiency during long-horizon copying tasks. In this technical report, we propose Unlimited OCR, a model designed to emulate human parsing working memory. Taking DeepSeek OCR as the baseline, we replace all attention layers in the decoder with our proposed Reference Sliding Window Attention (R-SWA), which reduces attention computation costs while maintaining a constant KV cache throughout the entire decoding process. By combining the high compression rate of DeepSeek OCR's encoder with our constant KV cache design, Unlimited OCR can transcribe dozens of pages of documents in a single forward pass under a standard maximum length of 32K. More importantly, R-SWA is a general-purpose parsing attention mechanismbeyond OCR, it is equally applicable to tasks such as ASR, translation, etc. Codes and model weights are publicly available at http://github.com/baidu/Unlimited-OCR. Vanilla Attention R-SWA Reference Working memory No attend KV cache KV cache Next Token Figure 1 | Illustration of Reference Sliding Window Attention (R-SWA). Each generated token attends to all reference tokens (visual tokens in OCR) and the preceding 𝑛 output tokens (128 by default). Compared to standard full attention, R-SWA maintains a constant KV cache throughout decoding. Compared to vanilla SWA, it preserves visual token fidelity by excluding them from state transitions, thereby avoiding progressive blurring.
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2606.23050")
get_code_for_paper("2606.23050")
have("2606.23050")
Connect an agent — have() is free.