TL;DR
TexOCR introduces a new paradigm for scientific document OCR by focusing on reconstructing PDFs into fully compilable, structurally sound LaTeX rather than flat Markdown or plain text. By combining a massive new dataset with reinforcement learning based on verifiable compilation unit tests, their 2B-parameter open-source model approaches the performance of proprietary giants like GPT-5.3.
What Problem Does This Paper Address?
Most modern document OCR tools convert PDFs into plain text or Markdown. While this works well for simple reading, it strips away the rich, executable structure of scientific documents—such as mathematical equations, cross-references, citations, and complex table formatting.
When existing multimodal large language models (MLLMs) attempt to output LaTeX, they often suffer from syntactic brittleness. A single missing bracket, unescaped character, or mismatched label can completely break compilation or silently corrupt document semantics (e.g., misnumbering equations or breaking citation links). The authors address this lack of global syntactic and structural awareness by treating page-level OCR as a compilable code-generation problem.
Methods
The authors propose a two-stage training pipeline built on top of a Qwen3-VL-2B base model:
- Stage 1: Supervised Fine-Tuning (SFT): The model is trained on page-aligned image-to-LaTeX pairs to establish high-fidelity page transcription capabilities.
- Stage 2: Reinforcement Learning with Verifiable Rewards (RLVR): To ensure functional correctness, the authors optimize the model using a group-based RL objective (similar to GRPO). Instead of relying on soft token probabilities, they score completions using a suite of deterministic, binary (pass/fail) unit tests. These tests explicitly check for compilation success, balanced delimiters, valid table structures, and resolved cross-references.
Inference is performed using a single-image protocol, which processes each page independently to preserve visual clarity and avoid the resolution loss common in multi-page merging.
Datasets
The paper introduces two major data contributions:
- TexOCR-Train: A large-scale training corpus containing 57K arXiv papers processed into 404K page-aligned (image, LaTeX/BibTeX) pairs. It utilizes automated alignment pipelines to correctly map floating elements (like figures and tables) and reference sections back to their source pages.
- TexOCR-Bench: A multi-dimensional evaluation benchmark consisting of 2,135 expert-annotated pages. To ensure diversity, data was sourced from contemporary arXiv papers, public-domain mathematics textbooks, historical letters from the Library of Congress, and government reports from the Internet Archive.
Key Insights and Ideas
- Syntax is Brittle: Standard text-matching metrics (like edit distance or BLEU) are poor proxies for LaTeX usability. A minor typo in plain text is still readable, but a minor typo in LaTeX code completely breaks the compilation pipeline.
- RLVR Enforces Invariants: Reinforcement learning with verifiable rewards forces the model to internalize structural "invariants" (e.g., ensuring every
\begin{equation}has a matching\end{equation}). This directly targets the brittle failure modes that token-level SFT fails to capture. - The Markdown Trap: Some advanced open-source OCR models (such as DeepSeek-OCR) are so heavily optimized for Markdown linearization that they fail to output valid LaTeX structures even when explicitly prompted, leading to near-zero structural scores.
- Group Size Matters: Scaling the group size ($K$) during the RLVR phase significantly reduces optimization noise and stabilizes training, leading to smoother and more reliable performance gains.
Key Results
- State-of-the-Art Open Source: The final TexOCR (SFT + RLVR) model achieves an overall score of 75.0 on TexOCR-Bench, outperforming all open-source baselines, including models over ten times its size (e.g., Qwen3-VL-32B at 68.8).
- Closing the Proprietary Gap: TexOCR performs remarkably close to the leading commercial model, GPT-5.3, which scores 78.5.
- RLVR vs. SFT: Adding the RLVR stage to the SFT baseline improved the Structural Faithfulness average score from 74.0 to 83.1, proving that targeted unit-test rewards successfully teach models how to handle complex document logic.
Limitations and Future Work
The primary limitation of this work is its page-level isolation. Because the model processes pages individually, it cannot natively handle document-wide, cross-page dependencies or maintain global consistency perfectly across a multi-page document. The authors note that future work should focus on developing document-level architectures that can capture long-range structural relationships without suffering from resolution loss.
Summary updated