Skip to content
Eric Jang – Building AlphaGo from scratch episode artwork

May 15, 2026 2 hr 37 min

Eric Jang – Building AlphaGo from scratch

from Dwarkesh Podcast Hosted by Dwarkesh Patel

Eric Jang walks through how to build AlphaGo from scratch, but with modern AI tools. Sometimes you understand the future better by stepping backward. AlphaGo is still the cleanest worked example of the primitives of intelligence: search, learning from experience, and self-play. You have to go back to 2017 to get insight into how the more general AIs of the future might learn. Once he explained how AlphaGo works, it gave us the context to have a discussion about how RL works in LLMs and how it could work better – naive policy gradient RL has to figure out which of the 100k+ tokens in your trajectory actually got you the right answer, while AlphaGo’s MCTS suggests a strictly better action every single move, giving you a training target that sidesteps the credit assignment problem. The way humans learn is surely closer to the second. Eric also kickstarted an Autoresearch loop on his project. And it was very interesting to discuss which parts of AI research LLMs can already automate pretty well (implementing and running experiments, optimizing hyperparameters) and which they still struggle with (choosing the right question to investigate next, escaping research dead ends). Informative to all the recent discussion about when we should expect an intelligence explosion, and what it would look like from the inside. Watch on YouTube. Read the transcript. And check out the flashcards I wrote to retain the insights. Sponsors * Cursor‘s agent SDK let me build a pipeline to generate flashcards for this episode. For each card, I had an agent read the transcript, ingest blackboard screenshots, generate an SVG visual, and run everything through a critic. A durable agent is much better at this kind of work than a chain of LLM calls, and Cursor’s SDK made it easy. Check out the cards at flashcards.dwarkesh.com and get started with the SDK at cursor.com/dwarkesh * Jane Street gave me a real deep-dive tour of one of their datacenters. I got to ask a bunch of questions to Ron Minsky, who co-leads Jane Street’s tech group, and Dan Pontecorvo, who runs Jane Street’s physical engineering team. They were willing to literally pull up the floorboards and take out racks to explain how everything works. Check out the full tour at janestreet.com/dwarkesh Timestamps (00:00:00) – Basics of Go (00:08:17) – Monte Carlo Tree Search (00:32:04) – What the neural network does (01:00:33) – Self-play (01:25:38) – Alternative RL approaches (01:45:47) – Why doesn't MCTS work for LLMs (02:01:09) – Off-policy training (02:12:02) – RL is even more information inefficient than you thought (02:22:16) – Automated AI researchers This is a public episode. If you would like to discuss this with other subscribers or get access to bonus episodes, visit www.dwarkesh.com

Episode details come from the podcast's RSS feed.

Embed this episode

Ready to play

Eric Jang – Building AlphaGo from scratch

0:00 2:37:29
of matches

Transcript Auto-generated, may contain errors

Today, I'm here with Eric Zhang, who was most recently vice president of AI at OneX Technologies, before that senior research scientist at what is now Google D-Mind Robotics. And you've been on Subatico for the last few months. One of the things you've been doing is rebuilding and improving and hacking on AlphaGo. And so what we're going to do is you're going to explain building AlphaGo from scratch and what it tells us about the future of AI research and development. But before we get to that, why is AlphaGo interesting? Why is this the project you decided to do on Subatico rather than just staying out at the beach?

Sure, yeah. I like making things and AlphaGo and Go AI is one of those things that really got me when I saw the early breakthroughs on AlphaGo in 2014, 2015, 2016, and so forth. It was just profound to see how smart AI systems could become and the computational complexity class that they could tackle with Deep Learning. This is a problem that has long been understood to be kind of intractable for a search, and yet it was solved through Deep Learning. So that was quite mysterious to me, and I always wanted to understand that phenomenon a little bit better. My training is often in deep neural nets for robotics,

where the decisions made by the neural networks are a bit more intuitive, but AlphaGo is a sort of problem where the decisions are actually the result of a very, very deep search. And it's always been very mysterious to me how a 10 layer network can sort of amortize the simulation of something so deep in the game tree. So if you plot out how much compute it took to build various iterations of strong go-bots over the years, you can see that in 2020 there was an open source project called Kaggo by David Wu from Jane Street, who basically achieved a 40x reduction in computing to train a really strong go-bot, a tablet, or a browser. I'm not certain that it's stronger than AlphaGo Zero or AlphaGo Zero, but it's very, very strong. And this is what most go-practitioners today train against when they're playing an AI. And thanks to LM coding, what took a whole team of research scientists

that defined and millions of dollars of research on computer can now be done for $5,000 of rented computer. By the way, if you're listening to this on an audio platform, this is a Blackboard lecture, so I highly recommend switching over to a video platform like YouTube if you can to look at the math and the graphs and the go-board. Okay, I guess we should first discuss how it works. Great. So how does the game work? So the game of code is a very simple one that can be implemented

quickly and easily on a computer. The objective of the game is basically to put down black and white stones and try to occupy as much territory in the game as possible. So I might start by putting down a black stone. Black always goes first. So the way you capture and upon stones is that for every intersection, if you can surround all four of its neighbors with your stones, then this one is sort of cut off from oxygen, if you will, and then it is a dead stone. So now

I control these four stones as well as this empty intersection here. So there's slight variations between Chinese, Japanese, and what is called Trump-Taylor rules. Trump-Taylor rules are designed to be completely unambiguous for go, so this is what all go-AIs train against and resolve against. So in typical go, like when that humans play, you're not allowed to put this white stone down. It would be instant suicide. In Trump-Taylor, it's actually fine. You put it down and it immediately

resolves to death. So the outcome is sort of the same. Let's go ahead and start over and play a few stones on the left. So I'll just start there. I'm basically playing randomly here, but I'm trying to get around your stones and see if I can... So this move basically exposes one empty neighbor

for your white stone and it's very akin to a check in chess where if you don't respond immediately by putting one here, then I can immediately capture it. It is sort of the diagonal, is that determined whether you're going to do it. The cross-section, not the diagon. So this one is surrounded on three sides. So you're at the threat of losing that stone and you don't play one immediately down.

Now you can see that I'm starting to pressure you because by putting a stone here, now you are forced to put one here. Otherwise you would have this two block to yourself. And then if you think through like what happens if you were to respond here, you can probably search into the future and deduce what I'll do in response once you get there. You're a lot of confidence in my abilities, but I'm guessing you put the black here. That's right. And then I would capture all three of the stones.

So I just assume that this is gone. This block is gone. Yes. So in go, it's actually okay to let opponent capture some stones. If, for example, it allows you to position to capture more stones in somewhere else on the board. And this is what makes go a very beautiful game is that you can kind of

lose the battle to win the world. And as the board size increases, the complexity of these micro-overs macro dynamics gets more interesting. So now I would capture this entire group. Okay. There's one more case that I want to demonstrate, which I had a bug in my code recently, which is the following situation. So let's consider a formation like this. And then we have other

pieces on the board in play or whatever. And so let's talk a little bit about how the game ends. In this territory, who controls these areas? Is it white or is it black? White. It's actually black because I am actually surrounded this whole area. And it's very,

assuming I have other black stones here, it's actually very hard for you to break this out of the control of this stuff. So when the final score is tallied, would these ones also count as being a... Yeah, great question. So this is where different rulesets have different ways of scoring. And so we should talk a little bit about how you resolve scores between humans and how you resolve scores between a computer computer. Because there's actually some ambiguity in how humans evaluate this.

So most humans would look at this board configuration and conclude that black is kind of totally surrounded white. And so white has no chance of life. We could play out more here, but then at the end, I would capture everything. However, if you have a way of breaking this formation and connecting white to something outside of it, then it can flip. And so this is where it's a little bit hard for a computer to decide these kind of things. So how do humans do it? It's worth thinking a little bit

about how humans resolve this because this will actually map later to how we think about the deep neural network. Humans basically say, I think the game is done. And then you have to also say, I think the game is done. And then we'll say, I think these are my stones. And then you have to agree. If you don't agree, then we can point. So essentially, once two humans, their so-called

value function agree on a consensus, then the Chinese rules result that. Interesting. So in Trump, Taylor scoring, it's perfectly unambiguous. So it can be decided, you know, algorithmically by computer. So if let's say you have this at the end game, the way you score this is that you first count how many stones you control. And that's unambiguous.

Then you count how many empty intersections that are not touched by your opponent's stones. So these intersections would not count for either player because both of all of these intersections are connected to both white stones and black stones. If this were like this, then white would get three points. Now, this is a little odd because a human would know that white is actually losing these points. But Trump, Taylor scoring would consider white to have all of these points as well as these points. So that is a very big difference in how computer

go scores things and how humans score things. How does the game end? The game ends when either a player chooses to resign or both players pass consecutively. So that's the rules. Nice. All right. Now I hope you correct this with AI.

Great. Let's understand how AlphaGo actually works and how so many of the audience might be able to implement it. Great. Yeah. Let's start with kind of an intuition about the underlying, you know, search process used to make moves. And we'll layer on ideas from deep learning to make

it much more efficient and practical. So go is a game where there's just two players. We're going to draw a person here and we're going to draw an AI here. And let's say this person is playing black. So they go first. So we're going to draw here.

And then now the AI is going to make a move based on what it sees here. So there's a question of like how you encode these inputs into the AI. Maybe you can use ones and zeros, but you want to represent, you know, black, white and empty. So you need at least three different values here. Right. So maybe you can use zero ones and two or something. So the AI might see something like,

you know, zero, zero, zero, zero. So this is the input to the AI on its turn. So the AI can choose, let's just pick three possible random moves that can go and I just drew these random. And so which move is best here? Right. Well, we don't know until the game ends. There's no,

Go does not have any kind of local reward of which move here is good. And this is what makes go a very difficult game is that you don't actually know who won until you really get to the end of the game. So how deep is this street? Right. Well, in a 19 by 19 go board, there are roughly to the order of 361 moves on any given move. And of course, as it fills up, you have less moves.

And the number of steps in the game can be somewhere from 250 to 300 moves and maybe experts might decide to end the game well before that. But under Trump, Taylor scoring, you actually have to play things all the way to the end. So this could be like 300 moves or something. Right. So like 300 like depth of the tree. So if you keep on expanding possible moves here, in this move, the AI is

going and then here the human would go. And then, you know, there's there's some and so forth. You can find that like essentially what you end up with is an enormous explosion in the possible game outcomes originating from just this one state. So this is something to the order of like, you know, 361 to 300 power 300, which is far more than the number of atoms in the universe. Like it's just, it's just, of course, actually there are redundancies and symmetries. So it's not

actually 300, but but that's sort of the, if you were to do a naive tree where there were no merging of children, then actually you end up with a tree about this big. What do you mean by merging of children? Right. Let me use this border. So if we start here, and then you play here, and then I play here, and then you play here, that is equivalent to I start here, you play here, I play here. Yeah. And then you play here. Right. So both of them arrive at the same spot,

but through different paths. So this child node can be thought about as a shared. And I guess it's not 360. It starts at 360 one, but it decreases by one each time. And the branching factor decreases by one each. But in any case, this is a very, very, very large

tree. And this is also why, you know, computer scientists for many years thought that Go was not a tractable problem this century, because the amount of compute you would need to exhaustively search every possible possibility is just too large. If you could, Go is actually determined as to game. So on any given state, you can actually compute what the best possible strategy you can, you can make is in order to win the game. You can search all the possible futures where you win, and then just make sure you always stay in that set of futures. So AlphaGo's kind of core conceptual

breakthrough was using neural nets to make this search problem tractable. So before we get into, you know, how neural networks are involved, let's talk a little bit about how we can, you know, assuming we have a powerful enough computer, search this tree to find the best move. So in the beginning, you're not going to build out the whole tree, because throwing that tree would be very expensive. Instead, you might do something like interactively figure out which leaves of this tree are worthy of exploring and expanding into the future to see, you know, what else is there. So there's some early algorithms in banded literature, like, you know, UCB-1, which is not exactly appropriate for, you know, sequential game like Go, but very much inspired the action selection algorithm used in AlphaGo. So UCB-1 looks like on every move, we're going to take the best action, or, you know,

the argmax over A that maximizes, you know, the Q of A, and I'll explain what Q of A is at a moment, plus some sort of exploration bonus. So on every node, we're going to track a few quantities. So let's, you know, consider each of these a node. This is the root node, where you're making decisions from. And these are the children of the root node. And we're going to say each node

is basically a data structure that is, it stores a visit count of this, this node, this child node. How often appear and visited this node? Yes. And we'll call this an action. So one thing that is easy to trip on is like, if you come from robotics or other kinds of reinforcement learning is like, where are the actions, right? I'm only talking about nodes. Nodes here represent states. And because

this is a perfectly deterministic game with no randomness, you can actually just infer the action based on the child. So if I go here, that implies an action. And this is the state that we resolve. So the LMS, if you ask to, you know, vibe code a MCTS implementation, it'll most likely design the right data structure here. But, you know, it's sort of a chef's choice. You can

actually rewrite the tree structure however you like. This was what Claude 4.6 wrote for me when I asked it. And it was a very reasonable choice. So, so then, you know, Q represents the mean action value of this action. And I'll use a subscript a to denote that this kind of corresponds to taking a specific action to get here, right? From the root node. So, so like, if we have root, basically taking a

gets us to this node here. And then we're going to also store the probability of taking this action. Again, from the parent. From the parent. Yes. Like, what are the odds that we sampled this one? And

this will become relevant later. You know, like, we talked about it to turn this to tree for now, so I'll bring probabilities into this later. And then finally, we have a sort of dictionary of children, which is just like, you know, more of these, you know, sort of classic linked list style reference tree. So, this is the basic data structure to implement a tree. And in AlphaGo, they use a slightly different action selection criteria called PUCKT. And it's short for predicted

upper confidence with trees. And this is basically when you select which child to take, you do argmax A of Q of S A plus constant. So, the equation forms are actually pretty similar. These are both scoring criteria, right? Like, you want to argmax this quantity and you want to argmax this quantity to determine which action to take. So, let's break down the intuition of like, how you select

actions here. This is the mean action value. So, how good is a given child on average? And if you actually, you know, knew the whole tree, then this is all you need, right? Just like the best action.

You don't really need to do more than that. But if you're interactively building this tree as you're figuring out what the Q values should be, then what you have to do is occasionally try some other actions, you know, as a sort of explorer versus exploit tradeoff. So, in both UCB and PUCKT, there's this term here that basically rewards taking actions that you haven't taken before. So, as we mentioned before, each node stores the visit count of taking that specific action, right? So, everything is initialized to zero. And so, for a given action, let's just say, like, action A, initially it's zero. And so, as

N is increasing, if, let's say, we've already made 10 action selections from that root node, but we haven't picked A yet, then this term actually starts to become quite large for A, right? And conversely, if we have chosen A 10 times out of 10, then now this term is quite small. It's administered very quickly. And the same thing is actually true here. Just to make sure I'm understanding it. Maybe I can put it in my own words. Legislative focus on UCB. What we're saying here,

you can think of it as such as two different things, the queue and then this exploration term. Yeah. Let's just be clear about what queue is. queue is basically saying, hey, once we do these rollouts, so you're actually running all these simulations, you go down the tree, and then you figure out, okay, if I end up at the terminal value of this tree, do I win this game or not? And then you do this average, whether I win this game or not, across all the, you know, the leaves of this tree, from starting from this node, that average, you're putting queue. And so, you're saying,

the queue is representing, will I win this game or not? What is probably the way I'll win this game starting this node? That's your sort of, that is your sort of exploit that is like saying, I've run these simulations, I think this is a good move or not. And then this other term is saying, have I explored this branch enough yet relative to the other actions I could be exploring? Or I have already explored, if I haven't explored this branch yet, you know, maybe I think it has a low score, but I just haven't explored that many branches, leaves down this node in this tree. So I should

maybe like, try this, even though the queue, this sort of exploit is telling you that this is not that valuable. And so, because LN of N grows slower than N, basically as over time, you will move from the argmax being dominated by this exploration term, which is the second term here, to the argmax being dominated by the queue term, which is like, okay, I've got enough simulations, I'm quite confident that this is the branch to go down. So the motivation for UCB was to come up with an algorithm where if you don't know the payoff of the arms, the different actions you can select to begin with, this strategy, basically with given some exploration term here, bounds your regret, in terms of how wrong you can possibly be. I don't know the proof. I don't also know if this one is proved to have a logarithmically or like, you know, swear root bounded regret or anything, but I think the algorithm was just derived to look something like this. And you can tell that these terms are

a little bit differently. And this is actually just to account for the fact that go has many more actions in every move compared to your standard bounded problem. So one small clarification to make is that you talked a little about simulations on probabilities and forth. We should remember that go fundamentally is a deterministic game. So the notion of like, where does the notion of probability come from here, right? If you had a very powerful computer, there is no probabilities. You just,

you can just compute the true average of what the mean action value is. So where does the probability come in? Well, it turns out that, as in, you know, computer go before AlphaGo, we've always done some sort of Monte Carlo method where we have some, we take the expected queue value averaged over a randomly selected tree. And at randomly selected tree is where probabilities come in. So the interpretation of queue is what is the expected action value under the, under the random distribution induced by some random search process? And so where does the random search process come in? That's where, you know,

p of action comes in. So if we assume a very naive algorithm where you have a uniform probability of taking any valid action, then this would just be one over, you know, the number of valid moves in, in the, in the setup. And you would be kind of taking this average over this very diffuse tree, right? And this is, this is a valid interval you can take, but it's very slow because you're going to consider a lot of trees that have very low value. And it's essentially almost like an important sampling problem where you want to, there's only a few actions and sort of a path that can contribute, you know, high value and almost everything else is low value. So, so this is

sort of a tricky problem here. Okay. So this is the action selection criteria for how you decide which moves to move down. Now, as you move down in in tree search, you will eventually run into a node where it's quite clear you've won or lost, right? At the very, very end of the game when there are no valid moves to play left under, under Trump Taylor scoring, you can decide whether you like, you know, won or lost, right? So you either win or you lost. And so this is basically, you know,

the, the final return of the whole game. Right. And so the, the question here is like we can assign a, a value you to a terminal leaf node of the tree, but how do we assign the values for nodes prior to the parents? And it turns out, you know, what you simply do is you just take the, your mean action value is essentially your average. So let's suppose these were leaf nodes. Sorry,

these were all leaf nodes. The, the mean action value of this node, you know, this action here is just the average of whether you want or lost at the leaf nodes. And correspondingly, you can kind of walk up the chain and say like, well, the mean action value of this node, let's call this like QB and this is action B is just the average of a weighted average of these ones here. Yeah. Right. And, and the weighted average is, it could be dependent on if you have a different

sampling distribution or not, but the basic intuition is that you want to resolve the game where you have a deterministic winner lose, and then you can kind of go backwards. This is called backup and assign values to these, these, these nodes or actions corresponding to the average over, over the final term. Okay. So if you were to do this without neural networks, it would still be intractable, which you would have trouble finding, you know, which actions to sample a lot of the actions would contribute very low value, especially if you're like, you know, trying to fight your way out of a losing position, and only a few actions give you high value. So the searching practice is still very, very expensive. But, but the, the idea is that like if you can, because go follows a tree

structure, you can actually, you know, inform a very good estimate of the value of this node based on the values of downstream, assuming they're all correct and assuming you've searched even. Your explanation earlier about the, um, the sorts of states where it's obviously human who's going to win, but it's not obvious to, or like your deterministic leaves a lot of play it out. Actually drove on the intuition of why the value function both is trainable and to why it's necessary in order to actually be able to learn this game effectively. And then each word defining value in the first place. But yeah. So we talked about, you know, this U value being, you know,

your final resolution of whether you want to loss, and this is the terminal leaf in a condition. Now, humans don't play all the way to the sort of edges of the, the leaves of the tree. Right. They kind of stop, you know, some dozens of moves before, maybe even hundreds of moves before in sort of high level play. So how do they know, right? Like you can think about humans as

implicitly having a neural network called a value function that basically, you know, takes in a board state and then it kind of evaluates, you know, he went. And so the human glances at the board and they know like I'm probably gonna lose, right? And they're essentially running a neural network that looks at a board and implicitly they are amortizing a huge number of possible game playouts and taking that average and then deciding whether the board is winnable or not, and then whether they should concede or, you know, keep playing. And this is remarkable. If you think about like the, the beauty of something like this, it's like a neural network in a, in a human can somehow do all of the simulation at a glance and then just know like within a few seconds without actually playing every single game logically based on just kind of like crystallized knowledge and experience that like they can do this. And so this gives us a hint that like in games like Go,

there are ways to basically radically speed up the search process. And this is one of the fundamental intuitions behind why AlphaGo works is that you can train a value function to look at a board and quickly resolves the game without playing out all of these trees into the, you know, into a very deep search depth. Yep, makes sense. I will say for the audience, I sort of found four previous episodes when I was prepping and seeing somewhat relevant to understand how AlphaGo works, I was very, very confusing. And, but it's the kind of thing where once you understand the problem in this way and then you'll build up an excuse, it is actually much more understandable and it will make a lot of sense. And it's okay to be confused right now, but it's probably simpler

to understand by getting this lecture than you anticipate. So I'll just make that note for the audience. Yeah, the important intuition at a high level just doing a little stuff about where we're going with all this is that classically for games like Go, you could build a tree, but we don't have computers powerful enough for that. And estimating the value of every action that you could possibly take is also hard because you don't know until the end of the game. You could take averages by playing them to the end, but that's also hard because you don't know which actions to take to sample these averages. So conceptually, there's kind of two problems. There's the breadth of the tree,

and then there's the depth of the tree. And AlphaGo gives us a way to basically shrink both of those to be very attractive. That's essentially the kind of core idea of it. Okay, so we take this idea that humans can glance at a board and instantly predict whether we win. And maybe that gives us the opportunity to really truncate how deeply we search.

And then we also know that humans can look at a board and decide what boards intuitively at a glance what moves might be good on a board. So these are kind of two things that we can use deep neural networks for to accelerate this search process. Let's go back before we talk to one of you. Let's just go back to how this play out works. We've only talked about making one move. So the

AI looks at this encoded go board. It searches for deeply into the tree to find out which of its action is the best. And then it takes that action. And then it goes back to the human. So maybe the human sees a go board that looks like this. And then they make their move. So maybe they put their

stone here. And then now we go back to the AI, which now looks at a new encoded board. I used two to denote the AI's playing as white and one to denote the human playing as black and zero is empty. And then now on the AI's turn, it does the MCTS tree search all over again from scratch. So if it throws away this old tree that is searched last round, and now there's a new root node and it begins to search a new. And then so and so forth. So MCTS is basically, you can think about it like a search

algorithm that is deciding what moves to play best aided by neural networks. And it's done on every move. Okay, great. So let's talk about the neural network part. And while you're racing, another sort of thing that was important for me to understand was this MCTS data structure with nodes and children's of nodes and whatever, this is done per move and reinstanciated once a move is made. So if human makes a move, then the AI looks at this and is trying to

basically run a bunch of simulations to figure out, okay, what should I make next? And those simulations, simulations basically like exploring one more node in this MCTS tree. And at the end, once all these once all these run thousands of simulations, that informs then this, I guess as you will explain this probability of what move to make next, that's what you store, you choose the best move given the sorbabilities, you discard all of that, then the next player makes a move, and you restart this process at the beginning of every move. Correct. One small addendum, you don't discard all of that, you keep one thing behind that we'll use later. Just like I did for Reiner, I wanted to make flashcards for this episode so that people

could retain these concepts. And ideally, an LLM can generate some candidates for me to then refine, but to actually get high quality suggestions, I needed to design a whole pipeline where the AI could take in and just screenshots of the blackboard at the right timestamps and then make SVG diagrams in case visuals were helpful, and then run the writing and drawing through a critic, and then revise the card in response to the feedback. It's very hard to accomplish this just by sacking LLM calls. The sort of step-by-step recipe works much better if you have a durable agent that's been engaging with the task across all the previous ages. So I use the cursor SDK to spin up an agent for each card. The cursor card and it saved me a bunch of work in designing some custom

context scaffold or figuring out how to design tool calls for taking screenshots or making animations. These agents all run in the cloud, so I don't have to worry about leaving my laptop up. I just get an email when I have candidates to review. You can check out my cards at flashcards.org cash.com and start building with the agents SDK at cursor.com slash work cash. Okay, so now we have a basic intuition of how it moves our made with search. We're going to talk about how neural networks

can speed this up by providing an analog to like the human intuition. So there's two networks. There is the value network, which takes in a state and it predicts, you know, am I going to win or lose? It's a binary classification problem. Then we're going to have a policy network, which induces a distribution over good actions to take. So I'm going to draw a one dimensional flattened

move distribution, but this is really like, you know, a square kind of grid, right? So maybe like if things actions are like, these are the kind of probability distribution over good actions. And both of these are categorical classification problems, right? So you can train this like any classifier in deep learning, you know, cross entropy, loss, that kind of stuff. So the specific architecture does not actually matter too much. I tried a few different architectures, transformers work,

resness work for small data regimes, my experience is that resness still kind of outperformed transformers and kind of give you more bang for the bug at lower budgets, but this may not be true. Why is that? They provide the inductive bias of like local convolutions and generally transformers start to outperform residual convolution networks when you want more global context. So one interesting finding from the Kotago paper was that they found it actually quite useful to pool together global features together and aggregate global features like throughout the network to kind of give the network a global sense of how to like connect value from one side of the board to another side of the board. But what does it mean to aggregate global features? Yeah. So if you have a very large 19 by 19

go board and you know, you've got some some sort of battles going on here and you got some battles going on here, when you pass this through a convolutional network, the receptive fields of the convolutional network are going to be good at computing local things and making that invariant. But they won't be able to kind of connect these two features easily, right? They need to sort of be pool together and attend to each other somehow. So the argument about, you know, why transformers are good for computer vision tasks like with, you know, vision transformers and so forth is that because they have a sort of global attention across the whole thing, they can more easily draw these connections. But you do need more data there so that you can kind of learn through data the sort of invariant local features. I've tried very hard to make transformers work for this problem

because I was kind of curious if transformers would present some sort of breakthrough and go and just move a lot of those tricks. But to try as I might actually have to figure out a way to make transformers better than residents for a different frame. So one more tangential question. It makes sense why it turns forward in members with their like global pooling information would be better if you need to consider information that is not just spatially, or yeah, CNN's give you a sort of bias things are next to you are especially relevant. And then they're sort of aggregated up. Yeah, exactly.

Yes. But suppose, okay, so for games where it isn't that relevant, what is happening locally just kind of consider the whole thing. You're saying transformers work better. How about games where, so they're talking about spatial dimension. How about the temporal dimension where right now we're only considering the previous move because it is a deterministic full information game where, but what if it was something like poker or diplomacy where really a bluff they made a while back is sort of relevant to understanding now and isolating to decide to make your next move and consider all those previous states with that then change the consideration of what inductive bias is most relevant to architecture. Right. Great question. So Go is a perfect information

game. And in perfect information games, there does exist a national equilibrium strategy for which you can do no worse than any other strategy. So if you know that your opponent has a particular bias, like they they love to play aggressively, you can actually principle counter that specific strategy better than a national equilibrium policy. But to counter any given strategy, there does exist a single national equilibrium that can be decided solely using the current state. So that is a design choice that most Go agents AlphaGo chose to do, which in hindsight turned out to work very well because the Nash equilibrium seems to be superhuman, like no human strategy seems to be able to be. Now there are variations of this where you would actually need to consider temporal

history. So and this is a very exciting research area that I would encourage people to kind of fork my repo and try these things out, which is if you were to play let's say 2v2Go, then you actually need to model your partner's behavior and you may not have information on how they play. So you need to aggregate some information on how they play so that you can respond accordingly. Right. Like these are situations where it's no longer a perfect information game. And then in

those cases, in terms of imperfect information or partial observability, then you do need some context to build them all. And I think that's a place where things get very, very exciting in terms of like self play or diplomacy style. Okay, so returning back to the neural network, the architecture again is not super important. You can get it to work with transformers, you can get it to work with resnets. I found that for low budget experiments resnets work a little better. You can also use

kind of a Carpatty style auto research hyperparameter tuning to make your architecture pretty good. And so you don't have to worry too much about that. You just need to set up the problem so that you have a target optimization. Okay, so we're going to pick just a somewhat arbitrary architecture that worked for what I did. But again, this part is not super important. You have your encoded board state

and we're going to just choose, let's say, do three, three, like, you know, similar to RGB, we're going to have three kind of channels, one channel to include black, one channel to include white, and then, and then one channel maybe to encode like empties or maybe like a mass region if you want to train on multiple board sizes. I'm actually not going to talk about multiple board sizes for now. That's a little bit too complicated. So we'll just say like, you know, we've got this two or three channel RGB like image, and then we go into a, you know, a resnet. And then we have two branching heads, one head predicts the value function. And this is like a single

logit. So let's just say R one. And then we have the policy, which is, no, R three, 61. So this is the architecture. And we're going to basically train this to predict the outcomes of games given the board state. And we're also going to train this to predict what are good moves. So

the OG AlphaGo paper or call AlphaGo lead, initialize this network with a supervised learning data set of expert human play. Later, they remove this restriction by having the model teach itself how to play well. But I find it actually from a matter of like implementation for your audience super, nice to always kind of initialize your, your experiments to something that's easy, and then like, you know, get the problem working before, you know, trying to bite off the whole thing and learn and type the rest. You generally want to kind of initialize just as deep learning, initializations, everything, right? You always want to initialize your research project to something as close to success as possible, especially if you're doing something new that you haven't done before, like always pick something that works and then get it to do something better rather than start from something that doesn't work at all. And then, you know, try to make it work. So

under that philosophy, it's a great idea to start from something that like, you know, has good initialization. So we're going to take human expert place and train this model to predict, you know, good actions, right? So we're going to take all of the winning games, all the moves in which a human one and sorry, an expert one and then predict those actions. And then regardless of board state, like, you know, whether you want to loss, you're going to predict the outcome. So you might be wondering, like, okay, well, some of the early boards, you know, where basically only one stone has been put down, how could you possibly know whether who the winner of this game is, right?

Well, if you have, you know, hundreds of thousands of games, then on average, you'll probably see that boards that start like this have a sort of half of the games that branch off from this will win and half of the games that branch off of this will lose. So that'll actually be fine. When you train this model to predict those, the logic will sort of converge to, you know, 0.5. And so, so for these, for these things, it's sort of expected that once you train the model, a starting board state will look like 0.5. And then as you progress towards the end of the game, it'll actually look something like, you know, this is 0.5. The win probability will sort of either go like this,

or it'll, it'll go like this. And, and this is sort of your move number. And so as you, you know, get hundreds of steps into the game, it becomes much more clear, like, who's more likely to win, who's more likely to lose under your expert data distribution. I understand the significance of why the, this way of thinking about value is especially relevant to the expert data. It is not relevant to the expert data. It's true for any data that you train it on. Yeah, so if you were to

learn a tablet resume, you would also expect this to follow. So, if you just do this, like, so imagine, you know, you're vibe coding, AlphaGo, and you, you, you gather some expert data sets from like, how to go online, or you, you know, you have a data set of human players and you train this model, actually turns out this model is a pretty good go player. It'll most likely beat most human players, right? So, so like, if you just take this policy recommendation and take the argmax over, you know, it's a, if this is the, you know, probabilities, you take the argmax and just take this action as your go play, it'll be a very, very fast go player that doesn't think in terms of like reasoning steps, you just kind of shoots from the hip and it'll be a very strong go player, which is already quite miraculous if you think about like, you know, 10 neural network layers, maybe under like 3 million parameters can already do something that impressive. And so, you can start this way and it's important when implementing this to kind of just verify that this is probably true. It's good to verify that

your go rules are implemented correctly that like, you know, you can run these simulations relatively quickly and, and just, it's almost like a sort of a checkpoint that like, you want to make sure that you can actually do this basic step before you try to layer on more complex things like search. So, but yeah, we can do a lot better than taking the raw neural network and playing the moves. And this is how we can apply it to Monte Carlo research. So, let's apply the neural network to, to improve Monte Carlo research. So, we start with our root node and we now have a four step iterative process to do MCTS. So, this tripped me up when I was first reading the paper and trying

to understand it, but essentially what we're going to do is we're going to choose a number of simulations. So, like, you know, num simulations. And this number varies. This can be, you know, somewhere between 200 to 2048. I believe in, in the AlphaGo.ly match, they use tens of thousands of simulations per move because they really wanted to boost the strength of the model as much as possible.

But in training, you don't actually need too many. And CadaGo, I think, uses something on this order as well. Do you know if they used, if you watch a documentary, they had a laptop out during the game. They didn't use a laptop itself. It was like on some. It was on some TPU pod, I think. Yeah.

But now... That is kind of unfair. Well, Lee is not using like one, E22 flops to do a move, you know. Fair enough. Interestingly enough, modern Go bots don't need that much compute at test time. And we'll actually find out as we talk about how the MCTS policy

improvement works is that over time, the raw network actually takes all of the burden of that big TPU pod and just pushes it into the network. And you can do all of that work with one, you know, neural network, but the TPU pod will always add the extra move on top. And so that's what they want for the match. So we're going to pick this kind of like num simulations thing. And for every simulation, we're going to basically do several things simultaneously. We're going to see which moves are the best in the

current tree. We're going to add extra leaves to the tree if we get to a point where we need to add a leaf. And we're going to update the action values for the tree. So that's what every simulation involves these kind of like a four-step process. So the four-step process is basically selection, expansion, evaluation, and backup. So at the beginning of our Monte Carlo tree search,

our tree is very basic. It only has the root node, our current board that our AI wants to play out. And so we're going to basically select the best action for this. So when this root node is created, we also know that we can evaluate this under our neural network and get the quantities, you know, V theta, as well as our probability over actions. And I'm going to say, so for all of the actions here, we can create a bunch of children. So this one has,

well, in this case, I'm drawing a three by three board with one board missing. So basically, there are eight possible children associated with this root node. So like, and each of these has an associated probability of taking that action. So there's P8, P1, P2, etc. Okay, so at the beginning of our Monte Carlo tree search, we have a root node and we can initialize it with some children, because we know the policy network evaluated on the root node gives us on a three by three board with one existing stone place, eight possible children that this AI could take.

So with each of the children, our policy network also gives us the probability of selecting that child. So the first step is to do the selection of the tree. And again, this is a very shallow tree. All we have so far is a tree of depth one, essentially, right? So our first move is to select by maximizing or argmaxing the Pucked criteria, which is basically, you know, Q, QsA plus C Pucked times P of A divided by N over one plus N A. So for each of these, we're going to, you know, N A is zero for all the

actions initially, N is zero. And so we're going to basically just, you know, pick according to this. Initially, what is going to be the chosen action here is most likely going to be biased towards, you know, the highest likelihood action here, right? Because these are sort of uniform for every node. So let's suppose P1 was the highest probability node. So you selected this one here. Now, you got

to this node and you realize that it's not a leaf node, right? It's not a terminal game, so you cannot resolve the final resolution. So the next step that you do is expansion. So you will then run this node, this board state, through the policy network. Note that this is the AI's move, right? Like AI is making this move. And so when we expand this tree, we're now thinking

about what the human might do or any opponent might do. So this is like, you're opponent. The tree expansion process actually is completely, so when we evaluate the node here, we're going to now evaluate the node from the perspective of this player. So then this one has possible actions that we could take and we expand basically the leaf nodes here. So for each of these nodes that we could, you know, arrive at, we're going to now check how good those nodes are, right? So maybe

from here, like the human could play here, the human could play here, or the human could play here. And we're going to store essentially the v theta for each of these things. So v theta of node one, or like node one prime, v theta node one. And so we're basically using our neural network to make an intuitive guess of how good is this board from the perspective of this player. And fortunately, because it's a zero sum game, it's easy to do is that the value for this player at this step is just one minus the value for this perspective. So it's easy to flip the search process depending on

which player you're at. And so this is the expansion step. You've taken a non-leaf node and expanded it and evaluated the value. And this is essentially a quick guess as to like, if I were to play to the end, am I going to win or not? Right? So you can almost think about the v theta as a shortcut for

searching to the end of the tree for any given simulation. And then we're going, and this is essentially the evaluation step. We're evaluating the quality of each of these boards. In original AlphaGo lead, they actually did something kind of interesting, which is that they took this value and they averaged it with the value of a real Go play out. So they actually played a real game from here all the way to the end. So like, I'm just going to draw this, just quickly line to indicate some path. And

they kind of like play this all the way to the top Taylor resolution of a full board. And so this is like a zero or one. And so they took this value and they just averaged it with this one here. So the formula they did was like, Alpha times v theta of some node plus sort of like one minus Alpha of a true randomly sampled playoff. And you might be wondering like, okay, well, how do they play this out? It would be very, very costly to do another search on this playoff, almost like a tree

within a tree. So they don't do this. Instead, they just take the policy network and play it against itself. So they just take this as both players and they just play all the time. And this is something that helps ground the, the estimates here in reality, because you can get a single sample estimate of like whether you would or not, you can think about in the end game where the board is almost resolved that this one actually becomes quite useful because the random, the player according to the policy will most likely decide a pretty reasonable guess of the game. And so you're not,

you know, facing a problem where this one kind of becomes unfethered from reality. It turns out this is totally unnecessary. So in all subsequent papers after AlphaGo lead, they just got rid of this. And so in my implementation, I also did the same and it speeds things up a lot because you don't have to roll these games out on every single single. So again, just to reinforce my understanding and just to re-explain it. In case it's not obvious, the P there in the select, that is the

probability coming from the network in this case. The policy network here. Okay. So fundamentally, a simulation, interesting of it is like rolling out one more node in the search process. Almost. So a simulation is easy to think about when the whole tree already exists, right? You just

walk down the tree using the puck selection criteria and then you keep going. Now, in AlphaGo, the data structure is such that we begin with a tree that has no, like basically only depth one, which is its only children. And you want to iteratively build out the tree as you're also selecting actions down the tree. So that's the kind of core thing here is that because it goes such a common and totally complex game, you cannot afford to build the tree in advance and then search it. You must search while building the tree. So let me just

finish up with actually the last step, which is the backup. So once you've scored these things, you basically take the mean, the value, the queue value assigned to the node here for taking this action is now just the average across your evaluated values. It's you take a running mean over over all of the, the simulations that you've taken and they average the values of the children. So that's what is known as the backup step. And once you evaluate this, you can actually kind of recursively go back. So if you know the, you know, the action value of this node, you can then take the average

on its parent and so forth. So, so you have this kind of four step process where you are choosing the best action that you know of so far, then you may run into a node where you, you haven't been to before, so you need to grow the tree a bit and then you run it through the network to guess whether you're going to win or not. And then you walk all the way back up to the root node to update your values on what the best moves are. So as you do this iteratively, this selection criteria will cause you to visit the, but because you're always selecting according to this criteria, you're always going to be selecting the best action you think at any given branch. Right. So, so the

final visit counts of like how often you chose these things will reflect your correct policy distribution as induced through this search process. And so the visit count that we stored in the note earlier actually becomes the sort of vote for like which way we should finally select an action here. So, you know, as a sort of test of understanding, it's worth thinking a little bit about whether we can make this even simpler, right. Like could we actually maybe even get rid of this one and still make the thing work. So recall that, you know, when you do an expansion and then an evaluation, at let's say this node, you are checking the sort of win probability of each of the childness, right.

And so if this one is, you know, like one and these are zero, you do kind of know something about which action might be better to take. And so why would you need still need this, right? Like, why not just normalize this one into some distribution and call that your policy distribution. This is fine. You can do this. And this probably does work. But in practice, having a single forward

pass that gives you a pretty good guess is how the breadth is is is is proved out. The there is a sort of duality here. Like it would be weird if let's say the policy recommended an action that disagreed with the value, right. If let's say the policy said this was very high probability, but this one said it was a low value, then there's actually something kind of fundamentally wrong between between your policy head and your value head. So they are linked. And you probably could

get rid of this if you came up with a different way to recover this from just the value evaluations. Right. But just make sure I understand the reason you don't do that is so that you don't have to do 316 dependent for passes to like, here's a value of everything. Let's talk about it. Instead, you can just do one forward pass and get like the probabilities of all them.

You can usually batch these somewhat efficiently. So it probably is not a huge computational burden in practice. But yes, you would have to pass 361 like up to 361 boards into a single mini batch update to evaluate all the values here, then normalize them. Now, there's actually a more important reason why we still do this, which is how Monte Carlo tree search is used to feedback on and recursively improve its own predictions and search capabilities. And that's where this one, having this as an explicit entity, you're modeling rather than an implicit normalization over your value is a good idea. Okay. So we talked about the simulations and basically what you end up with

as you roll out the number of simulations is a tree that kind of looks like, I'm drawing a very low dimensional version of this, of course, it's in the real game. It's much more high dimensional. But like you'll end up with basically a tree structure that has a lot of leaves that kind of terminate and are not visited again because their value is deemed to be too low. But then along one path, there will be a set of actions with very, very high visit counts that kind of gravitate towards that one set of decisions as you increase and so this is kind of like the mental picture of what the tree in Monte Carlo tree search looks like. And you should contrast this with like an exhaustive tree like in tic-tac-toe where you could say like, you know, there's nine actions and then eight and then seven and six and it's sort of like nine factorial sized tree. The Monte Carlo tree search

and go is very, very sparse. It only considers the paths that you've expanded children nodes on. Okay. So now that we have the search algorithm that applies the value function as well as the policy function, we can now talk about how the Monte Carlo tree search algorithm can actually act as a improvement operator on top of these guys here. 20 years ago, Jane Street's data center fit in the corner of an office. Ron Minsky, who cozies the tech group there, told me about how it all got

started. One of our compute clusters we called the Hive and I remember the first version of the Hive was literally like six Dell boxes stacked on top of each other at the end of the row. And the training systems themselves, we also had there because we actually wanted the ability to make sure we could turn the damn thing off. I mean, there were ups and downs like literally at some point, you know, one of the people who was cleaning the office unplugged one of the training systems in the middle of the day as they were vacuuming. So, you know, in the end, it is in fact better to have it all in the data center. Jane Street's data centers have come a long way since six else and I got

sure one of them in Texas with Ron and Dan Ponderkorvo, who leads Jane Street's physical engineering team. You know, these cabinets, these GP 300 tablets consume at think about 140 kwe. To prepare that to traditional air cool, you're talking about 10 to 40 kw. It's a lot more. We got deep into details of one of these data centers, things that I had never considered before. It's filled with a liquid,

a mix of distilled or deionized water and propylene glycol, 25% of propylene glycol. That's to inhibit any bacteria or algae growth. I don't love the world where we have to worry about bacteria growing in our servers. I got to see way more of what actually happens in the data center than I've ever seen before. Jane Street was willing to literally pull up the floorboards and take out the racks and take me to the back where all the killers are. You can check all of this out at janestreet.com

slash store cash or be posted to full store. Okay, so we now talk about the RL part of like how this thing gets stronger by playing itself, right? Let's say we play a game where the AI, so you make a move. AI will kind of compute the search and then this is this sort of visit count distribution. Let's say this is your policy, your policy initial policy recommendation at the at the note and then after MCTS, it gets more confident about one of these actions, right? And so maybe

the distribution looks a bit more p.k like this based on the search. Now, of course, you can tune the search process so that it ends up more diffuse, but that's probably not a good idea. MCTS should get more confident about specific actions than others, but it of course might place a lot of weight on other actions initially and then as you increase the number of stems, it should converge to a very p.k distribution. So this is your new let's call this like pi, let's wrap this in like an MCTS operator of A given S, right? So after applying MCTS process, your policy recommended distribution looks like this. It's a bit more peaky than the previous one.

And so then you take the Archmax or maybe you just sample from this, it doesn't have to be Archmax and then you make a move. And then you throw away the tree and then you begin to new on the next move, right? So again, like you compute a new distribution. So initially, maybe your guess looks like this and then you refine it through MCTS. Which one you want more x on the board, right? I'm sorry, that's correct. Yes. To something that

looks like, right? So on every move, you have your initial guess from your policy network. And then the search process that combines your policy network and your value network arrives at a more confident action that you take and then so and so forth. And then the game ends, and one person wins, and one person loses. So the way that the beauty of how AlphaGo trains itself is that it actually can take this final search process, the outcome of the search process, and tell the policy network, hey, like, you know, instead of having MCTS do all this, you know, leg work to arrive here, why don't you just predict that from the get go, right? Like, why don't you like,

you know, not use this guess and just predict this and begin with. And if you have this guess to begin with in your policy network, then MCTS has to do a lot less work to get things to work. And so if we draw like a sort of test time scaling plot, so let's say, like, this is like a number of simulations, let's say, you know, at zero simulations, your sort of implicit win rate is like, is like, I don't know, here, and then, and then without any, you just take this raw action that this is your win rate, win rate is, and let's say as we increase the number of sims, maybe, maybe you kind of have a win rate that looks like this, right? So when you search for, let's say, a thousand simulation steps, that gets you to a policy here that gets you here, which is great.

But if you were to distill this MCTS policy network back into your sort of a shoot from the hip policy network, then you could actually, you know, start here, like, if let's say this was, you know, zero by by distillation, then if you spend another 1000 sim steps, then you actually kind of get to here. It's almost like if you could just, you know, amortize the first 1000 steps actually into the policy network instead of the search process, then you can begin at a much better starting point, and then get a much better result for your, for the number of sims that you put. The same work type nature of test time ceiling as the numbers and relations increases them, but the increase in win rate is smaller. Is that true even for the distilled network?

That is to say, is there some gain of like, we can we start from the distilled, we get these early gains again, or is that just inherent to like the nature of MCTS? Yeah, to be honest, I actually don't know the test time scaling behavior of MCTS simulations, and I believe it might actually be quite sensitive to how strong this one is in practice. I'm just drawing a monotonic increasing function that gets the one. So don't pay too much attention to the shape of the curve, just know that it's monotonic with respect to it. Okay, so, so the idea of MCTS is very brilliant, which is like, we're gonna, we got something better by applying search, and we're going to now on our next iteration of updating this network, just train this to approximate the outcome of a thousand steps of search. And so instead of starting here, we get to now have a

neural network here, and then, and then, you know, the play gets stronger once we then apply another thousand steps and talk to it. And you keep going, right? So, so the training algorithm for AlphaGo is to basically take the games where you've applied the search on every move at the policy encountered, whether you want or lost, and that's quite important. And you're just going to train the model to imitate the search process. So there's an analogy to robotics actually, which is the dagger algorithm. First, I'm going to draw like a schematic of like, let's say, you know, the states, right? So

S0, S1, S2, S3. So let's say, you know, we took a series of actions in an MDP to, to get a trajectory. And these actions may be suboptimal, right? Maybe we lost at the end of this game. So, there is a family of algorithms that basically take trajectories and relabel the actions to better trajectories. So maybe a better action here would have been to take, you know, a zero prime,

a better action here would have been to take a one prime, another one like a two prime, a three prime. So what MCTS is doing is basically saying like you play this game where you eventually lost, but on every single action, I'm going to give you a strictly better action that you should take instead. It does not guarantee that you are going to win, but it does guarantee that, you know, if you take these tuples as training data so that you retrain your policy network to predict these ones instead of these ones, you're going to do better. And this is very related to dagger in robotics and in the implementation learning where you want to collect a intervention here. And even if you're in a not great state, for example, like a self-driving car that, you know, veers off the side of the road, there is still a valid action that kind of correct you and brings you back.

Okay, so, but any question, but is there a guarantee that MCTS must be better than the policy? For example, you could imagine early on in training because MCTS is informed by the value network. Early on in training, when the value network hasn't involved trained on finished games, that MCTS is worse than randomization policy. So is it just like a heuristic that MCTS is better than policy or is that like, is there some guarantee? Right. In practice, it is a heuristic and it

does work in also practice, but let me illustrate an example where MCTS can give you a worse distribution than your policy network. So, and this can often happen if your self-play algorithm has trained to a good point, but then somehow it's it collapses because it's not trained on diverse data. So, let's say we have a board state where the policy recommendations here are very good. So, like, you know, Pi of AS is like, great. But somehow, because maybe we're playing on a lot of games where the bots just resigned, instead of playing all the way to the Trump-Taylor resolution, they kind of forget how to evaluate those kind of late stage plans, right? Like in the case that we showed with

the corner play, maybe like 100% of our training data in our replay buffer has lost examples of how to evaluate the value function at those states. So, you might end up in a scenario where your terminal value is like very bad. And if the terminal values of the leaves are not good, then this will actually propagate all the way up and cause your puck selection criteria and your backups to be off, and then you end up visiting a very, very different distribution than what your policy initially recommended. Also, if your number of sims is low, then you might also have a variance issue where you just don't explore enough, right? Like it's only guaranteed to converge when you kind of take N2 in entity. So, so variance in, you know, your search process as well as inaccuracies

in your evaluation can definitely screw with the quality of your policy network. And so, that's why it's not a guarantee to prove. But, and that is why I think I suspect why AlphaGo.ly had the play outs to the end in their training algorithm, so they could ground this thing in real play outs. In practice, what you could also do is just like for 10% of the games, you prevent the boss from resigning and you just like resolve it to the end. So, you get some training data in your replay buffer to really resolve those kind of like late stage play outs that normal human players would kind of not play to. So, so this is why MCTS kind of, if you assume that the value

functions are correct, why it gives you a better policy is because it's a very critical, you know, chain of assumptions, assuming that this is accurate, then your search process should give you a better recommendation than your initial guess. Right. Okay. So, if you have a cold started policy, you have an office, your type thing. Really what's happening for the first few epochs is the policy is kind of useless. And what you're really just doing is hapless, playful games. And once we

have played full games for the preceding moves, we'll have labeled who won, who didn't win. And the loss for office, your has to components, which is like, how good is the policy relative to MCTS? And how good is the value prediction relative to who actually won the game from this move? And this is this sort of like, you can think of this being applied to every single action or every single move. And really what's happening at the beginning of office, your training is just like, we're trying to get the value function to actually predict who will win the game. If you're, if you find yourself in this

state and you're this player, and functionally that's all that's happening and later on, once that's well trained, now the policy is also improving. Okay. One trick I did find to be pretty useful, and this is not a peer reviewed claim. So just like, take this with a grain of salt, it's like, I found it useful in my own implementation to do the following. You want to first make sure that this is good before you invest a lot of cycles, we can see just right, like, it doesn't really make a lot of sense to do search on garbage value predictions. So, so you want to kind of start in a good place where this works.

AlphaGoGoGo does a very good thing where it just takes human games and then you like, train on it and it just works, right? Totally works. You can also take an open source GoBot play against itself, generate data, also works. So, so if you have some like offline data set that, that has realistic good play, you can easily learn the late stage value functions pretty well. And that's the, that's what you kind of need to start the search process.

Sorry, can you just read the sentence right now? Sure. So, so it's quite easy to evaluate a late stage GoGo game. Like when almost all the pieces are on the board, like, it's almost like a decidable problem, right? Because the lower and lower uncertainty has to like, adapt the tree.

So, most games play to the end by reasonable people will be good training data to train a good value function at terminal parts of the tree. Then as you play more games, the, the search will back up good values into the intermediate nodes of the tree. And then like, as you increase the amount of data, your value head gets a good intuition of like, what is a healthy board state versus a not healthy board state. Those are much more subtle to judge in the mid game than the beginning or the end. So, the most difficult part to score is like, not the beginning or the beginning, because the beginning is just like obviously 0.5 and then at the end it's like pretty obvious winning. So,

the hard part that you want to learn in the value function is like, who is winning in the middle? And so, this is actually very analogous to TD learning. Yes. And there's a beautiful connection to TD learning that we can, you know, talk about in a bit, as opposed to, you know, contrasting with money, cartilage research. So, so you first want to get good functions and expert data can kind of give you a quick shortcut. I recommend for, you know,

practitioners just do that first, just to initialize a good starting point. And then if you want to do the alpha zero thing or, or kind of go kind of tubular, raza learning, then what you can try to do is on a small board, play random games, just take a random agent. And if you play like, you know, 50,000 games, you'll actually learn a pretty good value function as well. Because on a 9x9 board, there's actually, you can see enough of the common patterns of random play. And then if you train a model that kind of can train on both 9x9 and 99 data, and kind of go, was, was, proposed one of these architectures, then there's some pretty good transfer learning from the value, value head evaluated at 9x9 to the 99. Right, because this unlike other games as much, like a very much a sense of like,

there's not like a new kind of piece that is introduced when you increase the size or something. If we take it to this limit and consider like a very tiny like four by four go board, like if you play 50,000 games, you're going to have a lot of end states that look like human play, right? Like, it's just like tic-tac-toe at that point. So, so if you like broaden this a little bit to like, 9x9, 5x5 or 9x9, it's not unrealistic to imagine that like purely random play will actually generate pretty reasonable looking boards. And then so you can score those pretty easily. And so that is

what gives you the bootstrapping to be able to then improve your policy with search. But it's very, very critical that MCTS has accurate value essence. And you need to ground the value. Ultimately, MCTS will fall apart if you don't have a grounding function for the value. I do curious how much compute you save by training the value in policy on the same network, that because they share the same representations, how much more efficient learning is because I know it's interesting if they're basically kind of, we've just talked about how they're kind of making similar predictions or they should be in line with each other. And so I'd be curious if

like, actually, you're like, having them on a computer, you gotta do like giving the same network. Right. AlphaGo. The original AlphaGo paper had two separate networks. And then in all subsequent papers, they merged the instruments and presumably the saved compute. But answering that

question in a very rigorous scientific way is actually a simple question, but in practice, it takes like, if you really want to chase that question down to it, it's limited. It takes quite a bit of work to really result. But intuitively, yes, they share a lot of representations. So, and as we mentioned, there is a sort of like, your policy network and your value network, when doing evaluation should kind of agree. So there really should be this sort of consistency between them. Yeah, that way there's the wrong way to think about it. I feel like when I learn how

NLM works and how simple RLVR is, at least as an algorithm, how simple it is, I'm sort of stunned by the kinds of things I can do, that I can learn how to build very complicated code repositories and whatever, simply from getting like a yes, no. And here, I feel like if you understand more deeply of like, just predicting MCTS and it actually seems AlphaGo seems less impressive in retrospect, the more you understand it, because you're like, oh, you're putting in a lot of bias by just saying how much you're like telling it how we should titrate exploration as things go on. You're building this very explicit tree search for it. And so I don't know if you try that intuition where it actually the more you understand the less impressive the accomplishment in 2017 seems. I personally disagree. I think they're profound for different reasons.

And I don't understand the LMRL like enough to comment on your podcast about it. But I think AlphaGo, so why is it a profound accomplishment? I think maybe it's worth stepping back a little bit and just like, it is different than modern RL and we can talk a little bit about like some of the algorithmic choices there. But I think the most profound thing here is that a 10 layer neural network pass, so basically 10 steps of reasoning. And of course, the reasoning is not just one trail thought. It could be like the distributed representations and a lot of thoughts going on at

the same time. But by construction, let's say a 10 layer neural network can only do 10 sequential steps of thinking. Ten steps of neural network paralyzed distributed representation thinking is able to amortize and approximate to a very, very high fidelity a nearly intractable search problem. So this was a breakthrough that I think most people don't even understand today, like fully comprehend like how profound that accomplishment is. And this is what also girds like AlphaFold, for example, right? Like where you have a very, very difficult physical

simulation process that you would need to roll out so many micro scale simulations. And yet, like 10 steps of a somewhat small neural network can somehow capture what feels like a MP class problem into a single problem. And so it actually makes me wonder if our understanding of problems like P equals MP or these very fundamental computational hardness problems are incomplete. Like it's not like, obviously, this is not a proof of like P equals MP or anything, but there's something to it that is very disturbing where like what felt like a very hard problem can fall to a very, very simple macroscopic. Yeah, that is a very interesting insight that a lot of problems which are proven to be empty hard, like I don't know if it's going to be empty hard, but protein folding, et cetera, have been like neural networks can solve them because they're empty hard in the worst case, but we're not dealing with the worst. We're usually not concerned with the worst case.

You know, they get strong, they get a lot of structure to them. Yeah, I think that the kind of question we should be asking ourselves is like we've been formulating, you know, solutions to MP hard problems as a kind of worst case complexity. And I wouldn't say, you know, this solves go, right? It doesn't give us a exact solution of the optimum. But in practice, like it is extremely useful. And the same thing has been shown in like alpha tensor, alpha fold where like, yes,

there's a very hard problem that in the worst case seems intractable and yet we're able to make like almost arbitrary amounts of progress. So here's a sort of like, you know, in the limit, what this might look like, right? Well, if you want to simulate, you know, something very complex like whether or predict the future, like, you know, do we live in a simulation or not, the computing resources you need to build a very complex simulation might be much smaller than you think based on, you know, our ability to amortize a lot of that computation into the forward passable single network. So to me, AlphaGo was the first paper that kind of like really showed this like profound level of, you know, simulation being compressed into a small amount of. I feel totally not at all qualified on the computational complexity to comment on this. But I wonder if

there's an important role of chaos here where if under what is the problem with weather and why does it take 10x amount of resources to predict weather a day out and continually so far every more day out is because it's a chaotic system. And so small perturbations can totally change the final lesson as time goes on. And I guess it's interesting. Well, I guess you would expect that for go and protein folding as well. So here's an analogy to whether that might be relevant to go. So the

problem of like, you know, here's our current board state. Given what we know about both players, what is the board state in the future? What is the exact board state in the future? Right? This is extremely sensitive to initial conditions, like a single stone place here can kind of disrupt the entire prediction. So this is hard. This is kind of intuitively the chaotic problem. And yet somehow,

this is this is hard. Somehow we can predict who's going to win. Like, and this captures a lot of possibilities here. And so that there's this more macroscopic quantity that we really care about, which is the average or expectation or some sort of global macro structure over a lot of, like, you know, possible futures. And so, and whether it could be the same thing, right?

Like, we don't exactly care like what the, you know, velocity of wind 6000 feet above a specific latitude longitude is we kind of care like, where's the hurricane or, you know, things like that. And I would say like in chaos, you know, there's a classic like Lorenz attractor, which kind of looks like this, right? Yes, you don't, if you start anywhere on the Lorenz attractor, you don't know where you're going to end up. But you do know that thing looks like this. Right. And so there's this kind

of beauty of like, sometimes we don't necessarily care about the micro scale things. We actually care about the macroscopic structure. And these things can be predictable. And contrast that, say, to something like a hash function, which is also incredibly dependent on initial conditions, but doesn't have a macro structure. At least hopefully if like, the work work. And so there's like no equivalent of a value function or like broadly how's the

weather going to be that is interesting there. It's really just about what is the move, what is the board going to look like 100 moves from now exactly? Yes, intuitively, that seems correct. I, and then again, this is also out of my area of expertise. But I find it interesting that like cryptography has not been able to like the tools of cryptography and, you know, hashing have also not been able to prove that like you cannot come up with fast approximation, like you cannot come up with fast approximation. If they were able to do that,

then you could prove he is not equal to him. Yeah. In fact, we know that there's structure and many critical protocols, obviously like RSA cryptography, there is structure and that structure is what quantum computers exploit to break them, right? Reiner has a very interesting block was a structure in the episode where he talks about how if you look at a high level of cryptographic protocols look like, and what neural networks look like, it's extremely similar, where you have sequential layers of jumbling information together. And it's because there's this conversion devolution in the algorithms, where in cryptography, you want the final state to be incredibly sensitive to initial conditions so that it can come out sort of looking jumbled based on if you change anything. And then neural networks,

you similarly want everything to be dependent on all the information, because you want to process all information and consider how it relates to itself. Yeah, you have the maximum power of neural network at the edge of chaos. I think there's some like research papers from Joshua Stoldik on this. Yeah. Yeah. Like, there's something kind of quite

fundamental about like chaos that is not just like hopeless noise. It's like there's something kind of useful in chaotic systems, at least at the boundary. But yeah, this is just my thing about this philosophy. I don't actually know the math well enough to comment. Anyway, if we go back to, we'll talk about a little bit, because there's some connections there, but let's just go back to the MCTS. Like, what is it doing? It is not crucially, it is not saying we're going to

increase the probability of winning directly. It's not going to say like we're going to up-weight all actions that won and down-weight all actions that didn't win. Yeah. Importantly, what it is doing is saying for every action we took, we did a pretty exhaustive search on MCTS to see if we could do better. And we're just going to make every action that we took better by predicting, like having the policy network predict that outcome instead. And so this is

a very, very nice idea, because you have one supervision target for every single action. Yeah. So the variance of your learning signal is very low compared to the alternative naive RL thing. So let's actually consider what, let's consider a very naive algorithm that looks a lot more like, you know, modern LMRL today, where we do something like, let's take the winner of a self-play game and encourage it to do more of that. Okay. So it's worth kind of thinking a little bit

about like, what are some alternatives if we could do to train self-play agents instead of MCTS? Right? Like, you know, we use a lot of LM cell RL these days, like, is that relevant? Can we do that instead? So let's think through this a little bit. Let's suppose we have a very naive algorithm where we

take a league of agents of different checkpoints and we play them against each other. And for the games where a single player wins, we're going to reinforce those actions up and then and then and train, retrain the policy network to imitate those guys instead of instead of MCTS objective. So what ends up happening is, let's say you have a chain of actions that led to a win. And you have a match up between two agents that are basically the same. So in fact, let's just assume that like, you know, policy A and policy B are like evenly matched, right? So the true, the true win rate is like 50%.

So let's say you play 100 games and then each game, let's say, lasts, you know, 300 moves. And you're doing some sort of like evolution strategy or some way to perturb these things to get them to do different things. Or maybe you don't and you just play them against each other and you see, like, occasionally this one might actually have a better strategy than this one. And so, so let's say, you know, 51 games, policy A wins. And then 49 games, policy B wins. And this is just

due to random luck or maybe you perturbed policy A in some way that led to this. And just to have a very, very simple model, let's pretend that for like 49 of the games, they played exactly equally. I'm sorry, for 50 of the games, they played exactly equally, right? And on that one game where this one won, it played slightly differently. It made like one critical move that like, you know, normally it would have done differently, but I'll just do some exploration or some random noise. It just happened

to make a smarter move than it did, previously. So you have one supervision signal, like one true supervision signal for your policy network. And then you have 99 games times 300 moves for which imitating those actions gives you exactly the same policy you had before. And so the scale of your variance is actually very bad because it's like you only have one label out of this enormous data set of actions, of supervision actions where you want actually, sorry, let me clarify a little bit. Okay, so we're just talking about how the good move, the distribution move is a small fraction of all the moves that are played across all the games on which you go to train. And this, of course,

reminds me of how LLM's are trained with policy gradient methods. Carpathira is when he was on the podcast called it like sucking supervision through a straw. And so yeah, it's interesting that this thing you're saying would be intractable and prevents you from actually getting beyond a certain level in Go is just by default. How LLM's are trained question mark? Right, so in this case, this is not to say it doesn't work, right? Like if you imagine increasing

the number of games to like, you know, millions of samples, you actually can get some meaningful supervision, like samples so long as you find a way to sort of mask out the supervision from these guys. And this is where things start to get pretty related to RL in terms of advantage and baseline. So let's look at the gradient variance of a very naive approach like this, where I'm just going to call it like gradient RL. And it's basically the sum of rewards. So the sum of rewards is the return, right? So like in our, now you've set up here,

we only have an indicator variable for the return where either you won or lost. So in the case where you lost, well, you just don't train on your gradient as zero, you don't train on those examples. And when you won, you try to predict those things. So you can think about this setup as a special case of this journal formula here. The trouble here is that this is very high variance because when you multiply these terms out, when you try to compute the variance of this, and so variance of the gradient is equal to expectation of squared minus, and just for simplicity, we can pretend this is like on average zero or something, if you're centering it at no signal. And the variance here

basically means that you're taking the square of this product term. And so you end up with a term that kind of grows quadratically with t. So variance, when you have a setup like this, this thing acts as a coupling effect on top of these terms here. So let's actually map this to an LM case. And we can answer like, why do LM's only do one step RL instead of a multi step RL scenario. In LM's,

you have a decoder that might, you know, predict some words like hello world. And so in current LM RL, they treat this entire sequence as a single action, just AT and big T is just one, right? And so yes, it is true that, you know, the, because of how, you know, transformers are formulated through the sort of product of conditional probabilities. We do have, you know, probability of this sequence is equal to the sort of sum of log probability, the whole sequence is equal to the sum of the probabilities of like, you know, individual tokens. Right? So in this case, I would, I would say something

like, you know, log hell plus log, low, plus log world. So this is true. And if this term were one, then they would be the same thing. However, in sampling things, if you have a reward term assigned to every specific token, now you have these interaction effects between the cross multiplication of these terms and these terms. Right. And so the problem becomes, how do you ascribe the credit associated

with every episode to all these different terms here? I guess the thing I'm confused on is what would that even look like to do it that way in, um, in LM's, in LM's because you do, you only do get a word at the end of the episode. So you could imagine a reward that says like, I'm going to give you some process supervision, uh, where you get a reward for each of these actions on every set. Okay. So you're saying it, instead of doing it that way, where you, um, like I guess the way you're written, it would be a sum at the end anyways. So they wouldn't have to be multiplied.

But you're saying instead of doing it that way, you would just add up this process rewards at the end and then treat that as one single or a signal. Correct. For one single, a lot of action. But um, isn't that how it's written to begin with anyways? Like the sum of the rewards. So the thing that's a

little bit hidden here in the math is that we're assuming that when you decompose the problem to a multi-step problem, that you're now introducing kind of correlations between your actions through the computation of this guy. And uh, so if you separate these things out, then there will be, um, this will magnify the variance of this one. So in the case where you don't separate it out, if you just have t equals one, you just have a single estimate of log problem and a single estimate of reward. Now, um, there are this, this term still shows up in LMs. It looks a little bit more like, that the naive reinforced estimator looks a bit like return of the single action plus times, you know, it looks kind of like this. This is sort of a very basic form here, but this is still a

contributor to variance. Um, so you want to make sure that like you don't, uh, similar to how in this case we were training on a lot of neutral labels, you want to make sure that you're subtract, you're sort of penalizing the labels that don't help and only rewarding the ones that actually make it better. Right. So intuitively, the analogy here is like, can we find a term in our training objective such that it's actually kind of discouraged from doing this, or you know, these don't have any effect on the gradient. And this has an effect on the gradient. Right. I guess if you apply that

there, the only thing you could do is eliminate 49 of the games. So at least the way you have it in there, it would be, um, 51 times actually the optimal case is to pull out, discard all of these moves and only get a gradient on that single move that you got better. Yeah. How would you do that? Right. So this is a pretty tricky problem in practice. And so this is where advantage estimation

happens in reinforcement learning. So you want to subtract, um, you know, a term from, from, um, from your, your multiplier instead of an indicator function of like one and zero, you want something that kind of behaves like a zero for all of these guys. No. And then a one for all these. Yeah. But you, so you could do that if there, um, if you can say, Hey, I won this game.

So this is slightly above baseline performance. Well, you want a lot of games. Exactly. But you don't know which ones let you win because they were truly better versus winning on accident. How would you design a baseline where it's truly better? Yeah. So this is where in RL,

people use things like TD learning to better approximate the quality function, the cube that we mentioned earlier. So you can try to subtract that from your, um, your, your return. So ideally, what you really want to do is in RL, you want to, um, push up the actions that make you better than the average and, um, push down the actions that make you worse than the average and they call this advantage. There are multiple ways to compute it. I highly recommend John Schulman's general advantage estimation paper as like a good treatment on how to, um, how to like think about various ways to compute it. But the, at the end of the day, you know, um, you want to reduce variance by

trying to make this smaller. And so it doesn't magnify the variance. Right. So, but, um, this requires you to have a very good estimate of what average performance from a state would look like. So this is, it's a fact of a value function thing we're talking about earlier.

Right. And so this, uh, keep in mind that in this case, this model free RL setting, uh, is trying to solve a credit assignment problem where you don't know which actions were actually good and which ones were bad. Monte Carlo tree search is doing something very fundamentally different, which is it's not trying to do credit assignment on wins. It's trying to improve the, uh, the label for any given action you took. And so we can actually think about a completely different algorithm called neural fixture self play, which was used to great effect in systems like AlphaStar and, um, and the opening eyes doing it. Um, so, so let me talk a little bit about how, um,

how you can kind of unify some of these RL ideas in the model free setting as well as the self play setting. Okay. So what happens if you don't have the ability to easily search a tree, right? Like in go, it's a perfectly observable game and you can easily construct a pretty deep tree that can completely capture the game state in a game like Starcraft, where you don't have really complete control over the binary. It's a little bit hard to do this. And I'm not even sure if it's a,

it's a deterministic game. Right. So that makes this, uh, kind of difficult from a data structures perspective. So, um, what is done instead is that the basic idea of supervising your actions with a better teacher is still there. Right. So, so, if, if I give them neural fictitious,

so we're going to talk a little bit about neural fictitious self play works. The same idea, we're going to like come up with better labels for each of the actions we took, just like an MCTS, but how do we derive the better labels? In MCTS, we, uh, perform search to, and assuming we have a good value function, the search will kind of give us a better result in our initial guess. In, um, in a game where you can't easily simulate a search process, what they do instead is train what is known as a best response policy. So you fix your opponent. So let's say you're, you're currently

training Pi A against a strong opponent Pi B. Uh, in StarCraft, maybe like, you know, those are the zerks and you're playing pertussis. Um, so you fix your opponent and you treat this as a classic model free RL algorithm where your goal is just to beat this guy. And so here you use your standard T learning style tricks or use PPO or any actually like, you know, model free RL algorithm to try to hill climb against winning this player. And so, um, you train, you train, basically you, you have a reward function that's like, you know, return is like, you know, one if wins against I B. So this is no longer a self play kind of problem. Right? This is just like a fixed

opponent and you're just, um, solving it and trying to maximize a score against against that. And then, you know, zero otherwise. And so you're, you have a sort of fixed environment where all you care about is just being this guy. And, um, once you have a good policy that you train with, uh, you know, pick your favorite model free RL algorithm PPO or sack or, you know, any kind of mixture of the, or, you know, the MPO or whatever, um, you now have a good policy that gives you a good label for what this one should do when playing against that player. And when you train multiple best response policies, you can basically then distill the RL algorithms into the labels for a given opponent. So you might have, let's say best response policy against PIB. And then

maybe you have a collect a league of, you know, um, of opponents like PIB, PIP, and you're going to take the best response policy that you train against each of these fixed opponents. And for this one, you're going to supervise them with a label that this one wouldn't provide. So it is kind of like, this is almost like a proxy for your MCTS teacher, right? Instead of MCTS teacher, use a model free RL algorithm to find the best search action that you could do to, uh, to kind of beat your opponent. And then you're finally, you're distilling the, um, the policy here into what is known as like a, a mixed strategy where it's trying to basically average across all possible opponents to go play against. And this is what gives you something that can do no, no worse than like, you know, an

averagely average selected opponent from the league. And so this gets around the problem of having to derive a teaching signal from MCTS, but it's still fundamentally is about relabeling your, your, your states with better actions so that they improve your policy. And in terms of this, it's like, if you win against, you win against this other policy, you sort of reinforce all the actions on that trajectory. Yes. So here you can use a number of algorithms like PPO, the MPO, uh, you know, Q learning even if you want, like, uh, the specific algorithm here, um, can be, you know, it's usually a model for you things you don't have search, but there's an interesting connection from MCTS and Q learning that I want to bring up. So in MCTS, you do something where you have a tree

and through the resolution of your value function at the leaves of the tree, or, you know, your approximate leaves of the tree, you can kind of back up through the, you know, the sequence of many sequences and then obtain some sort of mean value estimate, right? Like your Q is kind of derived from the average of a bunch of simulations. Um, in multiple free algorithms, there's often a component of estimating a Q value. And so, um, a Q, Q values are often learned through T learning, although in PPO, the way that the advantage estimation is not necessarily through a Bellman backup, but, um, but in Q learning, there's this kind of a very cool trick where, um, you do, you know, QSA is backed up as R plus, you know, some discount factor times the max, a Q of your next step. So intuitively how this works is like, if you have an MDP and then this is like, you know, terminal, what this is sort of saying is like the best action you can take at this, uh, state is equal to the reward you take for, you know, taking this action plus the best that

you can do at the next state. So this is sort of recursive and dynamic programming property of, of MDPs and you can train neural networks to basically try to enforce this, this, uh, consistency, right? So you can say like, well, once I know the Q value of this action, I can then use that to kind of compute something about the Q value. So when earlier I was like, Hey, my returning policy, why don't we just train the value alone? That is what this is. Um, this is a algorithm for

recovering value estimates of intermediate steps when you don't have the ability to do forward so you must collect a trajectory first of like, N steps before you're able to do this trick. Um, but the intuition is kind of the same, which is that like knowing something about the Q value here can tell you something about the Q value here and indeed you can recover a policy from a Q value. Right. So, so the, um, you don't need to explicitly model the policy distribution. You can actually recover the policy distribution by doing argmax over your, um, your Q value. So, so Q, uh, Q learning

or, um, you know, this kind of like, uh, approximate dynamic programming kind of propagates what you know about the future Q is backward like this, right? And you can see that there's a sort of similar structure that goes on here where, uh, in this case you're planning over trajectories your agent hasn't actually been through yet. Whereas in this case you're planning over trajectories your, your agent has visited. Um, so, so importantly, why does Q learning, you know, why was Q learning a big deal, right? Like it's because historically we just haven't had the ability to do search on fairly high dimensional problems like robotics or whatever. So for a long time we kind of make

the assumption that like, okay, well, if we can't model the dynamics with like a world model or something, we're going to instead just collect trajectories and then plan with respect to the only number that really matters, which is rewarding. Okay. So this is very interesting. And then to unify this with our discussion about the lens. So with LMS, we're doing something, you don't have Q values, but you're doing this sort of backwards learning where, hey, let's find the trajectories which pass some unit tests and coding environment and then let's reinforce those trajectories. And then there's a huge difference between that

and the forward approach with MCTS. And the reason you can do MCTS, and it's much more preferable to MCTS because you can do it per move and make each move better rather than having to learn per trajectory. Um, and hope, you know, as I said, we hope to learn this like straw, yeah, so get this version through a straw, basically just upgrade all the tokens in a trajectory that might or might not have been relevant to getting the answer right. The reason you can do this much more sort of sample efficient, uh, much more favorable thing with go is that because MCTS works in go, you basically know that, hey, if I just do search locally here, and this search is sort of truncated at the end by this value function that works even if I haven't unfolded my whole trajectory, I can just say, this is my new policy, um, and I can improve in a more iterative, like, local way rather than having to, having to unfold all these trajectories. So there was some research, I think from Google in 2023, 2024, where they did try to apply tree structures to reasoning. And I think it's,

you know, the jury is still out as to whether this can ever work. So I would say like, uh, we probably will see like, you know, revisiting of this idea of forward search, um, in the future, but there's two things that make MCTS very simple for go, which is that value estimation is kind of concrete and you can determine it for real. And then you can kind of, uh, sort of use it to truncate depth, as you said. And then the, uh, breadth is also, uh, determined. And what's kind of critical is that the action selection algorithm where you iteratively visit and grow the tree is, um, well suited for the size of problem that go is an adept of the problem, but for something like L and reasoning, um, you know, PUC might actually not be a good enough heuristic. It might be too greedy with local tokens,

and it might do something like, Oh, only give you, you know, uh, sort of obvious thoughts that are correct, but not really solve your final problem. So I would say the jury is probably still out on how like what the final instantiation of reasoning for LM's would look like. And I wouldn't rule out that like this stuff could, you know, come back, but it's been hard. Don't have LM sort of natively learn to do MCTS where they'll try and approach me like, Oh, that doesn't work. Let's back up. Let's

try this other thing and then go in the direction that proves to be more fruitful. Yeah, certainly, I think the LM's managed to do something that looks like real human reasoning without having to do an explicit tree structure. Um, that being said, I think the idea of doing forward search and simulation to get a better sense of what is valuable might make a comeback, um, even though not exactly in the same instantiation as, as, uh, off go. But just to make sure I understand the crux of it, like the, the breadth from the number of the elections being wider and the depth from being able to not being able to train a value function as easily because. So here's an example where LM's breakdown. The CPOC rule involves, you know, server of N over one plus NA in an LM, like you're most

likely never going to sample the same, uh, child more than once. Right. So if you have, let's say multi-step stuff thinking, um, because language is so broad and open-ended, it's a sort of, uh, discrete set of actions is not really an appropriate choice for an LM, even though they're discrete tokens. Um, it's just such a large number that this type of exploration here is probably not the right thing to do to guide how to search down a tree. Right. But I guess the crux comes down to the

fact that in go, you know that the MCTS is almost certainly better than your current policy, even though you haven't gotten, even though you haven't explored the end of any trajectory. And then, in, uh, in normal reasoning for other lens robotics, there's no way to just locally evaluate and improve your next move in a way that doesn't result in, in a way that's independent of actually like solving the problem. No way is a strong word. I think lots of people have thought about how to try to apply MCTS or its kind of successors like New Zero to continuous control spaces. And I'm sure, you know, very cool research work is still ongoing to try to crack that problem. Um, but yes, the, the

seeming challenge right now is that like most problems in much higher dimensional, um, you know, action spaces or something that's coming into really much bigger like language, they don't seem as amenable to the kind of discrete action selection heuristics as well as, uh, kind of game evaluation type stuff that, uh, go does. Um, but that's not to say the idea of like, you know, thinking into the future along multiple parallel tracks might not give you some information about like which way to search, right? Like if you think about mathematics, I think mathematics often occupies a little bit more of like a logical search procedure where you kind of to back up, you can kind of see like which path seemed good or not is more of a rigid structure there, whereas maybe like in a, uh, you know, business negotiation or something, um, it's less of a tree and maybe, you know, something a bit different.

Okay. So we're not too good at second, I see some more questions about off the go and about yeah, research more generally. Um, in 2021, Andy Jones had a paper called scaling scaling loss report games and, um, he basically anticipated inference compute. We're in from scaling by showing that you can trade off test time compute and training compute. That is to say that you can spend more compute on the, for the searching through the MCTS. Um, and if you do that, you can get the equivalent

performance as having spent more time training the model. Um, and so if you, you know, just, if you see this pattern, you might think, okay, well, without a lens, you might do something like that in the future. And in fact, that's what happened that's happening. Okay. So what is a kind of fun exploration one could do now to explore other axes of scaling in toy settings, which will be important to understanding what AI development might be like in a few years. Sure. Yeah. Um,

I think that indeed test time scaling and reasoning and how it interacts with model size are quite profound when it comes to like how much needs to be actually done as explicit search versus how much can be packed into the forward pass of a neural network. And, and how does a forward pass of a neural network sort of learn how to do something that should be a sort of sequential and recursive set? That's quite interesting. Um, so the, yeah, the, any drone scaling loss report games paper is quite cool. There's another really nice result from that paper where they showed that, um, not only can you predict scaling loss of like, you know, the sort of LM variety where, um, as you increase parameters, you can decrease amount of compute for search or vice versa. Um, he also showed that you can

actually predict how much compute is needed to solve a larger version of the board game. And then so with go, you know, which can scale from, you know, three by three to infinitely size, you know, go board, you might actually be able to sort of revisit this question and try to reproduce whether this shows up. You know, I actually started this project with this sort of motivation that like does the better lesson or does our knowledge of scaling laws allow us to kind of execute a lot better on a sort of compute optimal go bot. Can we, can we kind of build a strong go bot without all the kind of go tricks, right? Just by really focusing on the better lesson and scaling laws.

I have not been successful so far, but I think it's, it's sort of a fact that like, usually when you want scaling laws to work, you want to be in the regime where, um, the, the recipe already works and the data sets are good rather than trying to kind of figure out how to do scaling while also trying to figure out what the right data set are. So, so this is like the scientific understanding component in research often follows a step where you get something to work first and then you use that, um, system to collect data that then helps you build a mental model of how things work, such as scaling laws, right? And so usually actually you want to build a strong go bot using scaling laws, you actually have to make a strong go bot first and then use the scaling laws to kind of extrapolate a bit farther into the future. Same or just right now, first of all, you're saying scaling laws did not work or you could not, there was no scaling laws pattern that you put it at a C in your go bot.

Yeah, so a mistake I made initially when I had some bugs around how MCTS labeling was working was I would, um, I would collect a bunch of data with an expert policy and then treat it as a supervising problem and try to identify scaling laws with expert data sets. Um, you can indeed plot things that look kind of like this, but if you're in a regime where, you know, your policy is not working well, you might be just studying scaling laws on like bad data, right? So, so just like one important implementation details that if you want to study a scaling laws problem, you kind of have to have a problem for which like the data is good, the architecture is good, and there's no bugs and then like, you, you solve it there. Um, X and T, I wasn't able to like apply scaling laws to direct what to look, look at, um, until you know, I read the rest of the system working. And this sounds obvious, like, to researchers, of course, you want to have like a working bug-free system before you study scaling, but just sort of advice for practitioners on like where I actually tripped up when I started this project was you don't necessarily want to kind of jump into the science of studying your man-made artifact before your man-made artifact is like interesting enough to be studied.

Speaking of computing, so if you can look at these charts of compute usage train, the best AI model in the world over time, going back 10 years, and it's a very smooth line in log space, that is exponentially growing year over year, except there's this huge aberration, and that aberration is AlphaGo Zero, which is straight on way more compute than any other AI model at the time. It was like three, 23 flops, sort of comparable to like a frontier I mean, orders magnitude off, but so, um, and so yeah, the question is, especially with you being able to get something off and you're doing on your own- I got a donation from Prime Intellect for like about 10k, and then I spent, I spent maybe the first 4k doing kind of exploratory research, and then about 3k on the kind of final run, and then some of the remaining for serving the model for- Cool.

Yeah, is there sense that they were just too bad for any of you who can do it in 10k now? Uh, the computer required to be the first to do something is always like much larger than the computer takes to catch up, and it's the same story playing on the LMs, right? Like once someone else has done it, you can use tricks like distillation, you can use all sorts of like kind of crutches to kind of bootstrap your way to success. So with my own bot that I posted online, I actually used sort of best response training against the Kanagawa models to kind of get a strong level performance, and you know, as a time of recording, I'm validating whether this can be- I can kind of do that first step, which is to do the tabula raza, right? But importantly for research, you often want to start from a good right? So the kind of simple thing I did first was train best response agents against Kanagawa.

Um, Alpha Zero team, they did not have any policy that they could train against, right? Because they were trying to do everything tabula raza. So, um, and being the first to do it means that you're prioritizing getting a thing working rather than like let's say the most computer efficient possible implementation. So, um, this actually plays out in robotics as well. If you look at the kind of frontier of large models trained robotics, um, the scatter plot is all over the place and there isn't a very clean line the way that there is for frontier LMs, and that is because the folks training these models often are not, you know, at the scale where every flop counts and they need to like kind of squeeze out the performance of every single flop as the dominating decision deciding factor in pre-training, right? Instead their focus is more like we want a certain capability to show up.

So we optimize the training set up to kind of make it easy to derive that capability. And once you have that capability, well, um, invariably you scale up the compute, you are forced to kind of make a computer efficient because this is like hundreds of millions of dollars we're talking about. But, um, but in the past when, when computer experiments was kind of more plentiful or, you know, not, not, uh, not, uh, accounted in a way that the research was really responsible for, then you kind of end up with people optimizing for things besides kind of being on the computer optimal pre-no frontier. Like speed or something. Yeah, like, time to result or just getting to work.

I think the first off ago, like probably they had lots of compute and they didn't need to be, um, they didn't need to worry too much about making it the most compute optimality. And how much of the improvements to computer efficiency are methods that did not exist as of 2017 versus things which they could have been in 2017, but um, yeah. Great question. So, so going into this project, I kind of knew in the back of my mind that like, things always get easier to do over time. And I wanted to see like, where, where's Goat, given that like, it didn't seem like there has been any major open source, you know, strong bot is after Conoco and 2020. And then you know, reading the Conoco paper, there's a lot of clever

ideas. I was kind of wondering like, okay, let's, let's see if the bitter lesson has happened where like, a lot of these kind of tricks just sort of go away because of the video made messaging piece, right? And so roughly where are we on that? So, um, again, this is not a peer reviewed claim. So I, this is just my preliminary, um, you know, vibe guests on like what I've seen based on my own experiments, but it seems like, um, you know, architecture choices don't matter that much, you know, transformer versus resnet. We're at the sort of speed of GPU where the size of the model is not so big,

but this really matters. Um, um, you can actually simplify the set up quite a lot. So instead of doing a distributed asynchronous RL setup with replay buffers and pushers and collectors, you can kind of do a dumb synchronous thing where you'd like collect, you just try to supervise any model and then you collect again. And so there's like opportunities to simplify infrastructure. Um, NVIDIA GPS have indeed got faster. So whereas Catego is trained

on V 100s, you can train on like half the number of, you know, desktop, lack of GPUs and it still works. Um, and, um, some of the kind of auxiliary supervision objectives that Catego developed aren't really necessary if you have a strong initialization, right? So if you're initializing against, you know, best response training against Catego itself, then your own model actually needs none of the tricks that Catego needs. So then the core thing is like, how can you get as quickly as possible to some strong opponents? And that matters a lot more than the specific architectural innovations, but there are still some nice compute multipliers. So I found that training on nine by nine boards was

very nice for resolving end-game value functions. And then like, if you can co-train that on a architecture that can transfer between nine by nine and 19, then you can really cut down the warm start time to learn that from scratch. I think, uh, AlphaGo Zero, their plot was, um, first 30 hours or so are spent basically catching up to the supervised learning baseline. Um, and you can cut down that time a lot by kind of pre-training on a small board and then, and then like, you know, warm starting that into your, you know, 19 by 19 board play. Uh, there were some other stuff like, you know, varying the number of sims between episodes. This turns out to be not that sensitive

actually. Like you can kind of, you know, fix it or increase it. It doesn't matter too much. Um, so anyway, this kind of just nice for a scientific perspective, just revisiting like an old paper and seeing like what really matters. This is a potential question. But why is it okay to have a

buffer in AlphaGo? Cause every time I talk to any researcher, they're telling me about how bad this would be off policy. But then the way, and not even implementation of AlphaGo Zero would work is that most of the moves in a given backward step or an batch of backward steps, um, would be not, not among the ones that were made by the most recently trained model. So why is that okay? Great question. Yeah. And this, this gets into the sort of fundamental off policy versus on policy,

reinforcement learning kind of questions. So, uh, as we call in MCTS, you take actions that you took and you relabel them to, uh, to take different actions on the same states. Right. So, so the off policy part here comes where, um, what if you're relabeling states that your new policy would never visit? Like what's the point that you're kind of wasting capacity and in extreme limit, imagine your distribution of states and your training buffer are all states that you would never visit.

Then you're basically supervising them, uh, to take good actions on states you never achieve. And therefore your policy can get really bad. Right. So this is where off policy can really hurt, um, uh, AlphaGo. Um, however, if you interpret this sort of from like the dagger perspective, which is basically saying like a way to kind of correct yourself back to the optimal trajectory, given some, some data, what you kind of want in a algorithm like this is to have mostly states that you would visit, but then you have a small percentage or maybe a reasonable percentage of states in this kind of high dimensional tube around your optimal, you know, trajectories.

And any of those states are given a supervision target to kind of, uh, sort of funnel you back into your optimal trajectory. Uh, so maybe I can just draw quickly here. So in, um, sort of a dagger style setup, what your kind of optimal training data distribution is, is that here is your optimal states and actions. So this is like, you know, you want to be in the state, you want to be in the state, you want to be in the state, and then you win here. Um, and then these are your optimal policy actions. So these are the, these are the things that you definitely want to train on, but to make

it robust to disturbances, um, you want to make sure that if you happen to drift off into some other states, you can kind of funnel yourself back into, why isn't this a fully general argument for our policy training? This is actually why you want to do off policy training. Sometimes it's like, you don't want to have a compounding error where if you make a mistake, you don't have the data of how to return back to your optimal distribution. Yeah. And so, um, optimal control does not really say too much about like, uh, you know, how to, uh, you know, not accidentally get here because it's sort of making the assumption that like once you learn the policy, you'll get here, but in applications like robotics, right? Like, like, I don't know, a gust of wind blows you slightly off and then now you

need to like correct, right? Or the friction on one of your tires is kind of a little bit like lower than the other wheel and then now your car's drifting and you got to correct it. So these kind of things in like more real environments often happen where like, um, actually there's a funny quote about chess and it also goes like the problem with, uh, the problem with go and chess is that the other players always trying to do some shit. Like, uh, so like, you know, things can kind of drift off and you always want to be able to correct, uh, back to your, your waiting condition. So, so your replay buffer really should have like your, you know, the states that your policy would visit, plus some distribution of states that you might drift to and then how to return back to your optimal states. Yeah. Now, if you take this to the extreme and you say like, well, let's, uh, we don't have any

of this data and we're going to just like be labeling with MCTS, um, you know, states that are so far away from our optimal behavior, like this, this bag of states over here. Well, like now, yeah, I mean, like each of them gets a MCTS label and your policy learns how to take sort of the best possible action here, but you never get here. So like your training or model on states would never reach, like, like this is, this is not there. So then this is a problem. And this is where off policy can really hurt. Yeah. Um, so actually, as part of this project, I did try an experiment where I took a

bunch of trajectories and to try to saturate the GPU as much as possible. What I did was I took, uh, you know, random states from the data set and re-ran MCTS on just those states, right? So instead of playing a whole game where I'm doing MCTS on every move, I just ignore the sort of causality of moves and just pick random board states and I just label those with my current network. And, uh, and I might revisit old states that I've labeled before and relabel them again with my current network. And so in practice, this actually does work. You can actually say like, let's take some states

that are reasonable and constantly be relabeling them, um, in, uh, in, um, while we're training. And So this actually starts to converge on a very robotics like setup, which is very common, which is you have your, your data set of trajectories. Um, and then you have something like a replay buffer pusher and these are off policy, offline trajectories. Right. So your replay buffer pusher pushes transition tuples to, to, to the replay buffer. And then you have some job that's kind of

continuously, um, replanting what the best action you should have done instead of taking this action. Right. And so robotics is actually very common to use a, uh, the sort of minimized TD error. So like your Bellman, uh, data, uh, constantly is pulling things from here and trying to satisfy, you know, the QSA. So, so, um, and then from here, you have your trainer, which is trying to fit the S to A or, or, or, uh, um, fit the, you know, queue to the queue target. So,

so here you can think about this as a sort of planner, right? You've visited, um, states that you've been to and you take a current model and you rethink like, what could I have done better if I visited this? And, um, and so this is actually how like kind of off policy robotic learning systems are usually trained. Um, these days are sort of simpler recipe, but, but like, you know, in the Google QT updates, we kind of did things like this. So what is the trainer? Oh, yeah. The trainer is, uh,

you try to, you try to minimize, uh, QSA and Q target. Which I can explain the whole setup again. They got a high level. Yeah. So you have your off policy data that came from various policies.

You're constantly pushing, uh, transitions that you saw before to a replay buffer. No. And then you've got this thing called a Bellman update, which basically replans. Instead of this action, what action should I have taken at S to have a better, you know, value. And then the way you enforce that is you try to minimize the TD error. So, so actually, given this, you have S prime, right?

You, you compute Q of S prime and you find the action that should go with S prime that makes this Q value as high as possible. And then you add that to the reward here. And that gives you your actual target. Right. So for this current S and A, your Q target is this. So now you have a, now you send

back the Q target to this transition. So with this tuple, you pair with that a, uh, a Q target. And then here on the trainer, you simply just, you supervise learning and you minimize your current networks QSA with its target. Yeah. So in the background, you're just like, Hey, let me basically think through how valuable were all these actions actually? Yeah. And a more optimal policy where you're trying to maximize

this, what is the Q target of this transition? It's sort of like basically daydreaming. Exactly. Yeah. You can think about it. It's like you're kind of going back and hindsight and being like,

like, like, given what I've seen in his historical buffer, like, was there a better action I could have taken? Now the connection to go here that I tried and it was, you know, moderately successful, but too complex to kind of like open source was you replace this with like a MCTS relabler, where instead of doing this kind of target network computation, you run MCTS on your transition, right? So in this case, you have your state, your action, and then whether you want or not, again, and actually you can just toss these two. You don't care about these ones. You just take your state and you just plan MCTS to get your best policy, you know, on your current network, right? Not the network that took this action, but your current best policy network, you just

rerun your search offline on these transitions. And if these are transitions that your policy can get to, then this actually acts as a very nice stabilizing effect. And also one other benefit is that you can like fully saturate your GPU better because you're not like blocking on the go game to kind of like give you board states, you just simply search across all board states at any depth in peril. So, and then here the trainer would be just, you know, predict the MCTS labels. So, again, like this kind of works and this is quite relevant in robotics where you're really, you just have a lot of offline data and you can't simulate things like MCTS. But in practice, like it does

run into the problem where, you know, like if the current model is looking at states that it would never reach, then it's kind of wasting capacity. And so you have to be a little bit careful here. So the unpalacy thing and also much of RL has kind of converged to a much more unpalacy setup, where they don't really try to like directly train on off-policy data. At best, they use off-policy data as a way to reduce variance, but not directly influence the objective. Sorry, I have to converge to that?

It's just more stable. So, like you might use the off-policy queue as a way to do like, you know, advantage computation, like, you know, Q minus like sum of Q. That's kind of like your, your, you know, sorry, like, you know, sum of, like there's n actions and then, yeah, so, so like, so, like this is your value and then this is your current queue values. Your advantage for that action is like the average value minus the current one. So, like, people can try to estimate Q in an off-policy way and then like just use advantage here and then, and then the sort of, if there's a problem in these dynamics that it doesn't like blow up your loss as much. And so, in robotics,

there's a kind of convergence towards more like a using off-policy data to just shape your rewards, but not actually be directly here. I'm reminded now of our other conversation of why MCTS is so favorable as compared to the kind of, you know, reinforce a policy gradient kind of the other ones do. And this might be totally wrong, but I wrote a blog post a few months ago about how RL at least policy gradient RL is even more inefficient than you might think. And so, the inefficiency one thinks about naively is the fact that you have to roll out a whole trajectory in order to get any learning signal at all. And so, as these trajectories become longer and longer as an agent has to, instead of just previously like complete the next word in the sentence, it has to go instead to, hey, so do two days worth of work to figure out even if you even did this project correctly, the amount of information per flop has been decreasing. As you're to unroll two days

worth of thinking in order to see if you even did something correctly to like, to the speed of the amount of samples per flop has been decreasing. But so, you can think of them, you're trying to maximize your learning bits per flop, right? And this is, you can think of bits of per flop as samples per flop times bits per sample. And what I just mentioned a second ago is that the samples per flop go down as RL becomes more and more long horizon. But at least this kind of naive RL is also terrible from a bits per sample perspective. And here's what I mean, at least

compared to supervised learning. So, early on in training, let's say you have a vocabulary size for another one that is 100 k long. So, there's 100 k possible tokens that one can answer. And you have a totally untrained model. And you have a prompt like, the sky is, with supervised learning, what would happen is that the model would have some probability distribution over all the things you could say.

There's a label that says actually the term here is blue. And it would learn basically from across it to be lost exactly how far its distribution is from correctly saying blue. Now, if you're doing this through RL, you would say the model would try, the sky is, a licon. Nope, that's wrong. The sky is told. Nope, that's wrong. It's a totally untrained model, right? And so, you would have to

do this on the order of 100,000 times in order to just stumble on blue, then get some learning signal off of that. So, if you're in the supervised learning regime, and you just get, you have your distribution of probabilities, you get told that it's blue and you figure out how far off you are, the amount you learn is a function of your pass rate. So, like, the further away you are from blue, the more you've learned to go towards blue using cross entropy loss. And so, you think of it as like your pass rate, your prior probability of having said blue. And as a function of that, like, in supervised learning through cross entropy loss, you would learn negative log p, p being pass rate bits once you get this label. Whereas in RL, you're just randomly guessing shit and seeing it

or not. That's just basically going to be the entropy of a binary random variable, which is... And what's also tough here is that actually the distribution that you're sampling under is your policies distribution. So, like, if your policy has no chance of sampling blue, then you will never get a signal. Exactly, right. So, that's being modeled by the fact that

your probability of sampling blue is extremely low. If you do sample it, you do learn as much as you would have learned in supervised learning. In all other cases, like, 99.99% of an entry model, you're just learning incredibly little from seeing how the con is not the correct word or told is not the correct word. And that's what happens most of the time. So, you're just like, learn very little. So, if you try to graph, if you put on the x-axis, your pass rate,

and here you put the bits you're learning from a sample. If you have like zero percent here, 50 percent here, and 100 percent here. So, the end of trading, you're here. If you have supervised learning, negative pass rate would look something like this, and then the entropy of binary random variable would look like this. And this is... Depending on whether

you're doing maths or bits, if you do bits, it's like one, right? Here at the peak. This is like a coin flip. You learn the most from a coin flip. This is supervised learning. This is RL.

However, the problem is you spend most of training in this regime, right? Like in the low pass rate regime. And in fact, if how fast you're learning is a function of how many bits per sample you're getting, and you're getting very little signal here, if you chart the pass rate on a log scale, so you put the x-axis on a log scale where like at the beginning of training with a vocab size of 100k, the pass rate is one over 100k, then one over 10k, one over 100k, and then... Okay, what this graph looks like here, where supervised learning would look like this, and then RL, if you just basically crunch wide, I just showed there, it would look like that. Yeah, and arguably, you spend all your time here. It's actually never even getting a single success, right?

Exactly. So, it's a sort of depressing plot in the sense that like, once you're here, it's not at all obvious how you get to hear. Yeah. And once you're here, you have something, but like, you actually, in many RL problems, spend all the time here. So, there's a sort of question of like, how do you initialize? So, you're at least not at zero, but like at a non-zero pass rate.

Yeah. Well, one more thing I'd like to add about this per sample, that's very relevant to, any kind of machine learning problem is that, and there's a connection to a soft target and distillation, where if you have access to the logit, not just the one hot, like this is a sort of one hot token answer, if you have access to the soft targets, the entropy of this distribution is far, far higher than the one hot. So, there's actually way more information in bits per sample in a soft label. So, that's why distillation is so effective. For example, is that it's actually giving you way more information per sample. Oh, yeah. I wonder what the equation would be. But obviously,

it would just be the entropy of this distribution. Like, so, the entropy of this is zero. The entropy of this is like, you know, the entropy equation. And this is also why, like, you know, off it goes quite beautiful. And off it go, you don't train the policy network to imitate the MCTS action.

You train it to imitate the MCTS distribution. But both of these are actually valid. And if you wanted to do a scientific experiment of like, how important are this kind of soft label, dark knowledge distillation, you can run an experiment where you retrain the policy network on the action MCTS selected rather than the software. Interesting. Early hours or something around.

Intuitively, why is this ability to do iterative search where you don't necessarily need to be able to win the game in the beginning, you just need to be able to improve your current policy? Why is that so powerful on capability and learning compared to how Elle and currently learn RL? And, and yes, exactly this thing of this is considered your past rate of the entire trajectory. I actually don't know a way to think about this. Maybe you should help me out here.

Well, why is AlphaGo an elegant RL algorithm? Like, so, the major reason is that you never have to initialize at a zero percent success rate and solve the exploration problem of how to get a non-zero success. And this is what allows you to hill climb this beautiful supervised learning signal where, and if you look at actual implementation of AlphaGo, every step of the way, there's no, there's actually no, you know, TD error learning or dynamic programming, at least explicitly, it's just supervised learning on a value classification as well as a policy, you know, KL minimization. So it's just a supervised learning problem on improved labels. And so the training is very stable, right? You can train like, as big of a network as you want, you can kind of retrain this

on the dataset. Everything will just go stably. The infrastructure is very simple to implement as well. You don't need a complex distributed system to kind of keep everything on policy. At the end of the day, you're just saying like, I have some improved labels, let's retrain my supervised model on these targets. And so you're always in this beautiful regime where you're just trying to

improve the policy rather than escape this kind of like, sort of local minima where every signal is flack all around you. So one way to draw the curve is like, if you draw the sort of win rate of an MCTS policy versus the raw network, let's say that's dotted line as the raw network, the MCTS policy kind of looks like this. And so every step of the way, this supervision signal is very clean. You're never in a situation where, you know, the MCTS is kind of like giving you no signal unless your MCTS distribution converges to exactly what your policy is. No, no, no. Okay, that's a great way to explain it.

Cool. Okay, maybe we sit down and I ask some questions about automated research. Okay. One thing I really wanted to talk to you about is that you did a bunch of the research for this project through this kind of automated LLM coding assistant loop. And there's an idea that if you fully automated AI research, you can have some sort of singularity. Obviously, we're not

there yet, but to the extent that we have early indications of what this process might look like, I am curious what your observations about, what the AI is good at, what it's not good at, what you think about this scenario, likelihood, eventually, what thoughts you have about this in general? For sure. Yeah. I think automated scientific research is one of the most exciting skills that Frontier Labs are developing right now. And I think it's important for everyone who's doing any kind of research to get a good intuition of like what can do now and what it can and how might the sort of science process work in the future once we're having AI is automating a lot of this investigation. So in brief, I mostly use Opus 4.6 and 4.7 throughout the working on this. And

what works is that the models can do a very good job of doing hyperparameter optimization. So in the past, people would come up with a search based hyperparameters like learning rate and wait decay and maybe how many layers are in your network and they would just kind of do a grid search or a sort of Bayesian hyperparameter optimization approach. And then it would find some tune parameters. The kind of really cool thing that automated coding can do now is that it can search a much more open ended set of problems. It can say like, well, I've identified that the gradients are kind of small in this layer. So let me change it up here. Let me rewrite the codes of the data loader as a

new augmentation I came up with. Let's sort of try to find the best way to fit the constraints of the optimization problem. And you end up with this much more flexible and kind of high level, almost like grad student like ability to just, you know, grind a performance metric. And so this can squeeze out quite a lot of performance. You know, on a fixed dataset with a fixed time budget, improve perplexity by quite a lot on a sort of classification problem like LMZOR or Go.

And it is also fantastic now at basically executing any experiment. So I have a clock scale that I wrote called experiment where I give it a description of what I wanted to plot. And like I just described here's the x-axis. I want to use the y-axis, answer this question for me. And it'll go run off and do all the experiments, compile the plot, make a report, and suggest like, what might have caused it or so forth. So that's what works quite well today. And I think we can

expect that these abilities get better in the future. But it's also kind of useful to know, you know, what is it not doing so well today? So on my blog version of this tutorial, I have a plot of basically all the kind of experiments I did grouped in a sort of tree where every node kind of represents a failed successful or sort of mixed experimental result. And then from there, branches off into a child where it's like the follow on experiment, occasionally I'll kind of rabbit hole down a track like this off policy MCTS, reliably do a few experiments and then realize it's probably not worth it. So then I'll kind of jump to a completely different track.

And I call these kind of things like rows. So what I find is that current, you know, close models that we can access, the public can access today, they don't seem to be that great at selecting what the next experiment should be in a given track. And they don't seem to be able to kind of step back and do the lateral thinking of like, wait a minute, this track doesn't really make sense. Like, let's go back to sort of first principles and think about, you know, what the bottleneck might be or like, what are we trying to achieve? And so often I had to catch in for bugs myself by prompting the right question to clads like investigate, you know, what is causing this discrepancy? And then it'll answer the question. I think with like, you know,

meet those class models or meet those plus models coming online, maybe this just completely changes and these these problems just fall to to just improve scaling. But at the same time, I think there's a lot of like rich opportunity to develop our environments that might incentivize this kind of lateral thinking. And so one of the motivations for setting up this go environment was that I think that, you know, go captures a lot of very interesting research problems, often overlapping with, you know, LMS or robotics. And yet it's like very quick to verify. The outer loop is ultimately like does the agent do what I think it does and even kind of check the outcome of the go game quite easily. And then the inner loop involves all this kind of like, you know,

research engineering around distributed systems, predicting whether an idea is going to work or not, predicting the difference of particular modification to your training algorithm might make. And I think there's a rich library of subtasks and sub environments that you can kind of train and automated scientists to work on with go as sort of outer verification loop that then once you acquire these skills, maybe you can apply them to like other domains like, you know, biosciences or robotics or automated research, which is the real crux or the scary slash incredible thing for just making AI making future versions of the eyes. And you're suggesting the outer loop you're just going to just be your win rating is kind of go basically. That's one of them. I think there's a lot of deeper questions that one could tackle, right? So for example, let's say you have an idea on how to improve

a scaling law, compute multiplier. The outcome isn't necessarily like I achieved the best go bot ever. The outcome might just be like, can I predict what the win rate of my go bot will be? Or can I predict the scaling law plots that emerged from my idea? But then you can verify that you haven't ever worked hacked anything by using a very verifiable game like go on the outer loop.

I think there's a couple of interesting follow-on questions. There's questions on the inner loop in the outer loop. On the inner loop, there's a question of how locally verifiable any modification you might make is that is to say, could, would you know whether something is actually improvement or degradation, somebody I use try out, would you know that if something isn't working as a result of a bug or is it the result of the idea itself being wrong, the idea was talking about why having one of the reasons he thinks he's a good researcher is he's a good researcher. One of the things he thinks makes him a good researcher is that he has intuition about his strong belief in what the correct idea is and he is able to persevere through bugs and know which things are bugs versus mistakes in the fundamental idea based on his high level belief about this idea should work so therefore it's there has to be bugs versus the other way around. Why don't we start with that question actually? Yeah, how

locally verifiable are things which are good ideas? Yeah, I think as in the case of the success story for deep learning, you can think about this as like a decades-long idea that took like took a lot of faith to get it to work. And so this presents a very challenging long horizon, you know, RL problem where every step of the way you have like a committee telling you that this is a bad idea and then ultimately you break it through. And so like how do you design RL environments that maybe give you some feedback earlier? And I think this is a very tough open question that I don't have an answer to.

But you know, ultimately to play a very strong go-bought, you probably did need to discover deep learning. And so I think that like having a challenging game that cannot be cheated easily on the outer loop could be used as a sort of outer loop signal for something like discovering the principles of deep learning. Now of course, like to make it tractable, and this is where research takes really matters, like you have to come up with ways to initialize your problem so that you don't solve a sort of very intractable problem. Like maybe you can leverage LMs as a sort of a universal grammar in the middle to kind of give you some sort of local feedback. The fact that LMs are universal grammar means that they can kind of move at almost any level of the stack. They can think very locally as well as step back

and think like in very broad steps. And I think that's where a lot of the lateral thinking ability of humans is going to come from. Like how to know if the track that you're pursuing or the objective that you're pursuing is not right, and you should be asking a different question. The other question is how stackable local improvements are in the attempt to get to a better result on the outer loop. I've heard rumors that at some AI labs, the thing that has gone wrong is that people will individually pursue good ideas. But those don't end up stacking well. And so the

training run falls because of some weird interaction between two seemingly good ideas and having a single top-down vision of how things should work is very important. Having worked at different AI labs and also playing around with I guess parallel agents trying to run ideas. What is your sense of how parallelizable AI innovation is? Yeah, great question. I think the research tastes for executing well on the better lesson is that you need to know how much the better lesson can buy you and how much is too much to ask for.

At any given moment, of course in the fullness of time, compute is the single most important determinant on how things work. And it's almost inevitable that as you see all the energy and compute and parameters, the intelligence will just fall out of that. And that's super beautiful, super profound. No algorithm that can tell really matters beyond that. But in present day, we don't have infinite compute and parameters and arbitrarily good initialization. So we have to

come up with like heuristics that kind of give us that. But these heuristics are probably somewhat redundant. So that's probably why you see this effect where a lot of these compute multipliers don't necessarily stack. They might have some correlated benefit. And then three years down the line when the video GPUs have gone even stronger, maybe they stack even less well.

At any given point in time, the benefit of any given compute multiplier is transitory, which is what I suspected was the Cottago paper. There's many algorithmic ideas applied. And then you can see that with modern blackwell GPUs and Ada class GPUs that are much better than the V100 grade GPUs that the paper used, you can see that some of these algorithm tricks to speed up convergence just don't matter so much compared to something else. And I think that's a matter of taste in the present time. Yeah, interesting. How about the outer loop? How verifiable for making AI smarter?

With girl, you do have this outer loop of win rate against the best open source model out there. And even there, as you were saying, there are other outer loops of did you discover new phenomenon, which is actually very hard to if you didn't know scaling laws were important, if you're back in when was Chinchilla or Kaplan scaling was released? Twentyteen. Yeah. So if you're back in 2015, there's not an automated procedure one can easily imagine of knowing which paper is the scaling loss paper versus which is just like another random plot. And so that even in the go cases are

hard to verify outer loop. And the whole idea of an outer loop is to have some backstop on improvement. But let alone for general AGI, we're supposed to have a bunch of these benchmarks, but there's a problem that we know the things we can measure and we improve on the things we can measure, but we care about this broader ability to do economically useful work, which is at least until you automate not super easy to measure. So yeah, there's a question up. How good is the outer verification loop for for the self improvement? And does that matter? Yeah. I'm going to give a non rigorous

argument, but one that I intuitively believe, which is that, you know, divine AI research lab, they started as a sort of focus on games, right? Like they kind of use games as their outer loop, and then the researchers learned from experience of solving games, and then like now they're working on ellipse. And presumably, there was some positive transfer from their time working on games and like Atari and go and and Starcraft that like now helps them make good ellipse. Like I assume that there's like positive transfer in some regard, whether it's coding or general research ability or project management, right? Like all these things kind of like probably help them do well. And so

if that's the case, why wouldn't it also be true for automated AI researchers? Like they should be able to positively transfer experience tackling quick to verify, quick to innovate on environments to something more ambitious and economically useful, like automating drug discovery or so forth. I mean, I don't know if it hasn't been issued with historically until you jump in after or whatever, been a couple of years ago, people were saying, look, Google hasn't, isn't catching up in LLM's because they're too tight to the old approach. And yeah, there's gains, but there's also there's ways in which actively hinders you. It's actually not obvious to me that there's like, the jury's still out, right? I think like, who knows if the, you know, let's say currently Google's

doing quite well, who knows if the initialization on training on games is ultimately going to hobble their ability to be the winner in the long term, right? Like, it's hard to say for sure. And you know, likewise, who knows if the late seeming late start was really just them kind of pre-training for longer and how to scale up GPUs, or they invested other tech tree and like getting TPUs to be good, which seemed not that useful in the short term, but then the long term it becomes maybe like a, so it's even hard for humans to reason about what the optimal research strategy should be, even with the data we have today. Yeah, cool. Okay, we should let people know how they can find out more about this project, whether to fork it themselves, whether to check out your blog, whether to do an excellent job explaining these ideas. Where do people go next?

Right. Yeah. So my website is EVJ.com. There's a blog post that kind of links to an interactive version of this tutorial. And I'm like, GitHub, which is the username is just Eric Chang. There's

a, there's a auto go repo that people can fork and reproduce the training. And I also highly recommend people check out this blog post as Rox may think, which we touched on some of the ideas in this conversation. But it's this grander, you know, thesis of what happens when you have thinking as a primitive in the science exactly. Exactly. And I encourage the audience to think about the relationship between thinking and go via MCTS and search and how it relates to LMS. I think there's something quite like profound there. And probably underexplored

just because Go has been relatively underexplored compared to the boom in LMS. It's not to say that I think we should have trees in our LMS, but there's some very interesting duality between them. And you can actually do a lot of research on Go, MCTS and reasoning with very small budgets. That's great. Cool. Awesome. Eric, thanks for doing this. It's an honor to be on the podcast.

Frequently asked questions

How long is this episode of Dwarkesh Podcast?

This episode is 2 hours and 37 minutes long.

When was this Dwarkesh Podcast episode published?

This episode was published on May 15, 2026.

Is there a transcript available for this episode?

Yes, a full transcript is available for this episode. You can read the complete transcript on the episode page.

Can I download this Dwarkesh Podcast episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.