LeanDojo: Theorem Proving with Retrieval-Augmented Language Models

By Kaiyu Yang, Aidan M. Swope, Alex Gu, Rahul Chalamala, Peiyang Song, Shixing Yu, Saad Godil, Ryan J. Prenger, Anima Anandkumar. 2023

514 citations recorded by the source corpus.

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.

Subfields: Artificial Intelligence, Computational Theory and Mathematics, Retrieval-Augmented Generation, Large Language Models, Prompting & Reasoning

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Hailey Schoelkopf
  2. Sean Welleck
  3. Zhangir Azerbayev
  4. Xingyao Wang
  5. Hao Peng
  6. Keiran Paster
  7. Marco Dos Santos
  8. Albert Qiaochu Jiang

In Computational Theory and Mathematics

  1. Zhangir Azerbayev
  2. Hailey Schoelkopf
  3. Albert Qiaochu Jiang
  4. Heng Ji
  5. Hao Peng
  6. Sean Welleck
  7. Rahul Saha
  8. Keiran Paster

In Large Language Models

  1. Hailey Schoelkopf
  2. Sean Welleck
  3. Stella Biderman
  4. Heng Ji
  5. Hao Peng
  6. Albert Qiaochu Jiang
  7. Zhangir Azerbayev
  8. Rahul Saha

In Prompting & Reasoning

  1. Stella Biderman
  2. Albert Qiaochu Jiang
  3. Zhangir Azerbayev
  4. Sean Welleck
  5. Lifan Yuan
  6. Keiran Paster

Citations in the corpus