TheoremLlama: Transforming General-Purpose LLMs into Lean4 Experts

Ruida Wang, Jipeng Zhang, Yizhen Jia, Rui Pan, Shizhe Diao, Renjie Pi, Tong Zhang
{"title":"TheoremLlama: Transforming General-Purpose LLMs into Lean4 Experts","authors":"Ruida Wang, Jipeng Zhang, Yizhen Jia, Rui Pan, Shizhe Diao, Renjie Pi, Tong Zhang","doi":"arxiv-2407.03203","DOIUrl":null,"url":null,"abstract":"Proving mathematical theorems using computer-verifiable formal languages like\nLean significantly impacts mathematical reasoning. One approach to formal\ntheorem proving involves generating complete proofs using Large Language Models\n(LLMs) based on Natural Language (NL) proofs. Similar methods have shown\npromising results in code generation. However, most modern LLMs exhibit\nsuboptimal performance due to the scarcity of aligned NL and Formal Language\n(FL) theorem-proving data. This scarcity results in a paucity of methodologies\nfor training LLMs and techniques to fully utilize their capabilities in\ncomposing formal proofs. To address the challenges, this paper proposes\n**TheoremLlama**, an end-to-end framework to train a general-purpose LLM to\nbecome a Lean4 expert. This framework encompasses NL-FL aligned dataset\ngeneration methods, training approaches for the LLM formal theorem prover, and\ntechniques for LLM Lean4 proof writing. Using the dataset generation method, we\nprovide *Open Bootstrapped Theorems* (OBT), an NL-FL aligned and bootstrapped\ndataset. A key innovation in this framework is the NL-FL bootstrapping method,\nwhere NL proofs are integrated into Lean4 code for training datasets,\nleveraging the NL reasoning ability of LLMs for formal reasoning. The\n**TheoremLlama** framework achieves cumulative accuracies of 36.48% and 33.61%\non MiniF2F-Valid and Test datasets respectively, surpassing the GPT-4 baseline\nof 22.95% and 25.41%. We have also open-sourced our model checkpoints and\ngenerated dataset, and will soon make all the code publicly available.","PeriodicalId":501124,"journal":{"name":"arXiv - CS - Formal Languages and Automata Theory","volume":"22 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-07-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Formal Languages and Automata Theory","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2407.03203","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Proving mathematical theorems using computer-verifiable formal languages 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. Similar methods have shown promising results in code generation. However, most modern LLMs exhibit suboptimal performance due to the scarcity of aligned NL and Formal Language (FL) theorem-proving data. This scarcity results in a paucity of methodologies for training LLMs and techniques to fully utilize their capabilities in composing formal proofs. To address the challenges, this paper proposes **TheoremLlama**, an end-to-end framework to train a general-purpose LLM to become a Lean4 expert. This framework encompasses NL-FL aligned dataset generation methods, training approaches for the LLM formal theorem prover, and techniques for LLM Lean4 proof writing. Using the dataset generation method, we provide *Open Bootstrapped Theorems* (OBT), an NL-FL aligned and bootstrapped dataset. A key innovation in this framework is the NL-FL bootstrapping method, where NL proofs are integrated into Lean4 code for training datasets, leveraging 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%. We have also open-sourced our model checkpoints and generated dataset, and will soon make all the code publicly available.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
TheoremLlama:将通用LLM转化为精益4专家
使用计算机可验证的形式语言(如里昂语言)证明数学定理对数学推理产生了重大影响。形式化定理证明的一种方法是使用基于自然语言(NL)证明的大型语言模型(LLM)生成完整的证明。类似的方法在代码生成方面也取得了可喜的成果。然而,由于对齐的自然语言和形式语言(FL)定理证明数据稀缺,大多数现代 LLMs 都表现出次优性能。这种稀缺性导致缺乏训练 LLM 的方法和技术,无法充分利用 LLM 的能力来组合形式化证明。为了应对这些挑战,本文提出了***TheoremLlama***,这是一个端到端框架,用于训练通用LLM成为Lean4专家。该框架包括 NL-FL 对齐数据集生成方法、LLM 形式定理证明器的训练方法以及 LLM Lean4 证明编写技术。利用数据集生成方法,我们提供了*开放引导定理*(OBT),一个NL-FL对齐和引导数据集。该框架的一个关键创新是NL-FL引导方法,即把NL证明集成到用于训练数据集的Lean4代码中,利用LLM的NL推理能力进行形式推理。在MiniF2F-Valid和测试数据集上,**TheoremLlama**框架的累计准确率分别达到了36.48%和33.61%,超过了GPT-4基准线的22.95%和25.41%。我们还开源了模型检查点和生成的数据集,并将很快公开所有代码。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Query Learning of Advice and Nominal Automata Well-Behaved (Co)algebraic Semantics of Regular Expressions in Dafny Run supports and initial algebra supports of weighted automata Alternating hierarchy of sushifts defined by nondeterministic plane-walking automata $\mathbb{N}$-polyregular functions arise from well-quasi-orderings
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1