小模型DharmaOCR优化结构化OCR,降错率超87%且成本更低。
DharmaOCR: Specialized Small Language Models for Structured OCR that outperform Open-Source and Commercial Baselines

- 用DPO+SFT训练小模型,以拒绝错误生成来抑制循环输出。
- 在基准上实现0.925/0.911的抽取准确率,错写率仅0.40%/0.20%。
- 轻量版可低至22%每页成本,适合部署于资源受限场景。
本文提出DharmaOCR Full和Lite两款专用小型语言模型(SSLMs),专为结构化OCR设计,兼顾识别质量、生成稳定性和推理成本。构建了DharmaOCR-Benchmark,涵盖印刷体、手写体及法律行政文档,提出统一评估协议,同时测量内容保真度与结构准确性,并将文本退化作为首要指标(与单位成本并列)。实验证明,退化不仅是质量损失,更导致响应时间延长、吞吐下降和计算成本上升。方法上首次将直接偏好优化(DPO)应用于OCR,以退化生成为拒稿样本,有效惩罚循环行为。结合监督微调(SFT)强制符合严格JSON模式(标题、页边距、页脚、正文),使多类模型退化率降低最高达87.6%相对值,同时保持或提升抽取质量。最终模型(7B和3B)在该基准上超越所有开源及商业基线,得分分别为0.925和0.911,退化率分别为0.40%和0.20%。采用AWQ量化后,每页成本最多降低22%,质量损失极小,优于专有OCR API和开源方案。
原文摘要 · Abstract (English)
This manuscript introduces DharmaOCR Full and Lite, a pair of specialized small language models (SSLMs) for structured OCR that jointly optimize transcription quality, generation stability, and inference cost. It also presents DharmaOCR-Benchmark, a benchmark that covers printed, handwritten, and legal/administrative documents, and proposes a unified evaluation protocol that measures fidelity and structure while explicitly tracking text degeneration as a first-class benchmark metric (alongside unit cost). Beyond reporting degeneration rates, the manuscript empirically shows degeneration is not merely a quality failure, since it materially worsens production performance by increasing response time, reducing throughput, and inflating computational cost due to abnormally long generations. To the best of the author's knowledge, as a methodological contribution, this is the first application of Direct Preference Optimization (DPO) for OCR, explicitly using degenerate generations as rejected examples to penalize looping behavior. Combined with Supervised Fine-Tuning (SFT) for enforcing a strict JSON schema (header, margin, footer, and text), DPO consistently reduces degeneration rate across model families (up to 87.6% relative) while preserving or improving extraction quality. The resulting models, namely, DharmaOCR Full (7B) and DharmaOCR Lite (3B), set a new state-of-the-art on DharmaOCR-Benchmark, outperforming each open-source and commercial baseline model evaluated regarding extraction quality, reaching 0.925 and 0.911 scores with 0.40% and 0.20% degeneration rates. AWQ quantization reduced up to 22% per-page cost with negligible quality loss, enabling a strong quality-cost trade-off in comparison to proprietary OCR APIs and open-source alternatives.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。