無限OCR運作
Unlimited OCR Works
June 22, 2026
作者: Youyang Yin, Huanhuan Liu, YY, Qunyi Xie, Chaorun Liu, Shiqi Yang, Shaohua Wang, Zhanlong Liu, Hao Zou, Jinyue Chen, Shu Wei, Jingjing Wu, Mingxin Huang, Zhen Wu, Guibin Wang, Tengyu Du, Lei Jia
cs.AI
摘要
近期,以 DeepSeek OCR 为代表的端到端 OCR 模型再次让 OCR 技术重回公众视野。一个普遍的观点是,将大语言模型(LLM)作为解码器,能使模型利用语言的先验分布,从而提升 OCR 性能。然而,其缺点同样显而易见:随着输出序列增长,累积的 KV cache 导致内存消耗增加,并逐步减慢生成速度。这与人类在长文本抄写任务中效率不降的特点形成鲜明对比。本技术报告中,我们提出 Unlimited OCR,一种旨在模拟人类解析工作记忆的模型。以 DeepSeek OCR 为基础,我们将解码器中所有注意力层替换为我们提出的参考滑窗注意力(Reference Sliding Window Attention, R-SWA),在降低注意力计算成本的同时,保证整个解码过程中 KV cache 恒定。结合 DeepSeek OCR 编码器的高压缩率与我们恒定的 KV cache 设计,Unlimited OCR 可在标准最大长度 32K 下,单次前向推理即可转录数十页文档。更重要的是,R-SWA 是一种通用的解析注意力机制——除 OCR 外,同样适用于 ASR、翻译等任务。代码和模型权重已在 http://github.com/baidu/Unlimited-OCR 公开。
English
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 mechanism - beyond 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.