--- license: apache-2.0 library_name: transformers pipeline_tag: image-text-to-text base_model: ATH-MaaS/OvisOCR2 tags: - ocr - document-parsing - multimodal - markdown - tables - formulas --- # Mu-OCR [GitHub repository](https://github.com/AndyLiuYS-AI/Mu-OCR) Mu-OCR is a document parsing model distilled from [OvisOCR2](https://huggingface.co/ATH-MaaS/OvisOCR2) using Multi-Teacher On-Policy Distillation (MOPD). It aims to improve formula recognition while preserving table recognition and overall document parsing quality. The original model architecture and inference pipeline are retained. **Training data.** We use mathematical formula images from [IBEM-v1-cropped](https://huggingface.co/datasets/deepcopy/IBEM-v1-cropped) and table images from [PubTabNet](https://github.com/ibm-aur-nlp/PubTabNet). For formula recognition, we use displayed (`isolated`) formula images. For table recognition, we select samples on which the original OvisOCR2 performs better than a formula-only distilled model, targeting table recognition capabilities that may degrade during formula-specific distillation. **Multi-Teacher On-Policy Distillation (MOPD).** We initialize the student from OvisOCR2 and use [MiniCPM-OCR 1.0](https://huggingface.co/openbmb/MiniCPM-OCR-1.0) as the formula teacher and the frozen original OvisOCR2 as the table teacher. The student generates its own token sequences from formula and table images, and the task-specific teachers provide token-level probability supervision on the student-generated prefixes. We align candidate tokens across the student and teacher vocabularies where necessary and minimize reverse KL divergence over the aligned top-64 student candidates. The formula and table distillation losses are computed separately and combined with task-specific weights to balance formula enhancement and table preservation. We fine-tune the student using LoRA and merge the adapted weights for inference. ## Results on OmniDocBench | Model | Overall ↑ | TextEdit ↓ | FormulaCDM ↑ | TableTEDS ↑ | TableTEDS-S ↑ | Read OrderEdit ↓ | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | Mu-OCR | 96.6436 | 0.026530 | 97.8038 | 94.7800 | 97.1515 | 0.111771 | | OvisOCR2 | 96.5586 | 0.026492 | 97.5317 | 94.7933 | 97.1697 | 0.111737 | *Source: Both Mu-OCR and OvisOCR2 results are from our local evaluation under the same inference and evaluation settings.* ## Reproduce on OmniDocBench ### 1. Clone the repository and download the model Requirements: Linux, Docker, NVIDIA Container Toolkit, Git, Python 3 and a BF16-capable NVIDIA GPU with a driver compatible with the inference Docker image. The reported experiments used NVIDIA A100 80GB GPUs. Clone the repository: ```bash git clone https://github.com/AndyLiuYS-AI/Mu-OCR.git cd Mu-OCR ``` Download the model: ```bash python -m pip install -U huggingface_hub hf download AndyLiuys/Mu-OCR --local-dir ./models/Mu-OCR ``` The evaluation script automatically pulls the pinned inference and evaluation Docker images if they are not available locally. No separate installation of vLLM or evaluation dependencies on the host is required. ### 2. Run full inference and evaluation Use the [OmniDocBench v1.6 full dataset](https://huggingface.co/datasets/opendatalab/OmniDocBench) (1,651 pages). From the repository root, run: ```bash DATA="/path/to/OmniDocBench" GPU=1 bash eval_omnidocbench.sh ``` Replace `/path/to/OmniDocBench` with the actual dataset path and `GPU=1` with the index of an available GPU. The dataset directory should contain `OmniDocBench.json` and `images/`. The script completes full inference and automatically runs the [official OmniDocBench evaluator](https://github.com/opendatalab/OmniDocBench). The inference configuration uses vLLM 0.25.1, BF16, a batch size of 8, greedy decoding and a maximum generation length of 16,384 tokens. The evaluation uses `quick_match`, direct CDM scoring and page-level aggregation. The evaluator checkout and Docker image digests are pinned in the script. Minor numerical differences may occur across hardware and runtime environments. The Markdown predictions, inference logs, detailed evaluation results and `score/summary.json` are saved in the evaluation directory (`omnidocbench_eval_*`) printed at the end of the run. ## Additional Benchmark Results ### Real5-OmniDocBench | Model | Average ↑ | Scanning ↑ | Warping ↑ | Screen-Photography ↑ | Illumination ↑ | Skew ↑ | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | Mu-OCR | 92.35 | 93.77 | 91.52 | 92.98 | 93.13 | 90.37 | | OvisOCR2 | 92.23 | 93.73 | 91.27 | 93.05 | 92.90 | 90.22 | *Source: Both Mu-OCR and OvisOCR2 results are from our local evaluation under the same inference and evaluation settings, using the official OmniDocBench v1.5 evaluator and Docker environment.* ### Wild-OmniDocBench **Page-level results** | Model | Overall ↑ | TextEdit ↓ | FormulaCDM ↑ | TableTEDS ↑ | TableTEDS-S ↑ | Read OrderEdit ↓ | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | Mu-OCR | 87.75 | 0.128 | 90.03 | 86.00 | 90.19 | 0.195 | | OvisOCR2 | 87.56 | 0.131 | 90.28 | 85.52 | 89.50 | 0.199 | *Source: Both Mu-OCR and OvisOCR2 results are from our local evaluation under the same inference and evaluation settings, using the official OmniDocBench v1.6 evaluator and Docker environment.* In addition to the page-level evaluation, we also report element-level results on Wild-OmniDocBench under the same settings. **Element-level results** | Model | Overall ↑ | TextEdit ↓ | FormulaCDM ↑ | TableTEDS ↑ | TableTEDS-S ↑ | Read OrderEdit ↓ | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | Mu-OCR | 78.24 | 0.366 | 92.03 | 79.33 | 83.35 | 0.195 | | OvisOCR2 | 77.71 | 0.375 | 91.69 | 78.97 | 82.95 | 0.199 | Although the page-level formula CDM decreases slightly, the element-level formula CDM increases from 91.69 to 92.03. The two aggregation schemes weight pages and individual elements differently. Mu-OCR improves the overall score under both aggregation schemes, with improvements across all reported element-level metrics. ## License Mu-OCR is released under the [Apache License 2.0](LICENSE). The model is derived from [OvisOCR2](https://huggingface.co/ATH-MaaS/OvisOCR2), and the inference code is adapted from its original inference examples. The original copyright (Copyright 2026 Alibaba Cloud), license and attribution notices are retained. See [NOTICE](https://github.com/AndyLiuYS-AI/Mu-OCR/blob/main/NOTICE) for details of the modifications. We thank the OvisOCR2 authors for releasing their model and inference code. Please refer to the [OvisOCR2 Technical Report](https://arxiv.org/abs/2607.13639) for the original work.