YC Root AccessLeanAgent: Lifelong Learning for Formal Theorem Proving
EVERY SPOKEN WORD
5 min read · 1,403 words- 0:00 – 0:07
Intro
- AGAnkit Gupta
[upbeat music]
- 0:07 – 0:14
LeanAgent in one sentence: lifelong learning for formal theorem proving
- AGAnkit Gupta
We're here at YCML. I'm here with Adarsh, who's gonna present his work on formal theorem proving that he presented on ICLR last year. Adarsh, tell us what you worked on.
- 0:14 – 0:45
Stability vs. plasticity: the core trade-off in continual learning
- AKAdarsh Kumarappan
Yeah, so this is LeanAgent. It's a lifelong learning framework for formal theorem proving, and this is work I did when I was at Caltech. So one of the hardest problems right now in AI is the continual or lifelong learning problem. How do you learn new things without forgetting what came previously? And so it's kind of two sides of the coin here. So if you have excessive stability, then your model is effectively frozen, it's not able to learn new things.
- AGAnkit Gupta
Yep.
- AKAdarsh Kumarappan
Or if it's too plastic, it's learning so fast that it's for- completely forgetting what came before.
- AGAnkit Gupta
Yeah.
- 0:45 – 1:33
Why formal math is an ideal stress test (and what ‘backward transfer’ means)
- AKAdarsh Kumarappan
So the key to lifelong learning is to be in the sweet spot in between, and for this we chose the domain of formal math because it's one of the hardest places where you can do this. Math is inherently very cumulative and additive. You have to learn algebra before you do calculus and analysis, and so that's why we chose this domain.
- AGAnkit Gupta
You know, I don't necessarily think of math intuitively as a domain in which any amount of forgetting is necessarily useful. Like, what's the intuition behind why, why you would put math kind of in the center of these two things?
- AKAdarsh Kumarappan
Yeah. So sometimes what you have is that your very early premises are actually subsumed by later intuitions that you can gain, and as kind of a little teaser to, to later, this is called backwards transfers. As you learn new things, you actually already improve what you learned previously.
- AGAnkit Gupta
Yeah.
- AKAdarsh Kumarappan
So that's why you can have this sort of trade-off here.
- AGAnkit Gupta
Makes sense. Cool.
- 1:33 – 2:03
Lean basics: proofs as code, tactics, premises, and goals
- AKAdarsh Kumarappan
So I mentioned formal math, and the reason behind this is that we're using this language called Lean. So it's a programming language where you code your proof and the compiler checks that your proof is correct. So as an example, I'm in VS Code here. I've written out my theorem in a code, and what we have on the right is we see a lot of hypotheses and my current goal, and we want this goal to say, "No goals left," and we do this by writing line by line of this format. So here exact is what's called a tactic. A tactic is a function
- 2:03 – 2:34
The bottleneck: retrieving the right premises in an ever-growing math library
- AKAdarsh Kumarappan
call, and the argument is what's called a premise, and premises are just anything that's previously proven, so any theorems or definitions or lemmas or such. And as you can tell, there are so many premises in math that one of the hardest problems is how do you retrieve the relevant premises at each step of the proof? So that's one of the core challenges, and it's hard especially in math because within math everything is connected. And so as everything is connected and as it grows, as people keep adding new theorems, how do we know over time how
- 2:34 – 3:10
Agentic pipeline overview: scrape repos and build an easy-to-hard curriculum
- AKAdarsh Kumarappan
to retrieve but also not forget previous theorems? So that's the goal of LeanAgent. So it's a lot going on here. I'll cover at a high level. So it's effectively a agentic loop. It starts off by scraping GitHub and finding different Lean repositories, because Lean is just code, and then it needs to figure out the curriculum, the easy to hard of all the repos because you need to learn the foundational math before the more difficult math.
- AGAnkit Gupta
Oh, interesting. So it, it literally continually ... It's, you know, a continual learning agent in that you are giving it iteratively harder math to build up its premises.
- 3:10 – 3:40
How LeanAgent measures difficulty and sorts repositories
- AKAdarsh Kumarappan
Exactly. The same way that we would do as humans. And the way that we do this is that, as I showed you, we have these line by line of different steps and so the complexity of a theorem is E to the number of proof steps. We do this for all the theorems and repos, then for each repo we have a distribution of easy, medium, and hard, and we sort the repos to descending number of easy theorems. Once you have that, that curriculum goes into your dynamic database, so that is sort of the brain of LeanAgent. It stores all the theorems, all the premises, all the proofs, all those things. And
- 3:40 – 4:10
Dynamic database + one-epoch updates: the ‘brain’ that balances forgetting and learning
- AKAdarsh Kumarappan
then now you have to learn. So we take the latest retriever, so this is the one that has the most knowledge, and we actually just train it for one epoch. Pretty simple, and that's the best way to balance stability and plasticity. So you're learning the new premises without forgetting the previous ones. That gives you a new retriever, and then you do your best first tree search for your proving. So you have this new retriever, you retrieve premises. That goes into your tactic generator to generate different nodes of the tree, and then you do your tree search. You can do backtracking,
- 4:10 – 4:21
Proving loop: retrieval → tactic generation → best-first tree search → add new proofs
- AKAdarsh Kumarappan
timeout, all those things, and if you have a new proof which is generated, that goes back into your database. So over time, LeanAgent is getting better and stronger the same way that humans would.
- 4:21 – 4:37
What “train for one epoch” means in practice for Lean code corpora
- AGAnkit Gupta
All of this is just code, and so when you say train for one epoch, you basically mean one pass through your code repository is given to this LLM-
- AKAdarsh Kumarappan
Yeah
- AGAnkit Gupta
... that is getting updated with that code.
- AKAdarsh Kumarappan
Exactly.
- AGAnkit Gupta
Cool.
- 4:37 – 5:28
Results and the emergent benefit: backward transfer across domains
- AKAdarsh Kumarappan
Yeah. So after doing all of this, we were able to prove 155 new formal proofs across 23 domains. Uh, some of them are Ter- Ter- Terence Tao's domains as well, so he had some combinatorics domains and such. And as I mentioned, the original motivation was lifelong learning, and what we actually also noticed in addition to that was, as I mentioned, backwards transfer. So as you learn you actually do better on previous domains. So if I learn algebra and then topology, now I'm better at algebra. That's a cool emergent ability from this framework. And so to summarize, we are the first lifelong learning or continual learning framework for formal theorem proving. We were able to learn without forgetting and have backwards transfer, proved a lot of theorems across different repositories, and we learned from basic to advanced concepts, and the QR code for the paper is right here.
- AGAnkit Gupta
Cool. Yeah. My, my final thought for you is, you know, this paper was from ICLR last year.
- AKAdarsh Kumarappan
Yes.
- 5:28 – 6:49
Looking forward: stronger base models, small-model practicality, and search vs. RL
- AGAnkit Gupta
Since then there's been a lot of work in people using the latest coding agents for math. I'm curious how you see ... You know, if you were to start and embark on this type of thing today, are there new emerging capabilities of the base models that would mean that you would approach this very differently versus this kind of like iterative build-up approach? Like, does that, is that still relevant even with today's best models, or is there, like, a new version of that that you would do today?
- AKAdarsh Kumarappan
It's a good question. So I think there's sort of a debate right now to what extent Lean itself is useful. Some people think that for specific domains it's more useful than others. I think what I've seen is we've seen a lot of open source models get very, very strong at writing Lean, and so the models that we use here are what's called Byte5, B-Y-T-5, from Google.
- AGAnkit Gupta
Yeah.
- AKAdarsh Kumarappan
But probably putting a Kimmy or something else on there would be much better. I didn't mention this, but our models are pretty small on purpose so that people like Terence Tao can just run it themselves, but now we have lots of, like, Gemma and other small models, so that would be a good approach. I still feel like this tree search approach where we go step by step is still quite useful. You can also just generate it all at once and maybe do some test time RL. Those work, but it's very computationally expensive. We've taken sort of an alpha evolve type approach where you can just search and not do RL and still get some great results. So I think that there's some distinctions that could be made in different fields, but within math it seems like a lot of things work.
- AGAnkit Gupta
Cool. Thanks so much, man. This was great.
- AKAdarsh Kumarappan
Thank you.
- AGAnkit Gupta
Appreciate it.
Episode duration: 6:50
Install uListen for AI-powered chat & search across the full episode — Get Full Transcript
Transcript of episode ca8IURq5QP8