[论文解读] LeanDojo: Theorem Proving with Retrieval-Augmented Language Models
LeanDojo 引入一个开源的 Lean 练习场,提供数据、模型和基准,并介绍 ReProver,这是一个利用从 Lean 的数学库中检索到的前提来改进与大模型的定理证明的检索增强证明器。
Large language models (LLMs) have shown promise in proving formal theorems using proof assistants such as Lean. However, existing methods are difficult to reproduce or build on, due to private code, data, and large compute requirements. This has created substantial barriers to research on machine learning methods for theorem proving. This paper removes these barriers by introducing LeanDojo: an open-source Lean playground consisting of toolkits, data, models, and benchmarks. LeanDojo extracts data from Lean and enables interaction with the proof environment programmatically. It contains fine-grained annotations of premises in proofs, providing valuable data for premise selection: a key bottleneck in theorem proving. Using this data, we develop ReProver (Retrieval-Augmented Prover): an LLM-based prover augmented with retrieval for selecting premises from a vast math library. It is inexpensive and needs only one GPU week of training. Our retriever leverages LeanDojo's program analysis capability to identify accessible premises and hard negative examples, which makes retrieval much more effective. Furthermore, we construct a new benchmark consisting of 98,734 theorems and proofs extracted from Lean's math library. It features challenging data split requiring the prover to generalize to theorems relying on novel premises that are never used in training. We use this benchmark for training and evaluation, and experimental results demonstrate the effectiveness of ReProver over non-retrieval baselines and GPT-4. We thus provide the first set of open-source LLM-based theorem provers without any proprietary datasets and release it under a permissive MIT license to facilitate further research.
研究动机与目标
- 提供开放、可复现的工具,用于提取 Lean 数据并以编程方式与 Lean 交互。
- 开发一个检索增强的证明器(ReProver),从 mathlib 中选择前提以生成策略。
- 创建一个大规模、具有挑战性的 Lean 基准,用于评估前提选择和证明性能。
- 证明检索增强在 LeanMath 基准上相较于非检索基线以及 GPT-4 提高证明器性能。
提出的方法
- LeanDojo 从 Lean 提取运行时证明数据(状态、策略、前提),并为 Lean 增加完整的前提命名和可访问性信息。
- ReProver 使用一个检索增强的策略生成器,对少量检索到的前提出条件。
- 前提检索基于 Dense Passage Retriever,并做了改进:限定为可访问的前提并使用文件内的负例。
- 使用 Finetunes ByT5 编码器-解码器在状态+前提上训练以生成策略,随后用最佳优先搜索进行证明。
- 数据集 LeanDojo Benchmark 包含 98,734 个定理/证明和 130,262 个前提,novel_premises 数据划分用于测试泛化。
实验结果
研究问题
- RQ1使用检索增强提示并利用检索到的前提出提升 Lean 的交互式定理证明,是否优于非检索基线?
- RQ2将检索限定为可访问的前提并使用文件内负例,如何影响前提召回率和证明成功率?
- RQ3LeanDojo Benchmark 的划分(随机 vs novel_premises)对新颖前提的泛化有何影响?
- RQ4ReProver 在 MiniF2F 与 ProofNet 的外部数据集上的表现,相较于现有方法且不依赖大规模 RL?
主要发现
| 方法 | random R@1 | random R@10 | random MRR | novel_premises R@1 | novel_premises R@10 | novel_premises MRR |
|---|---|---|---|---|---|---|
| BM25 | 6.7 | 17.2 | 0.15 | 5.9 | 15.5 | 0.14 |
| w/ all premises | 1.9 | 11.9 | 0.08 | 2.1 | 12.4 | 0.08 |
| Ours | 13.5 | 38.4 | 0.31 | 9.1 | 27.6 | 0.24 |
| w/ all premises | 11.7 | 36.2 | 0.27 | 7.1 | 23.1 | 0.20 |
| w/o in-file negatives | 10.8 | 33.1 | 0.25 | 7.9 | 25.7 | 0.22 |
- ReProver 在 LeanDojo Benchmark 随机划分上达到 51.2% 的 Pass@1,优于不使用检索的基线(47.6%)和 GPT-4(29.0%)。
- 在 novel_premises 上,ReProver 达到 26.3% 的 Pass@1,超过不使用检索的基线(23.2%)和 GPT-4(7.4%)。
- 使用可访问前提和文件内负例进行前提检索显著提高召回度量相较于基线(例如在表 1,ours 在随机上 R@1 为 13.5 而 BM25 为 6.7)。
- ReProver 在 Lean 中分别证明 MiniF2F 的 26.5% 和 ProofNet 的 13.8% 测试集,与不依赖 RL 的最先进方法竞争并发现多十余个 Lean 无法证明的定理。
- 训练仅需五个 GPU 天,在单个 GPU 上进行,评估在八个 GPU 上完成,公开的代码、数据和模型以 MIT 许可证发布。
- LeanDojo Benchmark 是最大的面向数学的定理证明数据集之一,强调具有挑战性的泛化数据划分。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。