OCR-EDR: Rendering-Aware Diagnosis and Repair for Closed-Loop OCR Improvement
Summary (Overview)
-
Unified framework: OCR-EDR (OCR Error Diagnosis and Repair) integrates fine-grained error diagnosis, executable correction, and rendering-based visual reassessment into a single closed-loop paradigm that preserves valid predictions while repairing genuine errors.
-
Key innovation: The framework jointly analyzes three inputs—source image, editable OCR prediction, and its rendered image—allowing it to distinguish genuine errors from rendering-equivalent but non-canonical encodings (e.g.,
\tovs\rightarrow) that should be preserved. -
OCRErrBench: A new 900-case benchmark balanced across text (450) and formulas (450), with 457 valid (Good) and 443 erroneous (Bad) cases drawn from diverse real OCR predictions, supporting unified evaluation of preservation, diagnosis, localization, and repair.
-
DocEDR model: Built on Qwen3.5-9B, achieves 94.78% diagnostic accuracy on OCRErrBench, repairs 86.23% of erroneous inputs to visual consistency, and improves formula Case-F1 by 30.99 percentage points over DOCR-Inspector-7B.
-
Cross-benchmark gains: Repairs improve formula CDM by 2.24–4.62 points across Bad subsets of four different OCR systems on UniMER-Test, demonstrating generalizable inference-time correction.
Introduction and Theoretical Foundation
Background and Motivation
Document OCR systems perform well on routine documents but remain error-prone on complex formulas, structured text, and long-tail formats. Two failure modes dominate:
-
Specialized recognizers in traditional OCR pipelines are limited by recognition capability and training coverage, potentially missing fine-grained content or misrecognizing characters, symbols, and structures.
-
General vision-language models may hallucinate outputs unsupported by the source image.
A critical complication: structured OCR may represent the same visible content using different but equivalent encodings, which should not be treated as recognition errors. Examples include \to versus \rightarrow, and {\bf x} versus \textbf{x}—these differ as strings but render identically.
Limitations of Existing Approaches
-
Text-based post-correction (Dong and Smith 2018; Lyu et al. 2021; Thomas et al. 2024) maps noisy OCR sequences to cleaner text but cannot verify whether an edit restores the source document's visual content.
-
DOCR-Inspector (Zhang et al. 2025) defines 28 real-world error types with fine-grained feedback but cannot autonomously repair predictions, inspect new renderings, or decide when to stop. It is also sensitive to representational conventions, rejecting valid outputs that differ only in string form.
-
LATTE (Jiang et al. 2025) introduces visual comparison via rendered delta-view feedback for LaTeX formulas and tables but operates only on identified errors in task-specific formats.
The OCR-EDR Formulation
OCR-EDR defines a stateful diagnosis-and-repair task: Given a source region image , an initial OCR result , and its rendered image , the system returns a final OCR result that recovers the visible content. At each turn , the policy:
- Compares source image, current OCR result, and its rendering
- Emits an agent action with structured payload
- May apply local/global repair, request updated rendering, or stop
Methodology
Task Formulation
Input state at turn :
where is the current OCR candidate, is its rendering observation, and records preceding state transitions.
Rendering states: Two non-image states are distinguished:
- : rendering becomes outdated after an edit
- : explicit rendering failure
Error taxonomy (five atomic classes):
| Error Class | Scope | Repair Operation |
|---|---|---|
| invalid_output | Global | global_rewrite |
| global_mismatch | Global | global_rewrite |
| completeness | Local | insert/delete |
| content | Local | insert/delete/replace |
| structure | Local | insert/delete/replace |
Policy-level action space: inspect, diagnose_scope, localize, patch, global_patch, request_render, stop
DocEDR Model Architecture
Built on Qwen3.5-9B, DocEDR evolves a single editable OCR hypothesis through a trajectory rather than mapping a fixed input directly to output. Key design features:
- Diagnostic actions (
inspect,diagnose_scope,localize) append structured evidence without modifying - Patch actions apply localized insert/delete/replace operations;
global_patchreconstructs when localized editing is inappropriate - request_render keeps unchanged and updates observation with
- stop returns the current candidate
Training Strategy: Three Stages
1. Verifier SFT
Train a vision-text consistency verifier that predicts validity and atomic errors:
This checkpoint provides a stable visual-consistency signal and initialization encoding validity, error type, location, and correction cues.
2. Curriculum Repair SFT
Three supervised curricula before reward optimization:
- Stage 1: Single-turn direct repair without rendering
- Stage 2: Decision between requesting rendering and stopping
- Stage 3: Real rendering feedback with multi-turn residual repair and recovery
Each supervised trajectory is optimized via:
3. Reward Optimization (GRPO)
Label-conditioned reward with branch-specific objectives for Good () and Bad () inputs:
- For good inputs: rewards preservation; penalizes unnecessary editing/rendering/turns
- For bad inputs: combines reference agreement with frozen verifier assessment; rewards progress
Group-relative advantage with clipping:
Empirical Validation / Results
OCRErrBench Construction
- 900 cases balanced: 450 text, 450 formulas; 457 Good, 443 Bad
- Collected from DeepSeek-OCR, PaddleOCR-VL-1.5, and Qwen3.5-27B on OmniDocBench and PureDocBench
- Strict source-level isolation: training data excluded from benchmarks used for evaluation
- Triple-model annotation: GPT-5.6 Sol, Claude Opus 4.8, and Gemini 3.1 Pro must unanimously agree; rendering-equivalent positives receive separate manual audit
Diagnostic Results on OCRErrBench
| Method | Acc | BAcc | Bad-F1 | Type-F1 | Loc-Text | Loc-For. |
|---|---|---|---|---|---|---|
| Qwen3.5-9B | 81.44 | 81.26 | 78.67 | 33.25 | 48.54 | 39.52 |
| Qwen3.5-397B-A17B (FP8) | 87.78 | 87.64 | 86.42 | 25.34 | 56.20 | 69.17 |
| InternVL3.5-8B | 52.67 | 51.92 | 7.39 | 4.35 | 12.20 | 1.23 |
| GLM-4.6V-Flash | 55.33 | 54.63 | 17.28 | 6.50 | 22.10 | 0.61 |
| DOCR-Inspector-7B | 78.78 | 78.99 | 81.07 | 41.85 | 44.00 | 28.45 |
| DocEDR | 94.78 | 94.75 | 94.59 | 74.88 | 92.72 | 73.26 |
DocEDR outperforms the strongest baseline (Qwen3.5-397B) by 7.00 accuracy points () and DOCR-Inspector-7B by substantial margins on Type-F1 and localization.
Boundary Diagnosis: Rendering-Equivalent vs. Genuine Errors
| Method | Eq FP↓ | Comp. FN↓ | Cont. FN↓ | Struct. FN↓ |
|---|---|---|---|---|
| Edit dist. > 0.1 (Text) | 57.14 | 100.00 | 100.00 | 100.00 |
| CDM < 0.9 (Formula) | 2.94 | 100.00 | 100.00 | 100.00 |
| Qwen3.5-9B | 53.23 | 31.48 | 26.81 | 36.26 |
| DOCR-Inspector-7B | 75.81 | 3.70 | 16.67 | 9.89 |
| DocEDR | 25.81 | 1.85 | 4.35 | 5.49 |
Edit distance falsely rejects 57.14% of equivalent text; DocEDR reduces this to 25.81% while achieving near-zero false negatives on genuine local errors.
Cross-Benchmark Zero-Shot Diagnosis (DOCRcaseBench, N=637)
| Method | Acc | BAcc | B-F1 | C-F1 | Text | Fml. |
|---|---|---|---|---|---|---|
| DOCR-Inspector-7B | 62.48 | 69.27 | 72.69 | 67.52 | 72.89 | 56.69 |
| DocEDR | 71.59 | 74.28 | 80.64 | 75.25 | 72.38 | 87.68 |
Formula Case-F1 improves from 56.69% to 87.68%—61 additional correct cases (31.77% of the formula subset).
Repair Results on OCRErrBench
| Method | Exact Fix | Visual Fix | Text Fix | Formula Fix | Preserve |
|---|---|---|---|---|---|
| Qwen3.5-9B | 16.70 | 51.02 | 72.00 | 40.27 | 83.59 |
| Qwen3.5-397B | 26.19 | 72.23 | 80.67 | 67.92 | 94.75 |
| DOCR-guided | 24.15 | 65.46 | 76.67 | 59.73 | 83.15 |
| DocEDR | 82.17 | 86.23 | 90.67 | 83.96 | 93.44 |
DocEDR exceeds the strongest direct baseline by 55.98 points on ExactFix and 14.00 points on VisFix (95% CI: 9.48–18.74, ).
Formula Recognition Refinement on UniMER-Test (N=12,683 per parser)
| Parser | All CDM | Good % | Good CDM | Bad % | Bad CDM (Δ) |
|---|---|---|---|---|---|
| MinerU2.5 | 90.52 | 67.50 | 99.09 | 32.50 | 72.71 (+2.93) |
| PaddleOCR-VL-1.5 | 94.12 | 77.81 | 97.65 | 22.19 | 81.70 (+2.24) |
| InternVL3.5-8B | 65.59 | 74.08 | 66.97 | 25.92 | 61.62 (+3.72) |
| GLM-4.6V-Flash | 75.45 | 62.82 | 78.65 | 37.18 | 70.03 (+4.62) |
Repair improves every fixed Bad partition by 2.24–4.62 CDM points, with the largest gain on GLM-4.6V-Flash, demonstrating consistent gains across parsers with substantially different baselines.
Ablation Findings
- Input modality: Full (I + p + R) input performs best. Removing the OCR sequence drops localization to 80.54/55.25% (text/formula); removing rendering doubles equivalent-positive FP from 4.75% to 8.86%.
- Interaction mechanism: Rendering adds 3.61 ExactFix and 3.39 VisFix points in one step; iteration without rendering lowers ExactFix to 66.82%, versus 82.17% with the complete loop.
Theoretical and Practical Implications
Theoretical Contributions
-
Rendering-aware evaluation: The work demonstrates that visual consistency—not string identity—is the correct criterion for OCR validation. Rendering-equivalent encodings must be preserved, which challenges edit-distance-based evaluation paradigms.
-
Stateful correction as unified paradigm: Treating OCR output as an editable state within a closed-loop process (edit → render → reassess → decide) unifies previously fragmented capabilities: preservation, diagnosis, localization, and repair.
-
Label-conditioned reward design: The asymmetric treatment of Good (preservation) vs. Bad (repair) inputs addresses the fundamental tension between not corrupting valid outputs and maximizing correction efficacy.
Practical Implications
-
Actionable feedback: OCR-EDR transforms aggregate error statistics into specific, executable corrections—turning "how many errors" into "what's wrong, where, and how to fix it."
-
Cross-system generalizability: The consistent CDM gains across four different OCR parsers demonstrate that diagnosis and repair capabilities transfer across model families without retraining.
-
Human-AI collaboration: The triple-model annotation pipeline with expert review provides a scalable template for constructing high-quality error diagnosis benchmarks.
-
Data reuse: Verified corrections can serve as supervision for subsequent OCR optimization, closing the loop from inference-time correction to training-time improvement.
Conclusion
OCR-EDR establishes a rendering-aware closed-loop paradigm for document OCR error diagnosis and repair. The key contributions are:
-
Unified task formulation connecting fine-grained diagnosis, executable correction, and rendering-based reassessment while preserving correct and rendering-equivalent predictions.
-
OCRErrBench: A 900-case benchmark with unified evaluation of preservation, diagnosis, localization, and repair across text and formulas.
-
DocEDR model with staged training (verifier SFT → curriculum repair SFT → GRPO) that instantiates OCR-EDR as a unified policy.
-
Verified cross-benchmark corrections: Diagnosis translates into consistent performance gains on error subsets across diverse OCR systems.
The results—94.78% diagnostic accuracy, 86.23% repair-to-visual-consistency, and up to 30.99 percentage-point Case-F1 improvements—demonstrate that difficult OCR cases can serve as actionable feedback rather than terminal failures)Skip to content
Future Directions
The authors suggest that OCR-EDR advances toward OCR systems that continuously improve their predictions and data, implying future work on:
- Extending the framework to additional document types and modalities
- Using verified repairs as training supervision for upstream OCR models
- Scaling the approach to richer interaction loops and larger action spaces
Key formulas and definitions:
- : source region image
- : editable OCR prediction (state)
- : rendering function producing image of prediction
- : rendering observation at turn
- : trajectory of state transitions
- : ground-truth validity (good/bad)
- : training reference
- : terminal evidence
- : preservation score
- : verifier-aware terminal repair score
- : trajectory progress score
- : interaction costs for good/bad branches
- CDM: Character Detection Match (formula evaluation metric)
Related papers
- Magenta: Closing the Loop Between Mathematical Reasoning and Lean Verification
MAGENTA achieves 100% verified accuracy on AIME and HMMT benchmarks by pairing LLM reasoning with Lean 4 verification and diagnostic-guided self-correction, eliminating paraphrasing robustness gaps entirely.
- Beyond Solver Verdicts: Generative Reward Models for Autoformalization
Generative verification, which distills an offline Z3-equivalence oracle into a reference-free, continuous score, detects verdict-preserving-unfaithful formalizations with 0.961 AUROC, beating structural and solver-only methods.
- Compiler-Guided Adaptive Proof Search with Cross-Model Synergy on Context-Dependent Theorem Proving
Compiler-guided proof search alternating between two complementary LLMs with pairwise comparison and stagnation detection improves Lean 4 theorem proving pass rates by up to 12.66 points over single-model baselines.