Unlimited-OCR-2 model: Long PDFs without growing memory

Share

FuturPulse analysis · 28 October 2026

Unlimited-OCR-2 launched on 27 October 2026 as Baidu’s document-parsing model with 3.3 billion declared parameters. Its defining feature is Sparse Reference Sliding Window Attention, or SR-SWA, which keeps a fixed set of working references as a document grows. That makes it a specialist for long documents, not automatically the best OCR model for every scan.

At a glance

  • Baidu’s model page declares 3.3 billion parameters and describes the model as a successor to Unlimited OCR.
  • The published safetensors weights total about 6.7 GB on disk, according to the model listing.
  • Baidu says SR-SWA compresses text-visual interactions into a fixed reference set, with 512 tokens as an example, in the release repository.
  • The repository documents Transformers for quick tests and SGLang for serving, with page-window controls for long documents.
  • The public release announces MPDocBench and MarathonDocBench results, but the material available here does not include matched result tables with all evaluation conditions.

What is Unlimited-OCR-2?

Unlimited-OCR-2 is an image-to-text model that turns page images into structured text. It can process several pages in one request instead of treating every page as an isolated image. Baidu’s release repository says multi-page inference returns one <PAGE> marker for each supplied page and preserves the order of the input images.

That distinction matters. Basic OCR reads characters, while document parsing also tracks headings, tables, formulas and reading order. Extraction goes further by asking for particular fields, such as invoice totals or contract dates.

Unlimited-OCR-2 is aimed mainly at document parsing. Its value is the attempt to preserve structure and context across pages. A model card label cannot establish accuracy for a particular invoice format, handwriting style or regulated workflow, so buyers still need tests on their own files.

What changed at launch?

Baidu’s release log dates the launch of Unlimited OCR 2 to 27 October 2026. The same entry describes the model as achieving unlimited-horizon parsing with SR-SWA. The repository also announces a new MarathonDocBench benchmark for ultra-long document parsing.

“Unlimited” describes the decoding design rather than a promise that every PDF can be processed without limits. The repository exposes page-window settings, output caps and memory controls. Those settings show that deployment still involves choices about document length, concurrency and available device memory.

The release repository also lists ModelScope, Baidu Cloud and a public demo as availability routes. Those channels do not change the model’s core self-hosting options: Baidu documents a native Transformers path and a customised SGLang path.

How does SR-SWA change long-document OCR?

SR-SWA is the second model’s replacement for Reference Sliding Window Attention, or R-SWA. Attention is the mechanism that lets a model relate a new output token to earlier visual and text information. Baidu says SR-SWA compresses those interactions into a fixed-size set of working references, using 512 tokens as an example in the release repository.

A decoder normally keeps a key-value cache, often called a KV cache, while it generates text. The cache stores information about earlier tokens. As output grows, that stored state can consume more memory and slow generation.

The original Unlimited OCR paper describes R-SWA as a way to keep the KV cache constant during decoding. It says the first model replaced all decoder attention layers in its DeepSeek OCR baseline with R-SWA. The paper reports transcription of dozens of pages in one forward pass under a 32K maximum length.

SR-SWA takes the same general direction further. Baidu says it reduces ultra-long text-visual interactions to a fixed working-reference set. In practical terms, the model does not need to retain every prior interaction at full size as the document expands.

Read “unlimited” carefully. The claim concerns how attention work and memory behave as document length increases. It is not a public guarantee that every 300-page PDF will fit in one request, produce perfect tables or run within a fixed hardware budget.

How large is the model?

Unlimited-OCR-2 declares 3.3 billion parameters, according to the Baidu model listing. Parameters are the learned numerical values in a model. They help with storage planning, but they do not measure document accuracy by themselves.

The same listing supports a weight-only estimate of about 6.7 GB at 16-bit precision, 3.3 GB at 8-bit precision and 1.7 GB at 4-bit precision. The listing says the published safetensors weights total about 6.7 GB on disk. These are arithmetic estimates, not a hardware test.

Actual device memory must also hold page images, temporary tensors, the inference runtime and the remaining KV cache. Quantisation can reduce weight memory, but the release material does not establish a universal memory requirement for a given page count, image resolution or request batch.

How the estimate works. The calculation uses the declared parameter count and the published weight size. It treats lower-precision storage as a smaller representation of the weights. It excludes inference overhead, image processing and runtime allocations.
Concrete local optionExact figureWhat the figure meansEvidence tier
Unlimited-OCR-2 weights at 16-bitAbout 6.7 GBWeight memory only; add runtime and image memory before choosing a GPU.Baidu model listing and calculation
Unlimited-OCR-2 weights at 8-bitAbout 3.3 GBA smaller weight-memory target; quality depends on the quantisation method.Baidu model listing and calculation
Unlimited-OCR-2 weights at 4-bitAbout 1.7 GBThe lowest weight-only estimate here; it is not a full-job requirement.Baidu model listing and calculation

How does it compare with DeepSeek OCR and OvisOCR3?

Unlimited-OCR-2 is closest to DeepSeek OCR in its architecture and to OvisOCR3 in its document-task coverage. The original Unlimited OCR paper identifies DeepSeek OCR as its baseline. OvisOCR3’s technical report describes a separate model for document parsing, general OCR, key-information extraction, figure captioning and cross-page table reconstruction.

How the published model sizes compare: DeepSeek-OCR, Unlimited-OCR-2, OvisOCR3
How the published model sizes compare · Source: savrn.com
ModelPublished sizePrimary jobLong-document designVerified limit or resultEvidence tier
DeepSeek-OCR3.3B parametersOCR, Markdown conversion, page parsing and visual-text compressionBaseline architecture for the original Unlimited OCR work.Its public comparison record lists a 32,768-token context length.Published model metadata
Unlimited-OCR-23.3B declared parametersMulti-page document parsing with cross-page contextSR-SWA keeps a fixed set of working references.512-token reference-set example.Baidu release repository
OvisOCR30.8B parametersOCR, parsing, extraction, captions and cross-page tablesMulti-task training rather than a stated sparse-attention mechanism.96.74 overall on OmniDocBench v1.6, reported by its authors.Technical report

DeepSeek OCR remains a useful control for page-oriented workloads. OvisOCR3 is a broader task comparison because its authors explicitly combine OCR, extraction, captions and cross-page tables. Unlimited-OCR-2 makes a different trade-off by putting long-horizon parsing and attention memory at the centre of its design.

The OvisOCR3 report’s 96.74 score on OmniDocBench v1.6 is an author-reported benchmark result, not proof that it will beat Unlimited-OCR-2 on a private document set. OmniDocBench itself contains 1,651 PDF pages across 10 document types, five layout types and five language types, according to the benchmark repository.

Can benchmark scores decide this purchase?

No. Scores can narrow a shortlist, but they cannot replace a controlled test. The OmniDocBench repository records changes from version 1.6 to version 1.7, which means a result must be read alongside its dataset and evaluation-code version.

OvisOCR3 reports 96.74 on OmniDocBench v1.6 in its technical report. That result includes the stated benchmark version, but it does not provide a matched three-way test with Unlimited-OCR-2 and DeepSeek OCR under identical prompts, hardware and throughput conditions.

Baidu’s release repository says Unlimited-OCR-2 reaches state-of-the-art performance on MPDocBench and MarathonDocBench. The release description does not provide complete matched tables with dataset versions, prompts, hardware, batch settings and throughput. A fair margin over competing models therefore cannot be calculated from that announcement alone.

For a buyer, the useful test is closer to production. Keep the prompts, image conversion, page ordering, decoding settings and post-processing fixed. Then compare errors in tables, headings, formulas, page order and extracted fields.

What does serving Unlimited-OCR-2 require?

Baidu documents Transformers for quick tests and recommends SGLang for serving in the release repository. SGLang is an inference framework that hosts a model and handles generation requests. Its documentation describes low-latency serving, multi-GPU parallelism and support for NVIDIA, AMD, Intel Xeon, Google TPU, Ascend NPU and Moore Threads MUSA hardware.

The documented Transformers test used Python 3.10, the specified PyTorch and Transformers packages, and an NVIDIA A800 with 80 GB of memory, according to Baidu’s repository. That is a tested environment, not a published minimum requirement.

pip install torch==2.13.0 torchvision pillow transformers==4.52.1 \
huggingface-hub==0.36.0 tokenizers==0.21.4 addict==2.4.0 \
einops==0.8.2 easydict==1.13

The repository loads the model with trust_remote_code=True, safetensors and bfloat16. It then moves the model to CUDA. A multi-page call passes image paths in page order through infer_multi.

tokenizer = AutoTokenizer.from_pretrained(
    "baidu/Unlimited-OCR-2",
    trust_remote_code=True
)
model = AutoModel.from_pretrained(
    "baidu/Unlimited-OCR-2",
    trust_remote_code=True,
    use_safetensors=True,
    torch_dtype=torch.bfloat16
).eval().cuda()

text, num_tokens = model.infer_multi(
    tokenizer,
    image_files=pages,
    output_path="output/multi",
    save_results=True
)

For SGLang, Baidu specifies a Python 3.10 virtual environment, a customised SGLang wheel and PyMuPDF for converting PDFs into images. The repository gives the following installation commands.

uv venv --python 3.10
source .venv/bin/activate
uv pip install wheel/sglang-0.5.20.dev10+g8d62f5fb9c-py3-none-any.whl
uv pip install pymupdf==1.27.2.2
uv pip install fastokens==0.3.2

The release repository’s server command uses the model path, the Unlimited OCR chat template, the fast tokenizer, a 0.7 static memory fraction and an OpenAI-compatible port.

python -m sglang.launch_server \
  --model-path baidu/Unlimited-OCR-2 \
  --served-model-name Unlimited-OCR-2 \
  --chat-template unlimited-ocr \
  --tokenizer-backend fastokens \
  --tokenizer-worker-num 8 \
  --mem-fraction-static 0.7 \
  --max-running-requests 64 \
  --max-prefill-tokens 2048 \
  --enable-custom-logit-processor \
  --enable-streaming-session \
  --allow-auto-truncate \
  --disable-radix-cache \
  --mm-preprocess-cache-size-mb 0 \
  --host 0.0.0.0 \
  --port 10000

Long documents can use page-window scheduling. Baidu warns that a smaller page window reduces peak memory but can hurt cross-page merging when a block continues across a window boundary. Setting document limits to zero instead selects whole-document processing in one window.

Where does OCR stop and extraction begin?

Choose Unlimited-OCR-2 when the main risk is lost context across pages. A continued table, a heading separated from its paragraph or a chapter requiring one coherent Markdown output all benefit from multi-page processing.

Choose OvisOCR3 when the product needs several document tasks from one compact model. Its report covers parsing, OCR, key-information extraction, figure captioning and cross-page table reconstruction.

Keep DeepSeek OCR as a control when testing whether SR-SWA changes results on your long-document workload. If the documents are short and page-independent, the simpler baseline may be enough.

Which model should you actually use?

Start with Unlimited-OCR-2 if structure crosses page breaks. Test it on representative PDFs and inspect continued tables, headings, formulas, page order and total processing time.

Start with OvisOCR3 if the main output is structured fields, captions or table relations. Its published remit covers more task families in one model.

Keep DeepSeek OCR in the test set if you want to isolate the value of the attention change. Short documents may not expose the advantage of long-horizon parsing.

Do not choose from parameter count alone. Build an acceptance set that includes a dense report, a scanned document, a multi-page table, a formula-heavy file and every language you plan to support. Measure errors that affect customers, not only character similarity.

What we could not verify?

The public release announcement does not provide complete matched MPDocBench and MarathonDocBench result tables with dataset versions, prompts, hardware, batch settings and throughput. It therefore cannot establish a reproducible performance margin over DeepSeek OCR or OvisOCR3.

The release material also does not publish a universal minimum GPU-memory figure for a chosen page count, batch size or scan resolution. The A800 test environment is evidence that the documented setup was used, not a minimum requirement for all deployments.

No separate peer-reviewed technical report for Unlimited-OCR-2’s SR-SWA implementation appears in the cited material. The architecture description comes from Baidu’s release repository. The “unlimited” label should therefore be read as an architecture claim, not as a capacity promise.

Sources


Liam Johnson
Liam Johnson
Liam Johnson is a technology journalist covering artificial intelligence and the tools shaping how people work.

Read more

Local News