logo
0
0
Login

dots.ocr: Multilingual Document Layout Parsing in a Single Vision-Language Model

Blog HuggingFace

Introduction

dots.ocr is a powerful, multilingual document parser that unifies layout detection and content recognition within a single vision-language model while maintaining good reading order. Despite its compact 1.7B-parameter LLM foundation, it achieves state-of-the-art(SOTA) performance.

  1. Powerful Performance: dots.ocr achieves SOTA performance for text, tables, and reading order on OmniDocBench, while delivering formula recognition results comparable to much larger models like Doubao-1.5 and gemini2.5-pro.
  2. Multilingual Support: dots.ocr demonstrates robust parsing capabilities for low-resource languages, achieving decisive advantages across both layout detection and content recognition on our in-house multilingual documents benchmark.
  3. Unified and Simple Architecture: By leveraging a single vision-language model, dots.ocr offers a significantly more streamlined architecture than conventional methods that rely on complex, multi-model pipelines. Switching between tasks is accomplished simply by altering the input prompt, proving that a VLM can achieve competitive detection results compared to traditional detection models like DocLayout-YOLO.
  4. Efficient and Fast Performance: Built upon a compact 1.7B LLM, dots.ocr provides faster inference speeds than many other high-performing models based on larger foundations.

Performance Comparison: dots.ocr vs. Competing Models

Notes:

  • The EN, ZH metrics are the end2end evaluation results of OmniDocBench, and Multilingual metric is the end2end evaluation results of dots.ocr-bench.

News

  • 2025.07.30 🚀 We release dots.ocr, — a multilingual documents parsing model based on 1.7b llm, with SOTA performance.

Benchmark Results

1. OmniDocBench

The end-to-end evaluation results of different tasks.

Model
Type
MethodsOverallEditTextEditFormulaEditTableTEDSTableEditRead OrderEdit
ENZHENZHENZHENZHENZHENZH
Pipeline
Tools
MinerU0.1500.3570.0610.2150.2780.57778.662.10.1800.3440.0790.292
Marker0.3360.5560.0800.3150.5300.88367.649.20.6190.6850.1140.340
Mathpix0.1910.3650.1050.3840.3060.45477.067.10.2430.3200.1080.304
Docling0.5890.9090.4160.9870.999161.325.00.6270.8100.3130.837
Pix2Text0.3200.5280.1380.3560.2760.61173.666.20.5840.6450.2810.499
Unstructured0.5860.7160.1980.4810.999100.0610.9980.1450.387
OpenParse0.6460.8140.6810.9740.996164.827.50.2840.6390.5950.641
PPStruct-V30.1450.2060.0580.0880.2950.535--0.1590.1090.0690.091
Expert
VLMs
GOT-OCR0.2870.4110.1890.3150.3600.52853.247.20.4590.5200.1410.280
Nougat0.4520.9730.3650.9980.4880.94139.900.5721.0000.3820.954
Mistral OCR0.2680.4390.0720.3250.3180.49575.863.60.6000.6500.0830.284
OLMOCR-sglang0.3260.4690.0970.2930.4550.65568.161.30.6080.6520.1450.277
SmolDocling-256M0.4930.8160.2620.8380.7530.99744.916.50.7290.9070.2270.522
Dolphin0.2060.3060.1070.1970.4470.58077.367.20.1800.2850.0910.162
MinerU 20.1390.2400.0470.1090.2970.53682.579.00.1410.1950.069<0.118
OCRFlux0.1950.2810.0640.1830.3790.61371.681.30.2530.1390.0860.187
MonkeyOCR-pro-3B0.1380.2060.0670.1070.2460.42181.587.50.1390.1110.1000.185
General
VLMs
GPT4o0.2330.3990.1440.4090.4250.60672.062.90.2340.3290.1280.251
Qwen2-VL-72B0.2520.3270.0960.2180.4040.48776.876.40.3870.4080.1190.193
Qwen2.5-VL-72B0.2140.2610.0920.180.3150.43482.983.90.3410.2620.1060.168
Gemini2.5-Pro0.1480.2120.0550.1680.3560.43985.886.40.130.1190.0490.121
doubao-1-5-thinking-vision-pro-2504280.1400.1620.0430.0850.2950.38483.389.30.1650.0850.0580.094
Expert VLMsdots.ocr0.1250.1600.0320.0660.3290.41688.689.00.0990.0920.0400.067

The end-to-end text recognition performance across 9 PDF page types.

Model
Type
ModelsBookSlidesFinancial
Report
TextbookExam
Paper
MagazineAcademic
Papers
NotesNewspaperOverall
Pipeline
Tools
MinerU0.0550.1240.0330.1020.1590.0720.0250.9840.1710.206
Marker0.0740.3400.0890.3190.4520.1530.0590.6510.1920.274
Mathpix0.1310.2200.2020.2160.2780.1470.0910.6340.6900.300
Expert
VLMs
GOT-OCR0.1110.2220.0670.1320.2040.1980.1790.3880.7710.267
Nougat0.7340.9581.0000.8200.9300.8300.2140.9910.8710.806
Dolphin0.0910.1310.0570.1460.2310.1210.0740.3630.3070.177
OCRFlux0.0680.1250.0920.1020.1190.0830.0470.2230.5360.149
MonkeyOCR-pro-3B0.0840.1290.0600.0900.1070.0730.0500.1710.1070.100
General
VLMs
GPT4o0.1570.1630.3480.1870.2810.1730.1460.6070.7510.316
Qwen2.5-VL-7B0.1480.0530.1110.1370.1890.1170.1340.2040.7060.205
InternVL3-8B0.1630.0560.1070.1090.1290.1000.1590.1500.6810.188
doubao-1-5-thinking-vision-pro-2504280.0480.0480.0240.0620.0850.0510.0390.0960.1810.073
Expert VLMsdots.ocr0.0310.0470.0110.0820.0790.0280.0290.1090.0560.055

Notes:

  • The metrics are from MonkeyOCR, OmniDocBench, and our own internal evaluations.
  • We delete the Page-header and Page-footer cells in the result markdown.
  • We use tikz_preprocess pipeline to upsample the images to dpi 200.

2. dots.ocr-bench

This is an inhouse benchmark which contain 1493 pdf images with 100 languages.

The end-to-end evaluation results of different tasks.

MethodsOverallEditTextEditFormulaEditTableTEDSTableEditRead OrderEdit
MonkeyOCR-3B0.4830.4450.62750.930.4520.409
doubao-1-5-thinking-vision-pro-2504280.2910.2260.44071.20.2600.238
doubao-1-60.2990.2700.41771.00.2580.253
Gemini2.5-Pro0.2510.1630.40277.10.2360.202
dots.ocr 0.1770.0750.29779.20.1860.152

Notes:

  • We use the same metric calculation pipeline of OmniDocBench.
  • We delete the Page-header and Page-footer cells in the result markdown.

Layout Detection

MethodF1@IoU=.50:.05:.95↑F1@IoU=.50↑
OverallTextFormulaTablePictureOverallTextFormulaTablePicture
DocLayout-YOLO-DocStructBench0.7330.6940.4800.8030.6190.8060.7790.6200.8580.678
dots.ocr-parse all0.8310.8010.6540.8380.7480.9220.9090.7700.8880.831
dots.ocr-detection only 0.8450.8160.7160.8750.7650.9300.9170.8320.9180.843

Notes:

  • prompt_layout_all_en for parse all, prompt_layout_only_en for detection only, please refer to prompts

3. olmOCR-bench.

ModelArXivOld Scans
Math
TablesOld ScansHeaders and
Footers
Multi
column
Long Tiny
Text
BaseOverall
GOT OCR52.752.00.222.193.642.029.994.048.3 ± 1.1
Marker76.057.957.627.884.972.984.699.170.1 ± 1.1
MinerU75.447.460.917.396.659.039.196.661.5 ± 1.1
Mistral OCR77.267.560.629.393.671.377.199.472.0 ± 1.1
Nanonets OCR67.068.677.739.540.769.953.499.364.5 ± 1.1
GPT-4o
(No Anchor)
51.575.569.140.994.268.954.196.768.9 ± 1.1
GPT-4o
(Anchored)
53.574.570.040.793.869.360.696.869.9 ± 1.1
Gemini Flash 2
(No Anchor)
32.156.361.427.848.058.784.494.057.8 ± 1.1
Gemini Flash 2
(Anchored)
54.556.172.134.264.761.571.595.663.8 ± 1.2
Qwen 2 VL
(No Anchor)
19.731.724.217.188.98.36.855.531.5 ± 0.9
Qwen 2.5 VL
(No Anchor)
63.165.767.338.673.668.349.198.365.5 ± 1.2
olmOCR v0.1.75
(No Anchor)
71.571.471.442.894.177.771.097.874.7 ± 1.1
olmOCR v0.1.75
(Anchored)
74.971.271.042.294.578.373.398.375.5 ± 1.0
MonkeyOCR-pro-3B83.868.874.636.191.276.680.195.375.8 ± 1.0
dots.ocr82.164.288.340.994.182.481.299.579.1 ± 1.0

Note:

  • The metrics are from MonkeyOCR, olmocr, and our own internal evaluations.
  • We delete the Page-header and Page-footer cells in the result markdown.

Quick Start

🚀 One-Click Startup (New!)

For quick deployment with our enhanced setup:

DocumentPurposeFor Who
QUICK_START.md⚡ One-minute startup🔥 Everyone
STARTUP_GUIDE.md📖 Complete startup guideDetailed reference
WEB_GUIDE.md🌐 Web interface guideWeb users
INSTALL_GUIDE.md🛠️ Installation guideFirst-time setup

Quick Commands

# Check service status ./check_status.sh # Start persistent services (recommended) ./run_persistent.sh # Access Web Interface: http://localhost:7860 # Access API: http://localhost:8000

1. Installation

Install dots.ocr

conda create -n dots_ocr python=3.12 conda activate dots_ocr git clone https://github.com/rednote-hilab/dots.ocr.git cd dots.ocr # 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 pip install -e .

If you have trouble with the installation, try our Docker Image for an easier setup, and follow these steps:

git clone https://github.com/rednote-hilab/dots.ocr.git cd dots.ocr pip install -e .

Download Model Weights

💡Note: Please use a directory name without periods (e.g., DotsOCR instead of dots.ocr) for the model save path. This is a temporary workaround pending our integration with Transformers.

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. All of our evaluations results are based on vllm version 0.9.1. The Docker Image is based on the official vllm image. You can also follow Dockerfile to build the deployment environment by yourself.

# You need to register model to vllm at first python3 tools/download_model.py export hf_model_path=./weights/DotsOCR # Path to your downloaded model weights, Please use a directory name without periods (e.g., `DotsOCR` instead of `dots.ocr`) for the model save path. This is a temporary workaround pending our integration with Transformers. export PYTHONPATH=$(dirname "$hf_model_path"):$PYTHONPATH sed -i '/^from vllm\.entrypoints\.cli\.main import main$/a\ from DotsOCR import modeling_dots_ocr_vllm' `which vllm` # If you downloaded model weights by yourself, please replace `DotsOCR` by your model saved directory name, and remember to use a directory name without periods (e.g., `DotsOCR` instead of `dots.ocr`) # launch vllm server CUDA_VISIBLE_DEVICES=0 vllm serve ${hf_model_path} --tensor-parallel-size 1 --gpu-memory-utilization 0.95 --chat-template-content-format string --served-model-name model --trust-remote-code # If you get a ModuleNotFoundError: No module named 'DotsOCR', please check the note above on the saved model directory name. # vllm api demo python3 ./demo/demo_vllm.py --prompt_mode prompt_layout_all_en

Hugginface inference

python3 demo/demo_hf.py
Hugginface inference details
import torch from transformers import AutoModelForCausalLM, AutoProcessor, AutoTokenizer from qwen_vl_utils import process_vision_info from dots_ocr.utils import dict_promptmode_to_prompt model_path = "./weights/DotsOCR" 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)

3. Document Parse

Based on vLLM server, you can parse an image or a pdf file using the following commands:

# Parse all layout info, both detection and recognition # Parse a single image python3 dots_ocr/parser.py demo/demo_image1.jpg # Parse a single PDF python3 dots_ocr/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_ocr/parser.py demo/demo_image1.jpg --prompt prompt_layout_only_en # Parse text only, except Page-header and Page-footer python3 dots_ocr/parser.py demo/demo_image1.jpg --prompt prompt_ocr # Parse layout info by bbox python3 dots_ocr/parser.py demo/demo_image1.jpg --prompt prompt_grounding_ocr --bbox 163 241 1536 705

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 DotsOCRParser(..,use_hf=True)

Output Results
  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.

4. Demo

You can run the demo with the following command, or try directly at live demo

python demo/demo_gradio.py

We also provide a demo for grounding ocr:

python demo/demo_gradio_annotion.py

Example for formula document

formula1.png formula2.png formula3.png

Example for table document

table1.png table2.png table3.png

Example for multilingual document

Tibetan.png tradition_zh.png nl.png kannada.png russian.png

Example for reading order

reading_order.png

Example for grounding ocr

grounding.png

Acknowledgments

We would like to thank Qwen2.5-VL, aimv2, MonkeyOCR, OmniDocBench, PyMuPDF, for providing code and models.

We also thank DocLayNet, M6Doc, CDLA, D4LA for providing valuable datasets.

Limitation & Future Work

  • Complex Document Elements:

    • Table&Formula: dots.ocr is not yet perfect for high-complexity tables and formula extraction.
    • Picture: Pictures in documents are currently not parsed.
  • Parsing Failures: The model may fail to parse under certain conditions:

    • When the character-to-pixel ratio is excessively high. Try enlarging the image or increasing the PDF parsing DPI (a setting of 200 is recommended). However, please note that the model performs optimally on images with a resolution under 11289600 pixels.
    • Continuous special characters, such as ellipses (...) and underscores (_), may cause the prediction output to repeat endlessly. In such scenarios, consider using alternative prompts like prompt_layout_only_en, prompt_ocr, or prompt_grounding_ocr (details here).
  • Performance Bottleneck: Despite its 1.7B parameter LLM foundation, dots.ocr is not yet optimized for high-throughput processing of large PDF volumes.

We are committed to achieving more accurate table and formula parsing, as well as enhancing the model's OCR capabilities for broader generalization, all while aiming for a more powerful, more efficient model. Furthermore, we are actively considering the development of a more general-purpose perception model based on Vision-Language Models (VLMs), which would integrate general detection, image captioning, and OCR tasks into a unified framework. Parsing the content of the pictures in the documents is also a key priority for our future work. We believe that collaboration is the key to tackling these exciting challenges. If you are passionate about advancing the frontiers of document intelligence and are interested in contributing to these future endeavors, we would love to hear from you. Please reach out to us via email at: [yanqing4@xiaohongshu.com].