Abstract
Autoformalization—the translation of natural language mathematics into machine-verifiable code—is a critical challenge for ensuring mathematical rigor at scale. While current Large Language Models (LLMs) perform well on elementary mathematics, they struggle with the implicit context and complexity of high-level research. This paper introduces a modular four-step pipeline designed to decompose the autoformalization task into manageable sub-problems: unlinked theorem formalization, definition extraction, entity linking, and type adjustment. To evaluate this approach, the authors present arXiv2Formal, a benchmark dataset of 50 research-level theorems. Experimental results using GPT-3.5 demonstrate that in-context learning significantly improves performance, though substantial challenges remain in achieving fully compilable formalizations of research-grade mathematics.
Introduction: The Verification Gap
Mathematics is notoriously difficult to verify manually. Even proofs that appear sound can harbor subtle errors that persist for decades. Computer-based "proof assistants," such as Lean, offer a solution by providing absolute certainty through formal verification. However, the barrier to entry is immense: translating a single complex research theorem into a formal language often requires a team of experts and months of effort.
While Large Language Models (LLMs) have shown promise in formalizing high-school and undergraduate-level mathematics, they frequently fail when applied to contemporary research papers. Research mathematics relies on a vast web of implicit context and specialized definitions that are rarely contained within a single theorem statement. This makes direct "one-shot" translation—the current standard for AI tools—nearly impossible for high-level work.
A Modular Pipeline for Autoformalization
To address these complexities, the authors propose moving away from monolithic translation. Instead, they introduce a modular, four-stage pipeline that breaks the autoformalization process into discrete, manageable tasks. This approach allows for the use of specialized tools and techniques at each stage, turning a "black box" problem into a structured engineering challenge.
The pipeline consists of the following steps:
- Formalize Theorems (Unlinked): The theorem is translated into syntactically correct Lean code. Crucially, this stage uses "placeholders" for variables or functions that have not yet been formally defined in the environment.
- Formalize Definitions (Unlinked): The source paper is scanned for the definitions corresponding to those placeholders, which are then translated into a local formal library.
- Entity Linking: Natural Language Processing (NLP) techniques are employed to connect the placeholders in the theorem to the correct definitions, whether they reside in the local library or a global standard library like Lean’s mathlib.
- Adjust Types: The Lean compiler’s type-checker is used to identify and resolve misalignments. For instance, if a theorem assumes a variable is a "Vector Space" but the library defines it as a "Module over a Field," the system must reconcile these types to ensure the code compiles.
The arXiv2Formal Benchmark
A central contribution of this work is arXiv2Formal, a new benchmark dataset designed to track progress in the first stage of the pipeline: unlinked formalization. Unlike existing datasets such as miniF2F (high school math) or ProofNet (undergraduate math), arXiv2Formal focuses exclusively on "high-level" research mathematics.
The dataset contains 50 theorems sampled from various fields on arXiv.org, paired with their corresponding Lean 3 code. These pairs were generated through a semi-automated process: GPT-3.5 provided initial translations, which were then meticulously corrected by human experts to ensure accuracy and structural integrity. This dataset allows researchers to evaluate how well a model understands the linguistic and logical structure of a mathematical statement independently of its ability to navigate a massive formal library.
Results and the Power of Context
The researchers evaluated GPT-3.5 on the arXiv2Formal dataset to establish a baseline for the field. Their findings highlight the critical role of prompt engineering and context in mathematical translation.
As shown in the table above, a "zero-shot" approach yielded poor results, with a BLEU score of only 17.2. However, the application of In-Context Learning (ICL)—providing the model with a few examples of the desired output format—led to dramatic improvements. With 10 examples (+ICL 10), the BLEU score rose to 41.7, and the Translation Error Rate (TER) decreased significantly.
Furthermore, the study found a near-perfect correlation ($R = .99$) between automatic metrics like BLEU and human expert evaluations. This suggests that these automated scores are a reliable proxy for tracking progress in this specialized domain, facilitating faster iteration for future models.
Conclusion and Future Outlook
While the modular pipeline and the arXiv2Formal dataset represent significant steps forward, the authors acknowledge that autoformalization for research mathematics is still in its early stages. Current LLMs still struggle with multi-part theorems and complex conditional logic. Moreover, while this work focuses on the initial "unlinked" translation, the subsequent steps of entity linking and type adjustment remain formidable challenges.
By providing a structured roadmap and a high-quality benchmark, this research moves the field closer to a future where formal verification is a standard part of the mathematical research workflow, bridging the gap between natural language intuition and machine-verifiable certainty.
Summary updated