# LeanAgent: Lifelong Learning for Formal Theorem Proving
<!--
ref: @content/youtube/yc-root-access/leanagent-lifelong-learning-for-formal-theorem-proving
tags: [lifelong learning, formal theorem proving, Lean, catastrophic forgetting, curriculum learning, tree search, premise selection]
version: 2
updated_at: 2026-11-24T05:14:04.759Z
-->

**[Watch on YouTube](https://www.youtube.com/watch?v=ca8IURq5QP8)**

# LeanAgent: Lifelong Learning for Formal Theorem Proving

*Synthesized from Adarsh, the researcher behind LeanAgent, in conversation with an unnamed interviewer on YC Root Access, 2026-08-06.*

Adarsh, who says the work was done at the California Institute of Technology and presented at ICLR the previous year, is interviewed in a short segment recorded at a venue the transcript calls YCML. The interviewer is not named in the transcript, and the transcript is an auto-caption transcript, so some spellings may be off.

## Core Thesis
Adarsh argues that continuous (lifelong) learning is best tested in formal mathematics, because mathematics is cumulative: new results should not erase earlier ones. LeanAgent is a framework that orders Lean repositories into a curriculum from easy to hard, retrains its retrieval engine for one epoch per stage so that new knowledge is added without losing old knowledge, and feeds newly proven theorems back into its database.

## Key Insights
- **Stability versus plasticity.** Too much stability and the model freezes; too much plasticity and it forgets what came before. Adarsh presents one epoch of training on the latest retrieval engine per stage as the balance point.
- **Why Lean and why mathematics.** A Lean proof is code that the compiler checks step by step. Each step is a tactic call whose arguments are premises (any previously proven theorem, definition or lemma). Finding the relevant premises at each step is the main difficulty, because everything in mathematics is interconnected.
- **Agent cycle.** The system scans GitHub for Lean repositories. It scores each theorem by its number of proof steps, splits each repository into easy, medium and difficult theorems, and sorts repositories in descending order of their easy-theorem count. The resulting curriculum goes into a dynamic database that also holds all theorems, premises and proofs.
- **Search.** The newest retrieval engine supplies preconditions to a tactic generator, which creates the nodes of a proof tree. The search uses recursion and timeouts, and each new proof it finds is written back to the database.
- **Results.** The system proved 155 new formal proofs across 23 areas, some of them theoretical areas such as combinatorics. Adarsh also reports "reverse knowledge transfer": studying a later topic such as topology improved performance on an earlier one such as algebra.
- **Models.** The models used were ByT5 from Google, kept small enough that people can run them themselves. He suggests that small open models such as Gemma, or a newer open model, would probably do better today.
- **Search versus generation.** Step-by-step tree search still looks useful to him. Generating a whole proof at once with reinforcement learning at test time works but is very expensive. His approach is similar to AlphaEvolve, doing search without reinforcement learning, and he thinks this generalises across fields, with mathematics as a case where it works well.

## Actionable Takeaways
1. Order training material by difficulty before training: count proof steps per theorem, bucket each repository into easy, medium and difficult, and sort repositories by their easy count.
2. For each new stage, retrain the retrieval component for one epoch on the latest model rather than training on the new material alone, to balance stability and plasticity.
3. Write every newly verified proof back into the shared database so later stages can use it as premises.
4. When compute is limited, prefer step-by-step tree search with timeouts over generating complete proofs at once.
5. Start with a small model you can run yourself; Adarsh suggests that newer small open models may now outperform ByT5.

## Notable Quotes
> "If you have too much stability, your model will actually freeze." — Adarsh

> "Mathematics is inherently very cumulative and additive." — Adarsh

> "we were able to prove 155 new formal proofs in 23 areas" — Adarsh

> "I still think this tree search approach, where we go step by step, remains quite useful." — Adarsh

---

*Related: `@content/youtube/yc-root-access/improving-small-language-model-reasoning-with-a-search` · `@content/youtube/latent-space/why-transformers-hit-a-wall-the-moment-physics-shows-up-anima-anandkumar-caltech` · `@content/youtube/sequoia/rich-sutton-and-khurram-javed-why-ai-models-stop-learning-and-how-to-start-it-again` · `@content/youtube/latent-space/scaling-past-informal-ai`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*