NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Lean Workbook: A large-scale Lean problem set formalized from natural language math problems

Huaiyuan Ying, Zijian Wu, Yihan Geng, JIayu Wang, Dahua Lin, Kai Chen

TL;DR

Researchers have released Lean Workbook, a massive dataset of over 57,000 natural language math problems paired with their formal equivalents in the Lean 4 programming language. By using an iterative "active learning" pipeline that combines compiler feedback, back-translation, and human expertise, they’ve created a high-quality resource that significantly boosts the ability of AI models to understand and prove complex mathematical theorems.

The Challenge: Data Sparsity in Formal Theorem Proving

While Large Language Models (LLMs) like GPT-4 are surprisingly adept at solving natural language word problems, they struggle with formal theorem proving. Formal proving requires writing code in languages like Lean, which can be verified by a computer (a "proof assistant") to be 100% logically certain.

The primary bottleneck in this field isn't just the underlying logic; it's data sparsity. Existing formal datasets are either too small (like MiniF2F) or focus heavily on fundamental undergraduate math (like Mathlib) rather than the creative, "contest-level" problems found in Math Olympiads. Manually translating these complex problems into code is incredibly labor-intensive, requiring experts who are fluent in both high-level mathematics and formal logic programming.

Methods: An Iterative Autoformalization Pipeline

To scale up data production without sacrificing accuracy, the authors developed an iterative autoformalization pipeline.

Iterative autoformalization pipeline combining translation, back-translation, and human feedback

The process works in a continuous loop:

  1. Translation: An initial model (InternLM-Math) translates natural language problems from the Art of Problem Solving (AoPS) forum into Lean 4 code.
  2. The Compiler Filter: The code is run through the Lean 4 compiler. If it doesn't compile, it’s discarded or flagged. The compiler acts as an ultimate ground truth—if the code fails here, it is objectively incorrect.
  3. The NLI Filter (Back-translation): A piece of Lean code might compile perfectly but represent the wrong math problem. To ensure the meaning wasn't lost, the model translates the Lean code back into natural language. A second LLM (Qwen-1.5) then acts as a Natural Language Inference (NLI) judge, comparing the original problem with the back-translated version to ensure they are semantically identical.
  4. Human-in-the-Loop: Human experts (Math Olympiad winners) review samples that fail the filters, manually correcting them. These corrections are fed back into the model to improve it for the next round.
  5. Iteration: This process was repeated over six rounds, gradually increasing the model's accuracy and the complexity of problems it could handle.

The Datasets

The pipeline resulted in several key datasets sourced from the AoPS community forum, MiniF2F, and ProofNet:

  • Lean Workbook: The primary contribution, containing 57,231 formal-informal question pairs.
  • Lean Workbook Plus: An expanded version containing 82,893 pairs.
  • IMO Set: 21 new, high-difficulty International Mathematical Olympiad (IMO) problems formalized for the very first time.

Key Results

By specifically targeting the failure modes identified by the compiler and human experts, the researchers achieved remarkable accuracy and downstream performance improvements.

  • High Translation Accuracy: Manual examination of a random sample showed a 93.5% accuracy rate for the formalized statements across various math domains (algebra, number theory, calculus, etc.).
  • Significant Performance Boost: Fine-tuning an InternLM2-Math-Plus model on the Lean Workbook dataset led to a substantial jump in performance on the MiniF2F benchmark.
Performance improvements on the MiniF2F benchmark after training on Lean Workbook

As shown above, accuracy on the MiniF2F validation set rose from 44.3% to 50.4%, and test set accuracy rose from 37.3% to 46.7%.

Limitations and Future Work

While a massive step forward, the authors note a few ongoing challenges. First, the dataset contains some similar problems, and applying effective deduplication at this scale remains difficult. Second, the current pipeline is heavily focused on high-school and contest-level math; it may not yet generalize to the more abstract, research-level mathematics found in specialized journals.

Finally, while the dataset provides formalized statements, only about 5,000 of them currently include formal solutions. The next major frontier is using this rich data to train models that can not only state the problem formally but also search for and generate the complete, verifiable proof.

Summary updated

BibTeX
@inproceedings{ying2024lean,
  author = {Huaiyuan Ying and Zijian Wu and Yihan Geng and JIayu Wang and Dahua Lin and Kai Chen},
  title = {{Lean Workbook: A large-scale Lean problem set formalized from natural language math problems}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=Vcw3vzjHDb},
}
Figure