Rewrite, Then Veto: Rewriter-Agnostic Edit Gating for LLM-Based Post-OCR Correction

Jorge Ramón Fonseca CachoarXiv 2026 · arXiv

TL;DR

Large Language Models (LLMs) are powerful tools for fixing noisy OCR transcripts, but they frequently "over-correct" by changing text that was already accurate. This paper introduces EditVeto, a small (0.6B parameter) gating model that acts as a filter, deciding whether to accept or veto individual edit blocks proposed by a larger LLM rewriter. By reverting suspicious edits back to the original OCR text, EditVeto consistently improves correction quality across various LLMs, even those it wasn't trained on.

What Problem Does This Paper Address?

Digitizing historical archives often relies on Optical Character Recognition (OCR) performed decades ago, resulting in transcripts riddled with errors. While modern LLMs can be prompted to "rewrite" and fix these errors, they struggle with a specific constraint: they must restore intended word forms without adding, removing, or modernizing content.

In practice, LLMs often hallucinate, paraphrase, or "fix" archaic spellings that were actually correct in context. This is known as over-correction. The challenge is to harness the generative power of LLMs to fix actual errors while preventing them from damaging the parts of the text that are already correct.

Methods

The authors propose a "Rewrite, Then Veto" pipeline, illustrated in Figure 1:

  1. Rewrite: A "rewriter" (any LLM, like Qwen3-8B) generates a full-context correction of the OCR transcript.
  2. Align: The rewrite is aligned to the original OCR input at the character level using Levenshtein distance.
  3. Blockify: Differences between the input and the rewrite are grouped into "edit blocks" (runs of substitutions, insertions, or deletions).
  4. Gating: A small, learned gate model (EditVeto, based on Qwen3-0.6B) evaluates each block. It outputs a score representing the probability that the edit is helpful.
  5. Veto: If the score is below a certain threshold, the block is "vetoed" and the text reverts to the original OCR hypothesis. Otherwise, the edit is kept.
Overview of the EditVeto pipeline showing how a rewrite is aligned, blocked, and filtered.

The gate comes in two flavors: a full gate that uses the rewriter's token log-probabilities as features, and a text-only gate that relies solely on the input/output strings, making it truly "rewriter-agnostic."

Datasets

The study uses the HIPE-OCRepair-2026 dataset, a multilingual benchmark (English, French, German) spanning the 17th to 20th centuries. It includes:

  • dta19: German Fraktur books at various noise levels.
  • icdar2017: English and French historical newspapers.
  • impresso-snippets: Newspaper paragraphs in three languages.

The gate was trained on rewrites of the training split and evaluated on the official test sets.

Key Insights and Ideas

  • Context is King, but Dangerous: An oracle analysis revealed a surprising result: if you know exactly where the errors are, generating corrections span-by-span is actually worse than rewriting the whole document and then vetoing bad edits. The LLM needs the full context to generate a good correction, even if that context leads to collateral damage (over-correction) that must be filtered later.
  • Rewriter-Agnosticism: The text-only gate proved remarkably robust. It improved the performance of models it had never seen during training (like Mistral-Small-24B), suggesting that the "features" of a bad OCR correction are somewhat universal across different LLM families.
  • The Preference Score Trade-off: The paper emphasizes the "preference score"—a metric that counts how often a system improves a unit versus degrading it. EditVeto significantly boosts this score, proving it is an effective safeguard against the "do no harm" requirement of archival post-correction.

Key Results

  • Consistent Improvement: In the primary evaluation, the gate improved all five tested rewriters. The weighted character match error rate (cMER) fell by 0.0026–0.0044, and preference scores rose by 0.15–0.25.
  • Competition Performance: When applied to outputs from the HIPE-OCRepair-2026 competition, the gate improved three out of four teams.
  • Ensemble Power: By pooling gated edits from multiple fine-tuned (LoRA) rewriters, the authors achieved a cMER of 0.0069. This result tied for second place in the competition rankings, despite using only publicly available models and data (unlike the winner, who used massive domain-specific pre-training).

Limitations and Future Work

  • The "Ceiling" Effect: A veto gate can only remove bad edits; it cannot recover "missed" errors that the rewriter failed to propose in the first place. The system's recall is strictly bounded by the rewriter LLM.
  • Threshold Sensitivity: A single global threshold for the gate worked well for moderate-precision rewriters but actually hurt the very best (highest-precision) competition systems. Future work could involve adaptive thresholds that calibrate to a specific rewriter's precision.
  • Text-Only Scope: The current method does not utilize page images, which could provide valuable visual cues for distinguishing between OCR noise and archaic characters.
  • Normalization: The evaluation is tied to the HIPE scorer's normalization (which ignores case and punctuation), meaning the gate isn't currently optimized for "diplomatic fidelity" (exact character-for-character reproduction).

Summary updated

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.
BibTeX
@misc{cacho2026rewrite,
  author = {Jorge Ramón Fonseca Cacho},
  title = {{Rewrite, Then Veto: Rewriter-Agnostic Edit Gating for LLM-Based Post-OCR Correction}},
  year = {2026},
  eprint = {2611.05539},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.05539},
}
Figure