TL;DR
TongGuOCR is a novel multimodal large language model (MLLM) designed specifically for the optical character recognition (OCR) of Chinese historical documents. By combining layout-aware block processing, vocabulary expansion for rare characters, and discrete spatial transition tokens, it successfully overcomes the complex layouts and long-tailed character distributions that cause standard OCR models to fail.
What Problem Does This Paper Address?
Digitizing thousands of years of Chinese historical documents is vital for the digital humanities, yet automating their transcription remains notoriously difficult. Standard modern OCR tools and general-purpose MLLMs consistently fail when applied to these texts due to three core challenges:
- Intricate Layouts: Historical pages frequently mix vertical columns, table-like structures, irregular text blocks, and tiny interlinear annotations (notes squeezed between main text lines).
- Rare Characters: Ancient Chinese utilizes a massive, long-tailed vocabulary. Modern text tokenizers fragment these rare characters into multiple byte-level pieces, breaking the direct link between a visual glyph and its textual representation.
- Nontrivial Reading Orders: Without explicit spatial awareness, models easily get lost when transitioning from the bottom of one vertical line to the top of the next, leading to skipped lines, repetitions, or cross-column confusion.
Existing methods either look at the full page (losing resolution and blurring text) or look at single lines individually (losing the local context needed for coherent reading).
Methods
The authors introduce TongGuOCR, which splits the problem into two main components: Layout-Aware Preprocessing and Token-Augmented Recognition.
[Input Page] ➔ [Layout-Aware Preprocessing] ➔ [Token-Augmented Recognition] ➔ [Final Text]
1. Layout-Aware Preprocessing
Instead of processing full pages or isolated lines, TongGuOCR introduces an intermediate granularity called locally coherent recognition blocks.
- It uses text-line bounding boxes and applies a dynamic programming solution governed by a penalty-based objective function.
- This function penalizes over-segmentation (too many tiny blocks) and under-segmentation (blocks that cross unstable layout boundaries).
- The resulting blocks preserve local reading context while keeping character resolution high.
2. Token-Augmented Recognition
To fix character fragmentation and reading order issues, the model augments its target text sequence in two ways:
- Character-Level Vocabulary Expansion: The authors mined the training corpus for rare characters and added them directly to the tokenizer as single standalone tokens. This shortens the decoding path and prevents the model from hallucinating during generation.
- Line-to-Line Transition Modeling: The authors quantized the spatial displacement between consecutive lines into 24 discrete directional tokens (e.g.,
<left|far_up>,<right|down>). The model is trained to predict these spatial tokens at line boundaries, implicitly guiding the decoder along complex reading paths without requiring precise coordinate regression.
3. Three-Stage Training Strategy
The model undergoes a progressive Supervised Fine-Tuning (SFT) pipeline:
- Coarse Domain Adaptation: Pretraining on a massive, semi-automatically annotated page-level dataset.
- High-Quality Page-Level Refinement: Fine-tuning on clean, human-annotated pages.
- Block-Level Inference Alignment: Fine-tuning specifically on the cropped recognition blocks to eliminate any input-granularity mismatch during deployment.
Datasets
The model was trained and evaluated using three public datasets:
- HisDoc1B: A massive dataset containing over 3.16 million semi-automatically annotated page images, utilized for the initial coarse domain adaptation stage.
- MTHv2: A human-annotated dataset consisting of 3,199 images from the Tripitaka Koreana in Han.
- M5HisDoc: A highly challenging, multi-style benchmark containing 4,000 images with diverse layouts, calligraphic styles, and complex backgrounds.
Key Insights and Ideas
- Granularity Alignment is Crucial: The authors discovered that a model trained purely on full-page images performs poorly when evaluated on cropped blocks (and vice versa). Aligning the training data to the exact block-level crops used during inference (Stage 3 SFT) drastically reduced text insertion errors.
- Coarse Spatial Cues Beat Exact Coordinates: For text transcription, models don't need to predict exact bounding box coordinates to stay on track. Providing coarse relative directions (like "move far up and to the left") as discrete language tokens is entirely sufficient to anchor the MLLM's attention mechanism.
- Subword Fragmentation Harmed Vision-Language Alignment: Forcing a vision model to map one clear visual glyph to three or four fragmented byte tokens creates an unnecessary optimization bottleneck. Single-token representation restores a clean 1:1 visual-to-textual mapping.
Key Results
TongGuOCR achieved state-of-the-art results across both evaluation benchmarks, significantly outperforming general-purpose models (like GPT-5.5 and Qwen3.7-Plus) and specialized OCR models (like HunyuanOCR and GLM-OCR).
- On M5HisDoc (The Harder Benchmark): TongGuOCR achieved an Accuracy Rate (AR) of 93.76% (improving on the best baseline's 92.10%). It reduced the Normalized Edit Distance (NED) from 10.43 to 6.15 and slashed the Reading-Order Edit Distance (RO-ED) from 7.53 to 3.49.
- On MTHv2: It reached an AR of 97.93% and a near-perfect RO-ED of 1.51.
Qualitative evaluations (such as in Figure 4) demonstrate that while other advanced models skip lines or lose track in dense, table-like layouts, TongGuOCR successfully recovers the entire natural reading sequence.
Limitations and Future Work
Despite its strong performance, the authors note two primary limitations:
- Corpus-Dependent Vocabulary: The vocabulary expansion relies entirely on characters present in the training set. It cannot natively handle entirely unseen characters or ancient glyphs that have not yet been deciphered by historians.
- Benchmark Diversity: While diverse, the evaluated datasets still do not capture the full, near-infinite variety of historical Chinese printing and writing styles across different eras.
Future work will explore developing more flexible, open-vocabulary representations capable of handling completely unseen characters.
Summary updated