Image-Text-to-Text
ONNX
ONNX Runtime GenAI
moonbox
onnxruntime
dots-ocr
dots-mocr
ocr
document-parsing
vision-language
Instructions to use moonbox-dev/dots.mocr-ONNX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ONNX Runtime GenAI
How to use moonbox-dev/dots.mocr-ONNX with ONNX Runtime GenAI:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
File size: 36,635 Bytes
c3979d4 5c5695d c3979d4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | ---
base_model: dots-studio/dots.mocr
base_model_relation: quantized
license: mit
pipeline_tag: image-text-to-text
library_name: onnx
tags:
- onnx
- moonbox
- onnxruntime
- onnxruntime-genai
- dots-ocr
- dots-mocr
- ocr
- document-parsing
- vision-language
---
# dots.mocr ONNX
ONNX builds of [dots.mocr](https://huggingface.co/dots-studio/dots.mocr), made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each
precision is one folder holding the graphs and a small Python `pipeline.py` that does the rest (image preprocessing,
prompt, positions, decoding loop); what the graphs take and return is under *How to run*.
## Files
The last column is the benchmark against the original model (details under *How to run*): character error rate of
the recognised text against the page's text, per language, and against the original's own output.
| Precision | File | Size | sha256 | Benchmark |
|---|---|---|---|---|
| fp16 | [`fp16/chat_template.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/chat_template.json) | 1.1 kB | `c8d629ba2b31` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/decoder.onnx`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/decoder.onnx) | 0.2 MB | `8e7cff6f1700` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/decoder.onnx.data`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/decoder.onnx.data) | 3.12 GB | `f0c5ef55a085` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/embed.onnx`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/embed.onnx) | 466.7 MB | `c1180f1addfa` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/generation_config.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/generation_config.json) | 0.1 kB | `d9ca5bd51bbf` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/merges.txt`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/merges.txt) | 1.7 MB | `599bab540750` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/pipeline.py`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/pipeline.py) | 6.4 kB | `68f12fdf0bf5` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/preprocessor_config.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/preprocessor_config.json) | 0.4 kB | `fec8b3187ab0` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/special_tokens_map.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/special_tokens_map.json) | 0.5 kB | `92b060f39417` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/tokenizer.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/tokenizer.json) | 7.0 MB | `386545eb05f0` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/tokenizer_config.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/tokenizer_config.json) | 9.3 kB | `4f09a26dd6b2` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/vision.onnx`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/vision.onnx) | 1.3 MB | `b3c8faf4d747` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/vision.onnx.data`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/vision.onnx.data) | 2.52 GB | `12ea0e09143b` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| fp16 | [`fp16/vocab.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/fp16/vocab.json) | 2.8 MB | `ca10d7e9fb3e` | CER 0.0 % / 0.0 % (original 0.0 / 0.0, bf16), identical text; 0.65 s per page (CUDA) |
| int8 | [`int8/chat_template.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/chat_template.json) | 1.1 kB | `c8d629ba2b31` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/decoder.onnx`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/decoder.onnx) | 0.2 MB | `ce7e6f6a17bd` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/decoder.onnx.data`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/decoder.onnx.data) | 1.67 GB | `378cdee96fac` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/embed.onnx`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/embed.onnx) | 233.7 MB | `77291aaa6438` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/generation_config.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/generation_config.json) | 0.1 kB | `d9ca5bd51bbf` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/merges.txt`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/merges.txt) | 1.7 MB | `599bab540750` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/pipeline.py`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/pipeline.py) | 6.4 kB | `68f12fdf0bf5` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/preprocessor_config.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/preprocessor_config.json) | 0.4 kB | `fec8b3187ab0` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/special_tokens_map.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/special_tokens_map.json) | 0.5 kB | `92b060f39417` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/tokenizer.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/tokenizer.json) | 7.0 MB | `386545eb05f0` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/tokenizer_config.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/tokenizer_config.json) | 9.3 kB | `4f09a26dd6b2` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/vision.onnx`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/vision.onnx) | 1.27 GB | `e78a36185552` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
| int8 | [`int8/vocab.json`](https://huggingface.co/moonbox-dev/dots.mocr-ONNX/blob/main/int8/vocab.json) | 2.8 MB | `ca10d7e9fb3e` | CER 0.0 % / 0.0 %, identical text; 0.66 s per page (CUDA) |
## How to run
**License.** dots.mocr is released under the dots.mocr LICENSE AGREEMENT (copied here), which builds on the MIT License:
use, modification and redistribution are allowed, including commercially, on its terms. `NOTICE` lists the third-party
code it includes.
dots.mocr (rednote-hilab: a 3B document-parsing VLM. It pairs a 1.2B NaViT vision encoder with a 1.5B Qwen2 decoder,
and handles text, layout, tables, formulas and web pages) as three ONNX graphs plus `pipeline.py`, a numpy runtime that
reproduces the repository's processor and greedy decoding around them.
- `vision.onnx`: one image: `pixel_values` [P, 588] (the processor's 3 x 14 x 14 patches, grouped by 2 x 2 merge
block) and `position_ids` [P, 2] (each patch's row / column) -> `image_embeds` [P / 4, 1536] (the 42-layer dots ViT
with 2-D RoPE, then the patch merger).
- `embed.onnx`: `input_ids` [1, S] -> `inputs_embeds` [1, S, 1536].
- `decoder.onnx`: the Qwen2 decoder (28 layers, plain 1-D RoPE) from onnxruntime-genai's model builder:
`inputs_embeds`, `attention_mask`, `past_key_values.*` -> `logits`, `present.*`.
`pipeline.py` does the rest in numpy:
- the processor: Qwen2-VL image processing with temporal patch 1, resize (bicubic) to multiples of 28 within
3 136 - 11 289 600 pixels, CLIP's mean / std;
- the chat prompt `<|user|><|img|>...<|endofimg|>{prompt}<|endofuser|><|assistant|>`;
- greedy decoding until an end token.
It needs numpy, onnxruntime (or onnxruntime-gpu), tokenizers and Pillow:
```python
import sys
from PIL import Image
sys.path.insert(0, "int8")
import pipeline
ocr = pipeline.DotsOCR("int8", "cuda")
print(ocr(Image.open("page.png"))) # prompt_ocr: "Extract the text content from this image."
```
The prompts are those of `dots_mocr/utils/prompts.py` in the GitHub repository (`prompt_layout_all_en` returns the
layout with text as JSON). The repository's PDF / layout post-processing isn't included. On Windows, give CUDA sessions
the run option `memory.enable_memory_arena_shrinkage` = `gpu:0`, as `pipeline.py` does. Every input length differs, so
ONNX Runtime's GPU arena otherwise keeps growing.
**Precisions.** `fp16/`: the vision encoder fp16 weights and math with fp32 inputs / outputs, the embedding table
fp16, the decoder fp16 (builder). `int8/`: the vision encoder weight-only int8, the embedding table int8 per row, the
decoder 8-bit MatMulNBits (block 32). No int4: the 4-bit decoder made the Chinese pages run away (CER 1187 %; English
pages stayed exact), and 4-bit vision broke every page. No bf16: fp16 passes.
**Benchmark.** The lab's 12 synthetic pages: six English and six Chinese sentences of our own, rendered with Windows
fonts, so the text is known exactly. The prompt is `prompt_ocr`, decoded greedily. The original is the repository's
code (transformers 4.57.6, as the GitHub repository pins) in bfloat16 on CUDA, as the model ships. Scores: character
error rate (whitespace ignored) against the page's text, and against the original's output. Pass (the ASR rule): per
language, CER at most 1 point above the original's. The set is easy: the original reads every page exactly, and so
does every published build; it shows the conversion is faithful, not how the model does on hard documents. Time per
page on an RTX 3080 Laptop GPU (16 GB), whole pipeline.
| | CER English / Chinese | CER vs the original's text | seconds per page |
|---|---|---|---|
| original (PyTorch bf16, CUDA) | 0.0 % / 0.0 % | - | 1.72 |
| `fp16/` (CUDA) | 0.0 % / 0.0 % | 0.0 % / 0.0 % | 0.65 |
| `int8/` (CUDA) | 0.0 % / 0.0 % | 0.0 % / 0.0 % | 0.66 |
Graphs checked against the original modules before the benchmark (largest absolute difference, float32): vision 6.7e-4
of 18.4 (the wrapper is identical to the tower's own forward), embedding exact; the numpy front end gives the
processor's prompt ids exactly.
## How these were made
From [dots.mocr](https://huggingface.co/dots-studio/dots.mocr) at revision `7c53434cd4`. The graphs were exported from the original PyTorch modules with
torch.onnx (opset 17) and checked against them. Weight-only quantization: int8 is a per-output-channel int8 weight
behind DequantizeLinear, int4 is ONNX Runtime's MatMulNBits (block 32). Each card above says which precision every
graph uses. Every precision was benchmarked against the original before upload (pass: per language, character error
rate at most 1 point above the original's), and the `sha256` column above is what the files must hash to.
## License
mit. These files are a derivative of the original model and carry its license: it is copied in this
repository, and it governs your use of these files. The original model card follows unchanged.
---
# Original model card
<div align="center">
<h1 align="center">
dots.mocr
</h1>
[](https://huggingface.co/rednote-hilab/dots.mocr)
[](https://github.com/rednote-hilab/dots.mocr)
[](https://arxiv.org/abs/2603.13032v1)
<div align="center">
<a href="https://dotsocr.xiaohongshu.com" target="_blank" rel="noopener noreferrer"><strong>🖥️ Live Demo</strong></a> |
<a href="https://raw.githubusercontent.com/rednote-hilab/dots.ocr/master/assets/wechat.jpg" target="_blank" rel="noopener noreferrer"><strong>💬 WeChat</strong></a> |
<a href="https://www.xiaohongshu.com/user/profile/683ffe42000000001d021a4c" target="_blank" rel="noopener noreferrer"><strong>📕 rednote</strong></a> |
<a href="https://x.com/rednotehilab" target="_blank" rel="noopener noreferrer"><strong>🐦 X</strong></a>
</div>
</div>
## Introduction
We present [dots.mocr](https://huggingface.co/rednote-hilab/dots.mocr). Beyond achieving state-of-the-art (SOTA) performance in standard multilingual document parsing among models of comparable size, **dots.mocr** excels at converting structured graphics (e.g., charts, UI layouts, scientific figures and etc.) directly into SVG code. Its core capabilities encompass grounding, recognition, semantic understanding, and interactive dialogue.
Simultaneously, we are releasing [dots.mocr-svg](https://huggingface.co/rednote-hilab/dots.mocr-svg), a variant specifically optimized for robust image-to-SVG parsing tasks.
More information can be found [in the paper](https://arxiv.org/abs/2603.13032v1).
## Evaluation
### 1. Document Parsing
#### 1.1 Elo Score of different bench between latest models
<table>
<thead>
<tr>
<th>models</th>
<th>olmOCR-Bench</th>
<th>OmniDocBench (v1.5)</th>
<th>XDocParse</th>
<th>Average</th>
</tr>
</thead>
<tbody>
<tr>
<td>MonkeyOCR-pro-3B</td>
<td>895.0</td>
<td>811.3</td>
<td>637.1</td>
<td>781.1</td>
</tr>
<tr>
<td>GLM-OCR</td>
<td>884.2</td>
<td>972.6</td>
<td>820.7</td>
<td>892.5</td>
</tr>
<tr>
<td>PaddleOCR-VL-1.5</td>
<td>897.3</td>
<td>997.9</td>
<td>866.4</td>
<td>920.5</td>
</tr>
<tr>
<td>HuanyuanOCR</td>
<td>997.6</td>
<td>1003.9</td>
<td>951.1</td>
<td>984.2</td>
</tr>
<tr>
<td>dots.ocr</td>
<td>1041.1</td>
<td>1027.2</td>
<td>1190.3</td>
<td>1086.2</td>
</tr>
<!-- Highlighting dots.mocr row with bold tags -->
<tr>
<td><strong>dots.mocr</strong></td>
<td><strong>1104.4</strong></td>
<td><strong>1059.0</strong></td>
<td><strong>1210.7</strong></td>
<td><strong>1124.7</strong></td>
</tr>
<tr>
<td>Gemini 3 Pro</td>
<td>1180.4</td>
<td>1128.0</td>
<td>1323.7</td>
<td>1210.7</td>
</tr>
</tbody>
</table>
> **Notes:**
> - Results for Gemini 3 Pro, PaddleOCR-VL-1.5, and GLM-OCR were obtained via APIs, while HuanyuanOCR results were generated using local inference.
> - The Elo score evaluation was conducted using Gemini 3 Flash. The prompt can be found at: [Elo Score Prompt](https://github.com/rednote-hilab/dots.mocr/blob/master/tools/elo_score_prompt.py). These results are consistent with the findings on [ocrarena](https://www.ocrarena.ai/battle).
#### 1.2 olmOCR-bench
<table>
<thead>
<tr>
<th>Model</th>
<th>ArXiv</th>
<th>Old scans math</th>
<th>Tables</th>
<th>Old scans</th>
<th>Headers & footers</th>
<th>Multi column</th>
<th>Long tiny text</th>
<th>Base</th>
<th>Overall</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mistral OCR API</td>
<td>77.2</td>
<td>67.5</td>
<td>60.6</td>
<td>29.3</td>
<td>93.6</td>
<td>71.3</td>
<td>77.1</td>
<td>99.4</td>
<td>72.0±1.1</td>
</tr>
<tr>
<td>Marker 1.10.1</td>
<td>83.8</td>
<td>66.8</td>
<td>72.9</td>
<td>33.5</td>
<td>86.6</td>
<td>80.0</td>
<td>85.7</td>
<td>99.3</td>
<td>76.1±1.1</td>
</tr>
<tr>
<td>MinerU 2.5.4*</td>
<td>76.6</td>
<td>54.6</td>
<td>84.9</td>
<td>33.7</td>
<td>96.6</td>
<td>78.2</td>
<td>83.5</td>
<td>93.7</td>
<td>75.2±1.1</td>
</tr>
<tr>
<td>DeepSeek-OCR</td>
<td>77.2</td>
<td>73.6</td>
<td>80.2</td>
<td>33.3</td>
<td>96.1</td>
<td>66.4</td>
<td>79.4</td>
<td>99.8</td>
<td>75.7±1.0</td>
</tr>
<tr>
<td>Nanonets-OCR2-3B</td>
<td>75.4</td>
<td>46.1</td>
<td>86.8</td>
<td>40.9</td>
<td>32.1</td>
<td>81.9</td>
<td>93.0</td>
<td>99.6</td>
<td>69.5±1.1</td>
</tr>
<tr>
<td>PaddleOCR-VL*</td>
<td>85.7</td>
<td>71.0</td>
<td>84.1</td>
<td>37.8</td>
<td>97.0</td>
<td>79.9</td>
<td>85.7</td>
<td>98.5</td>
<td>80.0±1.0</td>
</tr>
<tr>
<td>Infinity-Parser 7B*</td>
<td>84.4</td>
<td>83.8</td>
<td>85.0</td>
<td>47.9</td>
<td>88.7</td>
<td>84.2</td>
<td>86.4</td>
<td>99.8</td>
<td>82.5±?</td>
</tr>
<tr>
<td>olmOCR v0.4.0</td>
<td>83.0</td>
<td>82.3</td>
<td>84.9</td>
<td>47.7</td>
<td>96.1</td>
<td>83.7</td>
<td>81.9</td>
<td>99.7</td>
<td>82.4±1.1</td>
</tr>
<tr>
<td>Chandra OCR 0.1.0*</td>
<td>82.2</td>
<td>80.3</td>
<td>88.0</td>
<td>50.4</td>
<td>90.8</td>
<td>81.2</td>
<td>92.3</td>
<td>99.9</td>
<td>83.1±0.9</td>
</tr>
<tr>
<td>dots.ocr</td>
<td>82.1</td>
<td>64.2</td>
<td>88.3</td>
<td>40.9</td>
<td>94.1</td>
<td>82.4</td>
<td>81.2</td>
<td>99.5</td>
<td>79.1±1.0</td>
</tr>
<tr>
<td><strong>dots.mocr</strong></td>
<td><strong>85.9</strong></td>
<td><strong>85.5</strong></td>
<td><strong>90.7</strong></td>
<td>48.2</td>
<td>94.0</td>
<td><strong>85.3</strong></td>
<td>81.6</td>
<td>99.7</td>
<td><strong>83.9±0.9</strong></td>
</tr>
</tbody>
</table>
> **Note:**
> - The metrics are from [olmocr](https://github.com/allenai/olmocr), and our own internal evaluations.
> - We delete the Page-header and Page-footer cells in the result markdown.
#### 1.3 Other Benchmarks
<table>
<thead>
<tr>
<th>Model Type</th>
<th>Methods</th>
<th>Size</th>
<th>OmniDocBench(v1.5)<br>TextEdit↓</th>
<th>OmniDocBench(v1.5)<br>Read OrderEdit↓</th>
<th>pdf-parse-bench</th>
</tr>
</thead>
<tbody>
<!-- GeneralVLMs Group (Reversed Order, 3 rows) -->
<tr>
<td rowspan="3"><strong>GeneralVLMs</strong></td>
<td>Gemini-2.5 Pro</td>
<td>-</td>
<td>0.075</td>
<td>0.097</td>
<td>9.06</td>
</tr>
<tr>
<td>Qwen3-VL-235B-A22B-Instruct</td>
<td>235B</td>
<td>0.069</td>
<td>0.068</td>
<td><strong>9.71</strong></td>
</tr>
<tr>
<td>gemini3pro</td>
<td>-</td>
<td>0.066</td>
<td>0.079</td>
<td>9.68</td>
</tr>
<!-- SpecializedVLMs Group (Reversed Order, 12 rows) -->
<tr>
<td rowspan="12"><strong>SpecializedVLMs</strong></td>
<td>Mistral OCR</td>
<td>-</td>
<td>0.164</td>
<td>0.144</td>
<td>8.84</td>
</tr>
<tr>
<td>Deepseek-OCR</td>
<td>3B</td>
<td>0.073</td>
<td>0.086</td>
<td>8.26</td>
</tr>
<tr>
<td>MonkeyOCR-3B</td>
<td>3B</td>
<td>0.075</td>
<td>0.129</td>
<td>9.27</td>
</tr>
<tr>
<td>OCRVerse</td>
<td>4B</td>
<td>0.058</td>
<td>0.071</td>
<td>--</td>
</tr>
<tr>
<td>MonkeyOCR-pro-3B</td>
<td>3B</td>
<td>0.075</td>
<td>0.128</td>
<td>-</td>
</tr>
<tr>
<td>MinerU2.5</td>
<td>1.2B</td>
<td>0.047</td>
<td>0.044</td>
<td>-</td>
</tr>
<tr>
<td>PaddleOCR-VL</td>
<td>0.9B</td>
<td>0.035</td>
<td>0.043</td>
<td>9.51</td>
</tr>
<tr>
<td>HunyuanOCR</td>
<td>0.9B</td>
<td>0.042</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>PaddleOCR-VL1.5</td>
<td>0.9B</td>
<td>0.035</td>
<td>0.042</td>
<td>-</td>
</tr>
<tr>
<td>GLMOCR</td>
<td>0.9B</td>
<td>0.04</td>
<td>0.043</td>
<td>-</td>
</tr>
<tr>
<td>dots.ocr</td>
<td>3B</td>
<td>0.048</td>
<td>0.053</td>
<td>9.29</td>
</tr>
<tr>
<td><u><strong>dots.mocr</strong></u></td>
<td>3B</td>
<td><strong>0.031</strong></td>
<td><strong>0.029</strong></td>
<td>9.54</td>
</tr>
</tbody>
</table>
> **Note:**
> - Metrics are sourced from [OmniDocBench](https://github.com/opendatalab/OmniDocBench) and other model publications. [pdf-parse-bench](https://github.com/phorn1/pdf-parse-bench) results are reproduced by Qwen3-VL-235B-A22B-Instruct.
> - Formula and Table metrics for OmniDocBench1.5 are omitted due to their high sensitivity to detection and matching protocols.
### 2. Structured Graphics Parsing
Visual languages (e.g., charts, graphics, chemical formulas, logos) encapsulate dense human knowledge. **dots.mocr** unifies the interpretation of these elements by parsing them directly into **SVG code**.
<table>
<thead>
<tr>
<th rowspan="2" style="text-align: left;">Methods</th>
<th colspan="3">Unisvg</th>
<th rowspan="2">Chartmimic</th>
<th rowspan="2">Design2Code</th>
<th rowspan="2">Genexam</th>
<th rowspan="2">SciGen</th>
<th rowspan="2">ChemDraw</th>
</tr>
<tr>
<th>Low-Level</th>
<th>High-Level</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">OCRVerse</td>
<td>0.632</td>
<td>0.852</td>
<td>0.763</td>
<td>0.799</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>0.881</td>
</tr>
<tr>
<td style="text-align: left;">Gemini 3 Pro</td>
<td>0.563</td>
<td>0.850</td>
<td>0.735</td>
<td>0.788</td>
<td>0.760</td>
<td>0.756</td>
<td>0.783</td>
<td>0.839</td>
</tr>
<tr>
<td style="text-align: left;">dots.mocr</td>
<td>0.850</td>
<td>0.923</td>
<td>0.894</td>
<td>0.772</td>
<td>0.801</td>
<td>0.664</td>
<td>0.660</td>
<td>0.790</td>
</tr>
<tr>
<td style="text-align: left;"><strong>dots.mocr-svg</strong></td>
<td><strong>0.860</strong></td>
<td><strong>0.931</strong></td>
<td><strong>0.902</strong></td>
<td><strong>0.905</strong></td>
<td><strong>0.834</strong></td>
<td><strong>0.8</strong></td>
<td><strong>0.797</strong></td>
<td><strong>0.901</strong></td>
</tr>
</tbody>
</table>
> **Note:**
> - We use the ISVGEN metric from [UniSVG](https://ryanlijinke.github.io/) to evaluate the parsing result. For benchmarks that do not natively support image parsing, we use the original images as input, and calculate the ISVGEN score between the rendered output and the original image.
> - [OCRVerse](https://github.com/DocTron-hub/OCRVerse) results are derived from various code formats (e.g., SVG, Python), whereas results for Gemini 3 Pro and dots.mocr are based specifically on SVG code.
> - Due to the capacity constraints of a 3B-parameter VLM, dots.mocr may not excel in all tasks yet like svg. To complement this, we are simultaneously releasing dots.mocr-svg. We plan to further address these limitations in future updates.
### 3. General Vision Tasks
<table>
<thead>
<tr>
<th>Model</th>
<th>CharXiv_descriptive</th>
<th>CharXiv_reasoning</th>
<th>OCR_Reasoning</th>
<th>infovqa</th>
<th>docvqa</th>
<th>ChartQA</th>
<th>OCRBench</th>
<th>AI2D</th>
<th>CountBenchQA</th>
<th>refcoco</th>
</tr>
</thead>
<tbody>
<tr>
<td>Qwen3vl-2b-instruct</td>
<td>62.3</td>
<td>26.8</td>
<td>-</td>
<td>72.4</td>
<td>93.3</td>
<td>-</td>
<td>85.8</td>
<td>76.9</td>
<td>88.4</td>
<td>-</td>
</tr>
<tr>
<td>Qwen3vl-4b-instruct</td>
<td>76.2</td>
<td>39.7</td>
<td>-</td>
<td>80.3</td>
<td>95.3</td>
<td>-</td>
<td>88.1</td>
<td>84.1</td>
<td>84.9</td>
<td>-</td>
</tr>
<tr>
<td><strong>dots.mocr</strong></td>
<td>77.4</td>
<td>55.3</td>
<td>22.85</td>
<td>73.76</td>
<td>91.85</td>
<td>83.2</td>
<td>86.0</td>
<td>82.16</td>
<td>94.46</td>
<td>80.03</td>
</tr>
</tbody>
</table>
# Quick Start
## 1. Installation
### Install dots.mocr
```shell
conda create -n dots_mocr python=3.12
conda activate dots_mocr
git clone https://github.com/rednote-hilab/dots.mocr.git
cd dots.mocr
# Install pytorch, see https://pytorch.org/get-started/previous-versions/ for your cuda version
# pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu128
# install flash-attn==2.8.0.post2 for faster inference
pip install -e .
```
If you have trouble with the installation, try our [Docker Image](https://hub.docker.com/r/rednotehilab/dots.ocr) for an easier setup, and follow these steps:
### Download Model Weights
> 💡**Note:** Please use a directory name without periods (e.g., `DotsMOCR` instead of `dots.mocr`) for the model save path. This is a temporary workaround pending our integration with Transformers.
```shell
python3 tools/download_model.py
# with modelscope
python3 tools/download_model.py --type modelscope
```
## 2. Deployment
### vLLM inference
We highly recommend using vLLM for deployment and inference. **Since vLLM version 0.11.0, Dots OCR has been officially integrated into vLLM with verified performance** and you can use vLLM docker image directly (e.g, `vllm/vllm-openai:v0.11.0`) to deploy the model server.
```shell
# Launch vLLM model server
## dots.mocr
CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.mocr --tensor-parallel-size 1 --gpu-memory-utilization 0.9 --chat-template-content-format string --served-model-name model --trust-remote-code
## dots.mocr-svg
CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.mocr-svg --tensor-parallel-size 1 --gpu-memory-utilization 0.9 --chat-template-content-format string --served-model-name model --trust-remote-code
# vLLM API Demo
# See dots_mocr/model/inference.py and dots_mocr/utils/prompts.py for details on parameter and prompt settings
# that help achieve the best output quality.
## document parsing
python3 ./demo/demo_vllm.py --prompt_mode prompt_layout_all_en
## web parsing
python3 ./demo/demo_vllm.py --prompt_mode prompt_web_parsing --image_path ./assets/showcase/origin/webpage_1.png
## scene spoting
python3 ./demo/demo_vllm.py --prompt_mode prompt_scene_spotting --image_path ./assets/showcase/origin/scene_1.jpg
## image parsing with svg code
python3 ./demo/demo_vllm_svg.py --prompt_mode prompt_image_to_svg
## general qa
python3 ./demo/demo_vllm_general.py
```
### Hugginface inference
```shell
python3 demo/demo_hf.py
```
<details>
<summary><b>Hugginface inference details</b></summary>
```python
import torch
from transformers import AutoModelForCausalLM, AutoProcessor, AutoTokenizer
from qwen_vl_utils import process_vision_info
from dots_mocr.utils import dict_promptmode_to_prompt
model_path = "./weights/DotsMOCR"
model = AutoModelForCausalLM.from_pretrained(
model_path,
attn_implementation="flash_attention_2",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
image_path = "demo/demo_image1.jpg"
prompt = """Please output the layout information from the PDF image, including each layout element's bbox, its category, and the corresponding text content within the bbox.
1. Bbox format: [x1, y1, x2, y2]
2. Layout Categories: The possible categories are ['Caption', 'Footnote', 'Formula', 'List-item', 'Page-footer', 'Page-header', 'Picture', 'Section-header', 'Table', 'Text', 'Title'].
3. Text Extraction & Formatting Rules:
- Picture: For the 'Picture' category, the text field should be omitted.
- Formula: Format its text as LaTeX.
- Table: Format its text as HTML.
- All Others (Text, Title, etc.): Format their text as Markdown.
4. Constraints:
- The output text must be the original text from the image, with no translation.
- All layout elements must be sorted according to human reading order.
5. Final Output: The entire output must be a single JSON object.
"""
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": image_path
},
{"type": "text", "text": prompt}
]
}
]
# Preparation for inference
text = processor.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
)
inputs = inputs.to("cuda")
# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=24000)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
```
</details>
### Hugginface inference with CPU
Please refer to [CPU inference](https://github.com/rednote-hilab/dots.ocr/issues/1#issuecomment-3148962536)
## 3. Document Parse
**Based on vLLM server**, you can parse an image or a pdf file using the following commands:
```bash
# Parse all layout info, both detection and recognition
# Parse a single image
python3 dots_mocr/parser.py demo/demo_image1.jpg
# Parse a single PDF
python3 dots_mocr/parser.py demo/demo_pdf1.pdf --num_thread 64 # try bigger num_threads for pdf with a large number of pages
# Layout detection only
python3 dots_mocr/parser.py demo/demo_image1.jpg --prompt prompt_layout_only_en
# Parse text only, except Page-header and Page-footer
python3 dots_mocr/parser.py demo/demo_image1.jpg --prompt prompt_ocr
```
**Based on Transformers**, you can parse an image or a pdf file using the same commands above, just add `--use_hf true`.
> Notice: transformers is slower than vllm, if you want to use demo/* with transformers,just add `use_hf=True` in `DotsMOCRParser(..,use_hf=True)`
<details>
<summary><b>Output Results</b></summary>
1. **Structured Layout Data** (`demo_image1.json`): A JSON file containing the detected layout elements, including their bounding boxes, categories, and extracted text.
2. **Processed Markdown File** (`demo_image1.md`): A Markdown file generated from the concatenated text of all detected cells.
* An additional version, `demo_image1_nohf.md`, is also provided, which excludes page headers and footers for compatibility with benchmarks like Omnidocbench and olmOCR-bench.
3. **Layout Visualization** (`demo_image1.jpg`): The original image with the detected layout bounding boxes drawn on it.
</details>
## 4. Demo
Have fun with the [live demo](https://dotsocr.xiaohongshu.com/).
### Examples for document parsing
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/formula1.png" alt="formula1.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/table3.png" alt="table3.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/Tibetan.png" alt="Tibetan.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/tradition_zh.png" alt="tradition_zh.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/nl.png" alt="nl.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/kannada.png" alt="kannada.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/russian.png" alt="russian.png" border="0" />
### Examples for image parsing
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/svg_1.png" alt="svg_1.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/svg_2.png" alt="svg_2.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/svg_4.png" alt="svg_4.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/svg_5.png" alt="svg_5.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/svg_6.png" alt="svg_6.png" border="0" />
> **Note:**
> - Inferenced by dots.mocr-svg
### Example for web parsing
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/webpage_1.png" alt="webpage_1.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/webpage_2.png" alt="webpage_2.png" border="0" />
### Examples for scene spotting
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/scene_1.png" alt="scene_1.png" border="0" />
<img src="https://raw.githubusercontent.com/rednote-hilab/dots.mocr/master/assets/showcase/result/scene_2.png" alt="scene_2.png" border="0" />
# Limitation & Future Work
- **Complex Document Elements:**
- **Table&Formula**: The extraction of complex tables and mathematical formulas persists as a difficult task given the model's compact architecture.
- **Picture**: We have adopted an SVG code representation for parsing structured graphics; however, the performance has yet to achieve the desired level of robustness.
- **Parsing Failures:** While we have reduced the rate of parsing failures compared to the previous version, these issues may still occur occasionally. We remain committed to further resolving these edge cases in future updates.
# Citation
```BibTeX
@misc{zheng2026multimodalocrparsedocuments,
title={Multimodal OCR: Parse Anything from Documents},
author={Handong Zheng and Yumeng Li and Kaile Zhang and Liang Xin and Guangwei Zhao and Hao Liu and Jiayu Chen and Jie Lou and Jiyu Qiu and Qi Fu and Rui Yang and Shuo Jiang and Weijian Luo and Weijie Su and Weijun Zhang and Xingyu Zhu and Yabin Li and Yiwei ma and Yu Chen and Zhaohui Yu and Guang Yang and Colin Zhang and Lei Zhang and Yuliang Liu and Xiang Bai},
year={2026},
eprint={2603.13032},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2603.13032},
}
```
|