Abstract
Optical Character Recognition (OCR) for mathematical formula is essential for the intelligent analysis of scientific literature. However, both task-specific and general vision-language models often struggle to handle the structural diversity, complexity, and real-world variability inherent in mathematical content. In this work, we present DocTron-Formula, a unified framework built upon general vision-language models, thereby eliminating the need for specialized architectures. Furthermore, we introduce CSFormula, a large-scale and challenging dataset that encompasses multidisciplinary and structurally complex formulas at the line, paragraph, and page levels. Through straightforward supervised fine-tuning, our approach achieves state-of-the-art performance across a variety of styles, scientific domains, and complex layouts. Experimental results demonstrate that our method not only surpasses specialized models in terms of accuracy and robustness, but also establishes a new paradigm for the automated understanding of complex scientific documents.
Introduction
Mathematical formula recognition is a cornerstone of scientific document analysis, yet it remains a significant challenge for traditional OCR systems. Unlike standard text, mathematical expressions are inherently non-linear, featuring deeply nested structures such as superscripts, subscripts, fractions, and matrices. Current research in this field faces three primary hurdles: a heavy reliance on brittle, task-specific architectures; datasets that lack the complexity found in real-world scientific literature; and a "layout fragility" where models fail when formulas are embedded within dense paragraphs or span entire pages.
The CSFormula Dataset and Methodology
To address these gaps, we introduce CSFormula (Complex and Structured Formula dataset), a large-scale benchmark designed to mirror the "messy" reality of authentic scientific documents. The dataset is structured hierarchically, covering line-level, paragraph-level, and full page-level samples.
Instead of engineering a new specialized neural network, DocTron-Formula leverages the power of general-purpose Vision-Language Models (VLMs), specifically the Qwen2.5-VL backbone (3B and 7B variants). By employing supervised fine-tuning (SFT) on the CSFormula dataset, the model learns to treat formula recognition as an autoregressive generative task. This approach allows the model to maintain structural integrity across different visual scales—from a single line to a multi-column page—without requiring a separate detection or cropping step.
Experimental Results and Insights
DocTron-Formula (7B) establishes a new state-of-the-art across multiple benchmarks. On the challenging page-level task of CSFormula, it achieved an Edit Distance (ED) of 0.251, significantly outperforming previous specialized models like UniMERNet, which recorded an ED of 0.903. On the UniMER benchmark, it reached an average ED of 0.098, surpassing specialized models and generalist heavyweights like GPT-4o.
A key finding of this work is that generalist VLMs, when trained on hierarchical data, can surpass specialists. The joint training on line, paragraph, and page levels enhances the model's spatial reasoning. Furthermore, the model demonstrates high robustness across various domains, successfully recovering deeply nested LaTeX expressions from diverse sources including printed text and screen captures. To better judge performance, the authors emphasize Character Detection Matching (CDM) over standard string metrics, as it better aligns with visual mathematical accuracy.
Conclusion
DocTron-Formula represents a paradigm shift in mathematical OCR, moving away from hand-crafted architectures toward generalist models capable of handling complex scientific layouts. While the current framework excels at formula transcription, future work will focus on holistic document analysis, including the integration of table recognition and the understanding of complex reading orders in multi-column documents.
Summary updated