Multilingual Mathematical Autoformalization

Albert Q. Jiang, Wenda Li, Mateja Jamnik · DOI

Introduction

Mathematics is traditionally expressed in natural language, which, while intuitive for humans, is often too ambiguous for computer verification. "Formal mathematics" solves this by using rigorous languages like Isabelle or Lean, allowing for absolute proof checking. However, translating informal math into formal code—a process known as autoformalization—is a significant challenge due to the extreme scarcity of parallel data.

To address this, researchers have introduced MMA, the largest dataset for mathematical autoformalization to date. By leveraging a novel "informalisation" approach and multilingual training, this work demonstrates that AI models can learn to bridge the gap between human thought and machine-verifiable logic more effectively than previously possible.

Methodology: Informalisation and Multilingual Training

The primary bottleneck in autoformalization is the lack of high-quality pairs of informal statements and their formal counterparts. The researchers bypassed this by reversing the problem: they took existing formal libraries and used GPT-4 to generate natural language descriptions for them, a process termed informalisation.

Using this synthetic data, they fine-tuned a LLaMA-33B model. A key innovation was the use of multilingual fine-tuning. Instead of training separate models for different formal languages, they trained a single "joint" model on both Isabelle and Lean4 data. This was designed to test whether the underlying mathematical concepts learned in one language could transfer to another, despite differences in syntax.

The MMA Dataset

The Multilingual Mathematical Autoformalization (MMA) dataset is the cornerstone of this research. It contains approximately 332,000 pairs of informal-formal statements, making it four times larger than any previous dataset in the field.

  • Isabelle Data: 244,000 pairs derived from the Archive of Formal Proofs.
  • Lean4 Data: 88,000 pairs derived from mathlib4.

This dataset provides a diverse training ground, covering topics from high school competition math to advanced undergraduate theorems.

Key Results: The Multilingual Advantage

The most significant finding of the study is the "multilingual advantage." The model trained on both Isabelle and Lean4 consistently outperformed models trained on only a single language, even when controlling for the total computational budget.

Validation metrics for Isabelle and Lean4 showing the benefits of multilingual fine-tuning.

As shown in the validation metrics, the joint model (orange line) achieves lower loss and higher token accuracy over time compared to the single-language models (green and purple lines). This suggests that the model is not just memorizing syntax but is developing a generalized understanding of mathematical structures that transcends specific formal languages.

On the miniF2F benchmark for Lean4, the multilingual model achieved a 20% compilation rate, a notable improvement over the 14% achieved by the Lean4-only model. Furthermore, while the base LLaMA-33B model failed to produce any valid formalizations, the fine-tuned MMA models generated statements that experts deemed correct or nearly correct 16–18% of the time.

Limitations and Future Directions

While MMA represents a major step forward, challenges remain. The synthetic data generated by GPT-4 is "noisy"; the LLM occasionally misinterprets complex technical types. Additionally, this work focuses on formalizing mathematical statements (theorems) rather than full proofs, which involve many more logical steps.

Future research will look toward expanding MMA to include other formal languages like Coq or HOL Light. The researchers also propose using "back-translation" techniques to iteratively refine the dataset, potentially reaching higher levels of accuracy without requiring additional human-annotated data. Ultimately, these models aim to serve as "copilots" for mathematicians, significantly reducing the manual effort required for formal verification.

Summary updated

BibTeX
@misc{jiang2023multilingual,
  author = {Albert Q. Jiang and Wenda Li and Mateja Jamnik},
  title = {{Multilingual Mathematical Autoformalization}},
  year = {2023},
  eprint = {2311.03755},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.03755},
}
Figure