--- license: other license_name: dharmaocr-benchmark-license license_link: LICENSE pretty_name: DharmaOCR-Benchmark language: - pt task_categories: - image-text-to-text tags: - ocr - benchmark - document-understanding - brazilian-portuguese - text-recognition - handwriting-recognition - legal-documents size_categories: - n<1K dataset_info: features: - name: id dtype: int64 - name: image dtype: image - name: image_base64 dtype: string - name: assistant dtype: string - name: assistant_without_json dtype: string splits: - name: test num_bytes: 2534593858 num_examples: 496 download_size: 2532700883 dataset_size: 2534593858 configs: - config_name: default data_files: - split: test path: data/test-* --- # DharmaOCR-Benchmark
 
## Overview **DharmaOCR-Benchmark** is a 496-instance evaluation suite for OCR models focused on **Brazilian Portuguese** documents. It covers printed text, handwritten text, and legal/administrative documents — domains underrepresented in existing benchmarks like OCRBench and olmOCR-Bench. This benchmark evaluates not only transcription quality, but also **text degeneration rate** and **unit inference cost** as first-class metrics. Released alongside the [DharmaOCR](https://huggingface.co/dharma-ai/DharmaOCR-Lite) family of models. For the full methodology and analysis, see our paper: **[DharmaOCR: Specialized Small Language Models for Structured OCR that Outperform Open-Source and Commercial Baselines](https://arxiv.org/abs/2604.14314)**. ## Why this benchmark? Existing OCR benchmarks do not reliably predict performance on Brazilian Portuguese documents. Language-specific orthography, domain vocabulary, and document formatting shift error profiles and amplify text degeneration in ways that general-purpose benchmarks fail to capture. DharmaOCR-Benchmark fills this gap with a focused, reproducible evaluation protocol. ## Dataset Composition | Subset | Samples | Description | |---|---|---| | **ESTER-Pt** | 363 | Printed text recognition in Brazilian Portuguese | | **Legal** | 83 | Legal and administrative documents (publicly sourced, fully human-audited) | | **BRESSAY** | 50 | Handwritten text recognition in Brazilian Portuguese | | **Total** | **496** | | > ⚠️ This benchmark was **not used** for training, model selection, DPO pair construction, or quantization calibration of any DharmaOCR model. ## Evaluation Protocol ### Score ``` DharmaOCR-Benchmark Score = (LevenshteinRatio + BLEU) / 2 ``` | Component | What it captures | |---|---| | `LevenshteinRatio` | Character-level fidelity (misspellings, missing accents, punctuation) | | `BLEU` | N-gram sequence preservation (reorderings, dropped spans) | ### Additional Metrics - **Text degeneration rate (%):** Requests that hit the output-token limit *and* exhibit repeated text spans (n-gram criterion). A critical operational metric — degenerate requests inflate cost and reduce throughput system-wide. - **Unit cost per page:** Enables fair comparison between self-hosted models and commercial APIs. ### Inference Setup | Parameter | Value | |---|---| | **GPU** | NVIDIA L40S (48GB GDDR6) | | **Instance** | AWS g6e.2xlarge | | **Engine** | vLLM | | **Max output tokens** | 8,192 | | **Temperature** | 0 | ## 🏆 Benchmark Results| Model | Score ↑ | Degeneration Rate (%) ↓ | Time/Page (s) ↓ |
|---|---|---|---|
| 🥇 DharmaOCR Full (7B, ours) | 0.925 | 0.40 | 2.132 |
| 🥈 DharmaOCR Lite (3B, ours) | 0.911 | 0.20 ✨ | 1.464 |
Commercial APIs | |||
| Claude Opus 4.6 | 0.833 | — | — |
| Gemini 3.1 Pro | 0.820 | — | — |
| GPT-5.4 | 0.750 | — | — |
| Google Vision | 0.686 | — | — |
| Google Document AI | 0.640 | — | — |
| GPT-4o | 0.635 | — | — |
| Amazon Textract | 0.618 | — | — |
| Mistral OCR 3 | 0.574 | — | — |
Open-Source Models | |||
| Qwen2.5-VL-7B-Instruct | 0.839 | 2.42 | 3.101 |
| Qwen3-VL-8B | 0.829 | 5.65 | 7.250 |
| olmOCR-2-7B | 0.823 | 1.41 | 4.306 |
| Nanonets-OCR2-3B | 0.791 | 2.62 | 1.911 |
| Dots OCR | 0.738 | 6.85 | 2.526 |
| GLM-OCR | 0.710 | 11.69 | 1.480 |
| Qwen3-VL-2B-Instruct | 0.623 | 11.69 | 3.566 |
| Qwen2.5-VL-3B-Instruct | 0.549 | 0.60 | 1.500 |
| gemma-3-4b-it | 0.214 | 33.96 | 2.182 |
| DeepSeek-OCR | 0.196 | 21.98 | 1.213 |