Infinity Parser: Layout Aware Reinforcement Learning for Scanned Document Parsing

Baode Wang, Biao Wu, Weizhen Li, Meng Fang, Yanjie Liang, Zuming Huang, Haozhe Wang, Jun Huang, Ling Chen, Wei Chu, Yuan Qi · OpenReview

TL;DR

Infinity-Parser introduces LayoutRL, the first end-to-end reinforcement learning framework designed specifically for layout-aware scanned document parsing. By optimizing a composite verifiable reward—integrating edit distance, paragraph count, and reading order preservation—the model moves beyond simple token imitation to master complex document structures. Supported by a newly curated 400K document dataset, Infinity-Parser achieves state-of-the-art performance across multiple benchmarks, substantially outperforming both specialized pipelines and general-purpose vision-language models (VLMs).

What Problem Does This Paper Address?

Converting scanned document images into structured, machine-readable formats (like Markdown or HTML) is a foundational challenge in Document AI. Pages often contain a chaotic mix of text paragraphs, multi-column layouts, tables, and mathematical formulas.

Traditional approaches rely on multi-stage pipelines (e.g., layout detection $\rightarrow$ OCR $\rightarrow$ formula recognition $\rightarrow$ heuristic post-processing). These systems are brittle and prone to error propagation. More recent end-to-end VLMs trained via Supervised Fine-Tuning (SFT) offer a cleaner alternative, but they suffer from a fundamental flaw: token-level SFT forces the model to memorize surface patterns rather than learn generalizable structural rules. As a result, SFT-based models struggle to generalize to out-of-distribution (OOD) document layouts. This issue is further compounded by a severe shortage of large-scale, high-quality training data that contains rich layout annotations.

Methods

To break free from the limitations of SFT, the authors propose LayoutRL, an end-to-end reinforcement learning framework powered by Group Relative Policy Optimization (GRPO). Instead of relying on coarse, binary outcome rewards, LayoutRL guides the model using a rule-based, multi-aspect verifiable reward mechanism ($R_{Multi-Aspect}$).

The reward function evaluates the final parsed output directly across three complementary dimensions:

  1. Edit Distance Reward ($R_{dist}$): Uses normalized Levenshtein distance to enforce character-level semantic and formatting accuracy.
  2. Count Reward ($R_{count}$): Compares the number of predicted paragraphs against the ground truth, penalizing missing or hallucinated blocks.
  3. Order Reward ($R_{order}$): Utilizes the Hungarian algorithm to establish a one-to-one matching between predicted and ground-truth segments, then calculates pairwise inversions to ensure the correct reading order is preserved.

Crucially, this setup requires no explicit intermediate "thinking" steps or a learned critic model, drastically reducing training instability and computational overhead.

Datasets

The authors introduced and evaluated their methods on a mix of new and established datasets:

  • Infinity-Doc-400K: A newly constructed corpus of 400,482 documents spanning seven domains (academic papers, financial reports, medical records, books, magazines, web pages, and synthetic documents). It leverages a dual-pipeline: a synthetic branch that renders clean HTML templates via a browser engine, and a real-world branch that applies a multi-expert cross-validation strategy to filter out annotation noise. Due to compute constraints, a 43K subset was used for primary RL training.
  • Evaluation Benchmarks: The model was rigorously tested on OmniDocBench (for layout-aware parsing), olmOCR-Bench (for document-level OCR facts), and both PubTabNet and FinTabNet (for complex table recognition).
Data construction pipelines for real-world and synthetic document generation.

Key Insights and Ideas

  • SFT Memorizes, RL Generalizes: A key finding is that as training data scales, SFT improves local paragraph-level accuracy but plateaus on global page-level accuracy. SFT merely mimics tokens. LayoutRL, however, continuously improves page-level accuracy because its structural rewards force the VLM to capture hierarchical dependencies and reading orders.
  • SFT is Often Redundant for RL: In ablation studies, training with RL directly from a base model (Zero + RL) yielded better structural consistency and comparable or superior overall results to a combined pipeline (SFT + RL). This implies that if a base VLM already possesses strong inherent perceptual capabilities, downstream SFT may be unnecessary before RL training.
  • Verifiable Rewards Over Learned Critics: By substituting a traditional neural network critic with deterministic, rule-based structural metrics (like paragraph matching and edit distance), the authors achieved highly stable training trajectories without the risk of reward hacking.
Figure 1: Comparison of document parsing performance on OmniDocBench under different train- ing strategies as training data size increases. Left: Evaluation with two complementary metrics: (1) Paragraph-level accuracy (edit distance evaluation on element contents only), which assesses element-wise consistency within individual element contents, independent of inter-element reading order; and (2) Page-level accuracy (edit distance evaluation on element contents and reading order), which measures global document reconstruction quality by aligning predicted outputs (e.g., texts, tables, and formulas) with ground-truth sequences. Right: In-Distribution and Out-of-Distribution task performance measured by accuracy score (1 – NED). See detailed descriptions of the task in Section 4.4.

Key Results

Infinity-Parser-7B set new performance standards across all major evaluation dimensions:

  • OmniDocBench: Achieved state-of-the-art (SOTA) overall edit distances of 0.141 (English) and 0.197 (Chinese), substantially outperforming massive models like Qwen2-VL-72B and GPT-4o.
  • olmOCR-Bench: Secured the highest overall score of 82.5, demonstrating remarkable robustness on challenging categories like old scans and dense multi-column layouts.
  • Table Recognition: On PubTabNet and FinTabNet, Infinity-Parser achieved top-tier Tree Edit Distance-based Similarity (TEDS) scores of 91.82 and 95.92 respectively, outperforming specialized end-to-end table parsing models.

Limitations and Future Work

Despite its strong performance, the authors noted a few key limitations:

  • Compute Bottlenecks: Due to limited hardware resources, the model was trained on only a 43K subset of the full 400K corpus for a single epoch. Scaling LayoutRL to the entire dataset remains an open objective.
  • Real-World Label Noise: While the synthetic data branch provides pristine labels, the real-world data pipeline relies on multi-model agreement, which can still introduce minor inconsistencies and incurs high manual filtering costs.

Summary updated

BibTeX
@misc{wang2025infinity,
  author = {Baode Wang and Biao Wu and Weizhen Li and Meng Fang and Yanjie Liang and Zuming Huang and Haozhe Wang and Jun Huang and Ling Chen and Wei Chu and Yuan Qi},
  title = {{Infinity Parser: Layout Aware Reinforcement Learning for Scanned Document Parsing}},
  year = {2025},
  eprint = {2506.03197},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.03197},
}
Figure