Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

~11 min readNature 2016

AlphaGo,
explained.

Go was supposed to be safe from computers for another decade. Its board has more possible positions than there are atoms in the universe, so brute-force search — the thing that cracked chess — simply can't reach the bottom. AlphaGo won anyway, by teaching search where to look: a policy network to whisper "these are the moves worth considering," a value network to judge "here's who's ahead," and a tree search to weave them into a plan. It beat a world champion, and its recipe reshaped how machines make decisions. Here's the search, the networks, and the rule that balances them.

The delta

What changes against DQN and PPO: the agent gets to think before acting

Rungs 1 and 2 are both reactive: a state goes in, an action comes out, and all the computation that improved the decision happened during training. Neither spends extra effort at decision time on a hard position. AlphaGo's change is to put a search between the network and the move, so the quality of a decision can be bought with compute at the moment it is needed.

Why Go forced this: the branching factor is on the order of 250 legal moves per position against roughly 35 for chess, so searching to any useful depth by enumeration is hopeless, and unlike chess there is no good hand-written function for judging who is ahead. Both of the things that made computer chess work were unavailable.

The construction supplies both from learning, and the division of labour is the thing to carry up the ladder. A policy network proposes a short list of plausible moves, which prunes the 250-wide tree to something searchable. A value network estimates who is winning from a position, which removes the need to search to the end of the game. Monte Carlo tree search then spends its budget where it matters, selecting branches by a rule that balances the policy's prior and the estimated value against how often a branch has already been tried — exploit what looks good, but not so exclusively that a good move with a low prior is never examined. The networks were bootstrapped from a large corpus of human expert games and then improved by self-play.

01

Why Go resisted

Chess programs win by searching: look ahead many moves, evaluate the resulting positions with a hand-crafted scoring function, and pick the line that leads somewhere good. Go breaks this on two axes. Its branching factor is enormous — around 250 legal moves per turn versus chess's ~35 — so the tree explodes far faster. And no one knew how to write a good evaluation function for a Go position; the value of a board is famously subtle, resisting the tidy piece-counting that works in chess.

So AlphaGo's problem was really two problems: the tree is too wide to search fully, and positions are too subtle to score by rule. Its answer was to learn both from data. A policy network learned which moves are worth considering — narrowing the tree — and a value network learned to score positions — replacing the missing evaluation function. Deep learning supplied the intuition; tree search supplied the calculation. Neither alone was enough; together they were superhuman.

The one-sentence version

Learn a policy network to narrow the search to promising moves and a value network to judge positions, then let Monte Carlo Tree Search combine them into strong play.

02

Policy and value

Two deep networks read the board. The policy network outputs a probability over moves — a prior saying which moves look good before any search. This is what tames the branching factor: instead of considering all ~250 moves seriously, the search concentrates on the handful the policy rates highly. The value network outputs a single number — an estimate of the probability that the current player wins from this position. This is the learned evaluation function Go never had.

Both are crucial to making search tractable. Earlier Go programs evaluated a position by playing it out to the end with fast random moves (Monte Carlo rollouts) — noisy and slow. AlphaGo's value network estimates the outcome directly from the position, and a separate small, fast rollout policy handles whatever rollouts it still does. The networks turn an impossible search into a guided one.

03

Tree search + PUCT

Monte Carlo Tree Search grows a search tree one simulation at a time. Each simulation: select a path down the tree, expand a new leaf, evaluate it with the value network, and back up the result to update every node on the path. The heart is the selection rule, PUCT, which decides at each node which move to explore by balancing exploitation against exploration:

(Strictly, the √ΣN factor is the PUCT form introduced with AlphaGo Zero; the original AlphaGo bonus was proportional to P(a)/(1 + N(a)).) The first term Q(a) = W/N is the move's average result so far — pure exploitation, pick what's been working. The second rewards moves with high policy prior P(a) and few visits N(a) — exploration, try promising or under-explored moves. Early on, the prior dominates and search follows the policy network's intuition; as a move accumulates visits, its exploration bonus shrinks and the choice increasingly trusts its measured value. Each simulation backs up its leaf value, incrementing visit counts and refining Q. After thousands of simulations, the most-visited move at the root is played. The runnable version below shows PUCT favoring the prior early and the value late.

04

How it learned

AlphaGo's networks were trained in stages, each building on the last:

The training pipeline
Imitate humansSupervised learning: policy net predicts expert moves from a database of human games.
Self-play RLThe policy improves by playing itself and reinforcing moves that led to wins.
Value from self-playThe value net learns to predict the winner of self-play games.
Search at play timeMCTS uses both networks to choose moves in real games.

Starting from human games gave the policy a strong initialization; self-play then pushed it past human play by discovering moves no human database contained. The value network, trained on the outcomes of these self-play games, learned to judge positions the way a strong player would. Its successor, AlphaGo Zero, later removed the human data entirely — learning from pure self-play, tabula rasa, and surpassing the original.

How it works

AlphaGo step by step: four networks, then a search that blends two evaluations

AlphaGo is not one network. It is a training pipeline that produces four learned components, and a search that uses all of them at play time.

root PUCT picks the path leaf s_L Value net v(s_L) one forward pass Fast rollout policy plays to the end, z = ±1 V = (1−λ)v + λz mix, λ = 0.5 back up V along the selected path prior P comes from the SL policy network
One simulation in AlphaGo's search. The leaf is evaluated by two independent estimators, and their weighted mix is the number that updates the tree.
  1. Train a supervised (SL) policy network on human games. A 13-layer convolutional network reads the board and predicts the move an expert played. It was trained on about 30 million positions from a public online Go server and predicted the expert move about 57 percent of the time, against about 44 percent for the best earlier result.
  2. Train a small, fast rollout policy. A linear model over simple local board patterns predicts expert moves about 24 percent of the time, but picks a move in about 2 microseconds, against about 3 milliseconds for the big network. It exists only to play simulated games to the end quickly.
  3. Improve a copy by self-play (the RL policy). Start from the SL network, then play it against randomly chosen earlier versions of itself, rewarding +1 for a win and −1 for a loss with a policy-gradient update. Opponents are drawn from older versions so the policy does not overfit to one rival. This network beat the SL network about 80 percent of the time head to head.
  4. Train a value network on self-play outcomes. A network with the same body as the policy network but a single output regresses toward who won. Training on every position of a game overfit badly, because positions from the same game share one outcome and the network memorized them. So the training set holds one position from each of 30 million distinct self-play games.
  5. Select inside the tree. Every edge stores a prior P (from the SL policy), a visit count N and an average value Q. From the root, walk down by taking the move with the highest Q plus a bonus that is large for high-prior, rarely visited moves and shrinks as N grows.
  6. Expand and evaluate the leaf two ways. At a new leaf, the policy network supplies priors for its children, then the leaf is scored twice. The value network gives one estimate from a single forward pass. The fast rollout policy plays the game to the end and yields a win or a loss. The two are mixed as V = (1 − λ)v + λz, with λ = 0.5 working best of the values the authors tried.
  7. Back up. Each edge on the path updates its visit count and sets Q to the average of the leaf evaluations that passed through it.
  8. Play the most-visited move at the root. Visit count is more stable than raw value, so it is the choice rule.

Why the prior comes from the SL policy

The RL policy was the stronger player on its own, but inside the search the SL policy worked better as the prior. The authors' explanation is that human moves are a broader set of reasonable candidates, while the RL policy concentrates on the single move it prefers and so offers the search fewer alternatives. The RL policy still earned its place, because the value network was trained on its games.

Compute

The networks run on GPUs and the rollouts on CPUs, asynchronously. The single-machine version used 48 CPUs and 8 GPUs. The distributed version used 1,202 CPUs and 176 GPUs.

The math

Selection, leaf evaluation and the two training signals

at = argmaxa [ Q(st, a) + u(st, a) ], u(s, a) ∝ P(s, a) / (1 + N(s, a))
V(sL) = (1 − λ) · vθ(sL) + λ · zL, λ = 0.5
  • Q(s, a) — mean of the leaf evaluations seen below this edge, the exploitation term.
  • u(s, a) — the exploration bonus; high for a large prior and few visits, fading as visits accumulate.
  • P(s, a) — prior probability from the SL policy network.
  • vθ — the value network; zL — the win or loss from the fast rollout.
  • RL policy training moves the weights along ∂ log pρ(at | st) / ∂ρ, scaled by the game outcome z; the value network moves along (∂vθ/∂θ)(z − vθ(s)).

Worked example: if the value network says 0.30 for a leaf (on a scale of −1 to 1) and the rollout ends in a win (z = +1), the mixed value is 0.5 × 0.30 + 0.5 × 1 = 0.65.

The evidence

Component strengths, the leaf-evaluation ablation, and the matches

The paper measures its pieces separately, which is why it is possible to say what each contributed.

ComponentMeasured result
SL policy networkabout 57% expert-move accuracy; about 44% for the best earlier result
Fast rollout policyabout 24% accuracy; about 2 microseconds per move
RL policy vs SL policywon about 80% of games
RL policy vs Pachi, no searchwon about 85%; the SL policy won about 11%
Value network vs rollouts with the RL policysimilar accuracy at roughly 15,000 times less computation

The ablation on leaf evaluation compared a search using only the value network, only rollouts, and the mix. Each single-evaluator version was already stronger than every other Go program tested, and the mix with λ = 0.5 was clearly stronger than either. The two estimators are complementary: the value network is fast and smooth, rollouts are slow and noisy but unbiased about real endings.

Against other programs, the single-machine version won 494 of 495 games, and the distributed version won about 77 percent of games against the single-machine version. In October 2015 the distributed version beat the European champion Fan Hui 5–0 in formal games. The 4–1 win over Lee Sedol in March 2016 came after the paper appeared, with an updated system.

Since then

What the authors admit, and what happened next

The system's dependencies are stated plainly, and every one of them is a target the next rung removes: it needs a database of human games to start from, it needs a separately-trained fast rollout policy to finish simulations cheaply, it runs several distinct networks, and it needs a large distributed compute setup to play at full strength. The paper is a demonstration that the combination works, not a claim that it is minimal.

What it only partly resolves is how much of the strength came from which part. The paper does ablate the leaf evaluation (value network only, rollouts only, or a mix), but the search, the learned prior and the learned evaluation all contribute, and separating them fully is the kind of ablation that a match against a human champion does not provide.

How it held up: the template held completely — a learned prior to propose, a learned evaluation to judge, and search at decision time to combine them is still the shape of every strong game-playing system. The specifics did not survive one year: rung 4 discards the human games, the rollout policy and the separate networks, and is stronger for it. The deepest consequence is elsewhere entirely. "Spend compute at decision time to improve a decision" is the idea that the reasoning ladder rediscovered for language models a long time later, and the search-improves-the-policy loop below is what reinforcement learning on reasoning traces approximates.

SOLVE IT YOURSELF

PUCT: exploit vs explore

The engine of AlphaGo's search is one selection formula. This computes PUCT — Q(a) plus an exploration bonus that grows with the policy prior P and shrinks with visits N. Watch it in action: the mean value is Q = W/N, the exploration term collapses as a move is visited more (3.75 at one visit, 0.15 at fifty), so early in the search two equally-tried moves are separated by their prior (the policy network's hunch), while late in the search — with thousands of visits — the higher-Q move wins even if its prior was low. Backing up a result increments the visits and updates Q. Change the priors, values, or visit counts and watch the balance tip.

YOUR TASK

Write the body of select. Everything else in the file is already written; this is the function the paper is about. Press ▶ Run to check it against the 5 assertions below — they start red.

WHAT IT HAS TO SATISFY — 5 ASSERTIONS
  1. Mean value Q = W / N
  2. The exploration term shrinks as visits grow
  3. At equal Q and visits, higher prior is selected
  4. With many visits, higher Q wins despite lower prior
  5. Backup increments visits and accumulates value
CPython · WebAssembly
06

What it became

AlphaGo's lineage generalized fast. AlphaGo Zero dropped human data and learned Go from scratch by self-play; AlphaZero generalized the same algorithm to chess and shogi with no game-specific knowledge; MuZero learned the rules themselves, planning in a learned model of the environment. The through-line is a single algorithm — search guided by learned policy and value, improved by self-play — applied ever more generally.

Its deepest influence, though, is the idea of scaling test-time search. AlphaGo showed that spending more compute at decision time — running more MCTS simulations — makes a system stronger, separately from training. That principle, learned intuition amplified by deliberate search, is exactly what today's reasoning models revive: generate and evaluate many lines of thought before answering. From a board game to self-improving reasoners, the same bet — think longer, search guided by learned judgment — keeps paying off.

Worth knowing

The exploration constant c in PUCT is the knob that sets how boldly the search tries the policy's suggestions versus trusting measured results — too low and it under-explores, too high and it wastes simulations. Tuning it is part of making MCTS work.

Questions

Questions people ask about AlphaGo

Why did AlphaGo use both a value network and a rollout policy?

The two estimate different things. The value network predicts the winner from a position in one forward pass, which is fast but can be biased. The fast rollout policy plays the game to the end, which is noisy but reflects what actually happens. AlphaGo mixed them with weight one half each, and that mix was clearly stronger than either alone, although each alone still beat every other Go program tested.

What is the difference between AlphaGo's SL policy and RL policy?

The SL policy was trained to predict moves from about 30 million positions of human expert games and matched the expert move about 57 percent of the time. The RL policy started as a copy of it and then improved through self-play, rewarded only for winning. Head to head the RL policy won about 80 percent of games. Surprisingly, the SL policy worked better as the prior inside the search.

Why was the value network trained on only one position per game?

Positions from the same game share one outcome and look very similar. When the authors trained on whole games, the network memorized outcomes instead of learning to judge positions, and it generalized badly. They generated 30 million separate self-play games and kept one position from each, which broke that correlation and produced a value network that was nearly as accurate as many rollouts at a tiny fraction of the cost.

How did AlphaGo choose its final move?

It played the move with the highest visit count at the root of the search tree, not the move with the highest average value. Visit counts are more stable, because a move with an unusually high value from only a few visits can be a fluke. During search, selection used a rule that adds a bonus based on the policy prior and shrinks with visits, so promising moves get examined deeply.

How much hardware did AlphaGo use?

The paper reports a single-machine version running on 48 CPUs and 8 GPUs, and a distributed version with 1,202 CPUs and 176 GPUs. The neural networks were evaluated on GPUs while rollouts ran on CPUs. The distributed version beat the single-machine version about 77 percent of the time, which shows that extra compute gave a clear, though not unlimited, increase in strength.

Check yourself

3 questions to test what you just read

Work each one out before you open it — a number, a prediction or a reason, not a definition. Producing the answer is what makes it stick. Your progress is kept on this device.

A leaf gets value-network output −0.2 and its rollout is a loss (z = −1). What is the mixed value with λ = 0.5?

Show answer

V = 0.5 × (−0.2) + 0.5 × (−1) = −0.1 − 0.5 = −0.6. Both estimators agree the leaf is bad, so the blend is clearly negative. If the rollout had been a win, the blend would be +0.4 instead.

Two moves have equal Q. One has prior 0.5 and 9 visits, the other prior 0.1 and 0 visits. Which does the exploration bonus favor, assuming the bonus is proportional to P/(1+N)?

Show answer

The first has a bonus proportional to 0.5/(1+9) = 0.05. The second has 0.1/(1+0) = 0.1, double. So the unvisited move is chosen next despite its smaller prior. After a visit or two, its bonus drops and the prior of the first move competes again.

Why would a search using only rollouts with a weak fast policy be unreliable even with many simulations?

Show answer

Each rollout is a noisy, single game played by a weak linear policy, so the outcome partly reflects the rollout policy's own mistakes rather than the position. More simulations reduce random noise but not that systematic bias. A value network trained on stronger self-play games corrects the bias, which is one reason the mix helped.

Where this sits

Learning by trial and error

Reward, policy, search. The line from Atari to a Go engine that was never shown a human game — and the algorithm (PPO) that RLHF later borrowed wholesale.

  1. 1DQN2015
  2. 2PPO2017
  3. 3AlphaGo2016
  4. 4AlphaZero2018
  5. 5MuZero2020

All 110 papers, in 19 ladders →

Mastering the Game of Go with Deep Neural Networks and Tree Search · Silver, Huang, Maddison, et al. · DeepMind · Nature 2016 · read the original paper → · Vibe Engines · 2026
Finished this one? 0 / 110 Paper Breakdowns done
NextAlphaZero Next on the “Learning by trial and error” ladder · rung 4 of 5

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns