Fast, accurate OCR with correctness assessment.
docs: expand benchmark reproduction guides and sync English
caowanxia12345c7beb00425
diff --git a/docs/benchmark_reproduction_en.md b/docs/benchmark_reproduction_en.mdindex 2e28e8c..113d00c 100644--- a/docs/benchmark_reproduction_en.md+++ b/docs/benchmark_reproduction_en.md@@ -1,10 +1,98 @@# MiniCPM-OCR 1.0 Reproduction Guide-[← Back to README](../README.md) · [中文](./benchmark_reproduction_zh.md) · [Model guide](./minicpm_ocr_1dot0_en.md)+[← Back to README](../README.md) · [Model guide](./minicpm_ocr_1dot0_en.md)-This document summarizes the test settings and deployment guides for the MiniCPM-OCR 1.0 parsing-efficiency comparison. Complete evaluation scripts, exact versions, and timing boundaries remain to be added.+This document summarizes the inference settings, scoring methods, and official sources for evaluating MiniCPM-OCR 1.0, along with the test settings and deployment guides for the parsing-efficiency comparison. Complete evaluation scripts, exact versions, and timing boundaries remain to be added.-## Test Settings+## Evaluation Reproduction++### Evaluation Settings++The same sampling parameters are used across all six benchmarks:++| Parameter | Value | Description |+| :--- | :--- | :--- |+| `temperature` | `0.01` | Sampling temperature |+| `top_p` | `0.001` | Nucleus sampling threshold |+| `top_k` | `1` | Maximum number of candidate tokens |+| `repetition_penalty` | `1.0` | No additional repetition penalty |+| `no_repeat_ngram_size` | `0` | Disable the constraint against repeated n-grams |+| `enable_thinking` | `false` | Disable thinking mode |++The generation length limit is set by **recognition region type**:++| Recognition region type | Maximum generation length (tokens) |+| :--- | ---: |+| Plain text | 4096 |+| Tables | 8192 |+| Display equations | 2048 |+| Inline equations | 1024 |++Short regions, such as headings, use lower generation length limits.++The visual configuration and model context limit are as follows:++| Parameter | Value |+| :--- | :--- |+| `downsample_mode` | `4x` |+| `max_slice_nums` | `9` |+| `max_model_len` | `40960` |++### Scoring Methods and Official Sources++Scoring is performed separately after the model generates predictions: the prediction files and the corresponding version of the ground-truth annotations (GT) are passed to the scorer, and the metrics are then aggregated.++### Benchmarks and Official Scoring Resources++| Benchmark | Scoring method | Official repositories and documentation |+| :--- | :--- | :--- |+| OmniDocBench v1.6 | Match elements in full-page Markdown against the v1.6 full GT, then compute text edit distance, formula CDM, table TEDS, and reading-order edit distance. This evaluation uses `quick_match`. | [OmniDocBench repository and evaluation guide](https://github.com/opendatalab/OmniDocBench#evaluation) |+| Real5-OmniDocBench | Reuse the OmniDocBench v1.5 annotations and scoring procedure. Score the five scenarios—Scanning, Warping, Screen-Photography, Illumination, and Skew—separately, with 1,355 pages per scenario. The aggregate score in this evaluation is the equally weighted average of the five scenario Overall scores. | [Official Real5 data and evaluation instructions](https://huggingface.co/datasets/PaddlePaddle/Real5-OmniDocBench#evaluation), [OmniDocBench v1.5 scoring repository](https://github.com/opendatalab/OmniDocBench/tree/v1_5) |+| Wild-OmniDocBench | Score full-page Markdown for 1,350 pages of images captured in real-world conditions, using OmniDocBench annotations and metrics. This evaluation uses the v1.6 scorer and the subset of v1.5 GT corresponding to the Wild pages. | [Official Wild repository](https://github.com/VirtualLUOUCAS/Wild_OmniDocBench#evaluation), [OmniDocBench scoring repository](https://github.com/opendatalab/OmniDocBench) |+| olmOCR-Bench | Use the official rules to check text presence and absence, reading order, table relationships, formulas, and other properties in Markdown. Compute the test pass rate for each category, then take the equally weighted average of the category scores. | [allenai/olmocr scoring instructions](https://github.com/allenai/olmocr/blob/main/olmocr/bench/README.md), [scoring code](https://github.com/allenai/olmocr/blob/main/olmocr/bench/benchmark.py), [official dataset](https://huggingface.co/datasets/allenai/olmOCR-bench) |+| OCRBench v2 | Write each answer to the `predict` field in the prediction JSON. First score by task type with `eval_scripts/eval.py`, then aggregate the Chinese and English task metrics with `eval_scripts/get_score.py`. | [Official MultimodalOCR/OCRBench_v2 repository and commands](https://github.com/Yuliang-Liu/MultimodalOCR/tree/main/OCRBench_v2#evaluation) |+| CHAOS-Bench | Compare model outputs against the actually altered words in the image, `ocr_ans`, to measure the proportion recognized faithfully. Outputting the original words, `origin_ans`, does not count as correct. The matching and aggregation rules for this evaluation are described below. | [Official HunyuanOCR/CHAOS-Bench data and evaluation instructions](https://github.com/Tencent-Hunyuan/HunyuanOCR/tree/main/benchmarks/CHAOS-Bench) |++### Document Parsing Metrics and Scoring Images++Overall for OmniDocBench, Real5, and Wild is calculated as follows, with `FormulaCDM` and `TableTEDS` expressed as percentages:++```text+Overall = ((1 - TextEdit) × 100 + FormulaCDM + TableTEDS) / 3+```++Lower `TextEdit` and reading-order edit distance are better; higher `FormulaCDM`, `TableTEDS`, `TableTEDS-S`, and Overall are better. Reading order and `TableTEDS-S` are reported separately and are not included in Overall above.++If a Docker scoring environment is needed, download the images referenced in the official documentation:++```bash+# Public image recommended by the current official OmniDocBench evaluation guide+docker pull ghcr.io/zeng-weijun/omnidocbench-eval:repro-ubuntu2204++# Environment image listed in the official OmniDocBench v1.5 documentation used for Real5+docker pull sunyuefeng/omnidocbench-env:v1.5+```++For complete mount and execution instructions, see the [OmniDocBench Docker evaluation guide](https://github.com/opendatalab/OmniDocBench#environment-setup-and-running) and [v1.5 Docker instructions](https://github.com/opendatalab/OmniDocBench/tree/v1_5#using-docker). The configuration file must specify `ground_truth.data_path`, `prediction.data_path`, the matching method, and the metrics. Run the following in the corresponding scoring environment:++```bash+python pdf_validation.py --config /path/to/eval.yaml+```++The GT page version must match the evaluation dataset; the v1.6 full GT cannot directly replace the v1.5 GT used for Real5. Public image tags may change. To reproduce historical results, pin the scoring code commit, image digest, GT version, and scoring configuration.++In this evaluation, OmniDocBench, Real5, and olmOCR use internally packaged images with scoring code and GT preinstalled; Wild uses fixed scoring assets, and CHAOS uses a local scoring script. The public images above are provided for setting up scoring environments.++### Scoring and Aggregation Rules++- **Evaluation scope**: The six tracks in the archived results are OmniDocBench v1.6, Real5, olmOCR-Bench, Wild original images, Wild deskewed images, and CHAOS-Bench.+- **Wild**: Results for original and deskewed images are reported separately, using the same GT and scorer. Deskewing changes input preprocessing, so these results must be treated as separate tracks.+- **olmOCR-Bench**: The main score is the equally weighted average of eight categories, including Base and Headers & Footers. If `excl. headers & footers` is also reported, average only the remaining seven categories with equal weights and label it explicitly.+- **CHAOS-Bench**: There are 500 pages and 1,025 altered words. In this evaluation, whitespace is normalized in the full-page Markdown, and `ocr_ans` is searched for case-insensitively at word boundaries. Compute the hit rate for each page, then take the equally weighted average across all 500 pages and multiply by 100. Pages with empty outputs receive zero. This local implementation does not align outputs individually with the annotated `bbox` regions, so its results should be reported separately from recognition results on cropped regions.++## Parsing Efficiency Test++### Settings| Item | Test condition || :--- | :--- |@@ -14,24 +102,17 @@ This document summarizes the test settings and deployment guides for the MiniCPM| Hardware | NVIDIA GeForce RTX 5090; all systems run on the same hardware || Metric | Pages processed per second (pages/s); higher values indicate higher throughput |-<!-- Source: test settings on pages 6–7 and the throughput chart on page 7 of the user-provided “MiniCPM-OCR 1.0 - 飞书云文档.pdf”; checked on 2026-10-22. The figure states “All models use accelerated configurations.” The original figure does not specify a separate acceleration method for GLM-OCR, so its name is unchanged. -->-Image-level concurrency and recognition concurrency for regions within a page are separate settings, corresponding to `pipeline.page_workers` and `pipeline.max_workers` in the SDK. See the [SDK tutorial](./minicpmvocr_tutorial_en.md). Image-level concurrency of 1 does not imply that regions within each page are recognized sequentially.-## Deployment and DSpark Acceleration+### Deployment and DSpark Acceleration- [SDK tutorial](./minicpmvocr_tutorial_en.md): Install the environment, connect an inference backend, parse documents, and check outputs.- [vLLM deployment guide](./vllm_deploy_en.md): Deploy the API service and check recognition results.-A comparison with and without DSpark must use the same main-model weights, dataset, hardware, and SDK configuration, changing only whether DSpark is enabled. The deployment examples start the service; complete comparison commands and logs for reproducing the speedup remain to be added.--## Interpreting Results+A comparison with and without DSpark must use the same main-model weights, dataset, hardware, and SDK configuration, changing only whether DSpark is enabled. The deployment examples start the service; complete comparison commands and logs for reproducing the 62% improvement remain to be added.-Measure the benefit of DSpark by comparing the same system with DSpark enabled and disabled. Cross-system throughput comparisons instead reflect each system's parsing efficiency under the settings above; report these two comparisons separately. Throughput values and comparison charts are collected in the [model guide's Throughput section](./minicpm_ocr_1dot0_en.md#throughput).+### Interpreting Results-## Reproduction Details Still to Be Added+Enabling DSpark decoding acceleration improves MiniCPM-OCR 1.0's end-to-end processing efficiency by **62%**. This improvement describes the benefit of DSpark acceleration and does not replace throughput comparisons with other systems.-- Model weight revisions, SDK versions, complete startup commands, and acceleration arguments for each system.-- Timing start and end points, warmup procedure, failure and retry handling, and complete run logs.-- Commands and results comparing MiniCPM-OCR 1.0 with DSpark enabled and disabled under identical conditions.-- Complete scripts, dataset versions, metric definitions, and subset results for each benchmark.+MiniCPM-OCR 1.0 achieves a parsing throughput of **1.213 pages/s**, compared with **1.179 pages/s** for GLM-OCR. With MiniCPM-OCR 1.0 as the relative-throughput baseline (**1.00×**), GLM-OCR, PaddleOCR-VL-1.6, MinerU2.5-Pro-Standard, and MinerU2.5-Pro-Advanced achieve **0.97×, 0.67×, 0.44×, and 0.28×**, respectively. For complete values and comparison charts, see the [model guide's Throughput section](./minicpm_ocr_1dot0_en.md#throughput).diff --git a/docs/benchmark_reproduction_zh.md b/docs/benchmark_reproduction_zh.mdindex c2a367a..46e68e8 100644--- a/docs/benchmark_reproduction_zh.md+++ b/docs/benchmark_reproduction_zh.md@@ -1,10 +1,96 @@# MiniCPM-OCR 1.0 复现文档-[← 返回 README](../README_zh.md) · [English](./benchmark_reproduction_en.md) · [模型指南](./minicpm_ocr_1dot0_zh.md)+[← 返回 README](../README.md) · [模型指南](./minicpm_ocr_1dot0_zh.md)-本文汇总 MiniCPM-OCR 1.0 解析效率对比的测试设置与部署入口。完整评测脚本、精确版本和计时范围待补充。+本文汇总 MiniCPM-OCR 1.0 的评测推理配置、评分方法与官方来源,以及解析效率对比的测试设置与部署入口。完整评测脚本、精确版本和计时范围待补充。-## 测试设置+## 效果复现+### 评测配置++六项评测中使用相同的采样参数:++| 参数 | 值 | 说明 |+| :--- | :--- | :--- |+| `temperature` | `0.01` | 采样温度 |+| `top_p` | `0.001` | 核采样阈值 |+| `top_k` | `1` | 候选 token 数量上限 |+| `repetition_penalty` | `1.0` | 不额外惩罚重复 |+| `no_repeat_ngram_size` | `0` | 关闭 n-gram 禁重复约束 |+| `enable_thinking` | `false` | 关闭思考模式 |++生成长度上限按**识别块类型**设置:++| 识别块类型 | 最大生成长度(tokens) |+| :--- | ---: |+| 普通文本 | 4096 |+| 表格 | 8192 |+| 独立公式 | 2048 |+| 行内公式 | 1024 |++标题等短块另设较低的生成长度上限。++视觉配置与模型上下文上限如下:++| 参数 | 值 |+| :--- | :--- |+| `downsample_mode` | `4x` |+| `max_slice_nums` | `9` |+| `max_model_len` | `40960` |++### 评分方法与官方来源++评分在模型生成预测结果后单独执行:将预测文件与对应版本的真值标注(GT)交给评分器,再汇总各项指标。++### 基准与官方评分入口++| 基准 | 评分方法 | 官方仓库与说明 |+| :--- | :--- | :--- |+| OmniDocBench v1.6 | 将整页 Markdown 与 v1.6 full GT 进行元素匹配,计算文本编辑距离、公式 CDM、表格 TEDS 和阅读顺序编辑距离。本轮使用 `quick_match`。 | [OmniDocBench 仓库与评分指南](https://github.com/opendatalab/OmniDocBench#evaluation) |+| Real5-OmniDocBench | 复用 OmniDocBench v1.5 的标注与评分流程;Scanning、Warping、Screen-Photography、Illumination、Skew 五个场景分别评分,每个场景 1,355 页。本轮总分为五个场景 Overall 的等权平均。 | [Real5 官方数据与评测说明](https://huggingface.co/datasets/PaddlePaddle/Real5-OmniDocBench#evaluation)、[OmniDocBench v1.5 评分仓库](https://github.com/opendatalab/OmniDocBench/tree/v1_5) |+| Wild-OmniDocBench | 对 1,350 页真实采集图像的整页 Markdown 评分,沿用 OmniDocBench 的标注与指标。本轮使用 v1.6 评分器和与 Wild 页面对应的 v1.5 GT 子集。 | [Wild 官方仓库](https://github.com/VirtualLUOUCAS/Wild_OmniDocBench#evaluation)、[OmniDocBench 评分仓库](https://github.com/opendatalab/OmniDocBench) |+| olmOCR-Bench | 使用官方规则检查 Markdown 中的文本出现/缺失、阅读顺序、表格关系和公式等;先计算各类别测试通过率,再对类别分数等权平均。 | [allenai/olmocr 评分说明](https://github.com/allenai/olmocr/blob/main/olmocr/bench/README.md)、[评分代码](https://github.com/allenai/olmocr/blob/main/olmocr/bench/benchmark.py)、[官方数据集](https://huggingface.co/datasets/allenai/olmOCR-bench) |+| OCRBench v2 | 将逐题回答写入预测 JSON 的 `predict` 字段,先用 `eval_scripts/eval.py` 按任务类型评分,再用 `eval_scripts/get_score.py` 汇总中英文各任务指标。 | [MultimodalOCR/OCRBench_v2 官方仓库与命令](https://github.com/Yuliang-Liu/MultimodalOCR/tree/main/OCRBench_v2#evaluation) |+| CHAOS-Bench | 比较模型输出与图像中实际被篡改的词 `ocr_ans`,统计忠实识别的比例;输出原词 `origin_ans` 不计为正确。本轮具体匹配与汇总口径见下文。 | [HunyuanOCR/CHAOS-Bench 官方数据与评测说明](https://github.com/Tencent-Hunyuan/HunyuanOCR/tree/main/benchmarks/CHAOS-Bench) |++### 文档解析指标与评分镜像++OmniDocBench、Real5 和 Wild 的 Overall 按以下公式计算,其中 `FormulaCDM`、`TableTEDS` 使用百分制:++```text+Overall = ((1 - TextEdit) × 100 + FormulaCDM + TableTEDS) / 3+```++`TextEdit` 和阅读顺序编辑距离越低越好;`FormulaCDM`、`TableTEDS`、`TableTEDS-S` 和 Overall 越高越好。阅读顺序与 `TableTEDS-S` 单独报告,不计入上述 Overall。++需要 Docker 评分环境时,可从官方文档提供的入口下载:++```bash+# OmniDocBench 当前官方评分指南推荐的公开镜像+docker pull ghcr.io/zeng-weijun/omnidocbench-eval:repro-ubuntu2204++# Real5 对应的 OmniDocBench v1.5 官方文档所列环境镜像+docker pull sunyuefeng/omnidocbench-env:v1.5+```++完整挂载与运行方式见 [OmniDocBench Docker 评分说明](https://github.com/opendatalab/OmniDocBench#environment-setup-and-running) 和 [v1.5 Docker 说明](https://github.com/opendatalab/OmniDocBench/tree/v1_5#using-docker)。配置文件需指定 `ground_truth.data_path`、`prediction.data_path`、匹配方法和指标;在对应评分环境中运行:++```bash+python pdf_validation.py --config /path/to/eval.yaml+```++GT 的页面版本必须与评测集对应,不能直接用 v1.6 full GT 替换 Real5 的 v1.5 GT。公开镜像标签可能更新,复现历史结果时应固定评分代码 commit、镜像 digest、GT 版本和评分配置。++本轮 OmniDocBench、Real5 和 olmOCR 使用预装评分代码与 GT 的内部封装镜像,Wild 使用固定的评分资产,CHAOS 使用本地评分脚本。上述公开镜像用于搭建评分环境。++### 统计口径++- **评测范围**:归档中的六个轨道为 OmniDocBench v1.6、Real5、olmOCR-Bench、Wild 原图、Wild 摆正和 CHAOS-Bench。+- **Wild**:原图与摆正结果分开报告,两者使用相同 GT 和评分器;摆正属于输入处理变化,不能与原图结果混为同一轨道。+- **olmOCR-Bench**:主分数包含 Base 和 Headers & Footers,共八个类别等权平均;如另报 `excl. headers & footers`,则仅对剩余七类等权平均,并明确标注。+- **CHAOS-Bench**:共 500 页、1,025 个篡改词。本轮在整页 Markdown 中归一化空白、忽略大小写,并按词边界搜索 `ocr_ans`;先算每页命中比例,再对 500 页等权平均并乘以 100。空输出页计零分。该本地实现未将输出与标注 `bbox` 逐一对齐,应与区域裁剪识别结果分开报告。++## 解析效率测试+### 设置| 项目 | 测试条件 || :--- | :--- |@@ -14,24 +100,18 @@| 硬件 | NVIDIA GeForce RTX 5090,所有系统在相同硬件条件下运行 || 指标 | 每秒处理页数(pages/s),数值越高表示吞吐越高 |-<!-- 数据来源:用户提供的《MiniCPM-OCR 1.0 - 飞书云文档.pdf》第 6–7 页测试条件与第 7 页吞吐图;材料核对日期:2026-10-22。图下注明“All models use accelerated configurations.”。原图 GLM-OCR 未进一步注明加速方法,因此保留原名称。 -->图片级并发与单页内文档块的识别并发是不同设置。SDK 中对应 `pipeline.page_workers` 和 `pipeline.max_workers`,详见 [SDK 使用教程](./minicpmvocr_tutorial.md)。上述图片级并发度为 1,不代表页内文档块也串行处理。-## 部署与 DSpark 加速+### 部署与 DSpark 加速- [SDK 使用教程](./minicpmvocr_tutorial.md):安装环境、连接推理后端、解析文档与检查输出。- [vLLM 部署指南](./vllm_deploy.md):部署 API 服务与检查识别结果。-DSpark 前后对照需使用相同主模型权重、数据集、硬件和 SDK 配置,仅改变 DSpark 开关。部署指南中的示例用于启动服务;用于复现加速收益的完整对照命令和日志待补充。--## 结果说明+DSpark 前后对照需使用相同主模型权重、数据集、硬件和 SDK 配置,仅改变 DSpark 开关。部署指南中的示例用于启动服务;用于复现 62% 提升的完整对照命令和日志待补充。-DSpark 的加速收益应由同一系统开启和关闭 DSpark 的对照实验衡量。跨系统吞吐比较则反映各系统在上述设置下的解析效率,两者需要分别报告。吞吐数值与对比图统一见 [模型指南的吞吐章节](./minicpm_ocr_1dot0_zh.md#吞吐)。+### 结果说明-## 待补充的复现信息+启用 DSpark 解码加速后,MiniCPM-OCR 1.0 的端到端处理效率提升 **62%**。该提升描述 DSpark 的加速收益,不能替代与其他系统的吞吐比较。-- 各系统的模型权重版本、SDK 版本、完整启动命令与加速参数。-- 计时起止点、预热方式、失败与重试的处理,以及完整运行日志。-- MiniCPM-OCR 1.0 在相同条件下开启和关闭 DSpark 的对照命令与结果。-- 各评测基准的完整脚本、数据版本、指标定义与子集结果。+MiniCPM-OCR 1.0 的解析吞吐为 **1.213 pages/s**,GLM-OCR 为 **1.179 pages/s**。相对吞吐以 MiniCPM-OCR 1.0 为基准(**1.00×**),GLM-OCR、PaddleOCR-VL-1.6、MinerU2.5-Pro-Standard 和 MinerU2.5-Pro-Advanced 分别为 **0.97×、0.67×、0.44× 和 0.28×**。完整数值与对比图见 [模型指南的吞吐章节](./minicpm_ocr_1dot0_zh.md#吞吐)。