Reference-Based Post-OCR Processing with LLM for Precise Diacritic Text in Historical Document Recognition

Thao Do, Dinh Phu Tran, An Vo, Daeyoung Kim

Abstract

Researchers from KAIST have developed a novel pipeline that utilizes existing ebooks as a "reference base" to correct Optical Character Recognition (OCR) errors in historical Vietnamese texts. By combining fuzzy string matching with Large Language Models (LLMs), specifically GPT-4o mini, they produced VieBookRead, a high-precision dataset of 25,585 pages. The proposed method significantly outperforms standalone spell-correction models, offering a robust solution for preserving cultural heritage in diacritic-heavy languages.

Introduction: The Challenge of Historical OCR

Optical Character Recognition (OCR) technology often fails when confronted with historical documents. Aged books are frequently marred by physical "noise" such as ripped pages, watermarks, and bleed-through ink. In languages with complex diacritics like Vietnamese—where a single character can have up to 17 variants—even minor visual noise can lead to an explosion of possible word combinations, rendering standard spell-checkers ineffective.

Furthermore, historical texts employ archaic vocabulary and grammatical structures that modern AI models, typically trained on contemporary web data, fail to recognize. This linguistic gap necessitates a specialized approach that goes beyond simple character recognition.

Methodology: Reference-Based Correction

The core innovation of this research is a "Reference-Based" pipeline. While page-to-page labels for historical books are rare, many titles have been manually transcribed into ebooks (EPUBs) by preservationists. Although these ebooks lack direct mapping to specific scanned pages, they contain the correct "ground truth" text.

The pipeline operates in four stages:

  1. Initial OCR & Heuristic Filtering: Raw text is extracted using Azure Document Intelligence. Heuristic filters are applied to remove non-textual noise like skewed stamps.
  2. Zero-Shot Figure Detection: Vision LLMs (mPlug-DocOwl and LLaVa) identify and exclude non-textual figures.
  3. Fuzzy Reference Matching: The noisy OCR output is aligned with the corresponding ebook text using Levenshtein distance to locate the most probable "clean" version of a paragraph.
  4. LLM-Guided Correction: GPT-4o mini receives both the noisy OCR and the ebook reference. It acts as an editor, using the reference to fix diacritics and archaic spellings while preserving the document's original structure.
The initial OCR extraction process, showing the transition from a raw historical scan (a) to region detection (b) and structured data output (c).

The VieBookRead Dataset

The study introduces VieBookRead, a comprehensive benchmark for historical Vietnamese document recognition. It consists of 25,585 pages from 123 books published between 1850 and 2003, covering genres from philosophy to folk literature. Unlike existing datasets that focus on scene text or handwritten Nom script, VieBookRead provides a large-scale resource for dense, printed historical text.

t-SNE visualization comparing VieBookRead (red) with other Vietnamese OCR benchmarks, demonstrating its unique distribution.

Key Results and Insights

The proposed method achieved a mean human evaluation score of 8.72/10, significantly higher than the previous state-of-the-art Vietnamese spell-correction model (7.03/10). In 86.66% of test cases, the LLM-based approach was judged semantically superior to standard methods.

A key insight from the study is that "Context is King." By providing the LLM with the actual reference text, the system shifts from "guessing" characters to "aligning" them, which drastically reduces hallucinations. Additionally, the researchers found that traditional two-stage OCR (detection followed by recognition) often outperformed modern end-to-end models on this noisy, high-density historical data.

Conclusion and Future Work

The VieBookRead pipeline demonstrates the power of leveraging existing unstructured digital resources to improve OCR accuracy. While the method currently depends on the availability of ebook references, it sets a new standard for high-precision digitization. Future work will focus on expanding this methodology to other diacritic-heavy languages and improving the handling of "dangling text"—content present in scans but missing from original ebook transcriptions.

Summary updated

BibTeX
@inproceedings{do2025reference,
  author = {Thao Do and Dinh Phu Tran and An Vo and Daeyoung Kim},
  title = {{Reference-Based Post-OCR Processing with LLM for Precise Diacritic Text in Historical Document Recognition}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i27.35012},
}
Figure