Rewrite, Then Veto: Rewriter-Agnostic Edit Gating for LLM-Based Post-OCR Correction
Organizations: Department of Computer Science, University of Nevada, Las Vegas, NV, USA
Abstract
LLMs can repair noisy OCR transcripts of historical documents, but they also change text that was already correct. We propose EditVeto, a veto gate placed after a full-context LLM rewrite. The rewrite is character-aligned to the OCR input, its differences are split into blocks, and a 0.6B-parameter gate keeps or reverts each block. An oracle analysis motivates the design: given the true error locations, per-span generation is worse than no correction, whereas vetoing a full rewrite's edits helps. Trained on rewrites by two Qwen3 models and evaluated, frozen, on the eight HIPE-OCRepair-2026 test sets, the gate improves all five rewriters tested, two of them unseen in training: weighted cMER falls by 0.0026-0.0044 and the preference score rises by 0.15-0.25 (paired bootstrap, p ~ 0.0002 each). On published competition outputs it lowers cMER for three of four teams but raises it for the winning run (0.0050 to 0.0065). In a second, disclosed test look, a retrained gate still improves LoRA-tuned rewriters (cMER -0.0011 to -0.0021), and an ensemble of their gated edits reaches a cMER of 0.0069 and a preference score of 0.928, mostly through fine-tuning and pooling rather than gating. Built only on public models and data, it is behind the winner (0.0050) and tied with the second-ranked run (0.0071), both from the only team using domain pre-training, and ahead of all other published runs. A third, secondary look shows the unchanged gate improving zero-shot Qwen3.8-27B (cMER 0.0114 to 0.0108) but only the preference score of its LoRA-tuned version.
Figures & tables
| Rewriter | No gate | Full gate | Text-only | cMER (full) |
|---|---|---|---|---|
| Qwen2.5-72B zs † | 0.0148 / 0.6107 | 0.0105 / 0.8343 | 0.0106 / 0.8324 | 0.0043 [ 0.0055, 0.0034] |
| LoRA-24B † | 0.0107 / 0.7980 | 0.0086 / 0.9169 | 0.0087 / 0.9100 | 0.0021 [ 0.0026, 0.0016] |
| LoRA-32B † | 0.0107 / 0.7961 | 0.0088 / 0.8980 | 0.0089 / 0.8913 | 0.0019 [ 0.0023, 0.0015] |
| LoRA-72B | 0.0096 / 0.8409 | 0.0085 / 0.8944 | 0.0086 / 0.8974 | 0.0011 [ 0.0016, 0.0007] |
| LoRA-72B-syn | 0.0098 / 0.9004 | 0.0080 / 0.9320 | 0.0081 / 0.9302 | 0.0018 [ 0.0042, 0.0004] |
| Ensemble A | – | 0.0071 / 0.9244 | – | – |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| System | cMER | Pref |
| No correction | 0.0275 | 0.0000 |
| Zero-shot rewrite (ZS) | 0.0247 | 0.4161 |
| Oracle per-span generation (earlier design) | 0.0562 | 0.6247 |
| Oracle window rewrite | 0.0255 | 0.2627 |
| ZS + oracle span gate (block) | 0.0229 | 0.6501 |
| ZS + oracle span gate (character) | 0.0236 | 0.5681 |
| No corr. | ZS | ZS + OSG | OPG | OW | ||||
|---|---|---|---|---|---|---|---|---|
| Cell | cMER | cMER | Pref | cMER | Pref | cMER | cMER | Pref |
| icdar2017 -en (188) | 0.0343 | 0.0288 | 0.6436 | 0.0278 | 0.7340 | 0.0506 | 0.0285 | 0.7500 |
| impresso -en (10) | 0.0372 | 0.0350 | 0.4000 | 0.0350 | 0.4000 | 0.0636 | 0.0335 | 0.5000 |
| impresso -fr (10) | 0.0150 | 0.0113 | 0.6000 | 0.0102 | 0.8000 | 0.0527 | 0.0154 | 0.0000 |
| impresso -de (10) | 0.0226 | 0.0209 | 0.4000 | 0.0169 | 0.9000 | 0.0340 | 0.0219 | 0.0000 |
| dta19-l0 (100) | 0.0045 | 0.0078 | 0.5300 | 0.0045 | 0.2000 | 0.0182 | 0.0049 | 0.0000 |
| Qwen3-8B | Qwen3-32B | |||
|---|---|---|---|---|
| System | cMER | Pref | cMER | Pref |
| No correction | 0.0265 | 0.0000 | 0.0265 | 0.0000 |
| Zero-shot rewrite (ZS) | 0.0238 | 0.5422 | 0.0284 | 0.6533 |
| ZS + oracle span gate (block) | 0.0222 | 0.7022 | 0.0178 | 0.8000 |
| ZS + oracle span gate (char.) | 0.0219 | 0.6222 | 0.0169 | 0.8133 |
| ZS + reverse span gate (block) | – | – | 0.0371 | 0.4244 |
| Rewriter | No gate | Full gate | Text-only gate | Span oracle ∗ | Label oracle ∗ |
|---|---|---|---|---|---|
| Qwen3-8B | 0.0245 / 0.461 | 0.0213 / 0.677 | 0.0211 / 0.679 | 0.0228 / 0.656 | 0.0198 / 0.745 |
| Qwen3-32B | 0.0220 / 0.600 | 0.0160 / 0.810 | 0.0161 / 0.811 | 0.0186 / 0.793 | 0.0135 / 0.859 |
| Qwen3-8B + LoRA | 0.0176 / 0.677 | 0.0143 / 0.898 | n/r | 0.0159 / 0.853 | 0.0108 / 0.970 |
| Mistral-Small-24B | 0.0251 / 0.486 | 0.0133 / 0.896 | 0.0138 / 0.837 | 0.0195 / 0.732 | 0.0110 / 0.944 |
| Qwen2.5-72B | 0.0216 / 0.563 | 0.0134 / 0.833 | 0.0133 / 0.815 | 0.0162 / 0.802 | 0.0105 / 0.910 |
| No gate | Full gate | Text-only gate | LO ∗ | |||||
|---|---|---|---|---|---|---|---|---|
| Rewriter | cMER | Pref | cMER | Pref | cMER | Pref | cMER | Pref |
| Qwen3-8B | 0.0184 | 0.4946 | 0.0153 | 0.7124 | 0.0153 | 0.6950 | 0.0134 | 0.7780 |
| Qwen3-32B | 0.0146 | 0.6433 | 0.0119 | 0.8228 | 0.0120 | 0.8083 | 0.0095 | 0.8844 |
| Qwen3-8B + LoRA | 0.0140 | 0.7061 | 0.0114 | 0.8541 | 0.0114 | 0.8535 | 0.0090 | 0.9274 |
| Mistral-Small-24B | 0.0158 | 0.6002 | 0.0116 | 0.8461 | 0.0116 | 0.8289 | 0.0086 | 0.9230 |
| Qwen2.5-72B | 0.0149 | 0.6074 | 0.0106 | 0.8446 | 0.0106 | 0.8281 | 0.0077 | 0.9132 |
| Cell | Units | Base | Best | Qwen3-8B | Qwen3-32B | LoRA | Mistral | Qwen2.5 |
|---|---|---|---|---|---|---|---|---|
| dta19-l0 | 30 | 0.40 | 0.29 a | 0.88 0.40 | 1.19 0.34 | 0.45 0.28 | 1.48 0.34 | 1.27 0.33 |
| dta19-l1 | 30 | 2.40 | 0.54 | 3.21 1.55 | 1.87 1.25 | 1.36 1.08 | 1.58 1.17 | 2.08 0.95 |
| dta19-l2 | 30 | 5.46 | 0.82 | 5.03 4.06 | 4.25 2.94 | 3.43 2.53 | 5.51 2.92 | 4.33 2.35 |
| icdar2017 -en | 100 | 2.60 | 0.44 | 1.71 1.59 | 1.22 0.96 | 1.26 1.09 | 1.58 0.93 | 1.65 0.79 |
| icdar2017 -fr | 100 | 1.84 | 0.40 | 1.23 1.36 | 0.87 1.10 | 1.33 1.29 | 0.89 1.11 | 0.91 1.05 |
| impresso -de | 100 | 2.96 | 0.58 | 2.47 1.87 | 2.05 1.65 | 1.94 1.47 | 2.11 1.65 | 1.93 1.55 |
| Run (cells) | cMER | Pref | cMER [95% CI] | (cMER / Pref) |
|---|---|---|---|---|
| BnF-Mistral 1 (8) | 0.0050 0.0065 | 0.9000 0.9252 | +0.0015 [+0.0012, +0.0019] | 0.0002 / 0.0090 |
| BnF-Mistral 2 (8) | 0.0090 0.0090 | 0.8739 0.9070 | 0.0001 [ 0.0004, +0.0003] | 0.69 / 0.0054 |
| BnF-Mistral 3 (8) | 0.0071 0.0077 | 0.8737 0.9196 | +0.0006 [+0.0003, +0.0008] | 0.0002 / 0.0002 |
| BLOCR 1 (8) | 0.0106 0.0096 | 0.7028 0.8596 | 0.0011 [ 0.0016, 0.0006] | 0.0002 / 0.0002 |
| L3i 1 (8) | 0.0176 0.0157 | 0.3591 0.4902 | 0.0018 [ 0.0027, 0.0012] | 0.0002 / 0.0002 |
| L3i 2 (3) | 0.0221 0.0199 | 0.0933 0.0167 | 0.0022 [ 0.0028, 0.0017] | 0.0002 / 0.0002 |
| Cell | Units | Qwen3-8B | Qwen3-32B | LoRA-8B | Mistral-24B | Qwen2.5-72B |
|---|---|---|---|---|---|---|
| dta19-l0 | 30 | 0.70 0.00 | 0.97 0.30 | 0.30 0.53 | 0.47 0.30 | 0.63 0.33 |
| dta19-l1 | 30 | 0.20 0.97 | 0.73 1.00 | 0.83 1.00 | 0.73 1.00 | 0.47 1.00 |
| dta19-l2 | 30 | 0.43 0.97 | 0.53 1.00 | 0.87 1.00 | 0.67 1.00 | 0.60 1.00 |
| icdar2017 -en | 100 | 0.70 0.76 | 0.87 0.94 | 0.91 0.93 | 0.70 0.94 | 0.78 0.98 |
| icdar2017 -fr | 100 | 0.85 0.84 | 0.96 0.94 | 0.78 0.84 | 0.94 0.98 | 0.92 0.96 |
| impresso -de | 100 | 0.42 0.80 | 0.68 0.80 | 0.52 0.87 | 0.57 0.94 | 0.61 0.81 |
| Rewriter | cMER [95% CI] | Pref [95% CI] |
|---|---|---|
| Qwen3-8B | 0.0030 [ 0.0042, 0.0021] | +0.200 [0.154, 0.248] |
| Qwen3-32B | 0.0026 [ 0.0031, 0.0022] | +0.165 [0.124, 0.207] |
| Qwen3-8B + LoRA | 0.0027 [ 0.0037, 0.0019] | +0.147 [0.106, 0.192] |
| Mistral-Small-24B | 0.0042 [ 0.0058, 0.0029] | +0.229 [0.177, 0.284] |
| Qwen2.5-72B | 0.0043 [ 0.0056, 0.0033] | +0.221 [0.172, 0.272] |
| Cell | Units | OCR | LoRA-24B | LoRA-32B | LoRA-72B | 72B-syn | Q72 | Ens. |
|---|---|---|---|---|---|---|---|---|
| icdar2017 -en | 100 | 2.60 | 0.97 0.81 | 0.97 0.83 | 0.88 0.79 | 0.83 0.79 | 1.57 0.82 | 0.61 |
| icdar2017 -fr | 100 | 1.84 | 1.30 1.17 | 1.12 1.13 | 1.05 1.09 | 0.97 1.03 | 0.89 1.00 | 0.94 |
| impresso -en | 100 | 1.70 | 0.69 0.71 | 0.73 0.70 | 0.66 0.69 | 0.64 0.72 | 0.74 0.83 | 0.63 |
| impresso -fr | 100 | 1.69 | 0.70 0.59 | 0.65 0.64 | 0.78 0.66 | 1.33 0.61 | 1.19 0.94 | 0.55 |
| impresso -de | 100 | 2.96 | 1.58 1.09 | 1.58 1.10 | 1.26 0.98 | 1.08 0.90 | 1.92 1.50 | 0.77 |
| dta19-l0 | 30 | 0.40 | 0.30 0.21 | 0.47 0.25 | 0.31 0.20 | 0.30 0.20 | 1.28 0.33 | 0.21 |
| Run (cells) | cMER (run ens.) | cMER [95% CI], | Pref, |
|---|---|---|---|
| BnF-Mistral 1 (8) | 0.0050 0.0069 | +0.0019 [+0.0014, +0.0024], 0.0002 | +0.028, 0.08 |
| BnF-Mistral 3 (8) | 0.0071 0.0069 | 0.0002 [ 0.0008, +0.0004], 0.49 | +0.054, 0.0006 |
| BnF-Mistral 2 (8) | 0.0090 0.0069 | 0.0022 [ 0.0027, 0.0016], 0.0002 | +0.054, 0.0016 |
| BLOCR 1 (8) | 0.0107 0.0069 | 0.0038 [ 0.0046, 0.0031], 0.0002 | +0.225, 0.0002 |
| L3i 1 (8) | 0.0176 0.0069 | 0.0107 [ 0.0122, 0.0094], 0.0002 | +0.569, 0.0002 |
| L3i 2 (3) | 0.0221 0.0065 | 0.0156 [ 0.0172, 0.0141], 0.0002 | +1.007, 0.0002 |
Historical Document Processing
Historical document processing uses AI to transcribe, structure, restore, and analyze manuscripts, books, newspapers, and archival records.
See all 79 papers