Unlimited-OCR is an open-source OCR project launched by Baidu, with the goal of advancing OCR from long-document parsing to unlimited-vision parsing. The project released the first generation, Unlimited-OCR, in June 2026, and released Unlimited OCR 2 in October 2026. The latter introduces Sparse Reference Sliding Window Attention (SR-SWA), which compresses text-vision attention interactions from ultra-long sequences into a fixed-size working reference set (e.g., 512 tokens), thereby limiting computational complexity so that per-step decoding latency and memory usage barely grow with document length. Based on SR-SWA, Unlimited OCR 2 can achieve truly unbounded document parsing within a limited context window, eliminating the quadratic attention scaling and memory bottlenecks that arise as documents grow. The project claims state-of-the-art performance on dozens-of-pages benchmarks (such as MPDocBench) and extreme hundreds-of-pages benchmarks (such as MarathonDocBench).
In terms of main capabilities, Unlimited OCR 2 supports multi-page inference (infer_multi), parsing all pages of a document in a single request, with the model able to leverage cross-page context; the prompt is automatically constructed as "<PAGE><image>" repeated num_pages times followed by "Multi page parsing.", each page is encoded as one global view (base mode), and the output contains one <PAGE> per page in input page order. Single-page inference (infer) uses dynamic tiling (gundam mode) to encode a single page by default. The project supports Transformers (native, for quick testing) and SGLang (recommended for service deployment).
In terms of usage, the project provides a Python 3.10 virtual environment managed with uv, requiring installation of a customized SGLang wheel (sglang-0.5.20.dev13+g75b9b06b02-py3-none-any.whl) and PyMuPDF for PDF-to-image conversion. After starting the SGLang server, requests can be sent via an OpenAI-compatible API. infer.py is a batch client for MPDocBench / MarathonDocBench that sends each document as a single request and saves the raw output, which is then converted to Markdown for evaluation by utils/process_unlimitedOCR2.py. utils/README.md explains the output format, merging rules, and post-processing details. Memory-related parameters include --mem-fraction-static (0.7 is recommended to stably support 32+ concurrency), --max-prefill-tokens (affects temporary tensor memory; lowering from 4096 to 2048 can halve the peak), the maximum bucket of --cuda-graph-bs-prefill must equal --max-prefill-tokens, and the default full_prefill_max_req of 8 in --cuda-graph-config causes 16/32 concurrency to fall back to eager mode. A smaller page window can reduce peak memory but affects cross-page merging; setting SGLANG_UOCR_EANABLE_DOC_LIMIT=0 allows parsing the entire document in a single window.
Applicable scenarios include end-to-end parsing and evaluation of ultra-long documents, books, multi-page scans, and hundred-page-level documents. Regarding limitations, the materials do not provide specific pricing, cost, platform compatibility details, or quantitative performance metrics; some parameter tuning needs to be adjusted according to hardware and concurrency requirements. The project acknowledges Deepseek-OCR, Deepseek-OCR-2, PaddleOCR, and SGLang.