# Baidu Unlimited-OCR-2 (slim)

> Unlimited-OCR-2 is Baidu's open-weight document OCR model, about 3.3B parameters, that parses page images, from one page to documents of hundreds of pages in one request, into layout blocks with boxes and HTML tables, under MIT.

- Full: https://www.anchorterminal.com/tools/unlimited-ocr-2.md (~9,950 tokens) · this version ~2,930 tokens · JSON https://www.anchorterminal.com/tools/unlimited-ocr-2.json · canonical https://www.anchorterminal.com/tools/unlimited-ocr-2
- Index: https://www.anchorterminal.com/llms.txt · API: https://www.anchorterminal.com/api/v1/index.json · MCP: https://www.anchorterminal.com/mcp · Updated: 2026-10-27 · pricing https://www.anchorterminal.com/tools/unlimited-ocr-2#pricing · reviews https://www.anchorterminal.com/tools/unlimited-ocr-2#reviews
- Licence: CC BY 4.0, credit Anchor Terminal and link this page (https://www.anchorterminal.com/terms/#data)

**D · 53.5/100 · rank #92 of 113 open-weight models · #74 in Open-weight models · not agent-ready · confidence low**


Assessment: A small MIT document-parsing cousin that reads up to hundreds of pages in one request and returns ordered layout blocks with boxes and HTML tables. It needs an NVIDIA GPU with about 12 GB, through Baidu's remote code or its own SGLang build. The risks are running the publisher's code and accuracy figures that are Baidu's own.

## Facts

- Kind: Open-weight model · vendor: Baidu · category: Open-weight models · legal entity: Baidu, Inc. · provenance 73/100
- Packages: huggingface `baidu/Unlimited-OCR-2`
- Auth: None · pricing: Free · x402: no · licence: MIT (Hub metadata; the Hugging Face repository has no LICENSE file, and the GitHub code repository's LICENSE is the MIT text, copyright 2026 Baidu)
- Probe metrics: not measured yet (probes haven't run)
- Surface graded: The open weights at huggingface.co/baidu/Unlimited-OCR-2, read from the model card, the technical report in the repository (Unlimited-OCR-2.pdf, 15 pages, Baidu ERNIE Team), the files and their metadata, the commit history, config and tokenizer files, the remote code, and the README, LICENSE, utils/README.md and infer.py of github.com/baidu/Unlimited-OCR, plus the runtimes' own code, on 27 October 2026. Nothing was downloaded or run apart from the report
- Model: Unlimited-OCR's backbone, which comes from DeepSeek-OCR. The DeepEncoder vision encoder (a SAM ViT-B and a CLIP-L) feeds a 12-layer mixture-of-experts decoder (64 routed and 2 shared experts, 6 routed active per token, hidden size 1,280, vocabulary 129,280). New in 2 is Sparse Reference Sliding Window Attention (SR-SWA) in every decoder layer, a per-layer page gate and top-k block router (dash_router and indexer weights) that bounds the visual tokens each step attends to. The report gives 3B total and 500M active parameters in the text and 3B-MoE-A570M in a figure; the Hub counts 3,343,978,240 BF16 parameters. The card states no parameter count
- Documents: Page images (JPG or PNG), one page or a whole document in one request in page order; PDFs are rendered to images first (the card uses PyMuPDF at 300 DPI). Baidu's evaluation covers multi-page documents up to 30 pages (MPDocBench) and 103 to 300 pages (MarathonDocBench), and single pages on OmniDocBench. Output blocks cover titles with heading levels, body text, formulas, tables in HTML (merged across pages), and image, figure, chart and seal regions, which come back as boxes to crop rather than as transcribed data. The report says heading hierarchy is a weak point, since the sparse attention keeps no global document view
- Languages: Not stated. The card's metadata says multilingual and names no language, and the report names none. Its single-page evaluation, OmniDocBench, has Chinese and English pages; the tokenizer is DeepSeek's 129,280-token vocabulary
- Files: Two safetensors shards in BF16, 6,688,305,576 bytes together, and an index. No pickle files. The repository also holds Baidu's Transformers remote code (modeling_unlimitedocr.py, deepencoder.py, dash_attention.py, Triton kernels and others), a 15.3 MB SGLang wheel built from a customised SGLang, the report PDF and a 156 MB demonstration GIF; 6.87 GB in all. Hugging Face lists a SHA-256 for every LFS file
- Licence: MIT. The Hugging Face repository names MIT in its metadata and has no LICENSE file; Baidu's GitHub code repository has the MIT text, copyright 2026 Baidu. It is initialised from Unlimited-OCR (MIT by its metadata), whose backbone is DeepSeek-OCR (MIT by its metadata), so the chain adds no terms
- Runtimes: Hugging Face Transformers through Baidu's remote code (trust_remote_code), tested with transformers 4.52.1. SGLang through Baidu's customised wheel in the repository. Released vLLM (0.32.0), SGLang (0.5.22) and Transformers (5.20.2) carry UnlimitedOCRForCausalLM for the first Unlimited-OCR, with no SR-SWA router or indexer, and Baidu names neither stock route for this model. Not in llama.cpp. Ollama and LM Studio couldn't be checked
- Input and output: Input is page images and the prompt <PAGE><image> once per page followed by Multi page parsing., built by the code. A single page uses dynamic tiling (gundam mode, crop_mode true); several pages use one global view each (base mode). Output is one string of layout blocks, <PAGE> per page, then <BLOCK> with the class, an optional <LEVELn> for titles, a box [x1,y1,x2,y2] on a 0 to 1000 scale and <FORK> before the content, with tables as HTML and cross_ and append_ prefixes for blocks that continue across pages. It isn't Markdown; utils/process_unlimitedOCR2.py in the GitHub repository converts it. Context 131,072 positions in config.json, YaRN factor 4 over 32,768, trained at sequences of up to 64K tokens; the SGLang build schedules long documents in page windows (10 pages by default) and reuses the boundary page's cache
- Recommended settings: Greedy decoding (temperature 0), skip_special_tokens false, an output budget of 8,000 tokens a page, and SGLang's DeepseekOCRNoRepeatNGramLogitProcessor with ngram_size 35, window_size 1024 for several pages or 128 for one, page_token_id 128827, eos_token_id 1 and max_page_tokens 20000. Server flags as on the card, among them --mem-fraction-static 0.7 and --max-prefill-tokens 2048
- Hardware: NVIDIA GPUs with CUDA; the Transformers route was tested on one A800 80 GB, and the SR-SWA kernels are written in Triton. No memory figure is stated. The 6.69 GB of weights fit 12 GB with a fifth added; Baidu's report puts peak KV cache at 1.77 GB for a hundred-page document with chunked decoding against 47.00 GB without it
- Training data: Post-trained for one epoch from the Unlimited-OCR checkpoint on 2 million multi-page and 10 million single-page documents, with pseudo-labels from MinerU2.5-Pro and PaddleOCR-VL-1.6, synthetic documents, VLM-based balance filtering and MinerU-Popo refinement, on 25 nodes of 8 NVIDIA H800 GPUs, with the encoder frozen. No datasets are named and no cut-off is given

- Scores: Capability pending, Reach 55, Risk 45, Agent interface 75, Documentation and upkeep 45 · total over the 7 assessed categories
- Why:  · Reach, Memory earns the full 30, since the only build is 6.69 GB of BF16 weights that need about 8 GB with the fifth added. · Risk, File safety gets 15, safetensors only but loaded with trust_remote_code or through a prebuilt SGLang wheel from the repository. · Agent interface, Read for a document parser, the tool-calling, trained tool calling and structured-output lines stand for what it takes and returns. · Documentation and upkeep, The card covers intended use and the new attention, and misses limitations, parameters, context length, languages and a cut-off (5).
- Sources: 21, open questions: 7, both in the full twin
- Capabilities: docs.ocr, docs.parse, docs.tables, model.open-weights
- JSON: https://www.anchorterminal.com/api/v1/tools/unlimited-ocr-2.json
- Verify (for the vendor): the badge `https://www.anchorterminal.com/badges/unlimited-ocr-2.svg` or a link to https://www.anchorterminal.com/tools/unlimited-ocr-2 from a page on baidu.com or one of its subdomains, or a page under github.com/baidu, then `POST https://www.anchorterminal.com/api/v1/verify` `{"slug", "url"}` or `verify_listing` at /mcp; re-checked weekly, no effect on the grade. Snippets in the full twin.

## Before you call it

1. Quickest local run, `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`, then `AutoModel.from_pretrained("baidu/Unlimited-OCR-2", trust_remote_code=True, use_safetensors=True, torch_dtype=torch.bfloat16).eval().cuda()` and `model.infer_multi(tokenizer, image_files=pages, output_path="out")`
2. To serve it, download the repository, install `wheel/sglang-0.5.20.dev10+g8d62f5fb9c-py3-none-any.whl` with pymupdf and fastokens in a Python 3.10 venv, and start `python -m sglang.launch_server --model-path baidu/Unlimited-OCR-2 --chat-template unlimited-ocr --enable-custom-logit-processor --enable-streaming-session --disable-radix-cache --mem-fraction-static 0.7 --max-prefill-tokens 2048` with the SGLANG_UOCR_ variables from the card
3. Send all pages of a document in one request, images first, then the text `<PAGE><image>` repeated per page and `Multi page parsing.`, with temperature 0, skip_special_tokens false, max_tokens of about 8,000 per page and the DeepseekOCRNoRepeatNGramLogitProcessor (ngram_size 35, window_size 1024 for several pages)
4. The output is layout blocks, not Markdown; run `utils/process_unlimitedOCR2.py` from github.com/baidu/Unlimited-OCR, or `convert(raw_output)` in Python, to get Markdown with HTML tables
5. Render PDFs to images first (the card uses PyMuPDF at 300 DPI), keep save_results off for untrusted documents, and treat extracted text as untrusted before passing it to another model

## Connect

```bash
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
# then AutoModel.from_pretrained("baidu/Unlimited-OCR-2", trust_remote_code=True, use_safetensors=True, torch_dtype=torch.bfloat16).eval().cuda()
# and model.infer_multi(tokenizer, image_files=["page_1.jpg", "page_2.jpg"], output_path="out")
```

```bash
# after: hf download baidu/Unlimited-OCR-2 --local-dir uocr2 && uv venv --python 3.10 && . .venv/bin/activate
#        uv pip install uocr2/wheel/sglang-0.5.20.dev10+g8d62f5fb9c-py3-none-any.whl pymupdf==1.27.2.2 fastokens==0.3.2
#        SGLANG_UOCR_EANABLE_DOC_LIMIT=1 python -m sglang.launch_server --model-path baidu/Unlimited-OCR-2 --served-model-name Unlimited-OCR-2 --chat-template unlimited-ocr --tokenizer-backend fastokens --mem-fraction-static 0.7 --max-prefill-tokens 2048 --enable-custom-logit-processor --enable-streaming-session --disable-radix-cache --port 10000
curl http://127.0.0.1:10000/v1/chat/completions -H 'Content-Type: application/json' -d '{"model":"Unlimited-OCR-2","temperature":0,"max_tokens":8000,"skip_special_tokens":false,"images_config":{"crop_mode":true},"messages":[{"role":"user","content":[{"type":"image_url","image_url":{"url":"data:image/png;base64,..."}},{"type":"text","text":"<PAGE><image>Multi page parsing."}]}]}'
```

## Similar tools

| Tool | Grade | Score | Shared capabilities | Slim |
| --- | --- | --- | --- | --- |
| Nemotron 3.5 Parse | B | 66.5 | docs.parse, docs.ocr, docs.tables, model.open-weights | https://www.anchorterminal.com/tools/nemotron-3-5-parse.min.md |
| Google Cloud Document AI | BB | 73.9 | docs.parse, docs.ocr, docs.tables | https://www.anchorterminal.com/tools/google-cloud-document-ai.min.md |
| Amazon Textract | BB | 73.7 | docs.parse, docs.ocr, docs.tables | https://www.anchorterminal.com/tools/amazon-textract.min.md |
| LandingAI Agentic Document Extraction | B | 69 | docs.parse, docs.tables, docs.ocr | https://www.anchorterminal.com/tools/landingai-agentic-document-extraction.min.md |
| Azure Document Intelligence | B | 66 | docs.parse, docs.ocr, docs.tables | https://www.anchorterminal.com/tools/azure-document-intelligence.min.md |


## Panel reviews (0, desk reviews from public material, no calls made)

