Mastering the game of Go with deep neural networks and tree search | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表
策略网络的监督学习策略网络的强化学习价值网络的强化学习结合策略网络与价值网络的搜索评估 AlphaGo 的棋力讨论方法问题设定先前工作搜索算法走子策略对称性策略网络:分类策略网络:强化学习价值网络:回归策略/价值网络的特征神经网络结构评估References
返回论文列表
目录

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

收录于 Nature 529, 484–489 (2016) 期刊论文被引 16,645 次
打开论文来源

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

用深度神经网络与树搜索精通围棋

David Silver1*, Aja Huang1*, Chris J. Maddison1, Arthur Guez1, Laurent Sifre1, George van den Driessche1, Julian Schrittwieser1, Ioannis Antonoglou1, Veda Panneershelvam1, Marc Lanctot1, Sander Dieleman1, Dominik Grewe1, John Nham2, Nal Kalchbrenner1, Ilya Sutskever2, Timothy Lillicrap1, Madeleine Leach1, Koray Kavukcuoglu1, Thore Graepel1 & Demis Hassabis1

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.

围棋长期以来被视为经典博弈里对人工智能最难的一项,原因在于搜索空间极大,局面与落子也很难评估。我们提出一种新的计算机围棋方法:用“价值网络”评估局面,用“策略网络”选择落子。这些深度神经网络通过一种新的组合来训练——既有来自人类高手对局的监督学习,也有来自自我对弈的强化学习。即便不做前瞻搜索,这些神经网络的棋力也达到了会模拟数千局随机自我对弈的最先进蒙特卡洛树搜索程序的水平。我们还提出一种把蒙特卡洛模拟与价值、策略网络结合起来的新搜索算法。使用这一算法,我们的程序 AlphaGo 对其他围棋程序的胜率达到 99.8%,并以 5 比 0 击败欧洲围棋冠军。这是计算机程序第一次在完整 19 路围棋中击败职业棋手,而这一成就此前被认为至少还要再等十年。

1Google DeepMind, 5 New Street Square, London EC4A 3TW, UK. 2Google, 1600 Amphitheatre Parkway, Mountain View, California 94043, USA.
*These authors contributed equally to this work.

All games of perfect information have an optimal value function, v∗(s)v^*(s)v∗(s), which determines the outcome of the game, from every board position or state sss, under perfect play by all players. These games may be solved by recursively computing the optimal value function in a search tree containing approximately bdb^dbd possible sequences of moves, where bbb is the game’s breadth (number of legal moves per position) and ddd is its depth (game length). In large games, such as chess (b≈35b \approx 35b≈35, d≈80d \approx 80d≈80)1^11 and especially Go (b≈250b \approx 250b≈250, d≈150d \approx 150d≈150)1^11, exhaustive search is infeasible2,3^{2,3}2,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 sss and replacing the subtree below sss by an approximate value function v(s)≈v∗(s)v(s) \approx v^*(s)v(s)≈v∗(s) that predicts the outcome from state sss. This approach has led to superhuman performance in chess4^44, checkers5^55 and othello6^66, but it was believed to be intractable in Go due to the complexity of the game7^77. Second, the breadth of the search may be reduced by sampling actions from a policy p(a∣s)p(a|s)p(a∣s) that is a probability distribution over possible moves aaa in position sss. For example, Monte Carlo rollouts8^88 search to maximum depth without branching at all, by sampling long sequences of actions for both players from a policy ppp. Averaging over such rollouts can provide an effective position evaluation, achieving superhuman performance in backgammon8^88 and Scrabble9^99, and weak amateur level play in Go10^{10}10.

所有完全信息博弈都有一个最优价值函数 v∗(s)v^*(s)v∗(s),它在双方都完美行棋时,从每一个局面或状态 sss 出发决定对局结果。这类博弈可以通过在搜索树里递归计算最优价值函数来求解,树中大约有 bdb^dbd 种可能的着法序列,其中 bbb 是博弈的宽度(每个局面的合法着法数),ddd 是深度(对局长度)。在国际象棋(b≈35b \approx 35b≈35,d≈80d \approx 80d≈80)1^11 这类大型博弈里,尤其是围棋(b≈250b \approx 250b≈250,d≈150d \approx 150d≈150)1^11,穷尽搜索不可行2,3^{2,3}2,3,但可以用两条一般原则缩小有效搜索空间。第一,用局面评估来降低搜索深度:在状态 sss 处截断搜索树,并把 sss 以下的子树替换成一个近似价值函数 v(s)≈v∗(s)v(s) \approx v^*(s)v(s)≈v∗(s),用来预测从 sss 出发的结果。这一做法已经在国际象棋4^44、跳棋5^55 和奥赛罗6^66 中带来超人表现,但由于围棋本身的复杂性,人们曾认为它对围棋行不通7^77。第二,可以从策略 p(a∣s)p(a|s)p(a∣s) 中采样动作来降低搜索宽度,该策略是局面 sss 上可能着法 aaa 的概率分布。例如,蒙特卡洛走子8^88 完全不分支,一直搜索到最大深度,双方都从策略 ppp 中采样长串动作。对这样的走子取平均,可以给出有效的局面评估,在西洋双陆棋8^88 和 Scrabble9^99 中达到超人水平,在围棋中则达到较弱的业余水平10^{10}10。

Monte Carlo tree search (MCTS)11,12^{11,12}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^{12}12. The strongest current Go programs are based on MCTS, enhanced by policies that are trained to predict human expert moves13^{13}13. 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–15^{13–15}13–15. However, prior work has been limited to shallow policies13–15^{13–15}13–15 or value functions16^{16}16 based on a linear combination of input features.

蒙特卡洛树搜索(MCTS)11,12^{11,12}11,12 用蒙特卡洛走子来估计搜索树中每个状态的价值。随着模拟次数增加,搜索树变大,相关价值也更准确。搜索中用来选择动作的策略也会随时间改进,方法是选择价值更高的子节点。在极限意义下,这一策略收敛到最优行棋,评估则收敛到最优价值函数12^{12}12。目前最强的围棋程序以 MCTS 为基础,并用训练来预测人类高手着法的策略加以增强13^{13}13。这些策略把搜索收窄到一束高概率动作,并在走子时采样动作。这一路线已经达到很强的业余水平13–15^{13–15}13–15。不过,先前工作仍局限于浅层策略13–15^{13–15}13–15,或基于输入特征线性组合的价值函数16^{16}16。

Recently, deep convolutional neural networks have achieved unprecedented performance in visual domains: for example, image classification17^{17}17, face recognition18^{18}18, and playing Atari games19^{19}19. They use many layers of neurons, each arranged in overlapping tiles, to construct increasingly abstract, localized representations of an image20^{20}20. We employ a similar architecture for the game of Go. We pass in the board position as a 19×1919 \times 1919×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.

近年来,深度卷积神经网络在视觉领域取得了前所未有的表现,例如图像分类17^{17}17、人脸识别18^{18}18 以及玩 Atari 游戏19^{19}19。它们使用许多层神经元,每一层都排布成相互重叠的小块,从而构造出越来越抽象、局部化的图像表示20^{20}20。我们为围棋采用了类似的结构:把棋盘局面当作一张 19×1919 \times 1919×19 的图像输入,用卷积层构造局面表示。我们用这些神经网络来降低搜索树的有效深度与宽度:用价值网络评估局面,用策略网络采样动作。

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σp_\sigmapσ​ directly from expert human moves. This provides fast, efficient learning updates with immediate feedback and high-quality gradients. Similar to prior work13,15^{13,15}13,15, we also train a fast policy pπp_\pipπ​ that can rapidly sample actions during rollouts. Next, we train a reinforcement learning (RL) policy network pρp_\rhopρ​ 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θv_\thetavθ​ 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.

我们用一条由若干机器学习阶段组成的流水线来训练这些神经网络(图 1)。首先,直接从人类高手着法训练一个监督学习(SL)策略网络 pσp_\sigmapσ​。这样可以得到快速、高效的学习更新,反馈即时,梯度质量也高。与先前工作13,15^{13,15}13,15 类似,我们还训练一个快速策略 pπp_\pipπ​,以便在走子时迅速采样动作。接下来,我们训练一个强化学习(RL)策略网络 pρp_\rhopρ​,通过优化自我对弈的最终结果来改进 SL 策略网络。这会把策略推向“赢棋”这一正确目标,而不是最大化预测准确率。最后,我们训练价值网络 vθv_\thetavθ​,用来预测 RL 策略网络自我对弈的胜者。我们的程序 AlphaGo 把策略网络、价值网络与 MCTS 高效地结合在一起。

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–24^{13,21–24}13,21–24. The SL policy network pσ(a∣s)p_\sigma(a|s)pσ​(a∣s) alternates between convolutional layers with weights σ\sigmaσ, and rectifier nonlinearities. A final softmax layer outputs a probability distribution over all legal moves aaa. The input sss 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)(s, a)(s,a), using stochastic gradient ascent to maximize the likelihood of the human move aaa selected in state sss

训练流水线的第一阶段,我们建立在用监督学习预测围棋高手着法的先前工作之上13,21–24^{13,21–24}13,21–24。SL 策略网络 pσ(a∣s)p_\sigma(a|s)pσ​(a∣s) 在带权重 σ\sigmaσ 的卷积层与整流非线性之间交替。最后的 softmax 层输出所有合法着法 aaa 上的概率分布。策略网络的输入 sss 是棋盘状态的一种简单表示(见扩展数据表 2)。策略网络在随机采样的状态–动作对 (s,a)(s, a)(s,a) 上训练,用随机梯度上升最大化人类在状态 sss 所选着法 aaa 的似然

Δσ∝∂log⁡pσ(a∣s)∂σ\Delta\sigma \propto \frac{\partial \log p_\sigma(a|s)}{\partial \sigma}Δσ∝∂σ∂logpσ​(a∣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^{24}24 (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)p_\pi(a|s)pπ​(a∣s), using a linear softmax of small pattern features (see Extended Data Table 4) with weights π\piπ; this achieved an accuracy of 24.2%, using just 2 μs to select an action, rather than 3 ms for the policy network.

我们用 KGS 围棋服务器上的 3000 万个局面,训练了一个 13 层的策略网络,称为 SL 策略网络。该网络在留出测试集上预测高手着法:使用全部输入特征时准确率为 57.0%,只用原始棋盘局面与着法历史时为 55.7%;提交时其他研究组的最优结果是 44.4%24^{24}24(完整结果见扩展数据表 3)。准确率上很小的改进就会带来棋力的大幅提升(图 2a);更大的网络准确率更高,但在搜索中评估更慢。我们还训练了更快但更不准的走子策略 pπ(a∣s)p_\pi(a|s)pπ​(a∣s),它是带权重 π\piπ 的小型模式特征的线性 softmax(见扩展数据表 4);准确率为 24.2%,选出一个动作只需 2 微秒,而策略网络需要 3 毫秒。

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^{25,26}25,26. The RL policy network pρp_\rhopρ​ is identical in structure to the SL policy network, and its weights ρ\rhoρ are initialized to the same values, ρ=σ\rho = \sigmaρ=σ. We play games between the current policy network pρp_\rhopρ​ 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)r(s)r(s) that is zero for all non-terminal time steps t<Tt < Tt<T. The outcome zt=±r(sT)z_t = \pm r(s_T)zt​=±r(sT​) is the terminal reward at the end of the game from the perspective of the current player at time step ttt: +1+1+1 for winning and −1-1−1 for losing. Weights are then updated at each time step ttt by stochastic gradient ascent in the direction that maximizes expected outcome25^{25}25

训练流水线的第二阶段,目标是用策略梯度强化学习(RL)25,26^{25,26}25,26 改进策略网络。RL 策略网络 pρp_\rhopρ​ 与 SL 策略网络结构相同,权重 ρ\rhoρ 初始化为相同的值,ρ=σ\rho = \sigmaρ=σ。我们让当前策略网络 pρp_\rhopρ​ 与随机选出的、该策略网络先前某一迭代对弈。这样从对手池中随机化,可以避免过拟合到当前策略,从而稳定训练。我们使用的奖励函数 r(s)r(s)r(s) 在所有非终止时间步 t<Tt < Tt<T 上都为零。结果 zt=±r(sT)z_t = \pm r(s_T)zt​=±r(sT​) 是对局结束时、从时间步 ttt 的当前棋手视角看到的终止奖励:赢为 +1+1+1,输为 −1-1−1。随后在每个时间步 ttt,沿最大化期望结果的方向做随机梯度上升来更新权重25^{25}25

Δρ∝∂log⁡pρ(at∣st)∂ρzt\Delta\rho \propto \frac{\partial \log p_\rho(a_t|s_t)}{\partial \rho} z_tΔρ∝∂ρ∂logpρ​(at​∣st​)​zt​

We evaluated the performance of the RL policy network in game play, sampling each move at∼pρ(⋅∣st)a_t \sim p_\rho(\cdot|s_t)at​∼pρ​(⋅∣st​) 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^{14}14, 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^{23}23 and 12% against a slightly weaker program, Fuego24^{24}24.

我们在对弈中评估 RL 策略网络的表现,每一步从它输出的动作概率分布中采样 at∼pρ(⋅∣st)a_t \sim p_\rho(\cdot|s_t)at​∼pρ​(⋅∣st​)。正面交锋时,RL 策略网络对 SL 策略网络的胜率超过 80%。我们还对当时最强的开源围棋程序 Pachi14^{14}14 做了测试:这是一个精巧的蒙特卡洛搜索程序,在 KGS 上排名业余 2 段,每步执行 10 万次模拟。完全不使用搜索时,RL 策略网络对 Pachi 的胜率为 85%。相比之下,此前仅基于卷积网络监督学习的最优结果,对 Pachi 的胜率为 11%23^{23}23,对稍弱的程序 Fuego 为 12%24^{24}24。

Reinforcement learning of value networks

价值网络的强化学习

The final stage of the training pipeline focuses on position evaluation, estimating a value function vp(s)v^p(s)vp(s) that predicts the outcome from position sss of games played by using policy ppp for both players28–30^{28–30}28–30

训练流水线的最后阶段关注局面评估,估计价值函数 vp(s)v^p(s)vp(s),用来预测双方都使用策略 ppp 时从局面 sss 出发的对局结果28–30^{28–30}28–30

vp(s)=E[zt∣st=s,at…T∼p]v^p(s) = \mathbb{E}[z_t \mid s_t = s, a_{t\ldots T} \sim p]vp(s)=E[zt​∣st​=s,at…T​∼p]

Ideally, we would like to know the optimal value function under perfect play v∗(s)v^*(s)v∗(s); in practice, we instead estimate the value function vpρ(s)v^{p_\rho}(s)vpρ​(s) for our strongest policy, using the RL policy network pρp_\rhopρ​. We approximate the value function using a value network vθ(s)v_\theta(s)vθ​(s) with weights θ\thetaθ, vθ(s)≈vpρ(s)≈v∗(s)v_\theta(s) \approx v^{p_\rho}(s) \approx v^*(s)vθ​(s)≈vpρ​(s)≈v∗(s). 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)(s, z)(s,z), using stochastic gradient descent to minimize the mean squared error (MSE) between the predicted value vθ(s)v_\theta(s)vθ​(s), and the corresponding outcome zzz

理想情况下,我们希望知道完美行棋下的最优价值函数 v∗(s)v^*(s)v∗(s);实践中,我们改为用最强策略——RL 策略网络 pρp_\rhopρ​——估计价值函数 vpρ(s)v^{p_\rho}(s)vpρ​(s)。我们用带权重 θ\thetaθ 的价值网络 vθ(s)v_\theta(s)vθ​(s) 来近似该价值函数,vθ(s)≈vpρ(s)≈v∗(s)v_\theta(s) \approx v^{p_\rho}(s) \approx v^*(s)vθ​(s)≈vpρ​(s)≈v∗(s)。这个神经网络与策略网络结构相近,但输出的是单个预测而不是概率分布。我们在状态–结果对 (s,z)(s, z)(s,z) 上做回归来训练价值网络的权重,用随机梯度下降最小化预测价值 vθ(s)v_\theta(s)vθ​(s) 与相应结果 zzz 之间的均方误差(MSE)

Δθ∝∂vθ(s)∂θ(z−vθ(s))\Delta\theta \propto \frac{\partial v_\theta(s)}{\partial \theta}\bigl(z - v_\theta(s)\bigr)Δθ∝∂θ∂vθ​(s)​(z−vθ​(s))

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πp_\pipπ​; the value function was consistently more accurate. A single evaluation of vθ(s)v_\theta(s)vθ​(s) also approached the accuracy of Monte Carlo rollouts using the RL policy network pρp_\rhopρ​, but using 15,000 times less computation.

从完整对局组成的数据里预测对局结果,这种朴素做法会导致过拟合。问题在于相继局面强相关,往往只差一子,而回归目标却整局共用。按这种方式在 KGS 数据集上训练时,价值网络记住的是对局结果,而不是泛化到新局面:测试集上最低 MSE 为 0.37,训练集上为 0.19。为缓解这一问题,我们生成了一个新的自我对弈数据集,包含 3000 万个互不相同的局面,每个局面采样自一局独立对弈。每局由 RL 策略网络与自己对弈直到终局。在这个数据集上训练后,训练集与测试集上的 MSE 分别为 0.226 与 0.234,表明过拟合很小。图 2b 给出价值网络的局面评估准确率,并与使用快速走子策略 pπp_\pipπ​ 的蒙特卡洛走子比较;价值函数始终更准。对 vθ(s)v_\theta(s)vθ​(s) 做一次评估,也接近使用 RL 策略网络 pρp_\rhopρ​ 做蒙特卡洛走子的准确率,但计算量少 15,000 倍。

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)(s, a)(s,a) of the search tree stores an action value Q(s,a)Q(s, a)Q(s,a), visit count N(s,a)N(s, a)N(s,a), and prior probability P(s,a)P(s, a)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 ttt of each simulation, an action ata_tat​ is selected from state sts_tst​

AlphaGo 在一种靠前瞻搜索选择动作的 MCTS 算法中结合策略网络与价值网络(图 3)。搜索树的每条边 (s,a)(s, a)(s,a) 存储动作价值 Q(s,a)Q(s, a)Q(s,a)、访问次数 N(s,a)N(s, a)N(s,a) 以及先验概率 P(s,a)P(s, a)P(s,a)。树通过模拟来遍历(也就是在完整对局中向下走、先不回传),从根状态出发。每次模拟的每个时间步 ttt,从状态 sts_tst​ 中选出动作 ata_tat​

at=arg⁡max⁡a(Q(st,a)+u(st,a))a_t = \arg\max_a \bigl(Q(s_t, a) + u(s_t, a)\bigr)at​=argamax​(Q(st​,a)+u(st​,a))

so as to maximize action value plus a bonus

以便最大化动作价值加上一项奖励

u(s,a)∝P(s,a)1+N(s,a)u(s, a) \propto \frac{P(s, a)}{1 + N(s, a)}u(s,a)∝1+N(s,a)P(s,a)​

that is proportional to the prior probability but decays with repeated visits to encourage exploration. When the traversal reaches a leaf node sLs_LsL​ at step LLL, the leaf node may be expanded. The leaf position sLs_LsL​ is processed just once by the SL policy network pσp_\sigmapσ​. The output probabilities are stored as prior probabilities PPP for each legal action aaa, P(s,a)=pσ(a∣s)P(s, a) = p_\sigma(a|s)P(s,a)=pσ​(a∣s). The leaf node is evaluated in two very different ways: first, by the value network vθ(sL)v_\theta(s_L)vθ​(sL​); and second, by the outcome zLz_LzL​ of a random rollout played out until terminal step TTT using the fast rollout policy pπp_\pipπ​; these evaluations are combined, using a mixing parameter λ\lambdaλ, into a leaf evaluation V(sL)V(s_L)V(sL​)

该项与先验概率成正比,但会随重复访问而衰减,以鼓励探索。当遍历在第 LLL 步到达叶节点 sLs_LsL​ 时,该叶节点可以被扩展。叶局面 sLs_LsL​ 只被 SL 策略网络 pσp_\sigmapσ​ 处理一次。输出概率作为每条合法动作 aaa 的先验概率存储,P(s,a)=pσ(a∣s)P(s, a) = p_\sigma(a|s)P(s,a)=pσ​(a∣s)。叶节点用两种很不相同的方式评估:第一,用价值网络 vθ(sL)v_\theta(s_L)vθ​(sL​);第二,用快速走子策略 pπp_\pipπ​ 随机走子到终止步 TTT 得到的结果 zLz_LzL​。这两种评估用混合参数 λ\lambdaλ 合成叶评估 V(sL)V(s_L)V(sL​)

V(sL)=(1−λ) vθ(sL)+λzLV(s_L) = (1-\lambda)\, v_\theta(s_L) + \lambda z_LV(sL​)=(1−λ)vθ​(sL​)+λzL​

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

模拟结束时,所有经过边的动作价值与访问次数都会更新。每条边累积经过它的所有模拟的访问次数与平均评估

N(s,a)=∑i=1n1(s,a,i)N(s, a) = \sum_{i=1}^{n} \mathbf{1}(s, a, i)N(s,a)=i=1∑n​1(s,a,i)

Q(s,a)=1N(s,a)∑i=1n1(s,a,i) V(sLi)Q(s, a) = \frac{1}{N(s, a)} \sum_{i=1}^{n} \mathbf{1}(s, a, i)\, V(s_L^i)Q(s,a)=N(s,a)1​i=1∑n​1(s,a,i)V(sLi​)

where sLis_L^isLi​ is the leaf node from the iiith simulation, and 1(s,a,i)\mathbf{1}(s, a, i)1(s,a,i) indicates whether an edge (s,a)(s, a)(s,a) was traversed during the iiith simulation. Once the search is complete, the algorithm chooses the most visited move from the root position.

其中 sLis_L^isLi​ 是第 iii 次模拟的叶节点,1(s,a,i)\mathbf{1}(s, a, i)1(s,a,i) 表示第 iii 次模拟是否经过边 (s,a)(s, a)(s,a)。搜索完成后,算法从根局面选择被访问最多的着法。

It is worth noting that the SL policy network pσp_\sigmapσ​ performed better in AlphaGo than the stronger RL policy network pρp_\rhopρ​, presumably because humans select a diverse beam of promising moves, whereas RL optimizes for the single best move. However, the value function vθ(s)≈vpρ(s)v_\theta(s) \approx v^{p_\rho}(s)vθ​(s)≈vpρ​(s) derived from the stronger RL policy network performed better in AlphaGo than a value function vθ(s)≈vpσ(s)v_\theta(s) \approx v^{p_\sigma}(s)vθ​(s)≈vpσ​(s) derived from the SL policy network.

值得注意的是,SL 策略网络 pσp_\sigmapσ​ 在 AlphaGo 里表现优于更强的 RL 策略网络 pρp_\rhopρ​,原因大概是人类会选出一束多样且有希望的着法,而 RL 优化的是单一最佳着法。不过,由更强的 RL 策略网络导出的价值函数 vθ(s)≈vpρ(s)v_\theta(s) \approx v^{p_\rho}(s)vθ​(s)≈vpρ​(s),在 AlphaGo 里优于由 SL 策略网络导出的价值函数 vθ(s)≈vpσ(s)v_\theta(s) \approx v^{p_\sigma}(s)vθ​(s)≈vpσ​(s)。

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.

评估策略网络与价值网络所需的计算量,比传统搜索启发式高出几个数量级。为了把 MCTS 与深度神经网络高效结合起来,AlphaGo 使用异步多线程搜索:在 CPU 上执行模拟,并在 GPU 上并行计算策略网络与价值网络。最终版 AlphaGo 使用 40 个搜索线程、48 个 CPU 与 8 个 GPU。我们还实现了分布式版本的 AlphaGo,利用多台机器、40 个搜索线程、1,202 个 CPU 与 176 个 GPU。异步与分布式 MCTS 的完整细节见方法部分。

Evaluating the playing strength of AlphaGo

评估 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^{13}13 and Zen, and the strongest open source programs Pachi14^{14}14 and Fuego15^{15}15. 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.

为评估 AlphaGo,我们在 AlphaGo 的不同变体以及其他若干围棋程序之间举办了内部循环赛,其中包括最强的商业程序 Crazy Stone13^{13}13 与 Zen,以及最强的开源程序 Pachi14^{14}14 与 Fuego15^{15}15。这些程序都以高性能 MCTS 算法为基础。此外,我们还纳入了开源程序 GnuGo,它使用的是 MCTS 出现之前的先进搜索方法。所有程序每步允许 5 秒计算时间。

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.

循环赛结果(见图 4a)表明,单机 AlphaGo 比此前任何围棋程序都强出许多段:对其他围棋程序 495 局中赢了 494 局(99.8%)。为给 AlphaGo 更大挑战,我们还下了让四子的对局(也就是给对手的免费着手);AlphaGo 对 Crazy Stone、Zen 与 Pachi 的让子胜率分别为 77%、86% 与 99%。分布式版本的 AlphaGo 明显更强,对单机 AlphaGo 的胜率为 77%,对其他程序则为 100%。

We also assessed variants of AlphaGo that evaluated positions using just the value network (λ=0\lambda = 0λ=0) or just rollouts (λ=1\lambda = 1λ=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\lambda = 0.5λ=0.5) performed best, winning ≥95%\geq 95\%≥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ρp_\rhopρ​, while the rollouts can precisely score and evaluate the outcome of games played by the weaker but faster rollout policy pπp_\pipπ​. Figure 5 visualizes the evaluation of a real game position by AlphaGo.

我们还评估了只使用价值网络(λ=0\lambda = 0λ=0)或只使用走子(λ=1\lambda = 1λ=1)来评估局面的 AlphaGo 变体(见图 4b)。即便没有走子,AlphaGo 也超过了所有其他围棋程序,表明价值网络为围棋中的蒙特卡洛评估提供了一种可行替代。不过,混合评估(λ=0.5\lambda = 0.5λ=0.5)表现最好,对其他变体的胜率 ≥95%\geq 95\%≥95%。这说明两种局面评估机制是互补的:价值网络近似由虽强但慢到不实用的 pρp_\rhopρ​ 所下对局的结果,而走子则能精确计分并评估由较弱但更快的走子策略 pπp_\pipπ​ 所下对局的结果。图 5 可视化了 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^{3,7,31}3,7,31.

最后,我们让分布式版本的 AlphaGo 对阵樊麾:他是职业二段,也是 2013、2014 与 2015 年欧洲围棋锦标赛冠军。2015 年 10 月 5 日至 9 日,AlphaGo 与樊麾进行了正式的五番棋。AlphaGo 以 5 比 0 获胜(图 6 与扩展数据表 1)。这是计算机围棋程序第一次在没有让子的完整围棋对局中击败人类职业棋手——这一成就此前被认为至少还要再等十年3,7,31^{3,7,31}3,7,31。

Discussion

讨论

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–33^{31–33}31–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.

这项工作中,我们开发了一个基于深度神经网络与树搜索相结合的围棋程序,棋力达到最强人类棋手的水平,从而实现了人工智能的“重大挑战”之一31–33^{31–33}31–33。我们第一次为围棋开发出有效的着法选择与局面评估函数,它们建立在由监督学习和强化学习新组合训练出的深度神经网络之上。我们提出了一种成功地把神经网络评估与蒙特卡洛走子结合起来的新搜索算法。我们的程序 AlphaGo 在高性能树搜索引擎中,把这些组件规模化地整合在一起。

During the match against Fan Hui, AlphaGo evaluated thousands of times fewer positions than Deep Blue did in its chess match against Kasparov4^44; 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.

在与樊麾的比赛中,AlphaGo 评估的局面数比 Deep Blue 在对阵卡斯帕罗夫的国际象棋比赛中少了数千倍4^44;它用策略网络更智能地选出那些局面,再用价值网络更精确地评估它们,以此来弥补——这种做法也许更接近人类的下棋方式。此外,Deep Blue 依赖手工设计的评估函数,而 AlphaGo 的神经网络则纯粹通过通用的监督学习与强化学习方法,直接从对局中训练而来。

Go is exemplary in many ways of the difficulties faced by artificial intelligence33,34^{33,34}33,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^{35,36}35,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.

围棋在许多方面都典型地体现了人工智能面临的困难33,34^{33,34}33,34:这是一项有挑战的决策任务,搜索空间难以处理,最优解又复杂到看起来无法直接用策略或价值函数去近似。计算机围棋此前的重大突破——MCTS 的引入——曾带动许多其他领域的相应进展,例如一般博弈、经典规划、部分可观察规划、调度以及约束满足35,36^{35,36}35,36。通过把树搜索与策略、价值网络结合起来,AlphaGo 终于在围棋上达到了职业水平,也让人看到希望:在其他看似难以处理的人工智能领域,现在同样有可能达到人类水平的表现。

Figure 1 | Neural network training pipeline and architecture. a, A fast rollout policy pπp_\pipπ​ and supervised learning (SL) policy network pσp_\sigmapσ​ are trained to predict human expert moves in a data set of positions. A reinforcement learning (RL) policy network pρp_\rhopρ​ 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θv_\thetavθ​ 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 sss as its input, passes it through many convolutional layers with parameters σ\sigmaσ (SL policy network) or ρ\rhoρ (RL policy network), and outputs a probability distribution pσ(a∣s)p_\sigma(a|s)pσ​(a∣s) or pρ(a∣s)p_\rho(a|s)pρ​(a∣s) over legal moves aaa, represented by a probability map over the board. The value network similarly uses many convolutional layers with parameters θ\thetaθ, but outputs a scalar value vθ(s′)v_\theta(s')vθ​(s′) that predicts the expected outcome in position s′s's′.

图 1 | 神经网络训练流水线与结构。a,快速走子策略 pπp_\pipπ​ 与监督学习(SL)策略网络 pσp_\sigmapσ​ 在一个局面数据集上训练,以预测人类高手着法。强化学习(RL)策略网络 pρp_\rhopρ​ 初始化为 SL 策略网络,再用策略梯度学习改进,以最大化对策略网络先前版本的对局结果(也就是赢下更多对局)。随后用 RL 策略网络进行自我对弈,生成新的数据集。最后,价值网络 vθv_\thetavθ​ 通过回归训练,预测自我对弈数据集中各局面的期望结果(也就是当前棋手是否获胜)。b,AlphaGo 所用神经网络结构的示意图。策略网络以棋盘局面 sss 的表示作为输入,经过许多带参数 σ\sigmaσ(SL 策略网络)或 ρ\rhoρ(RL 策略网络)的卷积层,输出合法着法 aaa 上的概率分布 pσ(a∣s)p_\sigma(a|s)pσ​(a∣s) 或 pρ(a∣s)p_\rho(a|s)pρ​(a∣s),表示为棋盘上的概率图。价值网络同样使用许多带参数 θ\thetaθ 的卷积层,但输出标量价值 vθ(s′)v_\theta(s')vθ​(s′),预测局面 s′s's′ 的期望结果。

Figure 2 | Strength and accuracy of policy and value networks. 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θv_\thetavθ​, or by the mean outcome of 100 rollouts, played out using either uniform random rollouts, the fast rollout policy pπp_\pipπ​, the SL policy network pσp_\sigmapσ​ or the RL policy network pρp_\rhopρ​. 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).

图 2 | 策略网络与价值网络的棋力与准确率。a,策略网络棋力随训练准确率变化的图。每层分别有 128、192、256 与 384 个卷积滤波器的策略网络在训练过程中被定期评估;图中给出使用该策略网络的 AlphaGo 对阵比赛版本 AlphaGo 的胜率。b,价值网络与不同策略走子之间的评估准确率比较。局面与结果采样自人类高手对局。每个局面由价值网络 vθv_\thetavθ​ 的单次前向传播评估,或由 100 次走子的平均结果评估,走子分别使用均匀随机走子、快速走子策略 pπp_\pipπ​、SL 策略网络 pσp_\sigmapσ​ 或 RL 策略网络 pρp_\rhopρ​。预测价值与实际对局结果之间的均方误差,按对局阶段(该局面已经下了多少手)画出。

Figure 3 | Monte Carlo tree search in AlphaGo. a, Each simulation traverses the tree by selecting the edge with maximum action value QQQ, plus a bonus u(P)u(P)u(P) that depends on a stored prior probability PPP for that edge. b, The leaf node may be expanded; the new node is processed once by the policy network pσp_\sigmapσ​ and the output probabilities are stored as prior probabilities PPP for each action. c, At the end of a simulation, the leaf node is evaluated in two ways: using the value network vθv_\thetavθ​; and by running a rollout to the end of the game with the fast rollout policy pπp_\pipπ​, then computing the winner with function rrr. d, Action values QQQ are updated to track the mean value of all evaluations r(⋅)r(\cdot)r(⋅) and vθ(⋅)v_\theta(\cdot)vθ​(⋅) in the subtree below that action.

图 3 | AlphaGo 中的蒙特卡洛树搜索。a,每次模拟通过选择动作价值 QQQ 加上奖励 u(P)u(P)u(P) 最大的边来遍历树,该奖励依赖于这条边存储的先验概率 PPP。b,叶节点可以被扩展;新节点由策略网络 pσp_\sigmapσ​ 处理一次,输出概率作为每个动作的先验概率 PPP 存储。c,一次模拟结束时,叶节点用两种方式评估:使用价值网络 vθv_\thetavθ​;以及用快速走子策略 pπp_\pipπ​ 走到终局,再用函数 rrr 计算胜者。d,动作价值 QQQ 被更新,以跟踪该动作以下子树中所有评估 r(⋅)r(\cdot)r(⋅) 与 vθ(⋅)v_\theta(\cdot)vθ​(⋅) 的平均值。

Figure 4 | Tournament evaluation of AlphaGo. a, Results of a tournament between different Go programs (see Extended Data Tables 6–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^{37}37: a 230 point gap corresponds to a 79% probability of winning, which roughly corresponds to one amateur dan rank advantage on KGS38^{38}38; 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.

图 4 | AlphaGo 的循环赛评估。a,不同围棋程序之间循环赛的结果(见扩展数据表 6–11)。每个程序每步大约使用 5 秒计算时间。为给 AlphaGo 更大挑战,一些程序(浅色上段)对所有对手让四子(也就是每局开始时的免费着手)。程序按 Elo 分评估37^{37}37:230 分的差距对应 79% 的胜率,大约相当于 KGS 上一个业余段位的优势38^{38}38;图中也给出与人类段位的大致对应,水平线表示该程序在网上达到的 KGS 段位。对阵人类欧洲冠军樊麾的对局也包括在内;这些对局使用更长的时限。图中给出 95% 置信区间。b,单机 AlphaGo 在不同组件组合下的表现。只使用策略网络的版本不做任何搜索。c,AlphaGo 中 MCTS 随搜索线程与 GPU 变化的可扩展性研究,使用异步搜索(浅蓝色)或分布式搜索(深蓝色),每步 2 秒。

Figure 5 | How AlphaGo (black, to play) selected its move in an informal game against Fan Hui. For each of the following statistics, the location of the maximum value is indicated by an orange circle. a, Evaluation of all successors s′s's′ of the root position sss, using the value network vθ(s′)v_\theta(s')vθ​(s′); estimated winning percentages are shown for the top evaluations. b, Action values Q(s,a)Q(s, a)Q(s,a) for each edge (s,a)(s, a)(s,a) in the tree from root position sss; averaged over value network evaluations only (λ=0\lambda = 0λ=0). c, Action values Q(s,a)Q(s, a)Q(s,a), averaged over rollout evaluations only (λ=1\lambda = 1λ=1). d, Move probabilities directly from the SL policy network, pσ(a∣s)p_\sigma(a|s)pσ​(a∣s); 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.

图 5 | AlphaGo(执黑,该下)如何在与樊麾的一局非正式对局中选择着法。对下面每一项统计,最大值的位置用橙色圆圈标出。a,用价值网络 vθ(s′)v_\theta(s')vθ​(s′) 评估根局面 sss 的所有后继 s′s's′;对评估最高的着法标出估计胜率。b,从根局面 sss 出发的树中每条边 (s,a)(s, a)(s,a) 的动作价值 Q(s,a)Q(s, a)Q(s,a);只对价值网络评估取平均(λ=0\lambda = 0λ=0)。c,动作价值 Q(s,a)Q(s, a)Q(s,a),只对走子评估取平均(λ=1\lambda = 1λ=1)。d,直接来自 SL 策略网络的着法概率 pσ(a∣s)p_\sigma(a|s)pσ​(a∣s);以百分比给出(若高于 0.1%)。e,模拟中从根节点选出各动作的频率百分比。f,AlphaGo 搜索树中的主要变化(访问次数最大的路径)。着法按编号顺序给出。AlphaGo 选择了红圈标出的着法;樊麾应以白方块标出的着法;在赛后解说中,他更倾向于 AlphaGo 预测的那手(标为 1)。

Figure 6 | Games from the match between AlphaGo and the European champion, Fan Hui. 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).

图 6 | AlphaGo 与欧洲冠军樊麾对局中的棋谱。着法按实际落子顺序编号给出。同一交叉点上的重复落子在棋盘下方成对标出。每对中的第一个手数表示重复落子发生的时机,交叉点由第二个手数标明(见补充信息)。

Online Content Methods, along with any additional Extended Data display items and Source Data, are available in the online version of the paper; references unique to these sections appear only in the online paper.

在线内容 方法部分,以及任何额外的扩展数据展示项与源数据,可在论文的在线版本中获得;这些部分独有的参考文献只出现在在线论文中。

Received 11 November 2015; accepted 5 January 2016.

2015 年 11 月 11 日收到;2016 年 1 月 5 日接受。

Acknowledgements 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.

致谢 我们感谢樊麾同意与 AlphaGo 对弈;感谢 T. Manning 担任比赛裁判;感谢 R. Munos 与 T. Schaul 的有益讨论与建议;感谢 A. Cain 与 M. Cant 在可视化方面的工作;感谢 P. Dayan、G. Wayne、D. Kumaran、D. Purves、H. van Hasselt、A. Barreto 与 G. Ostrovski 审阅本文;并感谢 DeepMind 团队其余成员的支持、想法与鼓励。

Author Contributions 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.

Author Information Reprints and permissions information is available at www.nature.com/reprints. The authors declare no competing financial interests. Readers are welcome to comment on the online version of the paper. Correspondence and requests for materials should be addressed to D.S. (davidsilver@google.com) or D.H. (demishassabis@google.com).

METHODS

方法

Problem setting

问题设定

Many games of perfect information, such as chess, checkers, othello, backgammon and Go, may be defined as alternating Markov games39^{39}39. In these games, there is a state space S\mathcal{S}S (where state includes an indication of the current player to play); an action space A(s)\mathcal{A}(s)A(s) defining the legal actions in any given state s∈Ss \in \mathcal{S}s∈S; a state transition function f(s,a,ξ)f(s, a, \xi)f(s,a,ξ) defining the successor state after selecting action aaa in state sss and random input ξ\xiξ (for example, dice); and finally a reward function ri(s)r_i(s)ri​(s) describing the reward received by player iii in state sss. We restrict our attention to two-player zero-sum games, r1(s)=−r2(s)=r(s)r_1(s) = -r_2(s) = r(s)r1​(s)=−r2​(s)=r(s), with deterministic state transitions, f(s,a,ξ)=f(s,a)f(s, a, \xi) = f(s, a)f(s,a,ξ)=f(s,a), and zero rewards except at a terminal time step TTT. The outcome of the game zt=±r(sT)z_t = \pm r(s_T)zt​=±r(sT​) is the terminal reward at the end of the game from the perspective of the current player at time step ttt. A policy p(a∣s)p(a|s)p(a∣s) is a probability distribution over legal actions a∈A(s)a \in \mathcal{A}(s)a∈A(s). A value function is the expected outcome if all actions for both players are selected according to policy ppp, that is, vp(s)=E[zt∣st=s,at…T∼p]v^p(s) = \mathbb{E}[z_t \mid s_t = s, a_{t\ldots T} \sim p]vp(s)=E[zt​∣st​=s,at…T​∼p]. Zero-sum games have a unique optimal value function v∗(s)v^*(s)v∗(s) that determines the outcome from state sss following perfect play by both players.

许多完全信息博弈,如国际象棋、跳棋、奥赛罗、西洋双陆棋与围棋,都可以定义为交替马尔可夫博弈39^{39}39。在这些博弈中,有状态空间 S\mathcal{S}S(状态中包含当前该谁下);动作空间 A(s)\mathcal{A}(s)A(s) 给出任一状态 s∈Ss \in \mathcal{S}s∈S 中的合法动作;状态转移函数 f(s,a,ξ)f(s, a, \xi)f(s,a,ξ) 给出在状态 sss 选择动作 aaa 并接受随机输入 ξ\xiξ(例如骰子)后的后继状态;最后还有奖励函数 ri(s)r_i(s)ri​(s),描述棋手 iii 在状态 sss 收到的奖励。我们只关注双人零和博弈,r1(s)=−r2(s)=r(s)r_1(s) = -r_2(s) = r(s)r1​(s)=−r2​(s)=r(s),状态转移是确定性的,f(s,a,ξ)=f(s,a)f(s, a, \xi) = f(s, a)f(s,a,ξ)=f(s,a),除终止时间步 TTT 外奖励为零。对局结果 zt=±r(sT)z_t = \pm r(s_T)zt​=±r(sT​) 是终局时从时间步 ttt 的当前棋手视角看到的终止奖励。策略 p(a∣s)p(a|s)p(a∣s) 是合法动作 a∈A(s)a \in \mathcal{A}(s)a∈A(s) 上的概率分布。价值函数是双方所有动作都按策略 ppp 选择时的期望结果,即 vp(s)=E[zt∣st=s,at…T∼p]v^p(s) = \mathbb{E}[z_t \mid s_t = s, a_{t\ldots T} \sim p]vp(s)=E[zt​∣st​=s,at…T​∼p]。零和博弈有唯一的最优价值函数 v∗(s)v^*(s)v∗(s),它决定双方完美行棋时从状态 sss 出发的结果。

Prior work

先前工作

The optimal value function can be computed recursively by minimax (or equivalently negamax) search40^{40}40. 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)v(s) \approx v^*(s)v(s)≈v∗(s) in place of terminal rewards. Depth-first minimax search with alpha–beta pruning40^{40}40 has achieved superhuman performance in chess4^44, checkers5^55 and othello6^66, but it has not been effective in Go7^77.

最优价值函数可以通过极小极大(或等价的负极大)搜索递归计算40^{40}40。大多数博弈都太大,无法做穷尽的极小极大树搜索;于是用近似价值函数 v(s)≈v∗(s)v(s) \approx v^*(s)v(s)≈v∗(s) 代替终止奖励来截断对局。带 alpha–beta 剪枝的深度优先极小极大搜索40^{40}40 已在国际象棋4^44、跳棋5^55 和奥赛罗6^66 中达到超人表现,但在围棋中并不有效7^77。

Reinforcement learning can learn to approximate the optimal value function directly from games of self-play39^{39}39. The majority of prior work has focused on a linear combination vθ(s)=ϕ(s)⋅θv_\theta(s) = \phi(s) \cdot \thetavθ​(s)=ϕ(s)⋅θ of features ϕ(s)\phi(s)ϕ(s) with weights θ\thetaθ. Weights were trained using temporal-difference learning41^{41}41 in chess42,43^{42,43}42,43, checkers44,45^{44,45}44,45 and Go30^{30}30; or using linear regression in othello6^66 and Scrabble9^99. Temporal-difference learning has also been used to train a neural network to approximate the optimal value function, achieving superhuman performance in backgammon46^{46}46; and achieving weak kyu-level performance in small-board Go28,29,47^{28,29,47}28,29,47 using convolutional networks.

强化学习可以直接从自我对弈中学习近似最优价值函数39^{39}39。先前工作大多关注特征 ϕ(s)\phi(s)ϕ(s) 与权重 θ\thetaθ 的线性组合 vθ(s)=ϕ(s)⋅θv_\theta(s) = \phi(s) \cdot \thetavθ​(s)=ϕ(s)⋅θ。权重在国际象棋42,43^{42,43}42,43、跳棋44,45^{44,45}44,45 与围棋30^{30}30 中用时序差分学习41^{41}41 训练;在奥赛罗6^66 与 Scrabble9^99 中则用线性回归。时序差分学习也被用来训练神经网络以近似最优价值函数,在西洋双陆棋中达到超人表现46^{46}46;在小组棋盘围棋中,用卷积网络达到了较弱的级位水平28,29,47^{28,29,47}28,29,47。

An alternative approach to minimax search is Monte Carlo tree search (MCTS)11,12^{11,12}11,12, which estimates the optimal value of interior nodes by a double approximation, Vn(s)≈vPn(s)≈v∗(s)V_n(s) \approx v^{P_n}(s) \approx v^*(s)Vn​(s)≈vPn​(s)≈v∗(s). The first approximation, Vn(s)≈vPn(s)V_n(s) \approx v^{P_n}(s)Vn​(s)≈vPn​(s), uses nnn Monte Carlo simulations to estimate the value function of a simulation policy PnP_nPn​. The second approximation, vPn(s)≈v∗(s)v^{P_n}(s) \approx v^*(s)vPn​(s)≈v∗(s), uses a simulation policy PnP_nPn​ in place of minimax optimal actions. The simulation policy selects actions according to a search control function arg⁡max⁡a(Qn(s,a)+u(s,a))\arg\max_a(Q_n(s, a) + u(s, a))argmaxa​(Qn​(s,a)+u(s,a)), such as UCT12^{12}12, that selects children with higher action values, Qn(s,a)=−Vn(f(s,a))Q_n(s, a) = -V_n(f(s, a))Qn​(s,a)=−Vn​(f(s,a)), plus a bonus u(s,a)u(s, a)u(s,a) that encourages exploration; or in the absence of a search tree at state sss, it samples actions from a fast rollout policy pπ(a∣s)p_\pi(a|s)pπ​(a∣s). 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^{12}12 to the optimal value function lim⁡n→∞Vn(s)=lim⁡n→∞vPn(s)=v∗(s)\lim_{n\to\infty} V_n(s) = \lim_{n\to\infty} v^{P_n}(s) = v^*(s)limn→∞​Vn​(s)=limn→∞​vPn​(s)=v∗(s). The strongest current Go programs are based on MCTS13–15,36^{13–15,36}13–15,36.

相对极小极大搜索的另一条路线是蒙特卡洛树搜索(MCTS)11,12^{11,12}11,12,它通过双重近似来估计内部节点的最优价值,Vn(s)≈vPn(s)≈v∗(s)V_n(s) \approx v^{P_n}(s) \approx v^*(s)Vn​(s)≈vPn​(s)≈v∗(s)。第一个近似 Vn(s)≈vPn(s)V_n(s) \approx v^{P_n}(s)Vn​(s)≈vPn​(s) 用 nnn 次蒙特卡洛模拟来估计模拟策略 PnP_nPn​ 的价值函数。第二个近似 vPn(s)≈v∗(s)v^{P_n}(s) \approx v^*(s)vPn​(s)≈v∗(s) 用模拟策略 PnP_nPn​ 代替极小极大最优动作。模拟策略按搜索控制函数 arg⁡max⁡a(Qn(s,a)+u(s,a))\arg\max_a(Q_n(s, a) + u(s, a))argmaxa​(Qn​(s,a)+u(s,a)) 选择动作,例如 UCT12^{12}12,它选择动作价值 Qn(s,a)=−Vn(f(s,a))Q_n(s, a) = -V_n(f(s, a))Qn​(s,a)=−Vn​(f(s,a)) 更高的子节点,再加上鼓励探索的奖励 u(s,a)u(s, a)u(s,a);若状态 sss 处还没有搜索树,则从快速走子策略 pπ(a∣s)p_\pi(a|s)pπ​(a∣s) 中采样动作。随着模拟增多、搜索树加深,模拟策略会得到越来越准确的统计量。在极限下,两个近似都变为精确,MCTS(例如配合 UCT)收敛12^{12}12 到最优价值函数 lim⁡n→∞Vn(s)=lim⁡n→∞vPn(s)=v∗(s)\lim_{n\to\infty} V_n(s) = \lim_{n\to\infty} v^{P_n}(s) = v^*(s)limn→∞​Vn​(s)=limn→∞​vPn​(s)=v∗(s)。目前最强的围棋程序都以 MCTS 为基础13–15,36^{13–15,36}13–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^{13}13; or to bias the bonus term towards high-probability moves48^{48}48. MCTS has also been combined with a value function that is used to initialize action values in newly expanded nodes16^{16}16, or to mix Monte Carlo evaluation with minimax evaluation49^{49}49. By contrast, AlphaGo’s use of value functions is based on truncated Monte Carlo search algorithms8,9^{8,9}8,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(λ\lambdaλ). 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.

此前,MCTS 曾与策略结合,用来把搜索树的束宽收窄到高概率着法13^{13}13,或把奖励项偏向高概率着法48^{48}48。MCTS 也曾与价值函数结合,用来初始化新扩展节点中的动作价值16^{16}16,或把蒙特卡洛评估与极小极大评估混合49^{49}49。相比之下,AlphaGo 对价值函数的使用建立在截断蒙特卡洛搜索算法8,9^{8,9}8,9 之上:在终局前结束走子,并用价值函数代替终止奖励。AlphaGo 的局面评估把完整走子与截断走子混合起来,在某些方面类似于著名的时序差分学习算法 TD(λ\lambdaλ)。AlphaGo 与先前工作的另一不同之处,是使用更慢但更强的策略与价值函数表示;评估深度神经网络比线性表示慢几个数量级,因此必须异步进行。

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

MCTS 的表现在很大程度上取决于走子策略的质量。先前工作关注手工设计的模式50^{50}50,或通过监督学习13^{13}13、强化学习16^{16}16、模拟平衡51,52^{51,52}51,52 或在线适应30,53^{30,53}30,53 来学习走子策略;不过,人们已经知道基于走子的局面评估常常不准54^{54}54。AlphaGo 使用相对简单的走子,转而用价值网络更直接地处理局面评估这一难题。

Search algorithm

搜索算法

To efficiently integrate large neural networks into AlphaGo, we implemented an asynchronous policy and value MCTS algorithm (APV-MCTS). Each node sss in the search tree contains edges (s,a)(s, a)(s,a) for all legal actions a∈A(s)a \in \mathcal{A}(s)a∈A(s). Each edge stores a set of statistics, {P(s,a),Nv(s,a),Nr(s,a),Wv(s,a),Wr(s,a),Q(s,a)}\{P(s,a), N_v(s,a), N_r(s,a), W_v(s,a), W_r(s,a), Q(s,a)\}{P(s,a),Nv​(s,a),Nr​(s,a),Wv​(s,a),Wr​(s,a),Q(s,a)}, where P(s,a)P(s, a)P(s,a) is the prior probability, Wv(s,a)W_v(s, a)Wv​(s,a) and Wr(s,a)W_r(s, a)Wr​(s,a) are Monte Carlo estimates of total action value, accumulated over Nv(s,a)N_v(s, a)Nv​(s,a) and Nr(s,a)N_r(s, a)Nr​(s,a) leaf evaluations and rollout rewards, respectively, and Q(s,a)Q(s, a)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.

为了把大型神经网络高效地纳入 AlphaGo,我们实现了一种异步的策略与价值 MCTS 算法(APV-MCTS)。搜索树中的每个节点 sss 包含所有合法动作 a∈A(s)a \in \mathcal{A}(s)a∈A(s) 对应的边 (s,a)(s, a)(s,a)。每条边存储一组统计量 {P(s,a),Nv(s,a),Nr(s,a),Wv(s,a),Wr(s,a),Q(s,a)}\{P(s,a), N_v(s,a), N_r(s,a), W_v(s,a), W_r(s,a), Q(s,a)\}{P(s,a),Nv​(s,a),Nr​(s,a),Wv​(s,a),Wr​(s,a),Q(s,a)},其中 P(s,a)P(s, a)P(s,a) 是先验概率,Wv(s,a)W_v(s, a)Wv​(s,a) 与 Wr(s,a)W_r(s, a)Wr​(s,a) 分别是在 Nv(s,a)N_v(s, a)Nv​(s,a) 次叶评估与 Nr(s,a)N_r(s, a)Nr​(s,a) 次走子奖励上累积的总动作价值的蒙特卡洛估计,Q(s,a)Q(s, a)Q(s,a) 则是该边的合成平均动作价值。多次模拟在不同搜索线程上并行执行。APV-MCTS 算法按图 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 LLL. At each of these time steps, t<Lt < Lt<L, an action is selected according to the statistics in the search tree, at=arg⁡max⁡a(Q(st,a)+u(st,a))a_t = \arg\max_a\bigl(Q(s_t, a) + u(s_t, a)\bigr)at​=argmaxa​(Q(st​,a)+u(st​,a)), using a variant of the PUCT algorithm48^{48}48, u(s,a)=cpuctP(s,a)∑bNr(s,b)1+Nr(s,a)u(s,a) = c_{\mathrm{puct}} P(s,a)\frac{\sqrt{\sum_b N_r(s,b)}}{1+N_r(s,a)}u(s,a)=cpuct​P(s,a)1+Nr​(s,a)∑b​Nr​(s,b)​​, where cpuctc_{\mathrm{puct}}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.

选择(图 3a)。每次模拟的第一段树内阶段从搜索树的根开始,到模拟在时间步 LLL 到达叶节点时结束。在这些时间步 t<Lt < Lt<L 的每一步,根据搜索树中的统计量选择动作 at=arg⁡max⁡a(Q(st,a)+u(st,a))a_t = \arg\max_a\bigl(Q(s_t, a) + u(s_t, a)\bigr)at​=argmaxa​(Q(st​,a)+u(st​,a)),使用的是 PUCT 算法48^{48}48 的一种变体,u(s,a)=cpuctP(s,a)∑bNr(s,b)1+Nr(s,a)u(s,a) = c_{\mathrm{puct}} P(s,a)\frac{\sqrt{\sum_b N_r(s,b)}}{1+N_r(s,a)}u(s,a)=cpuct​P(s,a)1+Nr​(s,a)∑b​Nr​(s,b)​​,其中 cpuctc_{\mathrm{puct}}cpuct​ 是决定探索程度的常数;这一搜索控制策略起初偏好先验概率高、访问次数低的动作,但在极限下偏好动作价值高的动作。

Evaluation (Fig. 3c). The leaf position sLs_LsL​ is added to a queue for evaluation vθ(sL)v_\theta(s_L)vθ​(sL​) by the value network, unless it has previously been evaluated. The second rollout phase of each simulation begins at leaf node sLs_LsL​ and continues until the end of the game. At each of these time-steps, t≥Lt \geq Lt≥L, actions are selected by both players according to the rollout policy, at∼pπ(⋅∣st)a_t \sim p_\pi(\cdot|s_t)at​∼pπ​(⋅∣st​). When the game reaches a terminal state, the outcome zt=±r(sT)z_t = \pm r(s_T)zt​=±r(sT​) is computed from the final score.

评估(图 3c)。除非叶局面 sLs_LsL​ 此前已被评估,否则将它加入队列,等待价值网络计算 vθ(sL)v_\theta(s_L)vθ​(sL​)。每次模拟的第二段走子阶段从叶节点 sLs_LsL​ 开始,一直持续到终局。在这些时间步 t≥Lt \geq Lt≥L,双方都按走子策略选择动作,at∼pπ(⋅∣st)a_t \sim p_\pi(\cdot|s_t)at​∼pπ​(⋅∣st​)。对局到达终止状态时,由最终分数计算出发 zt=±r(sT)z_t = \pm r(s_T)zt​=±r(sT​)。

Backup (Fig. 3d). At each in-tree step t≤Lt \leq Lt≤L of the simulation, the rollout statistics are updated as if it has lost nvln_{vl}nvl​ games, Nr(st,at)←Nr(st,at)+nvlN_r(s_t, a_t) \leftarrow N_r(s_t, a_t) + n_{vl}Nr​(st​,at​)←Nr​(st​,at​)+nvl​; Wr(st,at)←Wr(st,at)−nvlW_r(s_t, a_t) \leftarrow W_r(s_t, a_t) - n_{vl}Wr​(st​,at​)←Wr​(st​,at​)−nvl​; this virtual loss55^{55}55 discourages other threads from simultaneously exploring the identical variation. At the end of the simulation, the rollout statistics are updated in a backward pass through each step t≤Lt \leq Lt≤L, replacing the virtual losses by the outcome, Nr(st,at)←Nr(st,at)−nvl+1N_r(s_t, a_t) \leftarrow N_r(s_t, a_t) - n_{vl} + 1Nr​(st​,at​)←Nr​(st​,at​)−nvl​+1; Wr(st,at)←Wr(st,at)+nvl+ztW_r(s_t, a_t) \leftarrow W_r(s_t, a_t) + n_{vl} + z_tWr​(st​,at​)←Wr​(st​,at​)+nvl​+zt​. Asynchronously, a separate backward pass is initiated when the evaluation of the leaf position sLs_LsL​ completes. The output of the value network vθ(sL)v_\theta(s_L)vθ​(sL​) is used to update value statistics in a second backward pass through each step t≤Lt \leq Lt≤L, Nv(st,at)←Nv(st,at)+1N_v(s_t, a_t) \leftarrow N_v(s_t, a_t) + 1Nv​(st​,at​)←Nv​(st​,at​)+1, Wv(st,at)←Wv(st,at)+vθ(sL)W_v(s_t, a_t) \leftarrow W_v(s_t, a_t) + v_\theta(s_L)Wv​(st​,at​)←Wv​(st​,at​)+vθ​(sL​). The overall evaluation of each state action is a weighted average of the Monte Carlo estimates, Q(s,a)=(1−λ)Wv(s,a)Nv(s,a)+λWr(s,a)Nr(s,a)Q(s,a) = (1-\lambda)\frac{W_v(s,a)}{N_v(s,a)} + \lambda\frac{W_r(s,a)}{N_r(s,a)}Q(s,a)=(1−λ)Nv​(s,a)Wv​(s,a)​+λNr​(s,a)Wr​(s,a)​, that mixes together the value network and rollout evaluations with weighting parameter λ\lambdaλ. All updates are performed lock-free56^{56}56.

回传(图 3d)。在模拟的每个树内步骤 t≤Lt \leq Lt≤L,走子统计量先按输掉 nvln_{vl}nvl​ 局来更新,Nr(st,at)←Nr(st,at)+nvlN_r(s_t, a_t) \leftarrow N_r(s_t, a_t) + n_{vl}Nr​(st​,at​)←Nr​(st​,at​)+nvl​;Wr(st,at)←Wr(st,at)−nvlW_r(s_t, a_t) \leftarrow W_r(s_t, a_t) - n_{vl}Wr​(st​,at​)←Wr​(st​,at​)−nvl​;这种虚拟损失55^{55}55 会阻止其他线程同时探索同一变化。模拟结束时,走子统计量沿每个步骤 t≤Lt \leq Lt≤L 反向更新,用结果替换虚拟损失:Nr(st,at)←Nr(st,at)−nvl+1N_r(s_t, a_t) \leftarrow N_r(s_t, a_t) - n_{vl} + 1Nr​(st​,at​)←Nr​(st​,at​)−nvl​+1;Wr(st,at)←Wr(st,at)+nvl+ztW_r(s_t, a_t) \leftarrow W_r(s_t, a_t) + n_{vl} + z_tWr​(st​,at​)←Wr​(st​,at​)+nvl​+zt​。与此同时,当叶局面 sLs_LsL​ 的评估完成时,会启动另一次反向传递。价值网络的输出 vθ(sL)v_\theta(s_L)vθ​(sL​) 用于在第二次反向传递中更新每个步骤 t≤Lt \leq Lt≤L 的价值统计量,Nv(st,at)←Nv(st,at)+1N_v(s_t, a_t) \leftarrow N_v(s_t, a_t) + 1Nv​(st​,at​)←Nv​(st​,at​)+1,Wv(st,at)←Wv(st,at)+vθ(sL)W_v(s_t, a_t) \leftarrow W_v(s_t, a_t) + v_\theta(s_L)Wv​(st​,at​)←Wv​(st​,at​)+vθ​(sL​)。每个状态–动作的总体评估是这些蒙特卡洛估计的加权平均,Q(s,a)=(1−λ)Wv(s,a)Nv(s,a)+λWr(s,a)Nr(s,a)Q(s,a) = (1-\lambda)\frac{W_v(s,a)}{N_v(s,a)} + \lambda\frac{W_r(s,a)}{N_r(s,a)}Q(s,a)=(1−λ)Nv​(s,a)Wv​(s,a)​+λNr​(s,a)Wr​(s,a)​,用权重参数 λ\lambdaλ 把价值网络评估与走子评估混合起来。所有更新都是无锁的56^{56}56。

Expansion (Fig. 3b). When the visit count exceeds a threshold, Nr(s,a)>nthrN_r(s, a) > n_{\mathrm{thr}}Nr​(s,a)>nthr​, the successor state s′=f(s,a)s' = f(s, a)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′)}\{N(s', a) = N_r(s', a) = 0, W(s', a) = W_r(s', a) = 0, P(s', a) = p_\tau(a|s')\}{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′)p_\tau(a|s')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′s's′ is also inserted into a queue for asynchronous GPU evaluation by the policy network. Prior probabilities are computed by the SL policy network pσβ(⋅∣s′)p_\sigma^\beta(\cdot|s')pσβ​(⋅∣s′) with a softmax temperature set to β\betaβ; these replace the placeholder prior probabilities, P(s′,a)←pσβ(a∣s′)P(s', a) \leftarrow p_\sigma^\beta(a|s')P(s′,a)←pσβ​(a∣s′), using an atomic update. The threshold nthrn_{\mathrm{thr}}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.

扩展(图 3b)。当访问次数超过阈值 Nr(s,a)>nthrN_r(s, a) > n_{\mathrm{thr}}Nr​(s,a)>nthr​ 时,后继状态 s′=f(s,a)s' = f(s, a)s′=f(s,a) 被加入搜索树。新节点初始化为 {N(s′,a)=Nr(s′,a)=0,W(s′,a)=Wr(s′,a)=0,P(s′,a)=pτ(a∣s′)}\{N(s', a) = N_r(s', a) = 0, W(s', a) = W_r(s', a) = 0, P(s', a) = p_\tau(a|s')\}{N(s′,a)=Nr​(s′,a)=0,W(s′,a)=Wr​(s′,a)=0,P(s′,a)=pτ​(a∣s′)},用树策略 pτ(a∣s′)p_\tau(a|s')pτ​(a∣s′)(与走子策略类似但特征更多,见扩展数据表 4)为动作选择提供占位的先验概率。局面 s′s's′ 也会插入队列,供策略网络在 GPU 上异步评估。先验概率由 softmax 温度设为 β\betaβ 的 SL 策略网络 pσβ(⋅∣s′)p_\sigma^\beta(\cdot|s')pσβ​(⋅∣s′) 计算;它们通过原子更新替换占位先验,P(s′,a)←pσβ(a∣s′)P(s', a) \leftarrow p_\sigma^\beta(a|s')P(s′,a)←pσβ​(a∣s′)。阈值 nthrn_{\mathrm{thr}}nthr​ 动态调节,以保证加入策略队列的局面速率与 GPU 评估策略网络的速率相匹配。策略网络与价值网络评估局面时都使用大小为 1 的小批次,以尽量缩短端到端评估时间。

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.

我们还实现了分布式 APV-MCTS 算法。这一架构由一台执行主搜索的主机器、许多执行异步走子的远程工作 CPU,以及许多执行异步策略与价值网络评估的远程工作 GPU 组成。整棵搜索树存放在主机器上,主机器只执行每次模拟的树内阶段。叶局面被传送给执行走子阶段的工作 CPU,以及计算网络特征并评估策略与价值网络的工作 GPU。策略网络的先验概率返回给主机器,替换新扩展节点上的占位先验。走子奖励与价值网络输出也各自返回主机器,并沿原来的搜索路径回传。

At the end of search AlphaGo selects the action with maximum visit count; this is less sensitive to outliers than maximizing action value15^{15}15. 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^{57}57. AlphaGo resigns when its overall evaluation drops below an estimated 10% probability of winning the game, that is, max⁡aQ(s,a)<−0.8\max_a Q(s, a) < -0.8maxa​Q(s,a)<−0.8. AlphaGo does not employ the all-moves-as-first10^{10}10 or rapid action value estimation58^{58}58 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^{13}13, dynamic komi59^{59}59 or an opening book60^{60}60. The parameters used by AlphaGo in the Fan Hui match are listed in Extended Data Table 5.

搜索结束时,AlphaGo 选择访问次数最大的动作;这比最大化动作价值对离群值更不敏感15^{15}15。搜索树在后续时间步被复用:与已下动作对应的子节点成为新的根节点;该子节点以下的子树及其全部统计量被保留,树的其余部分则丢弃。比赛版本的 AlphaGo 在对手思考时继续搜索。如果最大化访问次数的动作与最大化动作价值的动作不一致,它会延长搜索。除此之外,时限安排成把大部分时间用在中盘57^{57}57。当总体评估降到估计胜率低于 10% 时,也就是 max⁡aQ(s,a)<−0.8\max_a Q(s, a) < -0.8maxa​Q(s,a)<−0.8 时,AlphaGo 认输。AlphaGo 不采用大多数蒙特卡洛围棋程序使用的“所有着法视作先着”10^{10}10 或快速动作价值估计58^{58}58 启发式;在用策略网络作为先验知识时,这些有偏启发式似乎不会再带来额外好处。此外,AlphaGo 也不使用渐进加宽13^{13}13、动态贴目59^{59}59 或开局库60^{60}60。樊麾比赛中 AlphaGo 使用的参数见扩展数据表 5。

Rollout policy

走子策略

The rollout policy pπ(a∣s)p_\pi(a|s)pπ​(a∣s) 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 sss, and ‘non-response’ patterns around the candidate move aaa in state sss. Each non-response pattern is a binary feature matching a specific 3×33 \times 33×3 pattern centred on aaa, defined by the colour (black, white, empty) and liberty count (1, 2, ≥3\geq 3≥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^{21}21 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 π\piπ 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.

走子策略 pπ(a∣s)p_\pi(a|s)pπ​(a∣s) 是线性 softmax 策略,基于快速、可增量计算的局部模式特征,既包括导致状态 sss 的前一手周围的“响应”模式,也包括状态 sss 中候选着法 aaa 周围的“非响应”模式。每个非响应模式是匹配以 aaa 为中心的特定 3×33 \times 33×3 模式的二值特征,由每个相邻交叉点的颜色(黑、白、空)与气数(1、2、≥3\geq 3≥3)定义。每个响应模式是匹配前一手为中心的 12 点菱形模式21^{21}21 中颜色与气数的二值特征。此外,少数手工设计的局部特征编码常识性的围棋规则(见扩展数据表 4)。与策略网络类似,走子策略的权重 π\piπ 用 Tygem 服务器上人类对局中的 800 万个局面,通过随机梯度下降最大化对数似然来训练。在空棋盘上,走子大约以每个 CPU 线程每秒 1,000 次模拟的速度执行。

Our rollout policy pπ(a∣s)p_\pi(a|s)pπ​(a∣s) contains less handcrafted knowledge than state-of-the-art Go programs13^{13}13. 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^{53}53. At every step of the tree traversal, the most probable action is inserted into a hash table, along with the 3×33 \times 33×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.

我们的走子策略 pπ(a∣s)p_\pi(a|s)pπ​(a∣s) 所含的手工知识比最先进的围棋程序13^{13}13 更少。我们转而利用 MCTS 内部更高质量的动作选择,它同时受到搜索树与策略网络的指引。我们提出一种新技术:缓存搜索树中的所有着法,然后在走子时下出相似的着法;这是“上次好应手”启发式53^{53}53 的推广。在树遍历的每一步,把最可能的动作连同前一手与当前手周围的 3×33 \times 33×3 模式上下文(颜色、气与子数)插入哈希表。在走子的每一步,把模式上下文与哈希表匹配;若找到匹配,就以高概率下出存储的着法。

Symmetries

对称性

In previous work, the symmetries of Go have been exploited by using rotationally and reflectionally invariant filters in the convolutional layers24,28,29^{24,28,29}24,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^{23}23. Instead, we exploit symmetries at run-time by dynamically transforming each position sss using the dihedral group of eight reflections and rotations, d1(s),…,d8(s)d_1(s), \ldots, d_8(s)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, vθ(s)=18∑j=18vθ(dj(s))v_\theta(s) = \frac{1}{8}\sum_{j=1}^{8} v_\theta(d_j(s))vθ​(s)=81​∑j=18​vθ​(dj​(s)). 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, pσ(⋅∣s)=18∑j=18dj−1pσ(⋅∣dj(s))p_\sigma(\cdot|s) = \frac{1}{8}\sum_{j=1}^{8} d_j^{-1} p_\sigma(\cdot|d_j(s))pσ​(⋅∣s)=81​∑j=18​dj−1​pσ​(⋅∣dj​(s)); 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]j \in [1, 8]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 sLs_LsL​ by vθ(dj(sL))v_\theta(d_j(s_L))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, dj−1pσ(⋅∣dj(s))d_j^{-1} p_\sigma(\cdot|d_j(s))dj−1​pσ​(⋅∣dj​(s)).

先前工作通过在卷积层中使用旋转与反射不变的滤波器来利用围棋的对称性24,28,29^{24,28,29}24,28,29。这在小型神经网络中可能有效,但在更大的网络中反而会损害表现,因为它阻止中间滤波器识别特定的非对称模式23^{23}23。我们改为在运行时利用对称性:用八种反射与旋转组成的二面体群动态变换每个局面 sss,得到 d1(s),…,d8(s)d_1(s), \ldots, d_8(s)d1​(s),…,d8​(s)。在显式对称集成中,把全部 8 个局面组成的小批次送入策略网络或价值网络并并行计算。对价值网络,输出值直接取平均,vθ(s)=18∑j=18vθ(dj(s))v_\theta(s) = \frac{1}{8}\sum_{j=1}^{8} v_\theta(d_j(s))vθ​(s)=81​∑j=18​vθ​(dj​(s))。对策略网络,把输出概率平面旋转/反射回原来的朝向,再取平均以得到集成预测,pσ(⋅∣s)=18∑j=18dj−1pσ(⋅∣dj(s))p_\sigma(\cdot|s) = \frac{1}{8}\sum_{j=1}^{8} d_j^{-1} p_\sigma(\cdot|d_j(s))pσ​(⋅∣s)=81​∑j=18​dj−1​pσ​(⋅∣dj​(s));原始网络评估中使用了这一做法(见扩展数据表 3)。APV-MCTS 则使用隐式对称集成,每次评估随机选择一种旋转/反射 j∈[1,8]j \in [1, 8]j∈[1,8]。我们只对该朝向计算恰好一次评估;在每次模拟中用 vθ(dj(sL))v_\theta(d_j(s_L))vθ​(dj​(sL​)) 计算叶节点 sLs_LsL​ 的价值,并让搜索过程对这些评估取平均。类似地,我们只对随机选出的单一旋转/反射计算策略网络,dj−1pσ(⋅∣dj(s))d_j^{-1} p_\sigma(\cdot|d_j(s))dj−1​pσ​(⋅∣dj​(s))。

Policy network: classification

策略网络:分类

We trained the policy network pσp_\sigmapσ​ 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 sss and the move aaa 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 mmm samples from the augmented KGS data set, {sk,ak}k=1m\{s_k, a_k\}_{k=1}^{m}{sk​,ak​}k=1m​, and applied an asynchronous stochastic gradient descent update to maximize the log likelihood of the action, Δσ=αm∑k=1m∂log⁡pσ(ak∣sk)∂σ\Delta\sigma = \frac{\alpha}{m}\sum_{k=1}^{m} \frac{\partial \log p_\sigma(a_k|s_k)}{\partial \sigma}Δσ=mα​∑k=1m​∂σ∂logpσ​(ak​∣sk​)​. The step size α\alphaα was initialized to 0.003 and was halved every 80 million training steps, without momentum terms, and a mini-batch size of m=16m = 16m=16. Updates were applied asynchronously on 50 GPUs using DistBelief61^{61}61; gradients older than 100 steps were discarded. Training took around 3 weeks for 340 million training steps.

我们训练策略网络 pσp_\sigmapσ​,按 KGS 数据集中人类高手的着法对局面分类。该数据集包含 KGS 6 到 9 段人类棋手所下 16 万局中的 2940 万个局面;其中 35.4% 是让子棋。数据集被分成测试集(前 100 万个局面)与训练集(其余 2840 万个局面)。数据集中排除了虚手。每个局面由原始棋盘描述 sss 与人类所选着法 aaa 组成。我们把数据集扩充为包含每个局面的全部八种反射与旋转。对称扩充与输入特征对每个局面预先计算。每个训练步,我们从扩充后的 KGS 数据集中随机采样大小为 mmm 的小批次 {sk,ak}k=1m\{s_k, a_k\}_{k=1}^{m}{sk​,ak​}k=1m​,并施加异步随机梯度下降更新,以最大化该动作的对数似然,Δσ=αm∑k=1m∂log⁡pσ(ak∣sk)∂σ\Delta\sigma = \frac{\alpha}{m}\sum_{k=1}^{m} \frac{\partial \log p_\sigma(a_k|s_k)}{\partial \sigma}Δσ=mα​∑k=1m​∂σ∂logpσ​(ak​∣sk​)​。步长 α\alphaα 初始化为 0.003,每 8000 万个训练步减半,不使用动量项,小批次大小 m=16m = 16m=16。更新在 50 块 GPU 上用 DistBelief61^{61}61 异步施加;超过 100 步的旧梯度被丢弃。训练约 3 周,共 3.40 亿个训练步。

Policy network: reinforcement learning

策略网络:强化学习

We further trained the policy network by policy gradient reinforcement learning25,26^{25,26}25,26. Each iteration consisted of a minibatch of nnn games played in parallel, between the current policy network pρp_\rhopρ​ that is being trained, and an opponent pρ−p_{\rho^-}pρ−​ that uses parameters ρ−\rho^-ρ− from a previous iteration, randomly sampled from a pool of opponents, so as to increase the stability of training. Weights were initialized to ρ=ρ−=σ\rho = \rho^- = \sigmaρ=ρ−=σ. Every 500 iterations, we added the current parameters ρ\rhoρ to the opponent pool. Each game iii in the mini-batch was played out until termination at step TiT_iTi​, and then scored to determine the outcome zti=±r(sTi)z_t^i = \pm r(s_{T_i})zti​=±r(sTi​​) from each player’s perspective. The games were then replayed to determine the policy gradient update using the REINFORCE algorithm25^{25}25 with baseline v(sti)v(s_t^i)v(sti​), Δρ=αn∑i=1n∑t=1Ti∂log⁡pρ(ati∣sti)∂ρ(zti−v(sti))\Delta\rho = \frac{\alpha}{n}\sum_{i=1}^{n}\sum_{t=1}^{T_i} \frac{\partial \log p_\rho(a_t^i|s_t^i)}{\partial \rho}(z_t^i - v(s_t^i))Δρ=nα​∑i=1n​∑t=1Ti​​∂ρ∂logpρ​(ati​∣sti​)​(zti​−v(sti​)). 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)v_\theta(s)vθ​(s) as a baseline; this provided a small performance boost. The policy network was trained in this way for 10,000 minibatches of 128 games, using 50 GPUs, for one day.

我们进一步用策略梯度强化学习25,26^{25,26}25,26 训练策略网络。每次迭代包含并行进行的 nnn 局对弈,对阵双方是正在训练的当前策略网络 pρp_\rhopρ​,以及使用先前某次迭代参数 ρ−\rho^-ρ−、从对手池中随机采样的对手 pρ−p_{\rho^-}pρ−​,以提高训练稳定性。权重初始化为 ρ=ρ−=σ\rho = \rho^- = \sigmaρ=ρ−=σ。每 500 次迭代,我们把当前参数 ρ\rhoρ 加入对手池。小批次中的每一局 iii 下到第 TiT_iTi​ 步终止,然后计分,从每位棋手的视角确定结果 zti=±r(sTi)z_t^i = \pm r(s_{T_i})zti​=±r(sTi​​)。随后重放这些对局,用带基线 v(sti)v(s_t^i)v(sti​) 的 REINFORCE 算法25^{25}25 确定策略梯度更新,Δρ=αn∑i=1n∑t=1Ti∂log⁡pρ(ati∣sti)∂ρ(zti−v(sti))\Delta\rho = \frac{\alpha}{n}\sum_{i=1}^{n}\sum_{t=1}^{T_i} \frac{\partial \log p_\rho(a_t^i|s_t^i)}{\partial \rho}(z_t^i - v(s_t^i))Δρ=nα​∑i=1n​∑t=1Ti​​∂ρ∂logpρ​(ati​∣sti​)​(zti​−v(sti​))。训练流水线的第一遍把基线设为零;第二遍我们用价值网络 vθ(s)v_\theta(s)vθ​(s) 作为基线,这带来了不大的性能提升。策略网络按这种方式训练了 10,000 个小批次、每批 128 局,使用 50 块 GPU,用时一天。

Value network: regression

价值网络:回归

We trained a value network vθ(s)≈vpρ(s)v_\theta(s) \approx v^{p_\rho}(s)vθ​(s)≈vpρ​(s) to approximate the value function of the RL policy network pρp_\rhopρ​. 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}U \sim \mathrm{unif}\{1, 450\}U∼unif{1,450}, and sampling the first t=1,…,U−1t = 1,\ldots,U-1t=1,…,U−1 moves from the SL policy network, at∼pσ(⋅∣st)a_t \sim p_\sigma(\cdot|s_t)at​∼pσ​(⋅∣st​); then sampling one move uniformly at random from available moves, aU∼unif{1,361}a_U \sim \mathrm{unif}\{1, 361\}aU​∼unif{1,361} (repeatedly until aUa_UaU​ is legal); then sampling the remaining sequence of moves until the game terminates, t=U+1,…,Tt = U+1,\ldots,Tt=U+1,…,T, from the RL policy network, at∼pρ(⋅∣st)a_t \sim p_\rho(\cdot|s_t)at​∼pρ​(⋅∣st​). Finally, the game is scored to determine the outcome zt=±r(sT)z_t = \pm r(s_T)zt​=±r(sT​). Only a single training example (sU+1,zU+1)(s_{U+1}, z_{U+1})(sU+1​,zU+1​) is added to the data set from each game. This data provides unbiased samples of the value function vpρ(sU+1)=E[zU+1∣sU+1,aU+1…T∼pρ]v^{p_\rho}(s_{U+1}) = \mathbb{E}[z_{U+1} \mid s_{U+1}, a_{U+1\ldots T} \sim p_\rho]vpρ​(sU+1​)=E[zU+1​∣sU+1​,aU+1…T​∼pρ​]. 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, Δθ=αm∑k=1m(zk−vθ(sk))∂vθ(sk)∂θ\Delta\theta = \frac{\alpha}{m}\sum_{k=1}^{m} \bigl(z_k - v_\theta(s_k)\bigr) \frac{\partial v_\theta(s_k)}{\partial \theta}Δθ=mα​∑k=1m​(zk​−vθ​(sk​))∂θ∂vθ​(sk​)​. The value network was trained for 50 million mini-batches of 32 positions, using 50 GPUs, for one week.

我们训练价值网络 vθ(s)≈vpρ(s)v_\theta(s) \approx v^{p_\rho}(s)vθ​(s)≈vpρ​(s),以近似 RL 策略网络 pρp_\rhopρ​ 的价值函数。为避免过拟合到对局里强相关的局面,我们构建了一个互不相关的自我对弈局面新数据集。该数据集包含 3000 多万个局面,每个取自一局独特的自我对弈。每局分三个阶段生成:先随机采样时间步 U∼unif{1,450}U \sim \mathrm{unif}\{1, 450\}U∼unif{1,450},前 t=1,…,U−1t = 1,\ldots,U-1t=1,…,U−1 手从 SL 策略网络采样,at∼pσ(⋅∣st)a_t \sim p_\sigma(\cdot|s_t)at​∼pσ​(⋅∣st​);然后从可走着法中均匀随机采样一手,aU∼unif{1,361}a_U \sim \mathrm{unif}\{1, 361\}aU​∼unif{1,361}(重复直到 aUa_UaU​ 合法);再从 RL 策略网络采样剩余着法直到终局,t=U+1,…,Tt = U+1,\ldots,Tt=U+1,…,T,at∼pρ(⋅∣st)a_t \sim p_\rho(\cdot|s_t)at​∼pρ​(⋅∣st​)。最后计分得到结果 zt=±r(sT)z_t = \pm r(s_T)zt​=±r(sT​)。每局只向数据集加入一个训练样本 (sU+1,zU+1)(s_{U+1}, z_{U+1})(sU+1​,zU+1​)。这些数据提供价值函数 vpρ(sU+1)=E[zU+1∣sU+1,aU+1…T∼pρ]v^{p_\rho}(s_{U+1}) = \mathbb{E}[z_{U+1} \mid s_{U+1}, a_{U+1\ldots T} \sim p_\rho]vpρ​(sU+1​)=E[zU+1​∣sU+1​,aU+1…T​∼pρ​] 的无偏样本。在生成的前两个阶段,我们从更嘈杂的分布中采样,以增加数据集的多样性。训练方法与 SL 策略网络训练相同,只是参数更新基于预测价值与观测奖励之间的均方误差,Δθ=αm∑k=1m(zk−vθ(sk))∂vθ(sk)∂θ\Delta\theta = \frac{\alpha}{m}\sum_{k=1}^{m} \bigl(z_k - v_\theta(s_k)\bigr) \frac{\partial v_\theta(s_k)}{\partial \theta}Δθ=mα​∑k=1m​(zk​−vθ​(sk​))∂θ∂vθ​(sk​)​。价值网络训练了 5000 万个小批次、每批 32 个局面,使用 50 块 GPU,用时一周。

Features for policy/value network

策略/价值网络的特征

Each position sss was pre-processed into a set of 19×1919 \times 1919×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^77. 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×1919 \times 1919×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\geq 8≥8 liberties. The full set of feature planes are listed in Extended Data Table 2.

每个局面 sss 被预处理成一组 19×1919 \times 1919×19 的特征平面。我们使用的特征直接来自规则的原始表示,标明围棋棋盘上每个交叉点的状态:棋子颜色、气(棋串相邻的空点)、提子、合法性、该子落下后经过的手数,以及(仅对价值网络)当前该谁下。此外,我们使用一个简单的战术特征,计算征子搜索的结果7^77。所有特征都相对于当前该下的一方计算;例如,每个交叉点的棋子颜色表示为我方或对方,而不是黑或白。每个整数值特征被拆成多个 19×1919 \times 1919×19 的二值平面(独热编码)。例如,用分开的二值特征平面表示某个交叉点是 1 气、2 气、……还是 ≥8\geq 8≥8 气。完整的特征平面列表见扩展数据表 2。

Neural network architecture

神经网络结构

The input to the policy network is a 19×19×4819 \times 19 \times 4819×19×48 image stack consisting of 48 feature planes. The first hidden layer zero pads the input into a 23×2323 \times 2323×23 image, then convolves kkk filters of kernel size 5×55 \times 55×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×2121 \times 2121×21 image, then convolves kkk filters of kernel size 3×33 \times 33×3 with stride 1, again followed by a rectifier nonlinearity. The final layer convolves 1 filter of kernel size 1×11 \times 11×1 with stride 1, with a different bias for each position, and applies a softmax function. The match version of AlphaGo used k=192k = 192k=192 filters; Fig. 2b and Extended Data Table 3 additionally show the results of training with k=128k = 128k=128, 256 and 384 filters. The input to the value network is also a 19×19×4819 \times 19 \times 4819×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×11 \times 11×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.

策略网络的输入是由 48 个特征平面组成的 19×19×4819 \times 19 \times 4819×19×48 图像堆。第一个隐藏层把输入零填充成 23×2323 \times 2323×23 的图像,再用 kkk 个核大小为 5×55 \times 55×5、步长为 1 的滤波器与输入图像卷积,并施加整流非线性。随后的第 2 到第 12 个隐藏层各自把上一隐藏层零填充成 21×2121 \times 2121×21 的图像,再用 kkk 个核大小为 3×33 \times 33×3、步长为 1 的滤波器卷积,同样后接整流非线性。最后一层用 1 个核大小为 1×11 \times 11×1、步长为 1 的滤波器卷积,每个位置有不同的偏置,并施加 softmax 函数。比赛版本的 AlphaGo 使用 k=192k = 192k=192 个滤波器;图 2b 与扩展数据表 3 还给出了 k=128k = 128k=128、256 与 384 个滤波器的训练结果。价值网络的输入也是 19×19×4819 \times 19 \times 4819×19×48 的图像堆,外加一个描述当前该谁下的二值特征平面。第 2 到第 11 个隐藏层与策略网络相同,第 12 个隐藏层是额外的卷积层,第 13 个隐藏层用 1 个核大小为 1×11 \times 11×1、步长为 1 的滤波器卷积,第 14 个隐藏层是带 256 个整流单元的全连接线性层。输出层是带单个 tanh 单元的全连接线性层。

Evaluation

评估

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 aaa will beat program bbb by a logistic function p(a beats b)=1/(1+exp⁡(celo(e(b)−e(a))))p(a\ \mathrm{beats}\ b) = 1/(1+\exp(c_{\mathrm{elo}}(e(b)-e(a))))p(a beats b)=1/(1+exp(celo​(e(b)−e(a)))), and estimate the ratings e(⋅)e(\cdot)e(⋅) by Bayesian logistic regression, computed by the BayesElo program37^{37}37 using the standard constant celo=1/400c_{\mathrm{elo}} = 1/400celo​=1/400. The scale was anchored to the BayesElo rating of professional Go player Fan Hui (2,908 at date of submission)62^{62}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 KKK stones is equivalent to giving K−1K-1K−1 free moves to black, rather than K−1/2K-1/2K−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.

我们通过内部循环赛评估计算机围棋程序的相对棋力,并测量每个程序的 Elo 等级分。我们用逻辑函数 p(a beats b)=1/(1+exp⁡(celo(e(b)−e(a))))p(a\ \mathrm{beats}\ b) = 1/(1+\exp(c_{\mathrm{elo}}(e(b)-e(a))))p(a beats b)=1/(1+exp(celo​(e(b)−e(a)))) 估计程序 aaa 击败程序 bbb 的概率,并用贝叶斯逻辑回归估计等级分 e(⋅)e(\cdot)e(⋅),由 BayesElo 程序37^{37}37 按标准常数 celo=1/400c_{\mathrm{elo}} = 1/400celo​=1/400 计算。标尺锚定在职业棋手樊麾的 BayesElo 等级分上(提交时为 2,908)62^{62}62。所有程序每步最多获得 5 秒计算时间;对局按中国规则计分,贴目 7.5 目(补偿白方后手的额外分数)。我们还下了让子棋,由 AlphaGo 执白对阵已有围棋程序;这些对局使用非标准让子规则:保留贴目,但黑方在通常的让子点上获得额外的子。按这些规则,让 KKK 子等价于给黑方 K−1K-1K−1 手免费着手,而不是标准无贴目让子规则下的 K−1/2K-1/2K−1/2 手。我们使用这些让子规则,是因为 AlphaGo 的价值网络专门按 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.

除分布式 AlphaGo 外,每个计算机围棋程序都在各自的单机上运行,机器规格相同,使用该程序当时最新可用版本及其支持的最好硬件配置(见扩展数据表 6)。在图 4 中,计算机程序的大致段位基于该程序达到的最高 KGS 段位;不过,KGS 版本可能与公开可用版本不同。

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.

与樊麾的比赛由公正裁判仲裁。正式对局五局、非正式对局五局,贴目 7.5,不让子,使用中国规则。AlphaGo 分别以 5–0 与 3–2 获胜(图 6 与扩展数据表 1)。正式对局的时限是 1 小时主时间外加三盘 30 秒读秒。非正式对局的时限是三盘 30 秒读秒。时限与对局条件由樊麾在赛前选定;双方也约定,总体比赛结果只由正式对局决定。为大致评估樊麾相对计算机围棋程序的等级分,我们把全部十局的结果追加到内部循环赛结果中,忽略时限差异。

Date Black White Category Result
5/10/15 Fan Hui AlphaGo Formal AlphaGo wins by 2.5 points
5/10/15 Fan Hui AlphaGo Informal Fan Hui wins by resignation
6/10/15 AlphaGo Fan Hui Formal AlphaGo wins by resignation
6/10/15 AlphaGo Fan Hui Informal AlphaGo wins by resignation
7/10/15 Fan Hui AlphaGo Formal AlphaGo wins by resignation
7/10/15 Fan Hui AlphaGo Informal AlphaGo wins by resignation
8/10/15 AlphaGo Fan Hui Formal AlphaGo wins by resignation
8/10/15 AlphaGo Fan Hui Informal AlphaGo wins by resignation
9/10/15 Fan Hui AlphaGo Formal AlphaGo wins by resignation
9/10/15 AlphaGo Fan Hui Informal Fan Hui wins by resignation

Extended Data Table 1 | Details of match between AlphaGo and Fan Hui. The match consisted of five formal games with longer time controls, and five informal games with shorter time controls. Time controls and playing conditions were chosen by Fan Hui in advance of the match.

Date Black White Category Result
5/10/15 Fan Hui AlphaGo Formal AlphaGo wins by 2.5 points
5/10/15 Fan Hui AlphaGo Informal Fan Hui wins by resignation
6/10/15 AlphaGo Fan Hui Formal AlphaGo wins by resignation
6/10/15 AlphaGo Fan Hui Informal AlphaGo wins by resignation
7/10/15 Fan Hui AlphaGo Formal AlphaGo wins by resignation
7/10/15 Fan Hui AlphaGo Informal AlphaGo wins by resignation
8/10/15 AlphaGo Fan Hui Formal AlphaGo wins by resignation
8/10/15 AlphaGo Fan Hui Informal AlphaGo wins by resignation
9/10/15 Fan Hui AlphaGo Formal AlphaGo wins by resignation
9/10/15 AlphaGo Fan Hui Informal Fan Hui wins by resignation

扩展数据表 1 | AlphaGo 与樊麾对局的细节。比赛包括五局时限较长的正式对局,以及五局时限较短的非正式对局。时限与对局条件由樊麾在赛前选定。

Feature # of planes Description
Stone colour 3 Player stone / opponent stone / empty
Ones 1 A constant plane filled with 1
Turns since 8 How many turns since a move was played
Liberties 8 Number of liberties (empty adjacent points)
Capture size 8 How many opponent stones would be captured
Self-atari size 8 How many of own stones would be captured
Liberties after move 8 Number of liberties after this move is played
Ladder capture 1 Whether a move at this point is a successful ladder capture
Ladder escape 1 Whether a move at this point is a successful ladder escape
Sensibleness 1 Whether a move is legal and does not fill its own eyes
Zeros 1 A constant plane filled with 0
Player color 1 Whether current player is black

Extended Data Table 2 | Input features for neural networks. Feature planes used by the policy network (all but last feature) and value network (all features).

特征 平面数 描述
Stone colour 3 我方子 / 对方子 / 空
Ones 1 填满 1 的常数平面
Turns since 8 一手棋落下后经过了多少手
Liberties 8 气数(相邻空点)
Capture size 8 会提掉多少对方的子
Self-atari size 8 会使己方多少子被提
Liberties after move 8 这手落下后的气数
Ladder capture 1 这点是否是成功的征子
Ladder escape 1 这点是否是成功的逃征
Sensibleness 1 这手是否合法且不填自己的眼
Zeros 1 填满 0 的常数平面
Player color 1 当前棋手是否执黑

扩展数据表 2 | 神经网络的输入特征。策略网络使用除最后一项外的全部特征平面,价值网络使用全部特征。

Filters Symmetries Features Test accuracy % Train accuracy % Raw net wins % AlphaGo wins % Forward time (ms)
128 1 48 54.6 57.0 36 53 2.8
192 1 48 55.4 58.0 50 50 4.8
256 1 48 55.9 59.1 67 55 7.1
256 2 48 56.5 59.8 67 38 13.9
256 4 48 56.9 60.2 69 14 27.6
256 8 48 57.0 60.4 69 5 55.3
192 1 4 47.6 51.4 25 15 4.8
192 1 12 54.7 57.1 30 34 4.8
192 1 20 54.7 57.2 38 40 4.8
192 8 4 49.2 53.2 24 2 36.8
192 8 12 55.7 58.3 32 3 36.8
192 8 20 55.8 58.4 42 3 36.8

Extended Data Table 3 | Supervised learning results for the policy network. The policy network architecture consists of 128, 192 or 256 filters in convolutional layers; an explicit symmetry ensemble over 2, 4 or 8 symmetries; using only the first 4, 12 or 20 input feature planes listed in Extended Data Table 2. The results consist of the test and train accuracy on the KGS data set; and the percentage of games won by given policy network against AlphaGo’s policy network (highlighted row 2): using the policy networks to select moves directly (raw wins); or using AlphaGo’s search to select moves (AlphaGo wins); and finally the computation time for a single evaluation of the policy network.

滤波器 对称 特征 测试准确率 % 训练准确率 % 原始网络胜率 % AlphaGo 胜率 % 前向时间 (ms)
128 1 48 54.6 57.0 36 53 2.8
192 1 48 55.4 58.0 50 50 4.8
256 1 48 55.9 59.1 67 55 7.1
256 2 48 56.5 59.8 67 38 13.9
256 4 48 56.9 60.2 69 14 27.6
256 8 48 57.0 60.4 69 5 55.3
192 1 4 47.6 51.4 25 15 4.8
192 1 12 54.7 57.1 30 34 4.8
192 1 20 54.7 57.2 38 40 4.8
192 8 4 49.2 53.2 24 2 36.8
192 8 12 55.7 58.3 32 3 36.8
192 8 20 55.8 58.4 42 3 36.8

扩展数据表 3 | 策略网络的监督学习结果。策略网络结构在卷积层中分别有 128、192 或 256 个滤波器;对 2、4 或 8 种对称做显式对称集成;只使用扩展数据表 2 中列出的前 4、12 或 20 个输入特征平面。结果包括 KGS 数据集上的测试与训练准确率;以及给定策略网络对 AlphaGo 策略网络(高亮的第 2 行)的胜率:直接用策略网络选择着法(原始网络胜率),或用 AlphaGo 的搜索选择着法(AlphaGo 胜率);最后是策略网络单次评估的计算时间。

Feature # of patterns Description
Response 1 Whether move matches one or more response pattern features
Save atari 1 Move saves stone(s) from capture
Neighbour 8 Move is 8-connected to previous move
Nakade 8192 Move matches a nakade pattern at captured stone
Response pattern 32207 Move matches 12-point diamond pattern near previous move
Non-response pattern 69338 Move matches 3×33 \times 33×3 pattern around move
Self-atari 1 Move allows stones to be captured
Last move distance 34 Manhattan distance to previous two moves
Non-response pattern 32207 Move matches 12-point diamond pattern centred around move

Extended Data Table 4 | Input features for rollout and tree policy. Features used by the rollout policy (first set) and tree policy (first and second set). Patterns are based on stone colour (black/white/empty) and liberties (1, 2, ≥3\geq 3≥3) at each intersection of the pattern.

特征 模式数 描述
Response 1 该着是否匹配一个或多个响应模式特征
Save atari 1 该着救出被打吃的子
Neighbour 8 该着与前一手 8 连通
Nakade 8192 该着匹配被提子处的 nakade 模式
Response pattern 32207 该着匹配前一手附近的 12 点菱形模式
Non-response pattern 69338 该着匹配周围的 3×33 \times 33×3 模式
Self-atari 1 该着使己方子可被提
Last move distance 34 到前两手的曼哈顿距离
Non-response pattern 32207 该着匹配以该着为中心的 12 点菱形模式

扩展数据表 4 | 走子策略与树策略的输入特征。走子策略使用第一组特征,树策略使用第一组与第二组。模式基于每个交叉点的棋子颜色(黑/白/空)与气数(1、2、≥3\geq 3≥3)。

Symbol Parameter Value
β\betaβ Softmax temperature 0.67
λ\lambdaλ Mixing parameter 0.5
nvln_{vl}nvl​ Virtual loss 3
nthrn_{thr}nthr​ Expansion threshold 40
cpuctc_{puct}cpuct​ Exploration constant 5

Extended Data Table 5 | Parameters used by AlphaGo.

符号 参数 取值
β\betaβ Softmax 温度 0.67
λ\lambdaλ 混合参数 0.5
nvln_{vl}nvl​ 虚拟损失 3
nthrn_{thr}nthr​ 扩展阈值 40
cpuctc_{puct}cpuct​ 探索常数 5

扩展数据表 5 | AlphaGo 使用的参数。

Short name Computer Player Version Time settings CPUs GPUs KGS Rank Elo
αrvpd\alpha_{rvp}^dαrvpd​ Distributed AlphaGo See Methods 5 seconds 1202 176 – 3140
αrvp\alpha_{rvp}αrvp​ AlphaGo See Methods 5 seconds 48 8 – 2890
CS CrazyStone 2015 5 seconds 32 – 6d 1929
ZN Zen 5 5 seconds 8 – 6d 1888
PC Pachi 10.99 400,000 sims 16 – 2d 1298
FG Fuego svn1989 100,000 sims 16 – – 1148
GG GnuGo 3.8 level 10 1 – 5k 431
CS4 CrazyStone 4 handicap stones 5 seconds 32 – – 2526
ZN4 Zen 4 handicap stones 5 seconds 8 – – 2413
PC4 Pachi 4 handicap stones 400,000 sims 16 – – 1756

Extended Data Table 6 | Results of a tournament between different Go programs. Each program played with a maximum of 5 s thinking time per move; the games against Fan Hui were conducted using longer time controls, as described in Methods. CS4, ZN4 and PC4 were given 4 handicap stones; komi was 7.5 in all games. Elo ratings were computed by BayesElo.

简称 计算机棋手 版本 时限 CPUs GPUs KGS 段位 Elo
αrvpd\alpha_{rvp}^dαrvpd​ Distributed AlphaGo See Methods 5 seconds 1202 176 – 3140
αrvp\alpha_{rvp}αrvp​ AlphaGo See Methods 5 seconds 48 8 – 2890
CS CrazyStone 2015 5 seconds 32 – 6d 1929
ZN Zen 5 5 seconds 8 – 6d 1888
PC Pachi 10.99 400,000 sims 16 – 2d 1298
FG Fuego svn1989 100,000 sims 16 – – 1148
GG GnuGo 3.8 level 10 1 – 5k 431
CS4 CrazyStone 4 handicap stones 5 seconds 32 – – 2526
ZN4 Zen 4 handicap stones 5 seconds 8 – – 2413
PC4 Pachi 4 handicap stones 400,000 sims 16 – – 1756

扩展数据表 6 | 不同围棋程序之间循环赛的结果。每个程序每步最多思考 5 秒;对阵樊麾的对局使用更长时限,如方法部分所述。CS4、ZN4 与 PC4 让四子;所有对局贴目 7.5。Elo 等级分由 BayesElo 计算。

Short name Policy network Value network Rollouts Mixing Policy GPUs Value GPUs Elo rating
αrvp\alpha_{rvp}αrvp​ pσp_\sigmapσ​ vθv_\thetavθ​ pπp_\pipπ​ λ=0.5\lambda = 0.5λ=0.5 2 6 2890
αvp\alpha_{vp}αvp​ pσp_\sigmapσ​ vθv_\thetavθ​ – λ=0\lambda = 0λ=0 2 6 2177
αrp\alpha_{rp}αrp​ pσp_\sigmapσ​ – pπp_\pipπ​ λ=1\lambda = 1λ=1 8 0 2416
αrv\alpha_{rv}αrv​ [pτ][p_\tau][pτ​] vθv_\thetavθ​ pπp_\pipπ​ λ=0.5\lambda = 0.5λ=0.5 0 8 2077
αv\alpha_{v}αv​ [pτ][p_\tau][pτ​] vθv_\thetavθ​ – λ=0\lambda = 0λ=0 0 8 1655
αr\alpha_{r}αr​ [pτ][p_\tau][pτ​] – pπp_\pipπ​ λ=1\lambda = 1λ=1 0 0 1457
αp\alpha_{p}αp​ pσp_\sigmapσ​ – – – 0 0 1517

Extended Data Table 7 | Results of a tournament between different variants of AlphaGo. Evaluating positions using rollouts only (αrp\alpha_{rp}αrp​, αr\alpha_{r}αr​), value nets only (αvp\alpha_{vp}αvp​, αv\alpha_{v}αv​), or mixing both (αrvp\alpha_{rvp}αrvp​, αrv\alpha_{rv}αrv​); either using the policy network pσp_\sigmapσ​ (αrvp\alpha_{rvp}αrvp​, αvp\alpha_{vp}αvp​, αrp\alpha_{rp}αrp​, αp\alpha_{p}αp​), or no policy network (that is, instead using the placeholder probabilities from the tree policy pτp_\taupτ​ throughout). Each program used 5 s per move on a single machine with 48 CPUs and 8 GPUs. Elo ratings were computed by BayesElo.

简称 策略网络 价值网络 走子 混合 策略 GPU 价值 GPU Elo
αrvp\alpha_{rvp}αrvp​ pσp_\sigmapσ​ vθv_\thetavθ​ pπp_\pipπ​ λ=0.5\lambda = 0.5λ=0.5 2 6 2890
αvp\alpha_{vp}αvp​ pσp_\sigmapσ​ vθv_\thetavθ​ – λ=0\lambda = 0λ=0 2 6 2177
αrp\alpha_{rp}αrp​ pσp_\sigmapσ​ – pπp_\pipπ​ λ=1\lambda = 1λ=1 8 0 2416
αrv\alpha_{rv}αrv​ [pτ][p_\tau][pτ​] vθv_\thetavθ​ pπp_\pipπ​ λ=0.5\lambda = 0.5λ=0.5 0 8 2077
αv\alpha_{v}αv​ [pτ][p_\tau][pτ​] vθv_\thetavθ​ – λ=0\lambda = 0λ=0 0 8 1655
αr\alpha_{r}αr​ [pτ][p_\tau][pτ​] – pπp_\pipπ​ λ=1\lambda = 1λ=1 0 0 1457
αp\alpha_{p}αp​ pσp_\sigmapσ​ – – – 0 0 1517

扩展数据表 7 | AlphaGo 不同变体之间循环赛的结果。只使用走子评估局面(αrp\alpha_{rp}αrp​、αr\alpha_{r}αr​),只使用价值网络(αvp\alpha_{vp}αvp​、αv\alpha_{v}αv​),或混合二者(αrvp\alpha_{rvp}αrvp​、αrv\alpha_{rv}αrv​);或者使用策略网络 pσp_\sigmapσ​(αrvp\alpha_{rvp}αrvp​、αvp\alpha_{vp}αvp​、αrp\alpha_{rp}αrp​、αp\alpha_{p}αp​),或者始终不使用策略网络(即改用树策略 pτp_\taupτ​ 的占位概率)。每个程序在配备 48 个 CPU 与 8 个 GPU 的单机上每步使用 5 秒。Elo 等级分由 BayesElo 计算。

AlphaGo Search threads CPUs GPUs Elo
Asynchronous 1 48 8 2203
Asynchronous 2 48 8 2393
Asynchronous 4 48 8 2564
Asynchronous 8 48 8 2665
Asynchronous 16 48 8 2778
Asynchronous 32 48 8 2867
Asynchronous 40 48 8 2890
Asynchronous 40 48 1 2181
Asynchronous 40 48 2 2738
Asynchronous 40 48 4 2850
Distributed 12 428 64 2937
Distributed 24 764 112 3079
Distributed 40 1202 176 3140
Distributed 64 1920 280 3168

Extended Data Table 8 | Results of a tournament between AlphaGo and distributed AlphaGo, testing scalability with hardware. Each program played with a maximum of 2 s thinking time per move. Elo ratings were computed by BayesElo.

AlphaGo 搜索线程 CPUs GPUs Elo
Asynchronous 1 48 8 2203
Asynchronous 2 48 8 2393
Asynchronous 4 48 8 2564
Asynchronous 8 48 8 2665
Asynchronous 16 48 8 2778
Asynchronous 32 48 8 2867
Asynchronous 40 48 8 2890
Asynchronous 40 48 1 2181
Asynchronous 40 48 2 2738
Asynchronous 40 48 4 2850
Distributed 12 428 64 2937
Distributed 24 764 112 3079
Distributed 40 1202 176 3140
Distributed 64 1920 280 3168

扩展数据表 8 | AlphaGo 与分布式 AlphaGo 之间循环赛的结果,用于测试随硬件的可扩展性。每个程序每步最多思考 2 秒。Elo 等级分由 BayesElo 计算。

αrvp\alpha_{rvp}αrvp​ αvp\alpha_{vp}αvp​ αrp\alpha_{rp}αrp​ αrv\alpha_{rv}αrv​ αr\alpha_{r}αr​ αv\alpha_{v}αv​ αp\alpha_{p}αp​
αrvp\alpha_{rvp}αrvp​ – 1 [0; 5] 5 [4; 7] 0 [0; 4] 0 [0; 8] 0 [0; 19] 0 [0; 19]
αvp\alpha_{vp}αvp​ 99 [95; 100] – 61 [52; 69] 35 [25; 48] 6 [1; 27] 0 [0; 22] 1 [0; 6]
αrp\alpha_{rp}αrp​ 95 [93; 96] 39 [31; 48] – 13 [7; 23] 0 [0; 9] 0 [0; 22] 4 [1; 21]
αrv\alpha_{rv}αrv​ 100 [96; 100] 65 [52; 75] 87 [77; 93] – 0 [0; 18] 29 [8; 64] 48 [33; 65]
αr\alpha_{r}αr​ 100 [92; 100] 94 [73; 99] 100 [91; 100] 100 [82; 100] – 78 [45; 94] 78 [71; 84]
αv\alpha_{v}αv​ 100 [81; 100] 100 [78; 100] 100 [78; 100] 71 [36; 92] 22 [6; 55] – 30 [16; 48]
αp\alpha_{p}αp​ 100 [81; 100] 99 [94; 100] 96 [79; 99] 52 [35; 67] 22 [16; 29] 70 [52; 84] –
CS 100 [97; 100] 74 [66; 81] 98 [94; 99] 80 [70; 87] 5 [3; 7] 36 [16; 61] 8 [5; 14]
ZN 99 [93; 100] 84 [67; 93] 98 [93; 99] 92 [67; 99] 6 [2; 19] 40 [12; 77] 100 [65; 100]
PC 100 [98; 100] 99 [95; 100] 100 [98; 100] 98 [89; 100] 78 [73; 81] 87 [68; 95] 55 [47; 62]
FG 100 [97; 100] 99 [93; 100] 100 [96; 100] 100 [91; 100] 78 [73; 83] 100 [65; 100] 65 [55; 73]
GG 100 [44; 100] 100 [34; 100] 100 [68; 100] 100 [57; 100] 99 [97; 100] 67 [21; 94] 99 [95; 100]
CS4 77 [69; 84] 12 [8; 18] 53 [44; 61] 15 [8; 24] 0 [0; 3] 0 [0; 30] 0 [0; 8]
ZN4 86 [77; 92] 25 [16; 38] 67 [56; 76] 14 [7; 27] 0 [0; 12] 0 [0; 43] –
PC4 99 [97; 100] 82 [75; 88] 98 [95; 99] 89 [79; 95] 32 [26; 39] 13 [3; 36] 35 [25; 46]

Extended Data Table 9 | Cross-table of win rates in per cent between programs. 95% Agresti–Coull confidence intervals in grey. Each program played with a maximum of 5 s thinking time per move. CS4, ZN4 and PC4 were given 4 handicap stones; komi was 7.5 in all games. Distributed AlphaGo scored 77% [70; 82] against αrvp\alpha_{rvp}αrvp​ and 100% against all other programs (no handicap games were played).

αrvp\alpha_{rvp}αrvp​ αvp\alpha_{vp}αvp​ αrp\alpha_{rp}αrp​ αrv\alpha_{rv}αrv​ αr\alpha_{r}αr​ αv\alpha_{v}αv​ αp\alpha_{p}αp​
αrvp\alpha_{rvp}αrvp​ – 1 [0; 5] 5 [4; 7] 0 [0; 4] 0 [0; 8] 0 [0; 19] 0 [0; 19]
αvp\alpha_{vp}αvp​ 99 [95; 100] – 61 [52; 69] 35 [25; 48] 6 [1; 27] 0 [0; 22] 1 [0; 6]
αrp\alpha_{rp}αrp​ 95 [93; 96] 39 [31; 48] – 13 [7; 23] 0 [0; 9] 0 [0; 22] 4 [1; 21]
αrv\alpha_{rv}αrv​ 100 [96; 100] 65 [52; 75] 87 [77; 93] – 0 [0; 18] 29 [8; 64] 48 [33; 65]
αr\alpha_{r}αr​ 100 [92; 100] 94 [73; 99] 100 [91; 100] 100 [82; 100] – 78 [45; 94] 78 [71; 84]
αv\alpha_{v}αv​ 100 [81; 100] 100 [78; 100] 100 [78; 100] 71 [36; 92] 22 [6; 55] – 30 [16; 48]
αp\alpha_{p}αp​ 100 [81; 100] 99 [94; 100] 96 [79; 99] 52 [35; 67] 22 [16; 29] 70 [52; 84] –
CS 100 [97; 100] 74 [66; 81] 98 [94; 99] 80 [70; 87] 5 [3; 7] 36 [16; 61] 8 [5; 14]
ZN 99 [93; 100] 84 [67; 93] 98 [93; 99] 92 [67; 99] 6 [2; 19] 40 [12; 77] 100 [65; 100]
PC 100 [98; 100] 99 [95; 100] 100 [98; 100] 98 [89; 100] 78 [73; 81] 87 [68; 95] 55 [47; 62]
FG 100 [97; 100] 99 [93; 100] 100 [96; 100] 100 [91; 100] 78 [73; 83] 100 [65; 100] 65 [55; 73]
GG 100 [44; 100] 100 [34; 100] 100 [68; 100] 100 [57; 100] 99 [97; 100] 67 [21; 94] 99 [95; 100]
CS4 77 [69; 84] 12 [8; 18] 53 [44; 61] 15 [8; 24] 0 [0; 3] 0 [0; 30] 0 [0; 8]
ZN4 86 [77; 92] 25 [16; 38] 67 [56; 76] 14 [7; 27] 0 [0; 12] 0 [0; 43] –
PC4 99 [97; 100] 82 [75; 88] 98 [95; 99] 89 [79; 95] 32 [26; 39] 13 [3; 36] 35 [25; 46]

扩展数据表 9 | 各程序之间胜率(百分比)的交叉表。灰色数字为 95% Agresti–Coull 置信区间。每个程序每步最多思考 5 秒。CS4、ZN4 与 PC4 让四子;所有对局贴目 7.5。分布式 AlphaGo 对 αrvp\alpha_{rvp}αrvp​ 的成绩为 77% [70; 82],对所有其他程序为 100%(未下让子棋)。

Threads 1 2 4 8 16 32 40 40 40 40
GPU 8 8 8 8 8 8 8 4 2 1
1 / 8 – 70 [61;78] 90 [84;94] 94 [83;98] 86 [72;94] 98 [91;100] 98 [92;99] 100 [76;100] 96 [91;98] 38 [25;52]
2 / 8 30 [22;39] – 72 [61;81] 81 [71;88] 86 [76;93] 92 [83;97] 93 [86;96] 83 [69;91] 84 [75;90] 26 [17;38]
4 / 8 10 [6;16] 28 [19;39] – 62 [53;70] 71 [61;80] 82 [71;89] 84 [74;90] 81 [69;89] 78 [63;88] 18 [10;28]
8 / 8 6 [2;17] 19 [12;29] 38 [30;47] – 61 [51;71] 65 [51;76] 73 [62;82] 74 [59;85] 64 [55;73] 12 [3;34]
16 / 8 14 [6;28] 14 [7;24] 29 [20;39] 39 [29;49] – 52 [41;63] 61 [50;71] 52 [41;64] 41 [32;51] 5 [1;25]
32 / 8 2 [0;9] 8 [3;17] 18 [11;29] 35 [24;49] 48 [37;59] – 52 [42;63] 44 [32;57] 26 [17;36] 0 [0;30]
40 / 8 2 [1;8] 8 [4;14] 16 [10;26] 27 [18;38] 39 [29;50] 48 [37;58] – 43 [30;56] 41 [26;58] 4 [1;18]
40 / 4 0 [0;24] 17 [9;31] 19 [11;31] 26 [15;41] 48 [36;59] 56 [43;68] 57 [44;70] – 29 [18;41] 2 [0;11]
40 / 2 4 [2;9] 16 [10;25] 22 [12;37] 36 [27;45] 59 [49;68] 74 [64;83] 59 [42;74] 71 [59;82] – 5 [1;17]
40 / 1 62 [48;75] 74 [62;83] 82 [72;90] 88 [66;97] 95 [75;99] 100 [70;100] 96 [82;99] 98 [89;100] 95 [83;99] –

Extended Data Table 10 | Cross-table of win rates in per cent between programs in the single-machine scalability study. 95% Agresti–Coull confidence intervals in grey. Each program played with 2 s per move; komi was 7.5 in all games.

线程 1 2 4 8 16 32 40 40 40 40
GPU 8 8 8 8 8 8 8 4 2 1
1 / 8 – 70 [61;78] 90 [84;94] 94 [83;98] 86 [72;94] 98 [91;100] 98 [92;99] 100 [76;100] 96 [91;98] 38 [25;52]
2 / 8 30 [22;39] – 72 [61;81] 81 [71;88] 86 [76;93] 92 [83;97] 93 [86;96] 83 [69;91] 84 [75;90] 26 [17;38]
4 / 8 10 [6;16] 28 [19;39] – 62 [53;70] 71 [61;80] 82 [71;89] 84 [74;90] 81 [69;89] 78 [63;88] 18 [10;28]
8 / 8 6 [2;17] 19 [12;29] 38 [30;47] – 61 [51;71] 65 [51;76] 73 [62;82] 74 [59;85] 64 [55;73] 12 [3;34]
16 / 8 14 [6;28] 14 [7;24] 29 [20;39] 39 [29;49] – 52 [41;63] 61 [50;71] 52 [41;64] 41 [32;51] 5 [1;25]
32 / 8 2 [0;9] 8 [3;17] 18 [11;29] 35 [24;49] 48 [37;59] – 52 [42;63] 44 [32;57] 26 [17;36] 0 [0;30]
40 / 8 2 [1;8] 8 [4;14] 16 [10;26] 27 [18;38] 39 [29;50] 48 [37;58] – 43 [30;56] 41 [26;58] 4 [1;18]
40 / 4 0 [0;24] 17 [9;31] 19 [11;31] 26 [15;41] 48 [36;59] 56 [43;68] 57 [44;70] – 29 [18;41] 2 [0;11]
40 / 2 4 [2;9] 16 [10;25] 22 [12;37] 36 [27;45] 59 [49;68] 74 [64;83] 59 [42;74] 71 [59;82] – 5 [1;17]
40 / 1 62 [48;75] 74 [62;83] 82 [72;90] 88 [66;97] 95 [75;99] 100 [70;100] 96 [82;99] 98 [89;100] 95 [83;99] –

扩展数据表 10 | 单机可扩展性研究中各程序之间胜率(百分比)的交叉表。灰色数字为 95% Agresti–Coull 置信区间。每个程序每步 2 秒;所有对局贴目 7.5。

Threads 40 12 24 40 64
GPU 8 64 112 176 280
CPU 48 428 764 1202 1920
40 / 8 / 48 – 52 [43; 61] 68 [59; 76] 77 [70; 82] 81 [65; 91]
12 / 64 / 428 48 [39; 57] – 64 [54; 73] 62 [41; 79] 83 [55; 95]
24 / 112 / 764 32 [24; 41] 36 [27; 46] – 36 [20; 57] 60 [51; 69]
40 / 176 / 1202 23 [18; 30] 38 [21; 59] 64 [43; 80] – 53 [39; 67]
64 / 280 / 1920 19 [9; 35] 17 [5; 45] 40 [31; 49] 47 [33; 61] –

Extended Data Table 11 | Cross-table of win rates in per cent between programs in the distributed scalability study. 95% Agresti–Coull confidence intervals in grey. Each program played with 2 s per move; komi was 7.5 in all games.

线程 40 12 24 40 64
GPU 8 64 112 176 280
CPU 48 428 764 1202 1920
40 / 8 / 48 – 52 [43; 61] 68 [59; 76] 77 [70; 82] 81 [65; 91]
12 / 64 / 428 48 [39; 57] – 64 [54; 73] 62 [41; 79] 83 [55; 95]
24 / 112 / 764 32 [24; 41] 36 [27; 46] – 36 [20; 57] 60 [51; 69]
40 / 176 / 1202 23 [18; 30] 38 [21; 59] 64 [43; 80] – 53 [39; 67]
64 / 280 / 1920 19 [9; 35] 17 [5; 45] 40 [31; 49] 47 [33; 61] –

扩展数据表 11 | 分布式可扩展性研究中各程序之间胜率(百分比)的交叉表。灰色数字为 95% Agresti–Coull 置信区间。每个程序每步 2 秒;所有对局贴目 7.5。

References

  1. Allis, L. V. Searching for Solutions in Games and Artificial Intelligence. PhD thesis, Univ. Limburg, Maastricht, The Netherlands (1994).
  2. van den Herik, H., Uiterwijk, J. W. & van Rijswijck, J. Games solved: now and in the future. Artif. Intell. 134, 277–311 (2002).
  3. Schaeffer, J. The games computers (and people) play. Advances in Computers 52, 189–266 (2000).
  4. Campbell, M., Hoane, A. & Hsu, F. Deep Blue. Artif. Intell. 134, 57–83 (2002).
  5. Schaeffer, J. et al. A world championship caliber checkers program. Artif. Intell. 53, 273–289 (1992).
  6. Buro, M. From simple features to sophisticated evaluation functions. In 1st International Conference on Computers and Games, 126–145 (1999).
  7. Müller, M. Computer Go. Artif. Intell. 134, 145–179 (2002).
  8. Tesauro, G. & Galperin, G. On-line policy improvement using Monte-Carlo search. In Advances in Neural Information Processing, 1068–1074 (1996).
  9. Sheppard, B. World-championship-caliber Scrabble. Artif. Intell. 134, 241–275 (2002).
  10. Bouzy, B. & Helmstetter, B. Monte-Carlo Go developments. In 10th International Conference on Advances in Computer Games, 159–174 (2003).
  11. Coulom, R. Efficient selectivity and backup operators in Monte-Carlo tree search. In 5th International Conference on Computers and Games, 72–83 (2006).
  12. Kocsis, L. & Szepesvári, C. Bandit based Monte-Carlo planning. In 15th European Conference on Machine Learning, 282–293 (2006).
  13. Coulom, R. Computing Elo ratings of move patterns in the game of Go. ICGA J. 30, 198–208 (2007).
  14. Baudiš, P. & Gailly, J.-L. Pachi: State of the art open source Go program. In Advances in Computer Games, 24–38 (Springer, 2012).
  15. Enzenberger, M., Müller, M., Arneson, B. & Segal, R. 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. Gelly, S. & Silver, D. Combining online and offline learning in UCT. In 17th International Conference on Machine Learning, 273–280 (2007).
  17. Krizhevsky, A., Sutskever, I. & Hinton, G. ImageNet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, 1097–1105 (2012).
  18. Lawrence, S., Giles, C. L., Tsoi, A. C. & Back, A. D. Face recognition: a convolutional neural-network approach. IEEE Trans. Neural Netw. 8, 98–113 (1997).
  19. Mnih, V. et al. Human-level control through deep reinforcement learning. Nature 518, 529–533 (2015).
  20. LeCun, Y., Bengio, Y. & Hinton, G. Deep learning. Nature 521, 436–444 (2015).
  21. Stern, D., Herbrich, R. & Graepel, T. Bayesian pattern ranking for move prediction in the game of Go. In International Conference of Machine Learning, 873–880 (2006).
  22. Sutskever, I. & Nair, V. Mimicking Go experts with convolutional neural networks. In International Conference on Artificial Neural Networks, 101–110 (2008).
  23. Maddison, C. J., Huang, A., Sutskever, I. & Silver, D. Move evaluation in Go using deep convolutional neural networks. 3rd International Conference on Learning Representations (2015).
  24. Clark, C. & Storkey, A. J. Training deep convolutional neural networks to play go. In 32nd International Conference on Machine Learning, 1766–1774 (2015).
  25. Williams, R. J. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn. 8, 229–256 (1992).
  26. Sutton, R., McAllester, D., Singh, S. & Mansour, Y. Policy gradient methods for reinforcement learning with function approximation. In Advances in Neural Information Processing Systems, 1057–1063 (2000).
  27. Sutton, R. & Barto, A. Reinforcement Learning: an Introduction (MIT Press, 1998).
  28. Schraudolph, N. N., Dayan, P. & Sejnowski, T. J. Temporal difference learning of position evaluation in the game of Go. Adv. Neural Inf. Process. Syst. 6, 817–824 (1994).
  29. Enzenberger, M. Evaluation in Go by a neural network using soft segmentation. In 10th Advances in Computer Games Conference, 97–108 (2003).
  30. Silver, D., Sutton, R. & Müller, M. Temporal-difference search in computer Go. Mach. Learn. 87, 183–219 (2012).
  31. Levinovitz, A. The mystery of Go, the ancient game that computers still can’t win. Wired Magazine (2014).
  32. Mechner, D. All Systems Go. The Sciences 38, 32–37 (1998).
  33. Mandziuk, J. Computational intelligence in mind games. In Challenges for Computational Intelligence, 407–442 (2007).
  34. Berliner, H. A chronology of computer chess and its literature. Artif. Intell. 10, 201–214 (1978).
  35. Browne, C. et al. A survey of Monte-Carlo tree search methods. IEEE Trans. Comput. Intell. AI in Games 4, 1–43 (2012).
  36. Gelly, S. et al. The grand challenge of computer Go: Monte Carlo tree search and extensions. Commun. ACM 55, 106–113 (2012).
  37. Coulom, R. Whole-history rating: A Bayesian rating system for players of time-varying strength. In International Conference on Computers and Games, 113–124 (2008).
  38. KGS. Rating system math. http://www.gokgs.com/help/rmath.html.
  1. Littman, M. L. Markov games as a framework for multi-agent reinforcement learning. In 11th International Conference on Machine Learning, 157–163 (1994).
  2. Knuth, D. E. & Moore, R. W. An analysis of alpha-beta pruning. Artif. Intell. 6, 293–326 (1975).
  3. Sutton, R. Learning to predict by the method of temporal differences. Mach. Learn. 3, 9–44 (1988).
  4. Baxter, J., Tridgell, A. & Weaver, L. Learning to play chess using temporal differences. Mach. Learn. 40, 243–263 (2000).
  5. Veness, J., Silver, D., Blair, A. & Uther, W. Bootstrapping from game tree search. In Advances in Neural Information Processing Systems (2009).
  6. Samuel, A. L. Some studies in machine learning using the game of checkers II - recent progress. IBM J. Res. Develop. 11, 601–617 (1967).
  7. Schaeffer, J., Hlynka, M. & Jussila, V. Temporal difference learning applied to a high-performance game-playing program. In 17th International Joint Conference on Artificial Intelligence, 529–534 (2001).
  8. Tesauro, G. TD-gammon, a self-teaching backgammon program, achieves master-level play. Neural Comput. 6, 215–219 (1994).
  9. Dahl, F. Honte, a Go-playing program using neural nets. In Machines that learn to play games, 205–223 (Nova Science, 1999).
  10. Rosin, C. D. Multi-armed bandits with episode context. Ann. Math. Artif. Intell. 61, 203–230 (2011).
  11. Lanctot, M., Winands, M. H. M., Pepels, T. & Sturtevant, N. R. Monte Carlo tree search with heuristic evaluations using implicit minimax backups. In IEEE Conference on Computational Intelligence and Games, 1–8 (2014).
  12. Gelly, S., Wang, Y., Munos, R. & Teytaud, O. Modification of UCT with patterns in Monte-Carlo Go. Tech. Rep. 6062, INRIA (2006).
  13. Silver, D. & Tesauro, G. Monte-Carlo simulation balancing. In 26th International Conference on Machine Learning, 119 (2009).
  14. Huang, S.-C., Coulom, R. & Lin, S.-S. Monte-Carlo simulation balancing in practice. In 7th International Conference on Computers and Games, 81–92 (Springer-Verlag, 2011).
  15. Baier, H. & Drake, P. D. 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).
  16. Huang, S. & Müller, M. Investigating the limits of Monte-Carlo tree search methods in computer Go. In 8th International Conference on Computers and Games, 39–48 (2013).
  17. Segal, R. B. On the scalability of parallel UCT. Computers and Games 6515, 36–47 (2011).
  18. Enzenberger, M. & Müller, M. A lock-free multithreaded Monte-Carlo tree search algorithm. In 12th Advances in Computer Games Conference, 14–20 (2009).
  19. Huang, S.-C., Coulom, R. & Lin, S.-S. 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).
  20. Gelly, S. & Silver, D. Monte-Carlo tree search and rapid action value estimation in computer Go. Artif. Intell. 175, 1856–1875 (2011).
  21. Baudiš, P. Balancing MCTS by dynamically adjusting the komi value. ICGA J. 34, 131 (2011).
  22. Baier, H. & Winands, M. H. Active opening book application for Monte-Carlo tree search in 19×19 Go. In Benelux Conference on Artificial Intelligence, 3–10 (2011).
  23. Dean, J. et al. Large scale distributed deep networks. In Advances in Neural Information Processing Systems, 1223–1231 (2012).
  24. Go ratings. http://www.goratings.org.