Unlimited OCR — Long-Horizon Document Parsing

Innovation

Baidu’s Unlimited OCR uses Reference Sliding Window Attention (R-SWA) replacing all standard attention layers in the decoder. This maintains a constant KV cache throughout decoding, solving the memory growth problem in long-document OCR.

Key Technical Details

  • Based on DeepSeek-OCR encoder with high compression rate
  • Constant KV cache regardless of output length
  • Transcribes dozens of pages in a single forward pass at 32K context
  • Two inference modes: “gundam” (640px crop) for single images, “base” (1024px) for full-page/PDF
  • General-purpose mechanism — applicable to ASR, translation, etc.

Deployment

  • HuggingFace Transformers (torch bfloat16)
  • SGLang server with OpenAI-compatible API
  • PyMuPDF for PDF-to-image conversion

Hermes Relevance

  • Potential for document parsing pipeline improvement
  • R-SWA constant KV cache concept may apply to agent context window management
  • Strong open-source contribution from Baidu