W ATCH THE U NOBSERVED : A S IMPLE A PPROACH TO P ARALLELIZING M ONTE C ARLO T REE S EARCH
Anonymous authors
Paper under double-blind review
A BSTRACT
Monte Carlo Tree Search (MCTS) algorithms have achieved great success on many challenging benchmarks (e.g., Computer Go).
However, they generally require a large number of rollouts, making their applications costly.
Furthermore, it is also extremely challenging to parallelize MCTS due to its inherent sequential nature: each rollout heavily relies on the statistics (e.g., node visitation counts) estimated from previous simulations to achieve an effective exploration-exploitation tradeoff.
In spite of these difﬁculties, we develop an algorithm, WU-UCT , to effectively parallelize MCTS, which achieves linear speedup and exhibits negligible performance loss with an increasing number of workers.
The key idea in WUUCT is a set of statistics that we introduce to track the number of on-going yet incomplete simulation queries (named as unobserved samples ).
These statistics are used to modify the UCT tree policy in the selection steps in a principled manner to retain effective exploration-exploitation tradeoff when we parallelize the most time-consuming expansion and simulation steps.
Experiments on a proprietary benchmark and the Atari Game benchmark demonstrate the linear speedup and the superior performance of WU-UCT comparing to existing techniques.
I NTRODUCTION
Recently, Monte Carlo Tree Search (MCTS) algorithms such as UCT (Kocsis et al., 2006) have achieved great success in solving many challenging artiﬁcial intelligence (AI) benchmarks, including video games (Guo et al., 2016) and Go (Silver et al., 2016).
However, they rely on a large number (e.g. millions) of interactions with the environment emulator to construct search trees for decision-making, which leads to high time complexity (Browne et al., 2012).
For this reason, there has been an increasing demand for parallelizing MCTS over multiple workers.
However, parallelizing MCTS without degrading its performance is difﬁcult (Segal, 2010; Mirsoleimani et al., 2018a;
Chaslot et al., 2008), mainly due to the fact that each MCTS iteration requires information from all previous iterations to provide effective exploration-exploitation tradeoff, which critically inﬂuences its performance.
Parallelizing MCTS would inevitably obscure these crucial information, and we will show in Section 2.2 that this loss of information potentially results in a signiﬁcant performance drop.
The key question is therefore how to acquire and utilize more available information to help the algorithm to achieve better exploration-exploitation tradeoff.
To this end, we propose WU-UCT ( W atch the U novserved in UCT ), a novel parallel MCTS algorithm, that attains linear speedup without sacriﬁcing the performance.
This is achieved by a conceptual innovation (Section 3.1) as well as an efﬁcient real system implementation (Section 3.2).
Speciﬁcally, the key idea in WU-UCT to overcome the aforementioned challenge is a set of statistics that tracks the number of on-going yet incomplete simulation queries (named as unobserved samples ).
We combine these newly devised statistics with the original statistics of observed samples to modify UCT’s policy in the selection steps in a principled manner, which, as we shall show in Section 4, effectively retains exploration-exploitation tradeoff during parallelization.
Our proposed approach has been successfully deployed in a production system for efﬁciently and accurately estimating the rate at which users pass levels (termed user pass-rate) in a mobile game “Joy City”, with the purpose of reducing their design cycles.
On this benchmark, we show that WU-UCT achieves near-optimal linear speedup and superior performance in predicting user pass-rate (Section 5.1).
We further evaluate WU-UCT on the Atari game benchmark and compare it to state-of-the-art parallel MCTS algorithms (Section 5.2), which also demonstrate our superior speedup and performance.
O N THE D IFFICULTIES OF PARALLELIZING MCTS
We ﬁrst introduce the MCTS and the UCT algorithms, along with their difﬁculties in parallelization
. 2. M ONTE C ARLO T REE S EARCH AND U PPER C ONFIDENCE BOUND FOR T REES (UCT)
We consider the Markov Decision Process (MDP) (cid:104)S , A , R, P, γ (cid:105) , where an agent interacts with the environment in order to maximize a long-term cumulative reward.
Speciﬁcally, an agent at state s t ∈ S takes an action a t ∈ A according to a policy π , so that the MDP transits to the next state s t +1 ∼ P ( s t +1 | s t , a t ) and emits a reward R ( s t , a t , s t +1 ) .
The objective of the agent is to learn an optimal policy π ∗ such that the long-term cumulative reward is maximized:
[Equation]
where s ∈ S denotes the initial state and γ is the discount factor.
Many reinforcement learning (RL) algorithms have been developed to solve the above problem (Sutton & Barto, 2018), including model-free algorithms (Mnih et al., 2013; 2016; Williams, 1992; Konda & Tsitsiklis, 2000; Schulman et al., 2015; 2017) and model-based algorithms (Nagabandi et al., 2018;
Weber et al., 2017;
Bertsekas, 2005; Deisenroth & Rasmussen, 2011).
Monte Carlo Tree Search (MCTS) is a modelbased RL algorithm that plans the best action at each time step (Browne et al., 2012).
Speciﬁcally, it uses the MDP model (or its sampler) to identify the best action at each time step by constructing a search tree (Figure 1(a)), where each node s represents a visited state, each edge from s denotes an action a s that can be taken at that state, and the landing node s (cid:48) denotes the state it transits to after taking a s .
As shown in Figure 1(a), MCTS repeatedly performs four sequential steps: selection, expansion, simulation and backpropagation.
The selection step traverses over the existing search tree until the leaf node (or other termination conditions are satisﬁed) by choosing actions (edges) a s at each node s according to a tree policy.
One widely used node-selection policy is the one used in the Upper Conﬁdence bound for Trees (UCT) (Kocsis et al., 2006):
[Equation]
(2) where C ( s ) denotes the set of all child nodes for s ; the ﬁrst term V s (cid:48) is an estimate for the long-term cumulative reward that can be received when starting from the state represented by node s (cid:48) , and the second term represents the uncertainty (size of the conﬁdence interval) of that estimate.
The conﬁdence interval is calculated based on the Upper Conﬁdence Bound (UCB) (Auer et al., 2002; Auer, 2002) using N s and N s (cid:48) , which denote the number of times that the nodes s and s (cid:48) have been visited, respectively.
Therefore, the key idea of the UCT policy (2) is to select the best action according to an optimistic estimation (i.e., the upper conﬁdence bound) of the expected return, which strikes a balance between the exploitation (ﬁrst term) and the exploration (second term) with β controlling their tradeoff.
Once the selection process reaches a leaf node of the search tree (or other termination conditions are met), we will expand the node according to a prior policy by adding a new child node.
Then, in the simulation step, we estimate its value function (cumulative reward) ˆ V s by running the environment simulator with a default (simulation) policy.
Finally, during backpropagation, we update the statistics V s and N s along the traversed path according to:
[Equation]
2. T HE INTRINSIC DIFFICULTIES OF PARALLELIZING MCTS
The above discussion implies that the MCTS algorithm is intrinsically sequential: each selection step in a new rollout requires the previous rollouts to complete in order to deliver the updated statistics, V s and N s , for the UCT tree policy (2).
Although this requirement of up-to-date statistics is not mandatory for implementation, it is in practice intensively required to achieve effective explorationexploitation tradeoff (Auer et al., 2002).
Speciﬁcally, up-to-date statistics best help the UCT tree policy to explore and prune non-rewarding branches as well as extensively visit rewarding path for additional planning depth.
Likewise, to achieve the best possible performance, when multiple workers are used, it is also important to ensure that each worker uses the most recent statistics (the colored V s and N s in Figure 1(b)) in its own selection step.
However, this is impossible in parallelizing MCTS based on the following observations.
First, the expansion step and the simulation
𝑉"(𝑠 % )
𝑉 ’ 𝑁 ’ 𝑠 ’ 𝑠 * 𝑠 + 𝑉 * 𝑁 * 𝑉 + 𝑁 + 𝑎 - .
=
𝑛 * 𝑎 - 1 = 𝑛 +
Selection 𝑠 𝑎 𝑠 %
Expansion 𝜋 𝑠 ’ 𝑠 * 𝑠 + 𝑠 % 𝑉 % 𝑁 % 𝑉 + 𝑁 + 𝑉 * 𝑁 *
Simulation
Backpropagation
[Figure]
𝑠
$ 𝑠 % 𝑠
[Figure]
𝑠
[Figure]
B
C 𝑉 ’ 𝑁 ’ 𝑉 #
[Figure]
[Figure]
𝑁
[Figure]
[Figure]
% 𝑠
[Figure]
𝑠 " 𝑠 # 𝑠 $ 𝑠 %
[Figure]
B
C 𝑉 % 𝑁 % 𝑉 " 𝑁 " 𝑉 # 𝑁 # 𝑉 ) 𝑁 )
𝑉 $ 𝑁 $ 𝑛 + 𝑠
[Figure]
𝑠 "
[Figure]
[Figure]
step are generally more time-consuming compared to the other two steps, because they involve a large number of interactions with the environment simulator.
Therefore, as exempliﬁed by Figure 1(c), when a worker C initiates a new selection step, the other workers A and B are most likely still in their simulation or expansion steps.
This prevents them from updating the (global) statistics for other workers like C, which happens at the backpropagation step.
Using outdated statistics (the gray-colored V s and N s ) at different workers could lead to a signiﬁcant loss in speedup and performance, due to behaviors like collapes of exploration or exploitation failure , which we shall discuss thoroughly in Section 4.
To give an example, Figure 1(c) illustrates the collapse of exploration, where worker C traverses over the same path as the worker A in its selection step due to the determinism of (2).
Speciﬁcally, if the statistics are unchanged between worker A and C begins the selection step, they will choose the same node according to (2), which greatly reduces the diversity of exploration.
Therefore, the key question that we want to address in parallelizing MCTS is how to keep track of the correct statistics and modify the UCT policy in a principled manner, with the hope of retaining effective exploration-exploitation tradeoff at different workers.
WU-UCT
In this section, we ﬁrst develop the conceptual idea of our WU-UCT algorithm (Section 3.1), and then we present a real system implementation using a master-worker architecture (Section 3.2).
3. W ATCH THE UNOBSERVED SAMPLES IN UCT TREE POLICY
As we pointed out earlier, the key question we want to address in parallelizing MCTS is how to deliver the most up-to-date statistics { V s , N s } to each worker so that they can achieve effective exploration-exploitation tradeoff in its selection step.
This is assumed to be the case in the ideal parallelization in Figure 1(b).
Algorithmically, it is equivalent to the sequential MCTS except that the rollouts are performed in parallel by different workers.
Unfortunately, in practice, the statistics { V s , N s } available to each worker are generally outdated because of the slow and incomplete simulation and expansion steps at the other workers.
Speciﬁcally, since the estimated value ˆ V s is unobservable before simulations complete and workers should not wait for the updated statistics to proceed, the (partial) loss of statistics { V s , N s } is unavoidable.
Now the question becomes: is there an alternative way to addressing the issue?
The answer is in the afﬁrmative and is explained below.
Aiming at bridging the gap between naive parallelization and the ideal case, we closely examine their difference in terms of the availability of statistics.
As illustrated by the colors of the statistics, their only difference in { V s , N s } is caused by the on-going simulation process.
As suggested by (3), although V s can only be updated after a simulation step is completed, the newest N s information can actually be available as early as a worker initiates a new rollout.
This is the key insight that we leverage to enable effective parallelization in our WU-UCT algorithm.
Motivated by this, we introduce another quantity, O s , to count the number of rollouts that have been initiated but not yet completed , which we name as unobserved samples .
That is, our new statistics
O s watch the number of unobserved samples, and are then used to correct the UCT tree policy (2) into the following form:
[Equation]
The intuition of the above modiﬁed node-selection policy is that when there are O s workers simulating (querying) node s , the conﬁdence interval at node s will eventually be shrunk after they complete.
Therefore, adding O s and O s (cid:48) to the exploration term considers such a fact beforehand and let other workers be aware of it.
Despite its simple form, (4) provides a principled way to retain effective exploration-exploitation tradeoff under parallel settings; it corrects the conﬁdence bound towards better exploration-exploitation tradeoff.
As the conﬁdence level is instantly updated (i.e., at the beginning of simulation), more recent workers are guaranteed to observe additional statistics, which prevent them from extensively querying the same node as well as ﬁnd better nodes for them to query.
For example, when multiple children are in demand for exploration, (4) allows them to be explored evenly.
In contrast, when a node has been sufﬁciently visited (i.e., large N s and N s (cid:48) ), adding O s and O s (cid:48) from the unobserved samples have little effect on (4) because the conﬁdence interval is sufﬁciently shrunk around V s (cid:48) , allowing extensively exploitation of the best-valued child.
3. S YSTEM IMPLEMENTATION USING M ASTER - WORKER ARCHITECTURES
We now proceed to explain the system implementation of WU-UCT, where the overall architecture is shown in Figure 2(a) (see Appendix A for the details).
Speciﬁcally, we use a master-worker architecture to implement the WU-UCT algorithm with the following considerations.
First, since the expansion and the simulation steps are much more time-consuming compared to the selection and the backpropagation steps, they should be intensively parallelized.
In fact, they are relatively easy to parallelize (e.g., different simulations could be performed independently).
Second, as we discussed earlier, different workers need to access the most up-to-date statistics { V s , N s , O s } in order to achieve successful exploration-exploitation tradeoff.
To this end, a centralized architecture for the selection and backpropagation step is more preferable as it allows adding strict restrictions to the retrieval and update of the statistics, making them up-to-date.
Speciﬁcally, we use a centralized master process to maintain a global set of statistics (in addition to other data such as game states), and let it be in charge of the backpropagation step (i.e., updating the glocal statistics) and the selection step (i.e., using the global statistics).
As shown in Figure 2(a), the master process repeatedly performs rollouts until a predeﬁned number of simulations is reached.
During each rollout, it selects nodes to query, assign expansion and simulation tasks to different workers, and collect the returned results to update the global statistics.
In particular, we use the following complete update and incomplete update to track N s and O s along the traversed path (see Figure 1(d)):
[Equation]
In addition, V s is also updated in the complete update step using (3).
Such a clear division of labor between the master and the workers provides sequential selection and backpropagation steps when we parallelize the costly expansion and simulation steps.
It ensures up-to-date statistics for all workers by the centralized master process and achieves linear speedup without much performance degradation (see Section 5 for the experimental results).
To justify the above rationale of our system design, we perform a set of running time analysis for our developed WU-UCT system and report the results in Figure 2(b)–(c).
We show the timeconsumption for different parts at the master and at the workers.
First, we focus exclusively on [Figure] [Figure]
[Figure] [Figure] the workers. With close-to-100% occupancy rate for the simulation workers, the simulation step is parallelized.
Although the expansion workers are not fully utilized, the expansion step is maximumly parallelized since the number of required simulation and expansion tasks is identical.
This suggests the existence of an optimal (task-dependent) ratio between the number of expansion workers and the number of simulation workers that fully parallelize both steps with the least resources (e.g. memory).
Returning to the master process, on both benchmarks, we see a clear dominance of the time spent on the simulation and the expansion steps even they are both parallelized byworkers.
This supports our design to parallelize only the simulation and expansion steps.
We ﬁnally focus on the communication overhead caused by parallelization.
Although more time-consuming compared to simulation and backpropagation, the communication overhead is negligible compared to the time used by the expansion and the simulation steps.
Other details in our system, such as the centralized game-state storage, are further discussed in Appendix A.
T HE B ENEFITS OF W ATCHING U NOBSERVED S AMPLES
In this section, we discuss the beneﬁts of watching unobserved samples in WU-UCT, and compare it with several popular parallel MCTS algorithms (Figure 3), including Leaf Parallelization (LeafP),
Tree Parallelization (TreeP) with virtual loss, and Root Parallelization (RootP).
1 LeafP parallelizes the leaf simulation, which leads to an effective hex game solver (Wang et al., 2018).
TreeP with virtual loss has recently achieved great success in challenging real-world tasks such as Go (Silver et al., 2016).
And RootP parallelizes the subtrees of the root node at different workers, and aggregates the statistics of the subtrees after all the workers complete their simulations (Soejima et al., 2010).
We argue that, by introducing the additional statistics O s , WU-UCT achieves a better explorationexploitation tradeoff than the above methods.
First, LeafP and TreeP represent two extremes in such a tradeoff.
LeafP lacks diversity in exploration as all its workers are assigned to simulating the same node, leading to performance drop caused by collapse of exploration in much the same way as the naive parallelization.
In contrast, although the virtual loss used in TreeP could encourage exploration diversity, this hard additive penalty could cause exploitatin failure : workers will be less likely to co-simulating the same node even when they are certain that it is optimal (Mirsoleimani et al., 2017).
RootP tries to avoid these issues by letting workers perform an independent tree search.
However, this reduces the equivalent number of rollouts at each worker, decreasing the accuracy of the UCT policy (2).
Different from the above three approaches, WU-UCT achieves a much better exploration-exploitation tradeoff in the following manner.
It encourages exploration by using O s to “penalize” the nodes that have many in-progress simulations.
Meanwhile, it allows multiple workers to exploit the most rewarding node since this “penalty” vanishes when N s becomes large (see (4)).
While we have seen the disadvantages of neglecting information of the unobserved samples, we now examine whether keeping track of them provides substantial beneﬁts.
Speciﬁcally, we examine how far away WU-UCT is from the ideal parallelization in Figure 1(b).
Recall that the blue-colored statistics in Figure 1(b)-(c) at nodes 3, 5 and 9 imply that they are available to workers, while the gray-colored statistics means they are outdated.
Although the unobserved sample counts O s compensates the outdated N s and make it up-to-date, the expected return V s can not be corrected before the simulation completes and returns ˆ V .
Therefore, we now focus on analyzing the inﬂuence of missing ˆ V , and we argue that the tree structure of the search tree could mitigate its harm on the V s ’s along the selected path.
To see this, ﬁrst note that all the selected trajectories start from the root node and ends at some terminal node.
Therefore, shallower nodes are generally visited more frequently, thus they are more robust to missing ˆ V ’s.
In contrast, nodes with deeper path depth are less frequently visited and their V s estimates are supposed to be more sensitive to missing ˆ V ’s. Recall that the problem of missing ˆ V is caused by in-progress simulations at the leaf node, and the number of missing ˆ V is determined by the number of in-progress simulations (i.e., the number of unobserved samples).
However, these deeper nodes are less likely to have many unobserved samples (in-progress simulations) because the probability for selecting the same path decreases signiﬁcantly as the node depth increases.
Therefore, the V s ’s at these deeper nodes are generally less outdated.
E XPERIMENTS
This section evaluates the proposed WU-UCT algorithm on a production system to predict the user pass-rate of a mobile game (Section 5.1) as well as the public Atari Game benchmark (Section 5.2), aiming at demonstrating the superior performance and near-linear speedup of WU-UCT.
5. E XPERIMENTS ON THE “J OY C ITY ” GAME
Joy City is a level-oriented game with diverse and challenging gameplay.
Players tap to eliminate connected items on the game board. To pass a level, players have to complete certain goals within a given number of steps. The number of steps used to pass a level (termed game step) is the main performance metric, separating masters from beginners.
It is a challenging reinforcement learning task due to its large number of game-state ( ≈ 12 9 × 9 ) and high randomness in the transition.
The goal of the production system is to accurately predict the user pass-rate of different levels, providing useful and fast feedback for level design.
Powered by WU-UCT, the system runs 16 × faster while accurately predicting user pass-rate (8.6% MAE).
In this subsection, we concentrate our analysis on the speedup and performance of WU-UCT using two typical levels (Level-35 and Level-58) 3 , and refer the readers interested in the user pass-rate prediction system to Appendix C.
We evaluate WU-UCT with different numbers of expansion and simulation workers (from 1 to 16 ) and report the speedup results in Figures 4(a)–(b).
For all experiments, we ﬁx the total number of simulations to 500.
First, note that when we have the same number of expansion workers and simulation workers, WU-UCT achieves linear speedup.
Furthermore, Figures 4 also suggest that both the expansion workers and the simulation workers are crucial, since lowering the number of workers [Figure]
[Table] from either sets decreases the speedup.
Besides the ideal speedup property, WU-UCT suffers negligible performance loss with the increasing number of workers, as shown in Figures 4(c)–(d).
The standard deviations of the performance (measured in the average game steps) over different numbers of expansion and simulation workers are only 0 .
67 and 1 .
22 for Level-35 and Level-58, respectively, which are much smaller than their average game steps ( 12 and 30 ).
5. E XPERIMENTS ON THE A TARI G AME BENCHMARK
We further evaluate WU-UCT on Atari Games (Bellemare et al., 2013), a classical benchmark for reinforcement learning (RL) and planning algorithms (Guo et al., 2014).
ALE is an ideal testbed for MCTS algorithms for its long planning horizon (several thousand), sparse reward, and complex game strategy.
We compare WU-UCT to three parallel MCTS algorithms discussed in Section 4: TreeP , LeafP , and RootP .
We also report the results of sequential UCT ( ≈ 16 × slower than WUUCT) and PPO (Schulman et al., 2017) as reference.
Generally, the performance of sequential UCT sets an upper bound for parallel UCT algorithms.
PPO is included since we used a distilled PPO policy network (Hinton et al., 2015; Rusu et al., 2015) as the roll-out policy for all other algorithms.
It is considered as a performance lower bound for both parallel and sequential UCT algorithms.
All experiments are performed with a total of 128 simulation steps (see Appendix D for details).
We ﬁrst compare the performance, measured by average episode reward, between WU-UCT and the baselines on 15 Atari games, which is done with 16 simulation workers and 1 expansion worker (for a fair comparison, since baselines do not parallel the expansion step).
Each task is repeated 10 times with the mean and standard deviation reported in Table 1.
Due to the better explorationexploitation tradeoff during selection, WU-UCT out-performs all other parallel algorithms in 12 out of 15 tasks.
Pairwise student t-test further show that WU-UCT performs signiﬁcantly better ( pvalue < 0.05) than TreeP, LeafP, and RootP in 8, 12, and 7 tasks, respectively.
Next, we examine the inﬂuence of the number of simulation workers on the speed and the performance.
In Figure 5, we compare the average episode return as well as time consumption (per step) for 4, 8, andsimulation workers.
The bar plots indicate that WU-UCT experiences little performance loss with when heavily parallelized.
WU-UCT also achieves the fastest speed compared to the baselines thanks to the efﬁcient master-worker architecture (Section 3.2).
In conclusion, our proposed WUUCT not only out-performs baseline approaches signiﬁcantly under the same number of workers but also achieves negligible performance loss with the increasing level of parallelization.
R ELATED W ORK MCTS
Monte Carlo Tree Search is a planning method for optimal decision making in problems with either deterministic (Silver et al., 2016) or stochastic (Sch¨afer et al., 2008) environments.
It has made a profound inﬂuence on Artiﬁcial Intelligence applications (Browne et al., 2012), and has even been applied to predict and mimic human behavior (van Opheusden et al., 2016).
Recently, there has been a wide range of work combining MCTS and other learning methods, providing mutual improvements to both methods.
For example, Guo et al.
(2014) harnesses the power of MCTS to boost the performance of model-free RL approaches; Shen et al.
(2018) bridges the gap between MCTS and graph-based search, outperforming RL and knowledge base completion baselines.
Many approaches have been developed to parallelize MCTS methods, with the objective being two-fold: achieve near-linear speedup under a large number of workers while maintaining the algorithm performance.
Popular parallelization approaches of MCTS include leaf parallelization, root parallelization, and tree parallelization (Chaslot et al., 2008).
Leaf parallelization aims at collecting better statistics by assigning multiple workers to query the same node (Cazenave & Jouandeau, 2007).
However, this comes at the cost of wasting diversity of the tree search.
Therefore, its performance degrades signiﬁcantly despite the near-ideal speedup with the help of a client-server network architecture (Kato & Takeuchi, 2010).
In root parallelization, multiple search trees are built and assigned to different workers.
Additional work incorporates periodical synchronization of statistics from different trees, which results in better performance in real-world tasks (Bourki et al., 2010).
However, a case study on Go reveals its inferiority with even a small number of workers (Soejima et al., 2010).
On the other hand, tree parallelization uses multiple workers to traverse, perform queries, and update on a shared search tree.
It beneﬁts signiﬁcantly from two techniques.
First, a virtual loss is added to avoid querying the same node by different workers (Chaslot et al., 2008).
This has been adopted in various successful applications of MCTS such as Go (Silver et al., 2016) and Dou-di-zhu (Whitehouse et al., 2011).
Additionally, architecture side improvements such as using pipeline (Mirsoleimani et al., 2018b) or lock-free structure (Mirsoleimani et al., 2018a) speedup the algorithm signiﬁcantly.
However, though being able to increase diversity, virtual loss degrades the performance under even four workers (Mirsoleimani et al., 2017; Bourki et al., 2010).
C ONCLUSION
This paper proposes WU-UCT, a novel parallel MCTS algorithm that addresses the problem of outdated statistics during parallelization by watching the number of unobserved samples.
Based on the newly devised statistics, it modiﬁes the UCT node-selection policy in a principled manner, which achieves effective exploration-exploitation tradeoff.
Together with our efﬁciency-oriented system implementation, WU-UCT achieves near-optimal linear speedup as well as negligible performance degradation across a wide range of tasks, including a deployed production system and Atari games.
S UPPLEMENTARY M
ATERIAL
A A LGORITHM DETAILS FOR WU-UCT
Pseudo-code of the proposed WU-UCT algorithm is provided in Algorithm 1.
Speciﬁcally, it provides the workﬂow of the master process.
When the number of completed updates ( t complete ) has not exceeded the maximum simulation step T max , the main process keeps performing selection, expansion, simulation, and backpropagation.
Selection and backpropagation are performed in the main process, while the two others are assigned to the workers.
The backpropagation step is divided into two sub-routines incomplete update (Algorithm 2) and complete update (Algorithm 3).
The former is evoked before simulation starts, while the latter is called after receiving simulation results.
Task index τ is added to help the main process to track different tasks returned from the workers.
To maximize efﬁciency, the master process keeps assigning expansion and simulation tasks until all workers are occupied.
Communication overhead of WU-UCT The choice for centralized game-state storage stems from the following observations: (i) size of the game-state is usually small, which allows efﬁcient inter-process transformation, and (ii) each game-state is used at most |A| times, thus is inefﬁcient to store in multiple processes.
Although this design may not be ideal for all tasks, it is at least a reasonable one.
During rollouts, game-states generated by any expansion worker may be later used by any other expansion and simulation workers.
Therefore, either a per-task transformation or decentralized storage is needed.
For the latter case, however, since a game-state will be used at most |A| times, most workers will not need it, which results in inefﬁciency of the decentralized storage.
Another possible solution is to store the game-states in shared memory.
However, to receive beneﬁt from it, the following conditions should be satisﬁed: (i) each process can access (read/write) the memory relatively fast even if some collisions may happen, and (ii) the shared memory is big enough to hold all game-states that may be accessed.
If the two conditions hold, we may be able to reduce the communication overhead.
Although, since the communication overhead is negligible even withsimulation and expansion workers, we should consider using more workers to speedup the algorithm.
B A LGORITHM OVERVIEW OF BASELINE APPROACHES
We give an overview of three baseline parallel UCT algorithms: Leaf Parallelization (LeafP), Tree Parallelization (TreeP) with virtual loss, and Root Parallelization (RootP), aiming at providing a comprehensive view to the readers. We refer readers interested in the details of these algorithms to
Chaslot et al.
As suggested by their names, LeafP, TreeP, and RootP parallelized different parts of the search tree.
Speciﬁcally, LeafP (Algorithm 4) parallelizes only the simulation process: whenever a node (state) is selected to query, all workers perform roll-out individually on it.
The main process (master) then wait for all workers to complete simulation and return their respective cumulative reward, which are used to update the traversed nodes’ status.
TreeP (Algorithm 5) parallelizes the whole tree search algorithm by allowing different workers to access a shared search tree simultaneously.
Each worker individually perform the selection, expansion, simulation, and back-propagation steps and update the nodes’ statistics.
To discourage querying the same node, individual workers add a virtual loss − r V L ( r V L is a hyper-parameter of the algorithm) to each of its traversed node during the selection process, and add it back ( + r V L ) during back-propagation.
This allows nodes currently being evaluated by some workers to have lower utility score (4) and will be less likely chosen by other workers.
As suggested by its name, RootP (Algorithm 6) parallelizes the root node.
Speciﬁcally, in an initialization step, all children of the root node is expanded, and budgets are allocated to each worker, which in total evenly divides the max number of simulation steps ( T max in Algorithm 6) to each child.
Then all workers construct a search tree in their local memory and perform sequential tree search until their allocated budget is completed, where the worker terminates.
Finally, the main process collects statistics from all workers and return the best policy.
Input: environment emulator E , root tree node s root , maximum simulation step T max , maximum simulation depth d max , number of expansion workers N exp , and number of simulation workers N sim
Initialize: expansion worker pool W exp , simulation worker pool W sim , game-state buffer B , t ← 0 , and t complete ← 0 while t complete < T max do
Traverse the tree top down from root node s root following (4) until (i) its depth greater than d max , (ii) it is a leaf node, or (iii) it is a node that has not been fully expanded and random() < 0.
if expansion is required then ¯ s ← shallow copy of the current node
Assign expansion task ( t, ¯ s ) to pool W exp //
t is the task index else assign simulation task ( t, s ) to pool W sim if episode not terminated Call incomplete update ( s ) ; if episode terminated, call complete update ( t, s, 0 . 0) end if if W exp fully occupied then
Wait for a expansion task with return: (task index τ , game state s , reward r , terminal signal d , task index τ ); expand the tree according to s , τ , r , and d ; assign simulation task ( τ, s ) to pool W sim
Call incomplete update ( t, s ) else continue if W sim fully occupied then Wait for a simulation task with return: (task index τ , node s , cumulative reward ¯ r )
Call complete update ( τ, s, ¯ r ) ; t complete ← t complete + 1 else continue t ← t + 1 end while input: node s while n (cid:54) =
null do
O s ← O s + 1 s ← PR ( s ) //
PR ( s ) denotes the parent node of s end while input: task index t , node s , reward ¯ r while n (cid:54) =
null do
N s ← N s + 1 ; O s ← O s − 1 Retrieve reward r according to task index t ¯ r ← r + γ ¯ r ; V s ← N s − 1 N s V s + 1 N s ¯ r s ← PR ( s ) // PR ( s ) denotes
[Table]
C E XPERIMENT DETAILS AND SYSTEM DESCRIPTION OF THE J OY C ITY GAME
This section describes the basic rules of the Joy City game (Appendix C.1) as well as details about the deployed pass-rate prediction system (Appendix C.2).
C. D ESCRIPTION OF THE J OY C ITY GAME
This section serves as an introduction to the basic rules of the tap game.
We can click cells with connected color regions to eliminate them.
The remaining cells then collapse to ﬁll in the gaps of exploded ones.
To goal is to fulﬁll all level requirements (goals) within a ﬁxed number of clicks.
Figure 6(a) provides consecutive snapshots for playing level 10 of the game.
The goal of this level is depicted on the top, which is 3 “cats” and 24 “balloons”.
The top-left corner represents the remaining steps.
Players have to accomplish all given goals before the step runs out.
Figure 6(a) demonstrates successful gameplay, where only 6 steps are used to complete the level.
In each of the three left frames, the cell noted by the purple circle is clicked.
Immediately, the same-color region marked with a red frame is eliminated.
Different goals/obstacles react differently.
For instance, when some cell is exploded beside a balloon, it will also explode.
Frame two demonstrates the use of props.
Tapping regions with connectivity above a certain threshold will provide prop as a bonus.
They have special effects that can help players pass the level faster.
Finally, in the last screenshot, all goals are completed and we pass the level.
[Figure] Figure 6(b) further demonstrates the variety of levels.
Speciﬁcally, the left-most frame depicts a special “boss level”, where the goal is the “kill” the evil cat.
The cat will randomly throw objects to the cells, adding additional randomness.
Three other frames illustrate relatively hard levels, which is revealed from their low-connectivity, abundance and complexity of the obstacles, and special layout.
C. D ETAILS OF THE LEVEL PASS - RATE PREDICTION SYSTEM
During a game design cycle, to achieve the desired game pass-rates, a game designer needs to hire many human testers to extensively test all the levels before its release, which generally takes a long time and is inaccurate.
Therefore, it would greatly reduce the game design cycle if we can develop a testing system that is able to provide quick and accurate feedback about the user pass-rates.
Figure 7 gives an overview of our deployed user pass-rate prediction system, where WU-UCT is used to mimic average user performance and provide features for predicting the human pass-rate.
As we will show later, it can achieve signiﬁcant speedup without signiﬁcant performance loss, 4 allowing the game designer to get the feedback in 20 minutes instead of 12 hours.
Speciﬁcally, we use
WU-UCT with different numbers of rollouts to mimic players with different skill levels, where WU-UCT with 10 rollouts is used to represent average players while the agent with 100 rollouts mimics skillful players. This is veriﬁed by the pair-wise sample t-test result provided in Table 2. On the other hand, MCTS could achieve good performance but takes a long time in testing.
[Table]
Policy π (as default policy)
[Figure]
Perform multiple game plays using P-UCT with different number of simulations
Game play results featureextraction
Pass rate, aveg.
used step, … ( features in total)
Linear regression
[Figure]
[Table]
With 10 simulations
[Table]
the WU-UCT agent performs statistically similar ( p -value > 5%) to human players, while with 100-simulation, the agent performs statistically better ( p -value < 5%).
Besides,
Figure 8 shows that our pass-rate prediction system achieves 8.6% mean absolute error (MAE) on 130 released game-levels, with 93% of them having MAE less than 20%.
The system consists of two working phases, i.e., training and inference.
Speciﬁcally, training and validation are done on 300 levels that have been released in a test version of the game.
In the training phase, the system has access to both the level and players’ pass-rate, while only levels are available in the inference phase, and the system needs to give quick and accurate feedback about the (predicted) user pass-rate.
In both phases, the levels are ﬁrst fed into an asynchronous advantage actor-critic (A3C) (Mnih et al., 2016) learner for a base policy π .
It is then used by the WU-UCT agent as a prior to select expand action as well as the default policy for simulation.
We then use WU-UCT to perform multiple gameplays.
The maximum depth and width (maximum number of child nodes for each node) of the search tree is 10 and 5, respectively.
The number of simulations is set toand 100 to get AI bots with different skill levels.
Six features (three for both the 10-simulation and 100-simulation agent) are extracted from the gameplay results.
Speciﬁcally, the features are AI’s pass-rate, average used step divided by the provided step (the number at the top-left corner in the screenshots in Figure 6), and median used step divided by the provided step.
During training, the features, as well as the players’ pass-rate, is used to learn a linear regressor, while in the inference phase, the regression model is used to predict user pass-rate.
C. A DDITIONAL EXPERIMENTAL RESULTS
In this section, we list the additional experimental results.
In Table 3, we report the speciﬁc speedup number for different numbers of expansion worker and simulation workers. [Figure] [Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table] [Figure] [Table] [Figure]
D E XPERIMENT DETAILS OF THE A TARI GAMES
This section provides the implementation details of the experiments on Atari games.
Speciﬁcally, we ﬁrst describe the training pipeline of the default policy.
We then illustrate how the default policy is connected with MCTS algorithm to perform simulation.
Training default policy for MCTS To allow better overall performance, we used the Proximal
Policy Gradient (PPO) (Schulman et al., 2017), one of the state-of-the-art on-policy reinforcement learning (RL) algorithms.
We adopted the highest-starred third-party code of PPO on GitHub.
The implementation uses the same hyper-parameters with the original paper.
The architecture of the policy network is shown in Figure 9.
The original PPO network is trained on 10 million frames for each task.
To reduce computation count, we shrank the network using network distillation (Hinton et al., 2015).
Speciﬁcally, it is a teacher-student training framework where the student (distilled) network mimics the output of the teacher network.
Samples are collected by the PPO network with the (cid:15) -greedy strategy ( (cid:15) = 0 . 1 ).
The student network optimizes its parameters to minimize the mean square error of the policy’s logits as well as the value.
Performance of the original PPO policy network as well as the distilled network is provided in Table 4.
MCTS simulation Both the policy output and the value output of the distilled network is used in the simulation phase.
Particularly, if simulation is started from state s , rollout is performed using [Figure] the policy network with an upper bound of 100 steps, where it results in state s (cid:48) .
If the environment does not terminate, the full return is compensated by the value function at state s (cid:48) .
Formally, the cumulative reward provided by the simulation is R simu
=
(cid:80) 99 i =
γ i r i + γ 100 V ( s (cid:48) ) , where V ( s ) denotes the value of state s .
To reduce the variance of Monte Carlo sampling, value function V ( s ) at state s is used additionally.
The ﬁnal return of the simulation phase is then R = 0 .
5 R simu +0 .
5 V ( s ) .
Hyperparameters and experiment details for WU-UCT For all tree search based algorithms (i.e., WU-UCT, TreeP, LeafP, and RootP), the maximum depth of the search tree is set to 100.
The search width is limited by 20 and the maximum number of simulations is 128.
The discount factor γ is set to 0.99 (note that the reported score is not discounted).
When performing gameplays, a tree search subroutine is invoked to plan for the best action in each time step.
The sub-routine iteratively constructs a search tree from its initial status with a root node only.
Experiments are deployed on 4 Intel (cid:114) Xeon (cid:114) E5-2650 v4 CPUs and 8 NVIDIA (cid:114) GeForce (cid:114) RTX 2080 Ti GPUs.
To minimize the speed ﬂuctuation caused by the different workload on the machine, we ensure the total number of simulation workers is smaller than the total number of CPU cores, allowing each process to fully occupy one single core.
The WU-UCT is implemented with multiple processes, with an inter-process pipe between the master process and each worker process.
Hyperparameters and experiments for baseline algorithms Failing to ﬁnd appropriate thirdparty packages for baseline algorithms (i.e., tree parallelization, leaf parallelization, and root parallelization), we built our implementation of them based on the corresponding papers.
Building all algorithms in the same package additionally allows us to accurately conduct speed-tests as it eliminates other factors (e.g. different language) that may bias the result.
Speciﬁcally, leaf parallelization is implemented with a master-worker structure: when the main process enters the simulation step, it assigns the task to all workers.
When return from all workers is available, the master process performs backpropagation according to these statistics and begin a new rollout.
As suggested by Browne et al.
(2012), tree parallelization is implemented using a decentralized structure, i.e., each worker performs rollouts on a shared search tree.
At the selection step, each traversed node is added a ﬁxed virtual loss − r V L to guarantee diversity of the tree search.
When performing backpropagation, r V L is again added to the traversed nodes.
r V L is chosen from 1.0 and 5.0 for each particular task.
In other words, we ran TreeP with r V L = 1 .
and r V L = 5 .
for each task, and report the better result.
Root parallelization is implemented according to Chaslot et al.
Similar to leaf parallelization, root parallelization consists of sub-processes that do not share information with each other.
At the beginning of the tree search process, each sub-process is assigned several actions of the root node to query.
They then perform sequential UCT rollouts until reaches a pre-deﬁned step size.
When all sub-processes complete the jobs, statistics from them is gathered by the main process, which then uses this information to choose the best action.
Input: environment emulator E , prior policy π , root tree
[Table]
s root , maximum
[Table]
, maximum
[Table]
depth d
[Table]
, and number
[Table]
N sim
Initialize: t complete ← 0 while t complete < T max do
Traverse the tree top down from root node s root following (2) until (i) its depth greater than d max , (ii) it is a leaf node, or (iii) it is a node that has not been fully
[Table]
and random(
[Table]
<
[Table]
s (cid:48)
← expand (
[Table]
[Table]
[Table]
) Each of the simulation workers perform roll-out beginning from s
[Table]
{+Wait until all workers completed simulation and returned cumulative reward { ¯ r i } N sim i =
+}
( ¯ r i is returned by worker i ) for i = 1 : N sim do Call back propagation ( s, ¯ r i ) end for t complete ← t complete + N sim end while
Input
[Table]
Add
[Table]
s
[Table]
←
[Table]
[Table]
from
[Table]
¯
[Table]
out Call back
[Table]
[Table]
[Table]
i )
Remove virtual loss from each of the traversed node:
[Table]
for each traversed s t
[Table]
if
[Table]
Terminate current process end if end
[Table]
[Table]
Averagely distribute the workload (perform tree search T avg times on each child of s root ) to the N sim workers, and copy the corresponding child nodes to the worker’s local memory.
Perform asynchronously
[Table]
N
[Table]
a
[Table]
of
[Table]
according to its
[Table]
[Table]
Terminate
[Table]
end if
[Table]
input: node s , environment emulator E , prior policy π a ← random action drawn from π ( · | s ) while s has expanded a do a ← random action drawn from π ( · | s ) end while s (cid:48) , r, d ← performing a in s according to E ( d : terminal signal) s (cid:48) ← a new node constructed according to s
Store reward signal r and termination indicator d in s (cid:48)
Link s (cid:48) as the child of s by the node corresponding to a input: node s , cumulative reward ¯ r while s (cid:54) =
null do
N s ← N s + 1 Retrieve the reward r in the current node s (which is collected during its expansion) ¯ r ← r + γ ¯ r
V s ← N s − 1 N s V s + 1 N s ¯ r s ← PR ( s ) //
PR ( s ) denotes the parent node of s end while