Grafy News

Baidu Open‑Sources Unlimited OCR 2 for Hundred‑Page Document Parsing

Baidu released Unlimited OCR 2, an MIT‑licensed 3‑billion‑parameter OCR model that can process 100‑page documents in a single request.

Illustration for the news story: Baidu Open‑Sources Unlimited OCR 2 for Hundred‑Page Document Parsing

Baidu has made its newest OCR system, Unlimited OCR 2, publicly available under an MIT license, allowing developers to run a 3 billion‑parameter model that can ingest and transcribe a hundred‑page document with a single API call. The release matters because it removes a long‑standing bottleneck in large‑scale document digitisation, offering near‑constant per‑step decoding cost and competitive accuracy on established benchmarks.

What is Unlimited OCR 2?

Unlimited OCR 2 is a deep‑learning model designed specifically for optical character recognition across long, multi‑page documents. Unlike many OCR solutions that require a separate request for each page or a fixed‑size chunk, this model can accept an entire hundred‑page PDF (or image sequence) in one request, returning a structured text output in a single pass. Baidu published the model under an MIT license, meaning anyone can download, modify, and deploy it without commercial restrictions. According to the MarkTechPost announcement, the model contains roughly three billion parameters, placing it in the same scale as many contemporary language models while being optimised for visual text extraction.

How does it differ from previous OCR models?

Traditional OCR pipelines often rely on a two‑stage approach: a layout detector that splits a document into regions, followed by a line‑or‑character recogniser that processes each region sequentially. This method scales linearly with page count, leading to high latency and resource consumption for long documents. Unlimited OCR 2 introduces a novel "SR‑SWA" (Sliding‑Window Self‑Regularising Attention) mechanism that keeps the computational cost per decoding step almost flat, regardless of document length. In practice, this means the model does not need to re‑initialise its attention window for every new page, dramatically reducing the overhead that typically plagues large‑scale OCR.

How well does it perform?

The model was evaluated on MarathonDocBench, a benchmark suite that measures OCR accuracy on long‑form documents with varied layouts, fonts, and image quality. Unlimited OCR 2 achieved a score of 77.1, surpassing previous open‑source baselines by a noticeable margin. While the score is not yet on par with proprietary, heavily‑engineered commercial services, the combination of speed, scalability, and openness makes it a compelling option for research and production environments that need to process bulk archives, legal contracts, or academic corpora without incurring per‑page fees.

Who can benefit from Unlimited OCR 2?

  • Researchers studying document understanding, multimodal language models, or OCR efficiency can use the publicly released weights to benchmark new ideas or explore alternative attention mechanisms.
  • Developers building SaaS platforms for document ingestion—such as contract‑analysis tools, invoice‑processing pipelines, or digital libraries—can integrate the model directly into their backend, avoiding the need for third‑party OCR APIs that charge per page.
  • Enterprises with legacy paper archives can deploy the model on‑premises, ensuring data privacy while dramatically cutting the time required to digitise large volumes of paperwork.

The model’s MIT licence also encourages community contributions. Users can fine‑tune the base weights on domain‑specific fonts (e.g., medical prescriptions or historical scripts) and share their checkpoints, fostering a collaborative ecosystem around large‑scale OCR.

Practical steps to try Unlimited OCR 2

  1. Download the repository from Baidu’s official GitHub page (linked in the original MarkTechPost article). The repo includes model checkpoints, inference scripts, and a Dockerfile for easy deployment.
  2. Set up the environment using the provided Docker image or by installing the required Python dependencies (PyTorch ≥ 2.0, torchvision, and the custom SR‑SWA attention module).
  3. Run a test inference on a multi‑page PDF using the ocr_infer.py script, which accepts a path to a PDF or a folder of image files and returns a JSON payload with page‑wise text and confidence scores.
  4. Integrate via API – the repo ships with a lightweight Flask server that exposes a /ocr endpoint. This endpoint can be called from any language that can make HTTP requests, making it straightforward to embed the service in existing workflows.

For developers who prefer a managed solution, several cloud providers have begun offering Baidu‑hosted endpoints for Unlimited OCR 2, though the open‑source version remains the most cost‑effective route for high‑volume use.

What does this mean for the AI document‑processing landscape?

Unlimited OCR 2 signals a shift toward open, high‑capacity OCR models that can handle real‑world document lengths without fragmenting the workload. The flat‑cost attention design could inspire similar efficiencies in other vision‑language tasks, such as layout‑aware language modelling or visual question answering over long PDFs. Moreover, the availability of a strong, freely‑licensed baseline lowers the entry barrier for startups and academic labs, potentially accelerating innovation in areas like automated contract review, historical document preservation, and large‑scale knowledge extraction.

Grafy relevance – using the model with Grafy tools

While Grafy does not host Unlimited OCR 2 natively, the platform’s Reader app is built to ingest PDFs and let AI agents query their contents. You can upload a hundred‑page PDF to Grafy Reader (/reader) and, using Grafy Chat (/chat), ask the model to summarise, extract entities, or answer specific questions—all without writing code. If you prefer to run the OCR model yourself, you can use Grafy Files (/files) to convert PDFs to images, feed those images to a locally hosted Unlimited OCR 2 instance, and then pipe the resulting JSON back into Reader for downstream AI‑driven analysis. This workflow demonstrates how Grafy’s modular apps can complement open‑source OCR advances, giving creators a seamless bridge between raw document digitisation and higher‑level AI tasks.

Frequently asked questions

How does the SR‑SWA attention keep decoding cost flat?

SR‑SWA combines a sliding‑window approach with self‑regularising weights, allowing the model to reuse attention context across pages. Instead of recomputing full‑sequence attention for each new page, it updates a limited window, keeping the per‑step compute roughly constant regardless of total document length.

Can Unlimited OCR 2 handle non‑Latin scripts?

The base model was trained primarily on Chinese and English corpora, but Baidu provides scripts for fine‑tuning on additional languages. Users can upload labelled data for scripts such as Arabic, Devanagari, or Cyrillic and continue training the attention layers to achieve comparable accuracy.

Is there a cloud‑hosted version I can try without setting up Docker?

Several cloud marketplaces now list pre‑configured Unlimited OCR 2 instances. While Baidu’s open‑source release is free, hosted services may charge per inference. Check the Baidu Cloud marketplace or third‑party AI platforms for ready‑to‑use endpoints.


Source: MarkTechPost — Baidu Open-Sources Unlimited OCR 2 for Hundred-Page Document Parsing