TheoremLlama: Transforming General-Purpose LLMs into Lean4 Experts
Ruida Wang, Jipeng Zhang, Yizhen Jia, Rui Pan, Shizhe Diao, Renjie Pi, Tong Zhang
Abstract
Proving mathematical theorems using computer-verifiable Formal Languages (FL) like Lean significantly impacts mathematical reasoning. One approach to formal theorem proving involves generating complete proofs using Large Language Models (LLMs) based on Natural Language (NL) proofs. However, due to the scarcity of aligned NL and FL theorem-proving data, most modern LLMs exhibit suboptimal performance. This scarcity results in a paucity of methodologies for training LLMs and techniques to fully utilize their capabilities in composing formal proofs. To address these challenges, this paper proposes TheoremLlama, an end-to-end framework that trains a general-purpose LLM to be a Lean4 expert. TheoremLlama includes NL-FL dataset generation and bootstrapping method to obtain aligned dataset, curriculum learning and block training techniques to train the model, and iterative proof writing method to write Lean4 proofs that work together synergistically. Using the dataset generation method in TheoremLlama, we provide Open Bootstrapped Theorems (OBT), an NL-FL aligned and bootstrapped dataset. Our novel NL-FL bootstrapping method, where NL proofs are integrated into Lean4 code for training datasets, leverages the NL reasoning ability of LLMs for formal reasoning. The TheoremLlama framework achieves cumulative accuracies of 36.48% and 33.61% on MiniF2F-Valid and Test datasets respectively, surpassing the GPT-4 baseline of 22.95% and 25.41%. Our code, model checkpoints, and the generated dataset is published in GitHub
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext d9fb5f0b-95be-4806-8f57-a03271c64368Cited by top-tier papers25
- BFS-Prover: Scalable Best-First Tree Search for LLM-based Automatic Theorem ProvingRan Xin, Chenguang Xi, Jie Yang, Feng Chen et al.ACL 2025 · 66 citations
- ATLAS: Autoformalizing Theorems through Lifting, Augmentation, and Synthesis of DataXiaoyang Liu, Kangjie Bao, Jiashuo Zhang, Yunqi Liu et al.NeurIPS 2025 · 28 citations
- A Comprehensive Survey of Scientific Large Language Models and Their Applications in Scientific DiscoveryYu Zhang, Xiusi Chen, Bowen Jin, Sheng Wang et al.EMNLP 2024 · 28 citations
- ProofBridge: Auto-Formalization of Natural Language Proofs in Lean via Joint EmbeddingsPrithwish Jana, Kaan Kale, Ahmet Ege Tanriverdi, Cruise Song et al.ICLR 2026 · 19 citations
- Lean Finder: Semantic Search for Mathlib That Understands User IntentsJialin Lu, Kye Emond, Kaiyu Yang, Swarat Chaudhuri et al.ICLR 2026 · 10 citations
Builds on10
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Big Self-Supervised Models are Strong Semi-Supervised LearnersTing Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi et al.NeurIPS 2020 · 2,611 citations
- Llemma: An Open Language Model for MathematicsZhangir Azerbayev, Hailey Schoelkopf, Keiran Paster, Marco Dos Santos et al.ICLR 2024 · 433 citations
- Do Not Have Enough Data? Deep Learning to the Rescue!Ateret Anaby-Tavor, Boaz Carmeli, Esther Goldbraich, Amir Kantor et al.AAAI 2020 · 398 citations
- Autoformalization with Large Language ModelsYuhuai Wu, Albert Qiaochu Jiang, Wenda Li, Markus N. Rabe et al.NeurIPS 2022 · 364 citations
Related papers
- NL2Lean: Translating Natural Language into Lean 4 through Multi-Aspect Reinforcement LearningYue Fang, Shaohan Huang, Xin Yu, Haizhen Huang et al.EMNLP 2025
- MUSTARD: Mastering Uniform Synthesis of Theorem and Proof DataYinya Huang, Xiaohan Lin, Zhengying Liu, Qingxing Cao et al.ICLR 2024 · 50 citations
- APOLLO: Automated LLM and Lean Collaboration for Advanced Formal ReasoningAzim Ospanov, Farzan Farnia, Roozbeh MohitNeurIPS 2025 · 49 citations
- MA-LoT: Model-Collaboration Lean-based Long Chain-of-Thought Reasoning enhances Formal Theorem ProvingRuida Wang, Rui Pan, Yuxin Li, Jipeng Zhang et al.ICML 2025
- FANS: Formal Answer Selection for LLM Natural Language Math Reasoning Using Lean4Jiarui Yao, Ruida Wang, Tong ZhangEMNLP 2025 · 1 citation
