Introduction
Optical Character Recognition (OCR) is a foundational technology for digitizing historical archives. However, historical documents present unique challenges, including archaic vocabularies, non-standard typography, and physical degradation. These factors often lead to high error rates that hinder downstream tasks like search and automated analysis. While post-OCR correction—the process of fixing text after digitization—is a well-established field, it faces a significant technical trade-off. Word-based models are computationally efficient but struggle with "out-of-vocabulary" (OOV) errors common in old texts. Conversely, character-based models offer the flexibility to correct any string but are computationally expensive and difficult to scale to long document sequences due to the quadratic memory complexity of standard Transformer architectures.
This paper introduces a novel character-level correction framework that treats a single sequence-to-sequence model as a massive, "virtual" ensemble. By applying the model to small, overlapping text windows and merging the results through weighted voting, the authors achieve state-of-the-art results while maintaining high sample efficiency.
Methodology: The Sliding Window Pipeline
The proposed system operates through a three-stage pipeline designed to maximize local context while bypassing the limitations of long-sequence processing.
- N-Gram Splitting: The input document is decomposed into overlapping character n-grams (windows). For instance, with a window size of 5, the word "hello" would generate windows such as "hello", "ello ", and "llo w". This ensures that every character is captured in multiple contexts.
- Parallel Correction: Each window is processed independently by a standard Transformer sequence-to-sequence model. Because these windows are short and fixed-length, they can be processed in parallel, significantly increasing throughput compared to traditional character-by-character generation on full documents.
- Weighted Voting: This is the core innovation of the approach. Since windows overlap, each character in the original document receives multiple predictions from the model. The system aggregates these predictions using a voting scheme to determine the final output character.
The "Virtual Ensemble" and Weighting Schemes
By shifting the window one character at a time, the model effectively acts as an ensemble of $n$ models (where $n$ is the window size). Each "member" of this ensemble views a specific character from a different contextual perspective. To optimize the merge, the authors evaluated three weighting functions for the voting process:
- Uniform: Every prediction carries equal weight.
- Triangle/Bell: Predictions from the center of a window are weighted more heavily than those at the edges. This addresses the "boundary effect," where sequence models often perform worse at the start or end of a string due to limited one-sided context.
Experimental Results
The researchers evaluated their method using the ICDAR 2019 Competition on Post-OCR Text Correction dataset, covering nine languages: Bulgarian, Czech, German, English, Spanish, French, Dutch, Polish, and Slovak.
Performance Highlights
The sliding window ensemble achieved new state-of-the-art (SOTA) performance in 5 out of 9 languages (Bulgarian, Czech, German, Spanish, and Dutch).
- German Results: The model showed its most significant impact on German texts, reducing the Character Error Rate (CER) from 24.77% to 15.62%, representing a 36.94% relative improvement.
- Consistency: The overlapping n-gram approach consistently outperformed "disjoint windows" (non-overlapping chunks), confirming that the ensemble voting logic is vital for accuracy.
- Sample Efficiency: Unlike many deep learning models that require millions of tokens, this method demonstrated significant gains using only a few hundred corrected documents for training.
Discussion and Limitations
While highly effective for narrative text, the model encountered difficulties with the French dataset. Analysis revealed that the French data consisted primarily of short, fragmented receipts. Because the model relies on local character context to make corrections, the lack of linguistic structure in receipt data limited its effectiveness.
Furthermore, while the system is parallelizable, the use of "Beam Search" for decoding remains computationally intensive—roughly 3 to 10 times slower than "Greedy Search." This suggests a trade-off between absolute accuracy and the speed required for massive-scale digital library processing.
Conclusion
This research demonstrates that character-level sequence-to-sequence models can be scaled effectively to full documents through a sliding window ensemble. By leveraging overlapping context and weighted voting, the system provides a robust, language-agnostic solution for historical OCR correction that is both accurate and sample-efficient. Future work may extend this technique to other domains where alignment is challenging, such as Handwritten Text Recognition (HTR).
Summary updated