Mastering the game of Go with deep neural networks and tree search

Published online:


The game of Go has long been viewed as the most challenging of classic games for artificial intelligence owing to its enormous search space and the difficulty of evaluating board positions and moves. Here we introduce a new approach to computer Go that uses ‘value networks’ to evaluate board positions and ‘policy networks’ to select moves. These deep neural networks are trained by a novel combination of supervised learning from human expert games, and reinforcement learning from games of self-play. Without any lookahead search, the neural networks play Go at the level of state-of-the-art Monte Carlo tree search programs that simulate thousands of random games of self-play. We also introduce a new search algorithm that combines Monte Carlo simulation with value and policy networks. Using this search algorithm, our program AlphaGo achieved a 99.8% winning rate against other Go programs, and defeated the human European Go champion by 5 games to 0. This is the first time that a computer program has defeated a human professional player in the full-sized game of Go, a feat previously thought to be at least a decade away.


All games of perfect information have an optimal value function, v*(s), which determines the outcome of the game, from every board position or state s, under perfect play by all players. These games may be solved by recursively computing the optimal value function in a search tree containing approximately bd possible sequences of moves, where b is the game’s breadth (number of legal moves per position) and d is its depth (game length). In large games, such as chess (b ≈ 35, d ≈ 80)1 and especially Go (b ≈ 250, d ≈ 150)1, exhaustive search is infeasible2,3, but the effective search space can be reduced by two general principles. First, the depth of the search may be reduced by position evaluation: truncating the search tree at state s and replacing the subtree below s by an approximate value function v(s) ≈ v*(s) that predicts the outcome from state s. This approach has led to superhuman performance in chess4, checkers5 and othello6, but it was believed to be intractable in Go due to the complexity of the game7. Second, the breadth of the search may be reduced by sampling actions from a policy p(a|s) that is a probability distribution over possible moves a in position s. For example, Monte Carlo rollouts8 search to maximum depth without branching at all, by sampling long sequences of actions for both players from a policy p. Averaging over such rollouts can provide an effective position evaluation, achieving superhuman performance in backgammon8 and Scrabble9, and weak amateur level play in Go10.

Monte Carlo tree search (MCTS)11,12 uses Monte Carlo rollouts to estimate the value of each state in a search tree. As more simulations are executed, the search tree grows larger and the relevant values become more accurate. The policy used to select actions during search is also improved over time, by selecting children with higher values. Asymptotically, this policy converges to optimal play, and the evaluations converge to the optimal value function12. The strongest current Go programs are based on MCTS, enhanced by policies that are trained to predict human expert moves13. These policies are used to narrow the search to a beam of high-probability actions, and to sample actions during rollouts. This approach has achieved strong amateur play13,14,15. However, prior work has been limited to shallow policies13,14,15 or value functions16 based on a linear combination of input features.

Recently, deep convolutional neural networks have achieved unprecedented performance in visual domains: for example, image classification17, face recognition18, and playing Atari games19. They use many layers of neurons, each arranged in overlapping tiles, to construct increasingly abstract, localized representations of an image20. We employ a similar architecture for the game of Go. We pass in the board position as a 19 × 19 image and use convolutional layers to construct a representation of the position. We use these neural networks to reduce the effective depth and breadth of the search tree: evaluating positions using a value network, and sampling actions using a policy network.

We train the neural networks using a pipeline consisting of several stages of machine learning (Fig. 1). We begin by training a supervised learning (SL) policy network pσ directly from expert human moves. This provides fast, efficient learning updates with immediate feedback and high-quality gradients. Similar to prior work13,15, we also train a fast policy pπ that can rapidly sample actions during rollouts. Next, we train a reinforcement learning (RL) policy network pρ that improves the SL policy network by optimizing the final outcome of games of self-play. This adjusts the policy towards the correct goal of winning games, rather than maximizing predictive accuracy. Finally, we train a value network vθ that predicts the winner of games played by the RL policy network against itself. Our program AlphaGo efficiently combines the policy and value networks with MCTS.

Figure 1: Neural network training pipeline and architecture.
Figure 1

a, A fast rollout policy pπ and supervised learning (SL) policy network pσ are trained to predict human expert moves in a data set of positions. A reinforcement learning (RL) policy network pρ is initialized to the SL policy network, and is then improved by policy gradient learning to maximize the outcome (that is, winning more games) against previous versions of the policy network. A new data set is generated by playing games of self-play with the RL policy network. Finally, a value network vθ is trained by regression to predict the expected outcome (that is, whether the current player wins) in positions from the self-play data set. b, Schematic representation of the neural network architecture used in AlphaGo. The policy network takes a representation of the board position s as its input, passes it through many convolutional layers with parameters σ (SL policy network) or ρ (RL policy network), and outputs a probability distribution or over legal moves a, represented by a probability map over the board. The value network similarly uses many convolutional layers with parameters θ, but outputs a scalar value vθ(s′) that predicts the expected outcome in position s′.

Supervised learning of policy networks

For the first stage of the training pipeline, we build on prior work on predicting expert moves in the game of Go using supervised learning13,21,22,23,24. The SL policy network pσ(a|s) alternates between convolutional layers with weights σ, and rectifier nonlinearities. A final softmax layer outputs a probability distribution over all legal moves a. The input s to the policy network is a simple representation of the board state (see Extended Data Table 2). The policy network is trained on randomly sampled state-action pairs (s, a), using stochastic gradient ascent to maximize the likelihood of the human move a selected in state s

We trained a 13-layer policy network, which we call the SL policy network, from 30 million positions from the KGS Go Server. The network predicted expert moves on a held out test set with an accuracy of 57.0% using all input features, and 55.7% using only raw board position and move history as inputs, compared to the state-of-the-art from other research groups of 44.4% at date of submission24 (full results in Extended Data Table 3). Small improvements in accuracy led to large improvements in playing strength (Fig. 2a); larger networks achieve better accuracy but are slower to evaluate during search. We also trained a faster but less accurate rollout policy pπ(a|s), using a linear softmax of small pattern features (see Extended Data Table 4) with weights π; this achieved an accuracy of 24.2%, using just 2 μs to select an action, rather than 3 ms for the policy network.

Figure 2: Strength and accuracy of policy and value networks.
Figure 2

a, Plot showing the playing strength of policy networks as a function of their training accuracy. Policy networks with 128, 192, 256 and 384 convolutional filters per layer were evaluated periodically during training; the plot shows the winning rate of AlphaGo using that policy network against the match version of AlphaGo. b, Comparison of evaluation accuracy between the value network and rollouts with different policies. Positions and outcomes were sampled from human expert games. Each position was evaluated by a single forward pass of the value network vθ, or by the mean outcome of 100 rollouts, played out using either uniform random rollouts, the fast rollout policy pπ, the SL policy network pσ or the RL policy network pρ. The mean squared error between the predicted value and the actual game outcome is plotted against the stage of the game (how many moves had been played in the given position).

Reinforcement learning of policy networks

The second stage of the training pipeline aims at improving the policy network by policy gradient reinforcement learning (RL)25,26. The RL policy network pρ is identical in structure to the SL policy network, and its weights ρ are initialized to the same values, ρ = σ. We play games between the current policy network pρ and a randomly selected previous iteration of the policy network. Randomizing from a pool of opponents in this way stabilizes training by preventing overfitting to the current policy. We use a reward function r(s) that is zero for all non-terminal time steps t < T. The outcome zt = ± r(sT) is the terminal reward at the end of the game from the perspective of the current player at time step t: +1 for winning and −1 for losing. Weights are then updated at each time step t by stochastic gradient ascent in the direction that maximizes expected outcome25

We evaluated the performance of the RL policy network in game play, sampling each move from its output probability distribution over actions. When played head-to-head, the RL policy network won more than 80% of games against the SL policy network. We also tested against the strongest open-source Go program, Pachi14, a sophisticated Monte Carlo search program, ranked at 2 amateur dan on KGS, that executes 100,000 simulations per move. Using no search at all, the RL policy network won 85% of games against Pachi. In comparison, the previous state-of-the-art, based only on supervised learning of convolutional networks, won 11% of games against Pachi23 and 12% against a slightly weaker program, Fuego24.

Reinforcement learning of value networks

The final stage of the training pipeline focuses on position evaluation, estimating a value function vp(s) that predicts the outcome from position s of games played by using policy p for both players28,29,30

Ideally, we would like to know the optimal value function under perfect play v*(s); in practice, we instead estimate the value function for our strongest policy, using the RL policy network pρ. We approximate the value function using a value network vθ(s) with weights θ, . This neural network has a similar architecture to the policy network, but outputs a single prediction instead of a probability distribution. We train the weights of the value network by regression on state-outcome pairs (s, z), using stochastic gradient descent to minimize the mean squared error (MSE) between the predicted value vθ(s), and the corresponding outcome z

The naive approach of predicting game outcomes from data consisting of complete games leads to overfitting. The problem is that successive positions are strongly correlated, differing by just one stone, but the regression target is shared for the entire game. When trained on the KGS data set in this way, the value network memorized the game outcomes rather than generalizing to new positions, achieving a minimum MSE of 0.37 on the test set, compared to 0.19 on the training set. To mitigate this problem, we generated a new self-play data set consisting of 30 million distinct positions, each sampled from a separate game. Each game was played between the RL policy network and itself until the game terminated. Training on this data set led to MSEs of 0.226 and 0.234 on the training and test set respectively, indicating minimal overfitting. Figure 2b shows the position evaluation accuracy of the value network, compared to Monte Carlo rollouts using the fast rollout policy pπ; the value function was consistently more accurate. A single evaluation of vθ(s) also approached the accuracy of Monte Carlo rollouts using the RL policy network pρ, but using 15,000 times less computation.

Searching with policy and value networks

AlphaGo combines the policy and value networks in an MCTS algorithm (Fig. 3) that selects actions by lookahead search. Each edge (s, a) of the search tree stores an action value Q(s, a), visit count N(s, a), and prior probability P(s, a). The tree is traversed by simulation (that is, descending the tree in complete games without backup), starting from the root state. At each time step t of each simulation, an action at is selected from state st

Figure 3: Monte Carlo tree search in AlphaGo.
Figure 3

a, Each simulation traverses the tree by selecting the edge with maximum action value Q, plus a bonus u(P) that depends on a stored prior probability P for that edge. b, The leaf node may be expanded; the new node is processed once by the policy network pσ and the output probabilities are stored as prior probabilities P for each action. c, At the end of a simulation, the leaf node is evaluated in two ways: using the value network vθ; and by running a rollout to the end of the game with the fast rollout policy pπ, then computing the winner with function r. d, Action values Q are updated to track the mean value of all evaluations r(·) and vθ(·) in the subtree below that action.

so as to maximize action value plus a bonus

that is proportional to the prior probability but decays with repeated visits to encourage exploration. When the traversal reaches a leaf node sL at step L, the leaf node may be expanded. The leaf position sL is processed just once by the SL policy network pσ. The output probabilities are stored as prior probabilities P for each legal action a, . The leaf node is evaluated in two very different ways: first, by the value network vθ(sL); and second, by the outcome zL of a random rollout played out until terminal step T using the fast rollout policy pπ; these evaluations are combined, using a mixing parameter λ, into a leaf evaluation V(sL)

At the end of simulation, the action values and visit counts of all traversed edges are updated. Each edge accumulates the visit count and mean evaluation of all simulations passing through that edge

where is the leaf node from the ith simulation, and 1(s, a, i) indicates whether an edge (s, a) was traversed during the ith simulation. Once the search is complete, the algorithm chooses the most visited move from the root position.

It is worth noting that the SL policy network pσ performed better in AlphaGo than the stronger RL policy network pρ, presumably because humans select a diverse beam of promising moves, whereas RL optimizes for the single best move. However, the value function derived from the stronger RL policy network performed better in AlphaGo than a value function derived from the SL policy network.

Evaluating policy and value networks requires several orders of magnitude more computation than traditional search heuristics. To efficiently combine MCTS with deep neural networks, AlphaGo uses an asynchronous multi-threaded search that executes simulations on CPUs, and computes policy and value networks in parallel on GPUs. The final version of AlphaGo used 40 search threads, 48 CPUs, and 8 GPUs. We also implemented a distributed version of AlphaGo that exploited multiple machines, 40 search threads, 1,202 CPUs and 176 GPUs. The Methods section provides full details of asynchronous and distributed MCTS.

Evaluating the playing strength of AlphaGo

To evaluate AlphaGo, we ran an internal tournament among variants of AlphaGo and several other Go programs, including the strongest commercial programs Crazy Stone13 and Zen, and the strongest open source programs Pachi14 and Fuego15. All of these programs are based on high-performance MCTS algorithms. In addition, we included the open source program GnuGo, a Go program using state-of-the-art search methods that preceded MCTS. All programs were allowed 5 s of computation time per move.

The results of the tournament (see Fig. 4a) suggest that single-machine AlphaGo is many dan ranks stronger than any previous Go program, winning 494 out of 495 games (99.8%) against other Go programs. To provide a greater challenge to AlphaGo, we also played games with four handicap stones (that is, free moves for the opponent); AlphaGo won 77%, 86%, and 99% of handicap games against Crazy Stone, Zen and Pachi, respectively. The distributed version of AlphaGo was significantly stronger, winning 77% of games against single-machine AlphaGo and 100% of its games against other programs.

Figure 4: Tournament evaluation of AlphaGo.
Figure 4

a, Results of a tournament between different Go programs (see Extended Data Tables 6,7,8,9,10,11). Each program used approximately 5 s computation time per move. To provide a greater challenge to AlphaGo, some programs (pale upper bars) were given four handicap stones (that is, free moves at the start of every game) against all opponents. Programs were evaluated on an Elo scale37: a 230 point gap corresponds to a 79% probability of winning, which roughly corresponds to one amateur dan rank advantage on KGS38; an approximate correspondence to human ranks is also shown, horizontal lines show KGS ranks achieved online by that program. Games against the human European champion Fan Hui were also included; these games used longer time controls. 95% confidence intervals are shown. b, Performance of AlphaGo, on a single machine, for different combinations of components. The version solely using the policy network does not perform any search. c, Scalability study of MCTS in AlphaGo with search threads and GPUs, using asynchronous search (light blue) or distributed search (dark blue), for 2 s per move.

We also assessed variants of AlphaGo that evaluated positions using just the value network (λ = 0) or just rollouts (λ = 1) (see Fig. 4b). Even without rollouts AlphaGo exceeded the performance of all other Go programs, demonstrating that value networks provide a viable alternative to Monte Carlo evaluation in Go. However, the mixed evaluation (λ = 0.5) performed best, winning ≥95% of games against other variants. This suggests that the two position-evaluation mechanisms are complementary: the value network approximates the outcome of games played by the strong but impractically slow pρ, while the rollouts can precisely score and evaluate the outcome of games played by the weaker but faster rollout policy pπ. Figure 5 visualizes the evaluation of a real game position by AlphaGo.

Figure 5: How AlphaGo (black, to play) selected its move in an informal game against Fan Hui.
Figure 5

For each of the following statistics, the location of the maximum value is indicated by an orange circle. a, Evaluation of all successors s′ of the root position s, using the value network vθ(s′); estimated winning percentages are shown for the top evaluations. b, Action values Q(s, a) for each edge (s, a) in the tree from root position s; averaged over value network evaluations only (λ = 0). c, Action values Q(s, a), averaged over rollout evaluations only (λ = 1). d, Move probabilities directly from the SL policy network, ; reported as a percentage (if above 0.1%). e, Percentage frequency with which actions were selected from the root during simulations. f, The principal variation (path with maximum visit count) from AlphaGo’s search tree. The moves are presented in a numbered sequence. AlphaGo selected the move indicated by the red circle; Fan Hui responded with the move indicated by the white square; in his post-game commentary he preferred the move (labelled 1) predicted by AlphaGo.

Finally, we evaluated the distributed version of AlphaGo against Fan Hui, a professional 2 dan, and the winner of the 2013, 2014 and 2015 European Go championships. Over 5–9 October 2015 AlphaGo and Fan Hui competed in a formal five-game match. AlphaGo won the match 5 games to 0 (Fig. 6 and Extended Data Table 1). This is the first time that a computer Go program has defeated a human professional player, without handicap, in the full game of Go—a feat that was previously believed to be at least a decade away3,7,31.

Figure 6: Games from the match between AlphaGo and the European champion, Fan Hui.
Figure 6

Moves are shown in a numbered sequence corresponding to the order in which they were played. Repeated moves on the same intersection are shown in pairs below the board. The first move number in each pair indicates when the repeat move was played, at an intersection identified by the second move number (see Supplementary Information).


In this work we have developed a Go program, based on a combination of deep neural networks and tree search, that plays at the level of the strongest human players, thereby achieving one of artificial intelligence’s “grand challenges”31,32,33. We have developed, for the first time, effective move selection and position evaluation functions for Go, based on deep neural networks that are trained by a novel combination of supervised and reinforcement learning. We have introduced a new search algorithm that successfully combines neural network evaluations with Monte Carlo rollouts. Our program AlphaGo integrates these components together, at scale, in a high-performance tree search engine.

During the match against Fan Hui, AlphaGo evaluated thousands of times fewer positions than Deep Blue did in its chess match against Kasparov4; compensating by selecting those positions more intelligently, using the policy network, and evaluating them more precisely, using the value network—an approach that is perhaps closer to how humans play. Furthermore, while Deep Blue relied on a handcrafted evaluation function, the neural networks of AlphaGo are trained directly from gameplay purely through general-purpose supervised and reinforcement learning methods.

Go is exemplary in many ways of the difficulties faced by artificial intelligence33,34: a challenging decision-making task, an intractable search space, and an optimal solution so complex it appears infeasible to directly approximate using a policy or value function. The previous major breakthrough in computer Go, the introduction of MCTS, led to corresponding advances in many other domains; for example, general game-playing, classical planning, partially observed planning, scheduling, and constraint satisfaction35,36. By combining tree search with policy and value networks, AlphaGo has finally reached a professional level in Go, providing hope that human-level performance can now be achieved in other seemingly intractable artificial intelligence domains.


Online Methods

Problem setting

Many games of perfect information, such as chess, checkers, othello, backgammon and Go, may be defined as alternating Markov games39. In these games, there is a state space (where state includes an indication of the current player to play); an action space defining the legal actions in any given state s; a state transition function f(s, a, ξ) defining the successor state after selecting action a in state s and random input ξ (for example, dice); and finally a reward function ri(s) describing the reward received by player i in state s. We restrict our attention to two-player zero-sum games, r1(s) = −r2(s) = r(s), with deterministic state transitions, f(s, a, ξ) = f(s, a), and zero rewards except at a terminal time step T. The outcome of the game zt = ±r(sT) is the terminal reward at the end of the game from the perspective of the current player at time step t. A policy p(a|s) is a probability distribution over legal actions . A value function is the expected outcome if all actions for both players are selected according to policy p, that is,  . Zero-sum games have a unique optimal value function v*(s) that determines the outcome from state s following perfect play by both players,

Prior work

The optimal value function can be computed recursively by minimax (or equivalently negamax) search40. Most games are too large for exhaustive minimax tree search; instead, the game is truncated by using an approximate value function v(s) ≈ v*(s) in place of terminal rewards. Depth-first minimax search with alpha–beta pruning40 has achieved superhuman performance in chess4, checkers5 and othello6, but it has not been effective in Go7.

Reinforcement learning can learn to approximate the optimal value function directly from games of self-play39. The majority of prior work has focused on a linear combination vθ(s) = φ(s) · θ of features φ(s) with weights θ. Weights were trained using temporal-difference learning41 in chess42,43, checkers44,45 and Go30; or using linear regression in othello6 and Scrabble9. Temporal-difference learning has also been used to train a neural network to approximate the optimal value function, achieving superhuman performance in backgammon46; and achieving weak kyu-level performance in small-board Go28,29,47 using convolutional networks.

An alternative approach to minimax search is Monte Carlo tree search (MCTS)11,12, which estimates the optimal value of interior nodes by a double approximation, . The first approximation, , uses n Monte Carlo simulations to estimate the value function of a simulation policy Pn. The second approximation, , uses a simulation policy Pn in place of minimax optimal actions. The simulation policy selects actions according to a search control function , such as UCT12, that selects children with higher action values, Qn(s, a) = −Vn(f(s, a)), plus a bonus u(s, a) that encourages exploration; or in the absence of a search tree at state s, it samples actions from a fast rollout policy  . As more simulations are executed and the search tree grows deeper, the simulation policy becomes informed by increasingly accurate statistics. In the limit, both approximations become exact and MCTS (for example, with UCT) converges12 to the optimal value function . The strongest current Go programs are based on MCTS13,14,15,36.

MCTS has previously been combined with a policy that is used to narrow the beam of the search tree to high-probability moves13; or to bias the bonus term towards high-probability moves48. MCTS has also been combined with a value function that is used to initialize action values in newly expanded nodes16, or to mix Monte Carlo evaluation with minimax evaluation49. By contrast, AlphaGo’s use of value functions is based on truncated Monte Carlo search algorithms8,9, which terminate rollouts before the end of the game and use a value function in place of the terminal reward. AlphaGo’s position evaluation mixes full rollouts with truncated rollouts, resembling in some respects the well-known temporal-difference learning algorithm TD(λ). AlphaGo also differs from prior work by using slower but more powerful representations of the policy and value function; evaluating deep neural networks is several orders of magnitude slower than linear representations and must therefore occur asynchronously.

The performance of MCTS is to a large degree determined by the quality of the rollout policy. Prior work has focused on handcrafted patterns50 or learning rollout policies by supervised learning13, reinforcement learning16, simulation balancing51,52 or online adaptation30,53; however, it is known that rollout-based position evaluation is frequently inaccurate54. AlphaGo uses relatively simple rollouts, and instead addresses the challenging problem of position evaluation more directly using value networks.

Search algorithm

To efficiently integrate large neural networks into AlphaGo, we implemented an asynchronous policy and value MCTS algorithm (APV-MCTS). Each node s in the search tree contains edges (s, a) for all legal actions . Each edge stores a set of statistics,

where P(s, a) is the prior probability, Wv(s, a) and Wr(s, a) are Monte Carlo estimates of total action value, accumulated over Nv(s, a) and Nr(s, a) leaf evaluations and rollout rewards, respectively, and Q(s, a) is the combined mean action value for that edge. Multiple simulations are executed in parallel on separate search threads. The APV-MCTS algorithm proceeds in the four stages outlined in Fig. 3.

Selection (Fig. 3a). The first in-tree phase of each simulation begins at the root of the search tree and finishes when the simulation reaches a leaf node at time step L. At each of these time steps, t < L, an action is selected according to the statistics in the search tree, using a variant of the PUCT algorithm48, , where cpuct is a constant determining the level of exploration; this search control strategy initially prefers actions with high prior probability and low visit count, but asymptotically prefers actions with high action value.

Evaluation (Fig. 3c). The leaf position sL is added to a queue for evaluation vθ(sL) by the value network, unless it has previously been evaluated. The second rollout phase of each simulation begins at leaf node sL and continues until the end of the game. At each of these time-steps, t ≥ L, actions are selected by both players according to the rollout policy, . When the game reaches a terminal state, the outcome is computed from the final score.

Backup (Fig. 3d). At each in-tree step t ≤ L of the simulation, the rollout statistics are updated as if it has lost nvl games, Nr(st, at) ← Nr(st, at) + nvl; Wr(st, at) ← Wr(st, at) −nvl; this virtual loss55 discourages other threads from simultaneously exploring the identical variation. At the end of the simulation, t he rollout statistics are updated in a backward pass through each step t ≤ L, replacing the virtual losses by the outcome, Nr(st, at) ← Nr(st, at) −nvl + 1; Wr(st, at) ← Wr(st, at) + nvl + zt. Asynchronously, a separate backward pass is initiated when the evaluation of the leaf position sL completes. The output of the value network vθ(sL) is used to update value statistics in a second backward pass through each step t ≤ L, Nv(st, at) ← Nv(st, at) + 1, Wv(st, at) ← Wv(st, at) + vθ(sL). The overall evaluation of each state action is a weighted average of the Monte Carlo estimates, , that mixes together the value network and rollout evaluations with weighting parameter λ. All updates are performed lock-free56.

Expansion (Fig. 3b). When the visit count exceeds a threshold, Nr(s, a) > nthr, the successor state s′ = f(s, a) is added to the search tree. The new node is initialized to {N(s′, a) =Nr(s′, a) = 0, W(s′, a) =Wr(s′, a) = 0, P(s′,a) = pσ(a|s′)}, using a tree policy pτ(a|s′) (similar to the rollout policy but with more features, see Extended Data Table 4) to provide placeholder prior probabilities for action selection. The position s′ is also inserted into a queue for asynchronous GPU evaluation by the policy network. Prior probabilities are computed by the SL policy network with a softmax temperature set to β; these replace the placeholder prior probabilities, , using an atomic update. The threshold nthr is adjusted dynamically to ensure that the rate at which positions are added to the policy queue matches the rate at which the GPUs evaluate the policy network. Positions are evaluated by both the policy network and the value network using a mini-batch size of 1 to minimize end-to-end evaluation time.

We also implemented a distributed APV-MCTS algorithm. This architecture consists of a single master machine that executes the main search, many remote worker CPUs that execute asynchronous rollouts, and many remote worker GPUs that execute asynchronous policy and value network evaluations. The entire search tree is stored on the master, which only executes the in-tree phase of each simulation. The leaf positions are communicated to the worker CPUs, which execute the rollout phase of simulation, and to the worker GPUs, which compute network features and evaluate the policy and value networks. The prior probabilities of the policy network are returned to the master, where they replace placeholder prior probabilities at the newly expanded node. The rewards from rollouts and the value network outputs are each returned to the master, and backed up the originating search path.

At the end of search AlphaGo selects the action with maximum visit count; this is less sensitive to outliers than maximizing action value15. The search tree is reused at subsequent time steps: the child node corresponding to the played action becomes the new root node; the subtree below this child is retained along with all its statistics, while the remainder of the tree is discarded. The match version of AlphaGo continues searching during the opponent’s move. It extends the search if the action maximizing visit count and the action maximizing action value disagree. Time controls were otherwise shaped to use most time in the middle-game57. AlphaGo resigns when its overall evaluation drops below an estimated 10% probability of winning the game, that is, .

AlphaGo does not employ the all-moves-as-first10 or rapid action value estimation58 heuristics used in the majority of Monte Carlo Go programs; when using policy networks as prior knowledge, these biased heuristics do not appear to give any additional benefit. In addition AlphaGo does not use progressive widening13, dynamic komi59 or an opening book60. The parameters used by AlphaGo in the Fan Hui match are listed in Extended Data Table 5.

Rollout policy

The rollout policy is a linear softmax policy based on fast, incrementally computed, local pattern-based features consisting of both ‘response’ patterns around the previous move that led to state s, and ‘non-response’ patterns around the candidate move a in state s. Each non-response pattern is a binary feature matching a specific 3 × 3 pattern centred on a, defined by the colour (black, white, empty) and liberty count (1, 2, ≥3) for each adjacent intersection. Each response pattern is a binary feature matching the colour and liberty count in a 12-point diamond-shaped pattern21 centred around the previous move. Additionally, a small number of handcrafted local features encode common-sense Go rules (see Extended Data Table 4). Similar to the policy network, the weights π of the rollout policy are trained from 8 million positions from human games on the Tygem server to maximize log likelihood by stochastic gradient descent. Rollouts execute at approximately 1,000 simulations per second per CPU thread on an empty board.

Our rollout policy pπ(a|s) contains less handcrafted knowledge than state-of-the-art Go programs13. Instead, we exploit the higher-quality action selection within MCTS, which is informed both by the search tree and the policy network. We introduce a new technique that caches all moves from the search tree and then plays similar moves during rollouts; a generalization of the ‘last good reply’ heuristic53. At every step of the tree traversal, the most probable action is inserted into a hash table, along with the 3 × 3 pattern context (colour, liberty and stone counts) around both the previous move and the current move. At each step of the rollout, the pattern context is matched against the hash table; if a match is found then the stored move is played with high probability.


In previous work, the symmetries of Go have been exploited by using rotationally and reflectionally invariant filters in the convolutional layers24,28,29. Although this may be effective in small neural networks, it actually hurts performance in larger networks, as it prevents the intermediate filters from identifying specific asymmetric patterns23. Instead, we exploit symmetries at run-time by dynamically transforming each position s using the dihedral group of eight reflections and rotations, d1(s), …, d8(s). In an explicit symmetry ensemble, a mini-batch of all 8 positions is passed into the policy network or value network and computed in parallel. For the value network, the output values are simply averaged, . For the policy network, the planes of output probabilities are rotated/reflected back into the original orientation, and averaged together to provide an ensemble prediction, ; this approach was used in our raw network evaluation (see Extended Data Table 3). Instead, APV-MCTS makes use of an implicit symmetry ensemble that randomly selects a single rotation/reflection j [1, 8] for each evaluation. We compute exactly one evaluation for that orientation only; in each simulation we compute the value of leaf node sL by vθ(dj(sL)), and allow the search procedure to average over these evaluations. Similarly, we compute the policy network for a single, randomly selected rotation/reflection, .

Policy network: classification

We trained the policy network pσ to classify positions according to expert moves played in the KGS data set. This data set contains 29.4 million positions from 160,000 games played by KGS 6 to 9 dan human players; 35.4% of the games are handicap games. The data set was split into a test set (the first million positions) and a training set (the remaining 28.4 million positions). Pass moves were excluded from the data set. Each position consisted of a raw board description s and the move a selected by the human. We augmented the data set to include all eight reflections and rotations of each position. Symmetry augmentation and input features were pre-computed for each position. For each training step, we sampled a randomly selected mini-batch of m samples from the augmented KGS data set, and applied an asynchronous stochastic gradient descent update to maximize the log likelihood of the action, . The step size α was initialized to 0.003 and was halved every 80 million training steps, without momentum terms, and a mini-batch size of m = 16. Updates were applied asynchronously on 50 GPUs using DistBelief 61; gradients older than 100 steps were discarded. Training took around 3 weeks for 340 million training steps.

Policy network: reinforcement learning

We further trained the policy network by policy gradient reinforcement learning25,26. Each iteration consisted of a mini-batch of n games played in parallel, between the current policy network pρ that is being trained, and an opponent that uses parameters ρ from a previous iteration, randomly sampled from a pool of opponents, so as to increase the stability of training. Weights were initialized to ρ = ρ = σ. Every 500 iterations, we added the current parameters ρ to the opponent pool. Each game i in the mini-batch was played out until termination at step Ti, and then scored to determine the outcome from each player’s perspective. The games were then replayed to determine the policy gradient update, , using the REINFORCE algorithm25 with baseline for variance reduction. On the first pass through the training pipeline, the baseline was set to zero; on the second pass we used the value network vθ(s) as a baseline; this provided a small performance boost. The policy network was trained in this way for 10,000 mini-batches of 128 games, using 50 GPUs, for one day.

Value network: regression

We trained a value network to approximate the value function of the RL policy network pρ. To avoid overfitting to the strongly correlated positions within games, we constructed a new data set of uncorrelated self-play positions. This data set consisted of over 30 million positions, each drawn from a unique game of self-play. Each game was generated in three phases by randomly sampling a time step U ~ unif{1, 450}, and sampling the first t = 1,… U − 1 moves from the SL policy network, at ~ pσ(·|st); then sampling one move uniformly at random from available moves, aU ~ unif{1, 361} (repeatedly until aU is legal); then sampling the remaining sequence of moves until the game terminates, t = U + 1, … T, from the RL policy network, at ~ pρ(·|st). Finally, the game is scored to determine the outcome zt = ±r(sT). Only a single training example (sU+1, zU+1) is added to the data set from each game. This data provides unbiased samples of the value function . During the first two phases of generation we sample from noisier distributions so as to increase the diversity of the data set. The training method was identical to SL policy network training, except that the parameter update was based on mean squared error between the predicted values and the observed rewards, . The value network was trained for 50 million mini-batches of 32 positions, using 50 GPUs, for one week.

Features for policy/value network

Each position s was pre-processed into a set of 19 × 19 feature planes. The features that we use come directly from the raw representation of the game rules, indicating the status of each intersection of the Go board: stone colour, liberties (adjacent empty points of stone’s chain), captures, legality, turns since stone was played, and (for the value network only) the current colour to play. In addition, we use one simple tactical feature that computes the outcome of a ladder search7. All features were computed relative to the current colour to play; for example, the stone colour at each intersection was represented as either player or opponent rather than black or white. Each integer feature value is split into multiple 19 × 19 planes of binary values (one-hot encoding). For example, separate binary feature planes are used to represent whether an intersection has 1 liberty, 2 liberties,…, ≥8 liberties. The full set of feature planes are listed in Extended Data Table 2.

Neural network architecture

The input to the policy network is a 19 × 19 × 48 image stack consisting of 48 feature planes. The first hidden layer zero pads the input into a 23 × 23 image, then convolves k filters of kernel size 5 × 5 with stride 1 with the input image and applies a rectifier nonlinearity. Each of the subsequent hidden layers 2 to 12 zero pads the respective previous hidden layer into a 21 × 21 image, then convolves k filters of kernel size 3 × 3 with stride 1, again followed by a rectifier nonlinearity. The final layer convolves 1 filter of kernel size 1 × 1 with stride 1, with a different bias for each position, and applies a softmax function. The match version of AlphaGo used k = 192 filters; Fig. 2b and Extended Data Table 3 additionally show the results of training with k = 128, 256 and 384 filters.

The input to the value network is also a 19 × 19 × 48 image stack, with an additional binary feature plane describing the current colour to play. Hidden layers 2 to 11 are identical to the policy network, hidden layer 12 is an additional convolution layer, hidden layer 13 convolves 1 filter of kernel size 1 × 1 with stride 1, and hidden layer 14 is a fully connected linear layer with 256 rectifier units. The output layer is a fully connected linear layer with a single tanh unit.


We evaluated the relative strength of computer Go programs by running an internal tournament and measuring the Elo rating of each program. We estimate the probability that program a will beat program b by a logistic function , and estimate the ratings e(·) by Bayesian logistic regression, computed by the BayesElo program37 using the standard constant celo = 1/400. The scale was anchored to the BayesElo rating of professional Go player Fan Hui (2,908 at date of submission)62. All programs received a maximum of 5 s computation time per move; games were scored using Chinese rules with a komi of 7.5 points (extra points to compensate white for playing second). We also played handicap games where AlphaGo played white against existing Go programs; for these games we used a non-standard handicap system in which komi was retained but black was given additional stones on the usual handicap points. Using these rules, a handicap of K stones is equivalent to giving K − 1 free moves to black, rather than K − 1/2 free moves using standard no-komi handicap rules. We used these handicap rules because AlphaGo’s value network was trained specifically to use a komi of 7.5.

With the exception of distributed AlphaGo, each computer Go program was executed on its own single machine, with identical specifications, using the latest available version and the best hardware configuration supported by that program (see Extended Data Table 6). In Fig. 4, approximate ranks of computer programs are based on the highest KGS rank achieved by that program; however, the KGS version may differ from the publicly available version.

The match against Fan Hui was arbitrated by an impartial referee. Five formal games and five informal games were played with 7.5 komi, no handicap, and Chinese rules. AlphaGo won these games 5–0 and 3–2 respectively (Fig. 6 and Extended Data Table 1). Time controls for formal games were 1 h main time plus three periods of 30 s byoyomi. Time controls for informal games were three periods of 30 s byoyomi. Time controls and playing conditions were chosen by Fan Hui in advance of the match; it was also agreed that the overall match outcome would be determined solely by the formal games. To approximately assess the relative rating of Fan Hui to computer Go programs, we appended the results of all ten games to our internal tournament results, ignoring differences in time controls.


  1. 1.

    Searching for Solutions in Games and Artificial Intelligence. PhD thesis, Univ. Limburg, Maastricht, The Netherlands (1994)

  2. 2.

    , & Games solved: now and in the future. Artif. Intell. 134, 277–311 (2002)

  3. 3.

    The games computers (and people) play. Advances in Computers 52, 189–266 (2000)

  4. 4.

    , & Deep Blue. Artif. Intell. 134, 57–83 (2002)

  5. 5.

    et al. A world championship caliber checkers program. Artif. Intell. 53, 273–289 (1992)

  6. 6.

    From simple features to sophisticated evaluation functions. In 1st International Conference on Computers and Games, 126–145 (1999)

  7. 7.

    Computer Go. Artif. Intell. 134, 145–179 (2002)

  8. 8.

    & On-line policy improvement using Monte-Carlo search. In Advances in Neural Information Processing, 1068–1074 (1996)

  9. 9.

    World-championship-caliber Scrabble. Artif. Intell. 134, 241–275 (2002)

  10. 10.

    & Monte-Carlo Go developments. In 10th International Conference on Advances in Computer Games, 159–174 (2003)

  11. 11.

    Efficient selectivity and backup operators in Monte-Carlo tree search. In 5th International Conference on Computers and Games, 72–83 (2006)

  12. 12.

    & Bandit based Monte-Carlo planning. In 15th European Conference on Machine Learning, 282–293 (2006)

  13. 13.

    Computing Elo ratings of move patterns in the game of Go. ICGA J. 30, 198–208 (2007)

  14. 14.

    & Pachi: State of the art open source Go program. In Advances in Computer Games, 24–38 (Springer, 2012)

  15. 15.

    , , & Fuego – an open-source framework for board games and Go engine based on Monte-Carlo tree search. IEEE Trans. Comput. Intell. AI in Games 2, 259–270 (2010)

  16. 16.

    & Combining online and offline learning in UCT. In 17th International Conference on Machine Learning, 273–280 (2007)

  17. 17.

    , & ImageNet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, 1097–1105 (2012)

  18. 18.

    , , & Face recognition: a convolutional neural-network approach. IEEE Trans. Neural Netw. 8, 98–113 (1997)

  19. 19.

    et al. Human-level control through deep reinforcement learning. Nature 518, 529–533 (2015)

  20. 20.

    , & Deep learning. Nature 521, 436–444 (2015)

  21. 21.

    , & Bayesian pattern ranking for move prediction in the game of Go. In International Conference of Machine Learning, 873–880 (2006)

  22. 22.

    & Mimicking Go experts with convolutional neural networks. In International Conference on Artificial Neural Networks, 101–110 (2008)

  23. 23.

    , , & Move evaluation in Go using deep convolutional neural networks. 3rd International Conference on Learning Representations (2015)

  24. 24.

    & Training deep convolutional neural networks to play go. In 32nd International Conference on Machine Learning, 1766–1774 (2015)

  25. 25.

    Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn. 8, 229–256 (1992)

  26. 26.

    , , & Policy gradient methods for reinforcement learning with function approximation. In Advances in Neural Information Processing Systems, 1057–1063 (2000)

  27. 27.

    & Reinforcement Learning: an Introduction (MIT Press, 1998)

  28. 28.

    , & Temporal difference learning of position evaluation in the game of Go. Adv. Neural Inf. Process. Syst. 6, 817–824 (1994)

  29. 29.

    Evaluation in Go by a neural network using soft segmentation. In 10th Advances in Computer Games Conference, 97–108 (2003). 267

  30. 30.

    , & Temporal-difference search in computer Go. Mach. Learn. 87, 183–219 (2012)

  31. 31.

    The mystery of Go, the ancient game that computers still can’t win. Wired Magazine (2014)

  32. 32.

    All Systems Go. The Sciences 38, 32–37 (1998)

  33. 33.

    Computational intelligence in mind games. In Challenges for Computational Intelligence, 407–442 (2007)

  34. 34.

    A chronology of computer chess and its literature. Artif. Intell. 10, 201–214 (1978)

  35. 35.

    et al. A survey of Monte-Carlo tree search methods. IEEE Trans. Comput. Intell. AI in Games 4, 1–43 (2012)

  36. 36.

    et al. The grand challenge of computer Go: Monte Carlo tree search and extensions. Commun. ACM 55, 106–113 (2012)

  37. 37.

    Whole-history rating: A Bayesian rating system for players of time-varying strength. In International Conference on Computers and Games, 113–124 (2008)

  38. 38.

    KGS. Rating system math.

  39. 39.

    Markov games as a framework for multi-agent reinforcement learning. In 11th International Conference on Machine Learning, 157–163 (1994)

  40. 40.

    & An analysis of alpha-beta pruning. Artif. Intell. 6, 293–326 (1975)

  41. 41.

    Learning to predict by the method of temporal differences. Mach. Learn. 3, 9–44 (1988)

  42. 42.

    , & Learning to play chess using temporal differences. Mach. Learn. 40, 243–263 (2000)

  43. 43.

    , , & Bootstrapping from game tree search. In Advances in Neural Information Processing Systems (2009)

  44. 44.

    Some studies in machine learning using the game of checkers II - recent progress. IBM J. Res. Develop. 11, 601–617 (1967)

  45. 45.

    , & Temporal difference learning applied to a high-performance game-playing program. In 17th International Joint Conference on Artificial Intelligence, 529–534 (2001)

  46. 46.

    TD-gammon, a self-teaching backgammon program, achieves master-level play. Neural Comput. 6, 215–219 (1994)

  47. 47.

    Honte, a Go-playing program using neural nets. In Machines that learn to play games, 205–223 (Nova Science, 1999)

  48. 48.

    Multi-armed bandits with episode context. Ann. Math. Artif. Intell. 61, 203–230 (2011)

  49. 49.

    , , & Monte Carlo tree search with heuristic evaluations using implicit minimax backups. In IEEE Conference on Computational Intelligence and Games, 1–8 (2014)

  50. 50.

    , , & Modification of UCT with patterns in Monte-Carlo Go. Tech. Rep. 6062, INRIA (2006)

  51. 51.

    & Monte-Carlo simulation balancing. In 26th International Conference on Machine Learning, 119 (2009)

  52. 52.

    , & Monte-Carlo simulation balancing in practice. In 7th International Conference on Computers and Games, 81–92 (Springer-Verlag, 2011)

  53. 53.

    & The power of forgetting: improving the last-good-reply policy in Monte Carlo Go. IEEE Trans. Comput. Intell. AI in Games 2, 303–309 (2010)

  54. 54.

    & Investigating the limits of Monte-Carlo tree search methods in computer Go. In 8th International Conference on Computers and Games, 39–48 (2013)

  55. 55.

    On the scalability of parallel UCT. Computers and Games 6515, 36–47 (2011)

  56. 56.

    & A lock-free multithreaded Monte-Carlo tree search algorithm. In 12th Advances in Computer Games Conference, 14–20 (2009)

  57. 57.

    , & Time management for Monte-Carlo tree search applied to the game of Go. In International Conference on Technologies and Applications of Artificial Intelligence, 462–466 (2010)

  58. 58.

    & Monte-Carlo tree search and rapid action value estimation in computer Go. Artif. Intell. 175, 1856–1875 (2011)

  59. 59.

    Balancing MCTS by dynamically adjusting the komi value. ICGA J. 34, 131 (2011)

  60. 60.

    & Active opening book application for Monte-Carlo tree search in 19×19 Go. In Benelux Conference on Artificial Intelligence, 3–10 (2011)

  61. 61.

    et al. Large scale distributed deep networks. In Advances in Neural Information Processing Systems, 1223–1231 (2012)

  62. 62.

    Go ratings.

Download references


We thank Fan Hui for agreeing to play against AlphaGo; T. Manning for refereeing the match; R. Munos and T. Schaul for helpful discussions and advice; A. Cain and M. Cant for work on the visuals; P. Dayan, G. Wayne, D. Kumaran, D. Purves, H. van Hasselt, A. Barreto and G. Ostrovski for reviewing the paper; and the rest of the DeepMind team for their support, ideas and encouragement.

Author information

Author notes

    • David Silver
    •  & Aja Huang

    These authors contributed equally to this work.


  1. Google DeepMind, 5 New Street Square, London EC4A 3TW, UK

    • David Silver
    • , Aja Huang
    • , Chris J. Maddison
    • , Arthur Guez
    • , Laurent Sifre
    • , George van den Driessche
    • , Julian Schrittwieser
    • , Ioannis Antonoglou
    • , Veda Panneershelvam
    • , Marc Lanctot
    • , Sander Dieleman
    • , Dominik Grewe
    • , Nal Kalchbrenner
    • , Timothy Lillicrap
    • , Madeleine Leach
    • , Koray Kavukcuoglu
    • , Thore Graepel
    •  & Demis Hassabis
  2. Google, 1600 Amphitheatre Parkway, Mountain View, California 94043, USA

    • John Nham
    •  & Ilya Sutskever


  1. Search for David Silver in:

  2. Search for Aja Huang in:

  3. Search for Chris J. Maddison in:

  4. Search for Arthur Guez in:

  5. Search for Laurent Sifre in:

  6. Search for George van den Driessche in:

  7. Search for Julian Schrittwieser in:

  8. Search for Ioannis Antonoglou in:

  9. Search for Veda Panneershelvam in:

  10. Search for Marc Lanctot in:

  11. Search for Sander Dieleman in:

  12. Search for Dominik Grewe in:

  13. Search for John Nham in:

  14. Search for Nal Kalchbrenner in:

  15. Search for Ilya Sutskever in:

  16. Search for Timothy Lillicrap in:

  17. Search for Madeleine Leach in:

  18. Search for Koray Kavukcuoglu in:

  19. Search for Thore Graepel in:

  20. Search for Demis Hassabis in:


A.H., G.v.d.D., J.S., I.A., M.La., A.G., T.G. and D.S. designed and implemented the search in AlphaGo. C.J.M., A.G., L.S., A.H., I.A., V.P., S.D., D.G., N.K., I.S., K.K. and D.S. designed and trained the neural networks in AlphaGo. J.S., J.N., A.H. and D.S. designed and implemented the evaluation framework for AlphaGo. D.S., M.Le., T.L., T.G., K.K. and D.H. managed and advised on the project. D.S., T.G., A.G. and D.H. wrote the paper.

Competing interests

The authors declare no competing financial interests.

Corresponding authors

Correspondence to David Silver or Demis Hassabis.

Extended data

Supplementary information

Zip files

  1. 1.

    Supplementary Information

    This zipped file contains game records for the 5 formal match games played between AlphaGo and Fan Hui.