TL;DR
Lean-STaR boosts automated theorem proving by teaching language models to "think" in natural language before writing formal code. By interleaving informal rationales with formal Lean tactics and using a self-improving "expert iteration" loop, the framework achieves state-of-the-art results on the miniF2F benchmark, proving that informal reasoning is a powerful catalyst for formal correctness.
What Problem Does This Paper Address?
Formal theorem proving is the "hard mode" of mathematical reasoning. Unlike informal math, where a human might skip steps or use hand-wavy logic, formal proving requires writing code (tactics) that a computer—an Interactive Theorem Prover (ITP) like Lean—can verify with absolute certainty.
The challenge is that existing AI models are usually trained only on the final "code" of these proofs. However, formal code is often dense and lacks the high-level strategic "thoughts" that a human mathematician uses to navigate a proof. This creates a gap: models struggle to plan their next move because they haven't been taught the underlying reasoning that connects one formal step to the next.
Methods
The authors introduce Lean-STaR, which adapts the "Self-Taught Reasoner" (STaR) framework to the world of formal logic. The process involves two main stages:
- Retrospective Rationale Generation: Since there is no massive dataset of "thoughts" paired with Lean code, the authors used GPT-4 to look at existing human-written proofs from Mathlib. GPT-4 was asked to generate a natural language explanation (a "thought") for why a specific tactic was used, given the current proof state. This created a new "thought-augmented" dataset.
- Expert Iteration: The model (initially an InternLM2-7B) is fine-tuned on these (state, thought, tactic) triples. Then, the model is allowed to attempt new problems. If it finds a correct proof (verified by the Lean solver), that successful trajectory—including the model's own generated thoughts—is added back into the training set for the next round of fine-tuning.
Crucially, the authors found that standard "Best-First Search" (common in theorem proving) worked poorly with natural language thoughts. They instead moved to a parallel sampling approach, which better accommodates the diversity and length of natural language reasoning.
Datasets
- Mathlib (via LeanDojo): The primary training source, consisting of the largest collection of human-written Lean proofs.
- miniF2F-test: The "gold standard" benchmark for evaluation, featuring high-school Olympiad-level math problems.
- Leandojo Benchmark: Used for evaluating the model's ability to handle novel premises it hasn't seen during training.
Key Insights and Ideas
- The Power of Informal Reasoning: The most striking insight is that natural language "Chain-of-Thought" (CoT) isn't just a UI feature for humans; it actually helps the model explore the search space of a proof more effectively.
- Symbolic Safety Nets: Even if the model makes a minor calculation error in its "thought" (e.g., miscalculating a sum), the final proof can still be correct because the symbolic Lean solver acts as a hard filter. The thought provides the strategy, while Lean ensures the execution is flawless.
- Diversity Drives Discovery: Adding thoughts increases the diversity of the model's outputs. During the expert iteration phase, this diversity allows the model to "stumble" upon correct proofs for difficult problems that a purely code-based model would never find.
- Retrospective Bootstrapping: Using a powerful model like GPT-4 to explain existing successful proofs is a highly efficient way to generate high-quality training data for smaller, specialized models.
Key Results
Lean-STaR shows significant performance jumps across the board:
- State-of-the-Art: Using the InternLM2-plus-7B base, Lean-STaR reached 46.3% (Pass@64) on miniF2F-test, a notable improvement over the 43.4% baseline.
- Base Model Gains: For the standard InternLM2-7B, performance jumped from 30.3% to 34.8% (Pass@32) after two iterations of Lean-STaR.
- Domain Strengths: The model showed particularly strong improvements in Number Theory, a domain that often requires complex multi-step logical leaps.
- Efficiency: Lean-STaR outperformed much larger models and specialized few-shot prompts (like GPT-4 at 11.9%), proving that fine-tuning on "thoughts" is more effective than just throwing more parameters at the problem.
Limitations and Future Work
- Computational Cost: Generating synthetic thoughts with GPT-4 is expensive, and the expert iteration loop is bottlenecked by the speed of the Lean ITP.
- Scalability: The current dataset is relatively small (approx. 50k-140k examples). Scaling this to millions of proof steps remains a challenge.
- Search vs. Sampling: While sampling worked better for thoughts, finding a way to integrate natural language reasoning back into efficient tree-search algorithms (like Monte Carlo Tree Search) is a promising future direction.
For more details, you can find the full paper at https://leanstar.github.io/.
Summary updated