Title: COMBINING Q-LEARNING AND SEARCH WITH AMORTIZED VALUE ESTIMATES

Abstract: We introduce "Search with Amortized Value Estimates" (SAVE), an approach for combining model-free Q-learning with model-based Monte-Carlo Tree Search (MCTS). In SAVE, a learned prior over state-action values is used to guide MCTS, which estimates an improved set of state-action values. The new Q-estimates are then used in combination with real experience to update the prior. This effectively amortizes the value computation performed by MCTS, resulting in a cooperative relationship between model-free learning and model-based search. SAVE can be implemented on top of any Q-learning agent with access to a model, which we demonstrate by incorporating it into agents that perform challenging physical reasoning tasks and Atari. SAVE consistently achieves higher rewards with fewer training steps, and-in contrast to typical model-based search approaches-yields strong performance with very small search budgets. By combining real experience with information computed during search, SAVE demonstrates that it is possible to improve on both the performance of model-free learning and the computational cost of planning.

1. INTRODUCTION:

Model-based methods have been at the heart of reinforcement learning (RL) since its inception (Bellman, 1957) , and have recently seen a resurgence in the era of deep learning, with powerful function approximators inspiring a variety of effective new approaches (Silver et al., 2018; Chua et al., 2018; Hamrick, 2019; Wang et al., 2019) . Despite the success of model-free RL in reaching state-of-the-art performance in challenging domains (e.g. Kapturowski et al., 2018; Haarnoja et al., 2018) , model-based methods hold the promise of allowing agents to more flexibly adapt to new situations and efficiently reason about what will happen to avoid potentially bad outcomes. The two key components of any such system are the model, which captures the dynamics of the world, and the planning algorithm, which chooses what computations to perform with the model in order to produce a decision or action (Sutton & Barto, 2018) .

Much recent work on model-based RL places an emphasis on model learning rather than planning, typically using generic off-the-shelf planners like Monte-Carlo rollouts or search (see Hamrick (2019) ; Wang et al. (2019) for recent surveys). Yet, with most generic planners, even a perfect model of the world may require large amounts of computation to be effective in high-dimensional, sparse reward settings. For example, recent methods which use Monte-Carlo Tree Search (MCTS) require 100s or 1000s of model evaluations per action during training, and even upwards of a million simulations per time step at test time (Anthony et al., 2017; Silver et al., 2018) . These large search budgets are required, in part, because much of the computation performed during planning-such as the estimation of action values-is coarsely summarized in behavioral traces such as visit counts (Anthony et al., 2017; Silver et al., 2018) , or discarded entirely after an action is selected (Bapst et al., 2019; Azizzadenesheli et al., 2018) . However, large search budgets are a luxury that is not always available: many real-world simulators are expensive and may only be feasible to query a handful of times. In this paper, we explore preserving the value estimates that were computed by search by amortizing them via a neural network and then using this network to guide future search, resulting in an approach which works well even with very small search budgets.

We propose a new method called "Search with Amortized Value Estimates" (SAVE) which uses a combination of real experience as well as the results of past searches to improve overall performance and reduce planning cost. During training, SAVE uses MCTS to estimate the Q-values at encountered states. These Q-values are used along with real experience to fit a Q-function, thus amortizing the computation required to estimate values during search. The Q-function is then used as a prior for subsequent searches, resulting in a symbiotic relationship between model-free learning and MCTS. At test time, SAVE uses MCTS guided by the learned prior to produce effective behavior, even with very small search budgets and in environments with tens of thousands of possible actions per state-settings which are very challenging for traditional planners.

2. BACKGROUND AND MOTIVATION:

Unifying the complementary approaches of learning and search has been of interest to the RL and planning communities for many years (e.g. Gelly & Silver, 2007; Guo et al., 2014; Gu et al., 2016; Silver et al., 2016) . SAVE is motivated in particular by two threads in this body of work: one which uses planning in-the-loop to produce experience for Q-learning, and one which learns a policy prior for guiding search. As we will describe next, both of these previous approaches can suffer from issues with training stability which are alleviated by SAVE by simultaneously using MCTS to strengthen an action-value function, and Q-learning to strengthen MCTS.

2.1. LEARNING FROM PLANNED ACTIONS:

A number of methods have explored learning from planned actions. Guo et al. (2014) trained a model-free policy to imitate the actions produced by an MCTS agent. Other methods use planning in-the-loop to recommend actions, which are then executed in the environment to gather experience for model-free learning (Silver et al., 2008; Gu et al., 2016; Azizzadenesheli et al., 2018; Shen et al., 2018; Lowrey et al., 2018; Bapst et al., 2019; Kartal et al., 2019) . However, problems can arise when learning with actions that were produced via planning, even with off-policy algorithms like Q-learning. As noted by both Gu et al. (2016) and Azizzadenesheli et al. (2018) , planning avoids suboptimal actions, resulting in a highly biased action distribution consisting of mostly good actions; information about suboptimal actions therefore does not get propagated back to the Q-function. As an example, consider the case where a Q-function recommends taking action a. During planning, this action is explored and is found to yield lower reward than expected. The planner will end up recommending some other action a , which is executed in the environment and later used to update the Q-function. However, this means that the original action a is never actually experienced and thus is never downweighed in the Q-function, resulting in poorly approximated Q-values.

One way to deal with this problem is to use a mixture of both on-policy and planned actions (Gu et al., 2016) . However, this throws away information about poor actions which is acquired during the planning process. In SAVE, we instead make use of this information by using the values estimated during search to help fit the Q-function. If the search finds that a particular action is worse than previously thought, this information will be reflected by the estimated values and will thus ultimately get propagated back to the Q-function. We explicitly test and confirm this hypothesis in Section 4.2.

2.2. USING PRIOR KNOWLEDGE IN SEARCH:

Much research has leveraged prior knowledge in the context of MCTS (Gelly & Silver, 2007; 2011; Silver et al., 2016; Segler et al., 2018; Silver et al., 2017b; 2018; Anthony et al., 2017; 2019) . Some of the most successful methods (Anthony et al., 2017; Silver et al., 2018) use a prior policy to guide search, the results of which are used to further improve the policy. However, such methods use information about past behavior to learn a policy prior-namely, the visit counts of actions during search-and discard other search information such as inferred Q-values. We might anticipate one potential failure mode of such "count-based policy learning" approaches. Consider an environment with sparse rewards, where most actions are highly suboptimal. In the limit of infinite search, actions which have highest value will be visited most frequently, resulting in a policy that guides search towards regions of high value. However, in the regime of small search budgets, the search may very well end up exploring mostly suboptimal actions. These actions have higher visit counts, and so are reinforced, leading to the agent being more likely to explore poor actions.

Rather than implicitly biasing search towards value through the use of visit counts, SAVE relies on a prior that explicitly encodes knowledge about value. If SAVE ends up searching poor actions, it will learn that they have low values and this knowledge will be reflected in future searches. Thus, in contrast to count-based approaches, a SAVE agent will be less likely to visit poor actions in the future despite having frequently visited them in the past. We explicitly test and confirm this hypothesis in Section 4.1.

2.3. OTHER RELATED WORK:

Finding effective ways of combining model-based and model-free experience has been of interest to the RL community for decades. Most famously, the Dyna algorithm (Sutton, 1990) proposes using real experience to learn a model and then using the model to train a model-free policy. A number of more recent works have explored how to incorporate this idea into deep architectures (Kalweit & Boedecker, 2017; Feinberg et al., 2018; Buckman et al., 2018; Serban et al., 2018; Kurutach et al., 2018; Kaiser et al., 2019) , with an emphasis on dealing with the errors that are introduced by approximate models. In these approaches, the policy or value function is typically trained using on-policy rollouts from the model without using additional planning. Another way to combine model-free and model-based approaches is "implicit planning", in which the computation of a planner is built into the architecture of a neural network itself (Weber et al., 2017; Buesing et al., 2018; Pascanu et al., 2017; Silver et al., 2017b; Oh et al., 2017; Guez et al., 2018; Farquhar et al., 2018; Hamrick et al., 2017; Srinivas et al., 2018; Yu et al., 2019; Tamar et al., 2016; Karkus et al., 2017) . While SAVE is not an implicit planning method, it shares similarities with such methods in that it also tightly integrates planning and learning.

3. METHOD:

… a < l a t e x i t s h a 1 _ b a s e 6 4 = " Q p d a H A t U L V h j r S K I 0 w w D h Z f 7 M 2 g = " > A A A B 6 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S J 4 K k k V 7 L H g x W M L 9 g P a U D b b S b t 2 s w m 7 G 6 G E / g I v H h T x 6 k / y 5 r 9 x 2 + a g r Q 8 G H u / N M D M v S A T X x n W / n Y 3 N r e 2 d 3 c J e c f / g 8 O i 4 d H L a 1 n G q G L Z Y L G L V D a h G w S W 2 D D c C u 4 l C G g U C O 8 H k b u 5 3 n l B p H s s H M 0 3 Q j + h I 8 p A z a q z U p I N S 2 a 2 4 C 5 B 1 4 u W k D D k a g 9 J X f x i z N E J p m K B a 9 z w 3 M X 5 G l e F M 4 K z Y T z U m l E 3 o C H u W S h q h 9 r P F o T N y a Z U h C W N l S x q y U H 9 P Z D T S e h o F t j O i Z q x X v b n 4 n 9 d L T V j z M y 6 T 1 K B k y 0 V h K o i J y f x r M u Q K m R F T S y h T 3 N 5 K 2 J g q y o z N p m h D 8 F Z f X i f t a s W 7 r l S b N + V 6 L Y + j A O d w A V f g w S 3 U 4 R 4 a 0 A I G C M / w C m / O o / P i v D s f

y 9 Y N J 5 8 5 g z 9 w P n 8 A w a m M 3 w = = < / l a t e x i t > s < l a t e x i t s h a 1 _ b a s e 6 4 = " 8 U D Z 6 x 7 J N g 5 b x q Z A o / H a 5 + Z x p q k = " >

A A A B 6 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S J 4 K k k V 7 L H g x W M L 9 g P a U D b b S b t 2 s w m 7 G 6 G E / g I v H h T x 6 k / y 5 r 9 x 2 + a g r Q 8 G H u / N M D M v S A T X x n W / n Y 3 N r e 2 d 3 c J e c f / g 8 O i 4 d H L a 1 n G q G L Z Y L G L V D a h G w S W 2 D D c C u 4 l C G g U C O 8 H k b u 5 3 n l B p H s s H M 0 3 Q j + h I 8 p A z a q z U 1 I N S 2 a 2 4 C 5 B 1 4 u W k D D k a g 9 J X f x i z N E J p m K B a 9 z w 3 M X 5 G l e F M 4 K z Y T z U m l E 3 o C H u W S h q h 9 r P F o T N y a Z U h C W N l S x q y U H 9 P Z D T S e h o F t j O i Z q x X v b n 4 n 9 d L T V j z M y 6 T 1 K B k y 0 V h K o i J y f x r M u Q K m R F T S y h T 3 N 5 K 2 J g q y o z N p m h D 8 F Z f X i f t a s W 7 r l S b N + V 6 L Y + j A O d w A V f g w S 3 U 4 R 4 a 0 A I G C M / w C m / O o / P i v D s f

y 9 Y N J 5 8 5 g z 9 w P n 8 A 3 P G M 8 Q = = < / l a t e x i t > s < l a t e x i t s h a 1 _ b a s e 6 4 = " 8 U D Z 6 x 7 J N g 5 b x q Z A o / H a 5 + Z x p q k = " > 

A A A B 6 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S J 4 K k k V 7 L H g x W M L 9 g P a U D b b S b t 2 s w m 7 G 6 G E / g I v H h T x 6 k / y 5 r 9 x 2 + a g r Q 8 G H u / N M D M v S A T X x n W / n Y 3 N r e 2 d 3 c J e c f / g 8 O i 4 d H L a 1 n G q G L Z Y L G L V D a h G w S W 2 D D c C u 4 l C G g U C O 8 H k b u 5 3 n l B p H s s H M 0 3 Q j + h I 8 p A z a q z U 1 I N S 2 a 2 4 C 5 B 1 4 u W k D D k a g 9 J X f x i z N E J p m K B a 9 z w 3 M X 5 G l e F M 4 K z Y T z U m l E 3 o C H u W S h q h 9 r P F o T N y a Z U h C W N l S x q y U H 9 P Z D T S e h o F t j O i Z q x X v b n 4 n 9 d L T V j z M y 6 T 1 K B k y 0 V h K o i J y f x r M u Q K m R F T S y h T 3 N 5 K 2 J g q y o z N p m h D 8 F Z f X i f t a s W 7 r l S b N + V 6 L Y + j A O d w A V f g w S 3 U 4 R 4 a 0 A I G C M / w C m / O o / P i v D s f y 9 Y N J 5 8 5 g z 9 w P n 8 A 3 P G M 8 Q = = < / l a t e x i t > Q 0 < l a t e x i t s h a 1 _ b a s e 6 4 = " h 6 y Z d p 7 K v x 5 3 i Y Z 6 / 8 / f n d V J N + Y = " > A A A B 6 n i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S J 4 K k k V 7 L H g x W O L 9 g P a U D b b S b t 0 s w m 7 G 6 G E / g Q v H h T x 6 i / y 5 r 9 x 2 + a g r Q 8 G H u / N M D M v S A T X x n W / n Y 3 N r e 2 d 3 c J e c f / g 8 O i 4 d H L a 1 n G q G L Z Y L G L V D a h G w S W 2 D D c C u 4 l C G g U C O 8 H k b u 5 3 n l B p H s t H M 0 3 Q j + h I 8 p A z a q z 0 0 B y 4 g 1 L Z r b g L k H X i 5 a Q M O R q D 0 l d / G L M 0 Q m m Y o F r 3 P D c x f k a V 4 U z g r N h P N S a U T e g I e 5 Z K G q H 2 s 8 W p M 3 J p l S E J Y 2 V L G r J Q f 0 9 k N N J 6 G g W 2 M 6 J m r F e 9 u f i f 1 0 t N W P M z L p P U o G T L R W E q i I n J / G 8 y 5 A q Z E V N L K F P c 3 k r Y m C r K j E 2 n a E P w V l 9 e J + 1 q x b u u V J s 3 5 X o t j 6 M A 5 3 A B V + D B L d T h H h r Q A g Y j e I Z X e H O E 8 + K 8 O x / L 1 g 0 n n z m D P 3 A + f w D M / 4 1 y < / l a t e x i t > Q K < l a t e x i t s h a 1 _ b a s e 6 4 = " 8 P p R y 1 8 I B A I w t P B X s 5 b s A Y I k f D c = " > A A A B 6 n i c b V D L S g N B E O y N r x h f U Y 9 e B o P g K e x G w R w D X g Q v C Z o H J E u Y n X S S I b O z y 8 y s E J Z 8 g h c P i n j 1 i 7 z 5 N 0 6 S P W h i Q U N R 1 U 1 3 V x A L r o 3 r f j u 5 j c 2 t 7 Z 3 8 b m F v / + D w q H h 8 0 t J R o h g 2 W S Q i 1 Q m o R s E l N g 0 3 A j u x Q h o G A t v B 5 H b u t 5 9 Q a R 7 J R z O N 0 Q / p S P I h Z 9 R Y 6 a H R v + 8 X S 2 7 Z X Y C s E y 8 j J c h Q 7 x e / e o O I J S F K w w T V u u u 5 s f F T q g x n A m e F X q I x p m x C R 9 i 1 V N I Q t Z 8 u T p 2 R C 6 s M y D B S t q Q h C / X 3 R E p D r a d h Y D t D a s Z 6 1 Z u L / 3 n d x A y r f s p l n B i U b L l o m A h i I j L / m w y 4 Q m b E 1 B L K F L e 3 E j a m i j J j 0 y n Y E L z V l 9 d J q 1 L 2 r s q V x n W p V s 3 i y M M Z n M M l e H A D N b i D O j S B w Q i e 4 R X e H O G 8 O O / O x 7 I 1 5 2 Q z p / A H z u c P 9 e u N j Q = = < / l a t e x i t > MCTS Q ✓ < l a t e x i t s h a 1 _ b a s e 6 4 = " e 6 A Q Y z f 9 + D r F s 4 G c W K F z 5 L a K p s w = " > A A A B 7 3 i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S J 4 K k k V 7 L H g x W M L 9 g P a U D b b T b t 0 s 4 m 7 E 6 G E / g k v H h T x 6 t / x 5 r 9 x 2 + a g r Q 8 G H u / N M D M v S K Q w 6 L r f z s b m 1 v b O b m G v u H 9 w e H R c O j l t m z j V j L d Y L G P d D a j h U i j e Q o G S d x P N a R R I 3 g k m d 3 O / 8 8 S 1 E b F 6 w G n C / Y i O l A g F o 2 i l b n P Q x z F H O i i V 3 Y q 7 A F k n X k 7 K k K M x K H 3 1 h z F L I 6 6 Q S W p M z 3 M T 9 D O q U T D J Z 8 V + a n h C 2 Y S O e M 9 S R S N u / G x x 7 4 x c W m V I w l j b U k g W 6 u + J j E b G T K P A d k Y U x 2 b V m 4 v / e b 0 U w 5 q f C Z W k y B V b L g p T S T A m 8 + f J U G j O U E 4 t o U w L e y t h Y 6 o p Q x t R 0 Y b g r b 6 8 T t r V i n d d q T Z v y v V a H k c B z u E C r s C D W 6 j D P T S g B Q w k P M M r v D m P z o v z 7 n w s W z e c f O Y M / s D 5 / A H 7 Y Y / m < / l a t e x i t > W < l a t e x i t s h a 1 _ b a s e 6 4 = " b k n B C l U A f 6 o P L w 2 q g d q S v J 1 X P M 4 = " > A A A B 6 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S J 4 K k k V 7 L H g x W M L 9 g P a U D b b S b t 2 s w m 7 G 6 G E / g I v H h T x 6 k / y 5 r 9 x 2 + a g r Q 8 G H u / N M D M v S A T X x n W / n Y 3 N r e 2 d 3 c J e c f / g 8 O i 4 d H L a 1 n G q G L Z Y L G L V D a h G w S W 2 D D c C u 4 l C G g U C O 8 H k b u 5 3 n l B p H s s H M 0 3 Q j + h I 8 p A z a q z U 7 A x K Z b f i L k D W i Z e T M u R o D E p f / W H M 0 g i l Y Y J q 3 f P c x P g Z V Y Y z g b N i P 9 W Y U D a h I + x Z K m m E 2 s 8 W h 8 7 I p V W G J I y V L W n I Q v 0 9 k d F I 6 2 k U 2 M 6 I m r F e 9 e b i f 1 4 v N W H N z 7 h M U o O S L R e F q S A m J v O v y Z A r Z E Z M L a F M c X s r Y W O q K D M 2 m 6 I N w V t 9 e Z 2 0 q x X v u l J t 3 p T r t T y O A p z D B V y B B 7 d Q h 3 t o Q A s Y I D z

G K R H A R I E U Y F 6 W q q G R n E k i A e M N I P Z s 3 M 7 z 8 S q W g k O n o e E 4 + j i a A h x U g b y b f L b X / E k Z 5 K n t 4 3 O w 8 L 3 6 4 4 V W c J u E n c n F R A j p Z v f 4 3 G E U 4 4 E R o z p N T Q d W L t p U h q i h l Z l E a J I j H C M z Q h Q 0 M F 4 k R 5 6 T L 4 A l 4 a Z Q z D S J o n N F y q v z d S x J W a 8 8 B M Z i H V u p e J / 3 n D R I d 1 L 6 U i T j Q R e H U o T B j U E c x a g G M q C d Z s b g j C k p q s E E + R R F i b r k q m B H f 9 y 5 u k V 6 u 6 1 9 V a + 6 b S q O d 1 F M E 5 u A B X w A W 3 o A H u Q A t 0 A Q Y J e A a v

4 M 1 6 s l 6 s d + t j N V q w 8 p 0 z 8 A f W 5 w + R p p L / < / l a t e x i t > r, s 0 < l a t e x i t s h a 1 _ b a s e 6 4 = " h J u f q p w z w 1 y q + q r P 9 F g I W b J g 5 j w

= " > A A A B 7 H i c b V B N S 8 N A E J 3 U r 1 q / q h 6 9 L B b R g 5 S k C v Z Y 8 O K x g r G F N p T N d t I u 3 W z C 7 k Y o p b / B i w d F v P q D v P l v 3 L Y 5 a O u D g c d 7 M 8 z M C 1 P B t X H d b 6 e w t r 6 x u V X c L u 3 s 7 u 0 f l A + P H n W S K Y Y + S 0 S i 2 i H V K L h E 3 3 A j s J 0 q p H E o s B W O b m d + 6 w m V 5 o l 8 M O M U g 5 g O J I 8 4 o 8 Z K v r o k + r x X r r h V d w 6 y S r y c V C B H s 1 f + 6 v Y T l s U o D R N U 6 4 7 n p i a Y U G U 4 E z g t d T O N K W U j O s C O p Z L G q I P J / N g p O b N K n 0 S J s i U N m a u / J y Y 0 1 n o c h 7 Y z p m a o l 7 2 Z + J / X y U x U D y Z c p p l B y R a L o k w Q k 5 D Z 5 6 T P F T I j x p Z Q p r i 9 l b A h V Z Q Z m 0 / J h u A t v 7 x K H m t V 7 6 p a u 7 + u N O p 5 H E U 4 g V O 4 A A 9 u o A F 3 0 A Q f G H B 4

h l d 4 c 6 T z 4 r w 7 H 4 v W g p P P H M M f O J 8 / z r 6 N / g = = < / l a t e x i t > s < l a t e x i t s h a 1 _ b a s e 6 4 = " 8 U D Z 6 x 7 J N g 5 b x q Z A o / H a 5 + Z x p q k = " >

A A A B 6 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S J 4 K k k V 7 L H g x W M L 9 g P a U D b b S b t 2 s w m 7 G 6 G E / g I v H h T x 6 k / y 5 r 9 x 2 + a g r Q 8 G H u / N M D M v S A T X x n W / n Y 3 N r e 2 d 3 c J e c f / g 8 O i 4 d H L a 1 n G q G L Z Y L G L V D a h G w S W 2 D D c C u 4 l C G g U C O 8 H k b u 5 3 n l B p H s s H M 0 3 Q j + h I 8 p A z a q z U 1 I N S 2 a 2 4 C 5 B 1 4 u W k D D k a g 9 J X f x i z N E J p m K B a 9 z w 3 M X 5 G l e F M 4 K z Y T z U m l E 3 o C H u W S h q h 9 r P F o T N y a Z U h C W N l S x q y U H 9 P Z D T S e h o F t j O i Z q x X v b n 4 n 9 d L T V j z M y 6 T 1 K B k y 0 V h K o i J y f x r M u Q K m R F T S y h T 3 N 5 K 2 J g q y o z N p m h D 8 F Z f X i f t a s W 7 r l S b N + V 6 L Y + j A O d w A V f g w S 3 U 4 R 4 a 0 A I G C M / w C m / O

o / P i v D s f y 9 Y N J 5 8 5 g z 9 w P n 8 A 3 P G M 8 Q = = < / l a t e x i t > {s, s 0 , a, r} < l a t e x i t s h a 1 _ b a s e 6 4 = " r 7 t f 9 M t 3 a 9 5 i P

P f L k e f W J + C + N 8 4 = " > A A A B + X i c b V B N S 8 N A E J 3 U r 1 q / o h 6 9 L B b R Q y l J K 9 h j w Y v H C v Y D m l A 2 2 0 2 7 d L M J u 5 t C C f 0 n X j w o 4 t V / 4 s 1 / 4 7 b N Q V s f D D z e m 2 F m X p B w p r T j f F u F r e 2 d 3 b 3 i f u n g 8 O j 4 x D 4 9 6 6 g 4 l Y S 2 S c x j 2 Q u w o p w J 2 t Z M c 9 p L J M V R w G k 3 m N w v / O 6 U S s V i 8 a R n C f U j P B I s Z A R r I w 1 s 2 8 t U B a n r C s I V J J E 3 H 9 h l p + o s g T a J m 5 M y 5 G g N 7 C 9 v G J M 0 o k I T j p X q u 0 6 i / Q x L z Q i n 8 5 K X K p p g M s E j 2 j d U 4 I g q P 1 t e P k d X R h m i M J a m h E Z L 9 f d E h i O l Z l F g O i O s x 2 r d W 4 j / e f 1 U h w 0 / Y y J J N R V k t S h M O d I x W s S A h k x S o v n M E E w k M 7 c i M s Y S E 2 3 C K p k Q 3 P W X N 0 m n V n X r 1 d r j b b n Z y O M o w g V c w g 2 4 c A d N e I A W t I H A F J 7 h F d 6 s z H q x 3 q 2 P V W v B y m f O 4 Q + s z x / k l J H Z < / l a t e x i t > real experience

< l a t e x i t s h a 1 _ b a s e 6 4 = " p I e c r h J d A M Z L r R y u j P a 2 Q

J d 4 c 1 A = " > A A A B / 3 i c b V C 7 S g N B F J 3 1 G e N r V b C x G Q y C V d i N g p Y B G 8 s I 5 g H J E m Y n d 5 M h s w 9 m 7 k r C m s J f s b F Q x N b f s P N v n C R b a O K B g c M 5 9 z D 3 H j + R Q q P j f F s r q 2 v

r G 5 u F r e L 2 z u 7 e v n 1 w 2 N B x q j j U e S x j 1 f K Z B i k i q K N A C a 1 E A Q t 9 C U 1 / e D P 1 m w + g t I i j e x w n 4

I W s H 4 l A c I Z G 6 t r H H Y Q R Z i Y i K Y w S U A I i D p O u X X L K z g x 0 m b g 5 K Z E c t a 7 9 1 e n F P A 0 h Q i 6 Z 1 m 3 X S d D L m E L B J U y K n V R D w v i Q 9 a F t a M R C 0 F 4 2 2 3 9 C z 4 z S o 0 G s z I u Q z t T f i Y y F W o 9 D 3 0 y G D A d 6 0 Z u K / 3 n t F I N r L x N R k q I 5 a / 5 R k E q K M Z 2 W Q X t C A U c 5 N o R x J c y u l A + Y Y h x N Z U V T g r t 4 8 j J p V M r u R b l y d 1 m q V v I 6 C u S E n J J z 4 p I r U i W 3 p E b q h J N H 8 k x e y Z v 1 Z L 1 Y 7 9 b H f H T F y j N H 5 A + s z x + 4 / 5 a A < / l a t e x i t > {s, Q MCTS } < l a t e x i t s h a 1 _ b a s e 6 4 = " M H 0 + Y w z 7 x s i v S 8 N 8 P y H t T G V x c w E = " > A A A C A H i c b V C 7 S g N B F J 2 N r x h f q x Y W N o N B s J C w G w V T B t L Y C A n m B d l l m Z 1 M k i G z D 2 b u i m H Z x l + x s V D E 1 s + w 8 2 + c P A p N P H D h c M 6 9 3 H u P H w u u w L K + j d z a + s b m V n 6 7 s L O 7 t 3 9 g H h 6 1 V Z R I y l o 0 E p H s + k Q x w U P W A g 6 C d W P J S O A L 1 v H H t a n f e W B S 8 S h s w i R m b k C G I R 9 w S k B L n n n i p O o S N z w H 2 C P I I L 2 r N e 8 z 7 G S e W b R K 1 g x 4 l d g L U k Q L 1 D 3 z y + l H N A l Y C F Q Q p X q 2 F Y O b E g m c C p Y V n E S x m N A x G b K e p i E J m H L T 2 Q M Z P t d K H w 8 i q S s E P F N / T 6 Q k U G o S + L o z I D B S y 9 5 U / M / r J T C o u C k P 4 w R Y S O e L B o n A E O F p G r j P J a M g J p o Q K r m + F d M R k Y S C z q y g Q 7 C X X 1 4 l 7 X L J v i q V G 9 f F a m U R R x 6 d o j N 0 g W x 0 g 6 r o F t V R C 1 G U o W

f 0 i t 6 M J + P F e D c + 5 q 0 5 Y z F z j P 7 A + P w B + H q V + Q = = < / l a t e x i t > search experience < l a t e x i t s h a 1 _ b a s e 6 4 = " 7 c l D K K q a H S y k R / u C G 6 T A X n J q E U k = " > A A Y V w J 8 1 f K B 0 w x j q a 0 o i n B X Y y 8 T B q V s n t R r t x d l q q V v I 4 C O S G n 5 J y 4 5 I p U y S 2 p k T r h 5 J E 8 k 1 f y Z j 1 Z L 9 a 7 9 T E f X b H y n S P y B 9 b n D 1 S N l 2 Y = < / l a t e x i t > L A < l a t e x i t s h a 1 _ b a s e 6 4 = " N C i / i X F w s W o X 9 y F n e v a X v F 7 H

J Q 4 = " > A A A C S H i c f Z D L S s N A F I Y n 9 R 5 v V Z d u g k U Q k Z K I Y J c V X b h Q r G B V a E I 5 m Z 7 W o Z N J n J m I J e Q 5 3 O r r + A a + h T t x 5 6 S t 4 A 0 P D H z 8 5 5 + Z c / 4 w 4 U x p 1 3 2 x S h O T U 9 M z s 3 P 2 / M L i 0 n J 5 Z f V S x a m k 2 K Q x j + V 1 C A o 5 E 9 j U T H O 8 T i R C F H K 8 C v u H R f / q D q V i s b j Q g w S D C H q C d R k F b a T A j 0 D f U O D Z S d 4 + a J c r b t U d l v M b v D F U y L g a 7 R V r 0 + / E N I 1 Q a M p B q Z b n J j r I Q G p G O e a 2 n y p M g P a h h y 2 D A i J U Q T a c O n c 2 j d J x u r E 0 R 2 h n q H 6 9 k U G k 1 C A K j b O Y U v 3 s F e J f v V a q u 7 U g Y y J J N Q o 6 + q i b c k f H T h G B 0 2 E S q e Y D A 0 A l M 7 M 6 9 A Y k U G 2 C s m 3 / C M 0 y E k / N w 2 c J S t C x 3 M 5 8 k L 0 I 7 n O z X M / f K e g / I x O f R k O 2 C d b 7 G e N v u N y t e m 7 V O 9 + r 1 G v j i G f J O t k g W 8 Q j + 6 R O j k m D N A k l t + S B P J I n 6 9 l 6 t d 6 s 9 5 G 1 Z I 3 v r J F v V S p 9 A K R 1 s e A = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " N C i / i X F w s W o X 9 y F n e v a X v F 7 H J Q 4 = " > A A A C S H i c f Z D L S s N A F I Y n 9 R 5 v V Z d u g k U Q k Z K I Y J c V X b h Q r G B V a E I 5 m Z 7 W o Z N J n J m I J e Q 5 3 O r r + A a + h T t x 5 6 S t 4 A 0 P D H z 8 5 5 + Z c / 4 w 4 U x p 1 3 2 x S h O T U 9 M z s 3 P 2 / M L i 0 n J 5 Z f V S x a m k 2 K Q x j + V 1 C A o 5 E 9 j U T H O 8 T i R C F H K 8 C v u H R f / q D q V i s b j Q g w S D C H q C d R k F b a T A j 0 D f U O D Z S d 4 + a J c r b t U d l v M b v D F U y L g a 7 R V r 0 + / E N I 1 Q a M p B q Z b n J j r I Q G p G O e a 2 n y p M g P a h h y 2 D A i J U Q T a c O n c 2 j d J x u r E 0 R 2 h n q H 6 9 k U G k 1 C A K j b O Y U v 3 s F e J f v V a q u 7 U g Y y J J N Q o 6 + q i b c k f H T h G B 0 2 E S q e Y D A 0 A l M 7 M 6 9 A Y k U G 2 C s m 3 / C M 0 y E k / N w 2 c J S t C x 3 M 5 8 k L 0 I 7 n O z X M / f K e g / I x O f R k O 2 C d b 7 G e N v u N y t e m 7 V O 9 + r 1 G v j i G f J O t k g W 8 Q j + 6 R O j k m D N A k l t + S B P J I n 6 9 l 6 t d 6 s 9 5 G 1 Z I 3 v r J F v V S p 9 A K R 1 s e A = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " N C i / i X F w s W o X 9 y F n e v a X v F 7 H J Q 4 = " > A A A C S H i c f Z D L S s N A F I Y n 9 R 5 v V Z d u g k U Q k Z K I Y J c V X b h Q r G B V a E I 5 m Z 7 W o Z N J n J m I J e Q 5 3 O r r + A a + h T t x 5 6 S t 4 A 0 P D H z 8 5 5 + Z c / 4 w 4 U x p 1 3 2 x S h O T U 9 M z s 3 P 2 / M L i 0 n J 5 Z f V S x a m k 2 K Q x j + V 1 C A o 5 E 9 j U T H O 8 T i R C F H K 8 C v u H R f / q D q V i s b j Q g w S D C H q C d R k F b a T A j 0 D f U O D Z S d 4 + a J c r b t U d l v M b v D F U y L g a 7 R V r 0 + / E N I 1 Q a M p B q Z b n J j r I Q G p G O e a 2 n y p M g P a h h y 2 D A i J U Q T a c O n c 2 j d J x u r E 0 R 2 h n q H 6 9 k U G k 1 C A K j b O Y U v 3 s F e J f v V a q u 7 U g Y y J J N Q o 6 + q i b c k f H T h G B 0 2 E S q e Y D A 0 A l M 7 M 6 9 A Y k U G 2 C s m 3 / C M 0 y E k / N w 2 c J S t C x 3 M 5 8 k L 0 I 7 n O z X M / f K e g / I x O f R k O 2 C d b 7 G e N v u N y t e m 7 V O 9 + r 1 G v j i G f J O t k g W 8 Q j + 6 R O j k m D N A k l t + S B P J I n 6 9 l 6 t d 6 s 9 5 G 1 Z I 3 v r J F v V S p 9 A K R 1 s e A = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " N C i / i X F w s W o X 9 y F n e v a X v F 7 H J Q 4 = " > A A A C S H i c f Z D L S s N A F I Y n 9 R 5 v V Z d u g k U Q k Z K I Y J c V X b h Q r G B V a E I 5 m Z 7 W o Z N J n J m I J e Q 5 3 O r r + A a + h T t x 5 6 S t 4 A 0 P D H z 8 5 5 + Z c / 4 w 4 U x p 1 3 2 x S h O T U 9 M z s 3 P 2 / M L i 0 n J 5 Z f V S x a m k 2 K Q x j + V 1 C A o 5 E 9 j U T H O 8 T i R C F H K 8 C v u H R f / q D q V i s b j Q g w S D C H q C d R k F b a T A j 0 D f U O D Z S d 4 + a J c r b t U d l v M b v D F U y L g a 7 R V r 0 + / E N I 1 Q a M p B q Z b n J j r I Q G p G O e a 2 n y p M g P a h h y 2 D A i J U Q T a c O n c 2 j d J x u r E 0 R 2 h n q H 6 9 k U G k 1 C A K j b O Y U v 3 s F e J f v V a q u 7 U g Y y J J N Q o 6 + q i b c k f H T h G B 0 2 E S q e Y D A 0 A l M 7 M 6 9 A Y k U G 2 C s m 3 / C M 0 y E k / N w 2 c J S t C x 3 M 5 8 k L 0 I 7 n O z X M / f K e g / I x O f R k O 2 C d b 7 G e N v u N y t e m 7 V O 9 + r 1 G v j i G f J O t k g W 8 Q j + 6 R O j k m D N A k l t + S B P J I n 6 9 l 6 t d 6 s 9 5 G 1 Z I 3 v r J F v V S p 9 A K R 1 s e A = < / l a t e x i t > L Q < l a t e x i t s h a 1 _ b a s e 6 4 = " v q d e / P a g J X e F r 0 / V F n H n U 6 i 1 m C s = " > A A A C S H i c f Z D L S s N A F I Y n 9 V b j r d W l m 2 A R R K Q k I t h l Q R c u F F u w K j S h n E x P 6 + B k E m c m Y g l 5 D r f 6 O r 6 B b + F O 3 D m p F b z h g Y G P / / w z c 8 4 f J p w p 7 b r P V m l q e m Z 2 r j x v L y w u L a 9 U q q v n K k 4 l x Q 6 N e S w v Q 1 D I m c C O Z p r j Z S I R o p D j R X h 9 U P Q v b l E q F o s z P U o w i G A o 2 I B R 0 E Y K / A j 0 F Q W e H e e 9 d q 9 S c + v u u J z f 4 E 2 g R i b V 6 l W t T b 8 f 0 z R C o S k H p b q e m + g g A 6 k Z 5 Z j b f q o w A X o N Q + w a F B C h C r L x 1 L m z a Z S + M 4 i l O U I 7 Y / X r j Q w i p U Z R a J z F l O p n r x D / 6 n V T P W g E G R N J q l H Q j 4 8 G K X d 0 7 B Q R O H 0 m k W o + M g B U M j O r Q 6 9 A A t U m K N v 2 D 9 E s I / H E P H y a o A Q d y + 3 M B z m M 4 C 4 3 y w 3 9 n Y L + M z L x a T R k m 2 C 9 n z H + h v P d u u f W v f Z e r d m Y R F w m 6 2 S D b B G P 7 J M m O S I t 0 i G U 3 J B 7 8 k A e

r S f r x X q 1 3 j 6 s J W t y Z 4 1 8 q 1 L p H c H 1 s f A = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " v q d e / P a g J X e F r 0 /

V F n H n U 6 i 1 m C s = " > A A A C S H i c f Z D L S s N A F I Y n 9 V b j r d W l m 2 A R R K Q k I t h l Q R c u F F u w K j S h n E x P 6 + B k E m c m Y g l 5 D r f 6 O r 6 B b + F O 3 D m p F b z h g Y G P / / w z c 8 4 f J p w p 7 b r P V m l q e m Z 2 r j x v L y w u L a 9 U q q v n K k 4 l x Q 6 N e S w v Q 1 D I m c C O Z p r j Z S I R o p D j R X h 9 U P Q v b l E q F o s z P U o w i G A o 2 I B R 0 E Y K / A j 0 F Q W e H e e 9 d q 9 S c + v u u J z f 4 E 2 g R i b V 6 l W t T b 8 f 0 z R C o S k H p b q e m + g g A 6 k Z 5 Z j b f q o w A X o N Q + w a F B C h C r L x 1 L m z a Z S + M 4 i l O U I 7 Y / X r j Q w i p U Z R a J z F l O p n r x D / 6 n V T P W g E G R N J q l H Q j 4 8 G K X d 0 7 B Q R O H 0 m k W o + M g B U M j O r Q 6 9 A A t U m K N v 2 D 9 E s I / H E P H y a o A Q d y + 3 M B z m M 4 C 4 3 y w 3 9 n Y L + M z L x a T R k m 2 C 9 n z H + h v P d u u f W v f Z e r d m Y R F w m 6 2 S D b B G P 7 J M m O S I t 0 i G U 3 J B 7 8 k A e

r S f r x X q 1 3 j 6 s J W t y Z 4 1 8 q 1 L p H c H 1 s f A = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " v q d e / P a g J X e F r 0 /

V F n H n U 6 i 1 m C s = " > A A A C S H i c f Z D L S s N A F I Y n 9 V b j r d W l m 2 A R R K Q k I t h l Q R c u F F u w K j S h n E x P 6 + B k E m c m Y g l 5 D r f 6 O r 6 B b + F O 3 D m p F b z h g Y G P / / w z c 8 4 f J p w p 7 b r P V m l q e m Z 2 r j x v L y w u L a 9 U q q v n K k 4 l x Q 6 N e S w v Q 1 D I m c C O Z p r j Z S I R o p D j R X h 9 U P Q v b l E q F o s z P U o w i G A o 2 I B R 0 E Y K / A j 0 F Q W e H e e 9 d q 9 S c + v u u J z f 4 E 2 g R i b V 6 l W t T b 8 f 0 z R C o S k H p b q e m + g g A 6 k Z 5 Z j b f q o w A X o N Q + w a F B C h C r L x 1 L m z a Z S + M 4 i l O U I 7 Y / X r j Q w i p U Z R a J z F l O p n r x D / 6 n V T P W g E G R N J q l H Q j 4 8 G K X d 0 7 B Q R O H 0 m k W o + M g B U M j O r Q 6 9 A A t U m K N v 2 D 9 E s I / H E P H y a o A Q d y + 3 M B z m M 4 C 4 3 y w 3 9 n Y L + M z L x a T R k m 2 C 9 n z H + h v P d u u f W v f Z e r d m Y R F w m 6 2 S D b B G P 7 J M m O S I t 0 i G U 3 J B 7 8 k A e

r S f r x X q 1 3 j 6 s J W t y Z 4 1 8 q 1 L p H c H 1 s f A = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " v q d e / P a g J X e F r 0 / tions 1 and 4 ). From Q MCTS , an action a is selected via epsilon-greedy and the resulting experience (s, a, r, s , Q MCTS ) is added to a replay buffer. When learning, the agent uses real experience to update Q θ via Q-learning (L Q ) as well as an amortization loss (L A ) which regresses Q θ towards the Q-values estimated during search (Equation 6).

V F n H n U 6 i 1 m C s = " > A A A C S H i c f Z D L S s N A F I Y n 9 V b j r d W l m 2 A R R K Q k I t h l Q R c u F F u w K j S h n E x P 6 + B k E m c m Y g l 5 D r f 6 O r 6 B b + F O 3 D m p F b z h g Y G P / / w z c 8 4 f J p w p 7 b r P V m l q e m Z 2 r j x v L y w u L a 9 U q q v n K k 4 l x Q 6 N e S w v Q 1 D I m c C O Z p r j Z S I R o p D j R X h 9 U P Q v b l E q F o s z P U o w i G A o 2 I B R 0 E Y K / A j 0 F Q W e H e e 9 d q 9 S c + v u u J z f 4 E 2 g R i b V 6 l W t T b 8 f 0 z R C o S k H p b q e m + g g A 6 k Z 5 Z j b f q o w A X o N Q + w a F B C h C r L x 1 L m z a Z S + M 4 i l O U I 7 Y / X r j Q w i p U Z R a J z F l O p n r x D / 6 n V T P W g E G R N J q l H Q j 4 8 G K X d 0 7 B Q R O H 0 m k W o + M g B U M j O r Q 6 9 A A t U m K N v 2 D 9 E s I / H E P H y a o A Q d y + 3 M B z m M 4 C 4 3 y w 3 9 n Y L + M z L x a T R k m 2 C 9 n z H + h v P d u u f W v f Z e r d m Y R F w m 6 2 S D b B G P 7 J M m O S I t 0 i G U 3 J B 7 8 k A e r S f r x X q 1 3 j 6 s J W t y Z 4 1 8 q 1 L p H c H 1 s f A = < / l a t e x i t > Q ✓ < l a t e x i t s h a 1 _ b a s e 6 4 = " e 6 A Q Y z f 9 + D r F s 4 G c W K F z 5 L a K p s w = " > A A A B 7 3 i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S J 4 K k k V 7 L H g x W M L 9 g P a U D b b T b t 0 s 4 m 7 E 6 G E / g k v H h T x 6 t / x 5 r 9 x 2 + a g r Q 8 G H u / N M D M v S K Q w 6 L r f z s b m 1 v b O b m G v u H 9 w e H R c O j l t m z j V j L d Y L G P d D a j h U i j e Q o G S d x P N a R R I 3 g k m d 3 O / 8 8 S 1 E b F 6 w G n C / Y i O l A g F o 2 i l b n P Q x z F H O i i V 3 Y q 7 A F k n X k 7 K k K M x K H 3 1 h z F L I 6 6 Q S W p M z 3 M T 9 D O q U T D J Z 8 V + a n h C 2 Y S O e M 9 S R S N u / G x x 7 4 x c W m V I w l j b U k g W 6 u + J j E b G T K P A d k Y U x 2 b V m 4 v / e b 0 U w 5 q f C Z W k y B V b L g p T S T A m 8 + f J U G j O U E 4 t o U w L e y t h Y 6 o p Q x t R 0 Y b g r b 6 8 T t r V i n d d q T Z v y v V a H k c B z u E C r s C D W 6 j D P T S g B Q w k P M M r v D m P z o v z 7 n w s W z e c f O Y M / s D 5 / A H 7 Y Y / m < / l a t e x i t > Q ✓ 0 < l a t e x i t s h a 1 _ b a s e 6 4 = " Y 4 Q n O D p e w 4 e / 9 q 5 T P 2 b Y Q W 6 L h b U = " > A A A B 8 n i c b V B N S 8 N A E J 3 4 W e t X 1 a O X Y B E 9 l a Q K 9 l j w 4 r E F + w F t K J v t p l 2 6 2 Q 2 7 E 6 G E / g w v H h T x 6 q / x 5 r 9 x 2 + a g r Q 8 G H u / N M D M v T A Q 3 6 H n f z s b m 1 v b O b m G v u H 9 w e H R c O j l t G 5 V q y l p U C a W 7 I T F M c M l a y F G w b q I Z i U P B O u H k f u 5 3 n p g 2 X M l H n C Y s i M l I 8 o h T g l b q N Q d Z H 8 c M y d V s U C p 7 F W 8 B d 5 3 4 O S l D j s a g 9 N U f K p r G T C I V x J i e 7 y U Y Z E Q j p 4 L N i v 3 U s I T Q C R m x n q W S x M w E 2 e L k m X t p l a E b K W 1 L o r t Q f 0 9 k J D Z m G o e 2 M y Y 4 N q v e X P z P 6 6 U Y 1 Y K M y y R F J u l y U Z Q K F 5 U 7 / 9 8 d c s 0 o i q k l h G p u b 3 X p m G h C 0 a Z U t C H 4 q y + v k 3 a 1 4 t 9 U q s 3 b c r 2 W x 1 G A c 7 i A a / D h D u r w A A 1 o A Q U F z / A

Q 0 ≡ Q θ is built up to Q K , which is returned as Q MCTS (Equa-

SAVE features two main components (Figure 1 ). First, we use a search policy that incorporates the Q-function Q θ (s, a) as a prior over Q-values that are estimated during search. Second, to train the Qfunction we rely on an objective function that combines both the TD-error from Q-learning with an amortization loss that amortizes the value computation performed by the search. The amortization loss, combined with the prior over Q-values, thus enables future searches to build on previous ones, resulting in stronger search performance overall.

3.1. STANDARD MCTS:

Before explaining how SAVE leverages search, we briefly describe the standard MCTS algorithm (Kocsis & Szepesvári, 2006; Coulom, 2006) . While we focus here on the single-player setting, we note that the formulation of MCTS (and by extension, SAVE) is similar for two-player settings. MCTS uses a simulator or model of the environment to explore possible future states and actions, with the aim of finding a good action to execute from the current state, s 0 . In MCTS, we assume access to a budget of K iterations (or simulations). The k th iteration of MCTS consists of three phases: selection, expan-sion, and backup. In the selection phase, we expand a search tree beginning with the current state and taking actions according to a search policy:

EQUATION

where Q k is the currently estimated value of taking action a while in state s, which will be explained further below. U k (s, a) is the UCT exploration term:

EQUATION

where N k (s, a) is the number of times we have explored taking action a from state s and c UCT is a constant that encourages exploration. This selection procedure is repeated for T -1 times, until a new action a T -1 that had not previously been explored is chosen from state s T -1 . This begins the expansion phase, during which a T -1 is executed in the simulator, resulting in a reward r T -1 and new state s T . The new state s T is added to the search tree, and its value V (s T ) is estimated either via a state-value function or (more traditionally) via a Monte-Carlo rollout. At this point the backup phase begins, during which the value of s T is used to update (or "back up") the values of its parent states earlier in the tree. Specifically, for state s t , the i th backed up return is estimated as:

EQUATION

where γ is the discount factor and r j was the reward obtained after executing a j in s j when traversing the search tree. These backups are then used to estimate the Q-function in Equation 1as

Q k (s, a) = N k (s,a) i=1 R i (s, a)/N k (s, a).

3.2. INCORPORATING A PRIOR DURING SEARCH:

SAVE makes several changes to the standard MCTS procedure. First, it assumes it has visited every state and action pair once by initializing N (s, a) = 1 for all states and actions.1 Second, for each of these state-action pairs, it assumes a prior estimate of its value, Q θ (s, a), and uses this as an initial estimate for Q k , similar to Gelly & Silver (2007; 2011) :

EQUATION

)

where Q 0 (s, a) := Q θ (s, a). Third, rather than using a separate state-value function or Monte-Carlo rollouts to estimate the value of new states, SAVE uses the same state-action value function, i.e. V (s) := max a Q θ (s, a). These three changes provide a mechanism for incorporating Q-based prior knowledge into MCTS: specifically, SAVE acts as if it has visited every state-action pair once, with the estimated values being given by Q θ . Roughly speaking, this can be interpreted as using MCTS to perform Bayesian inference over Q-values, with the prior specified by Q θ with a weight equivalent to a pseudocount of one. This set of changes contrasts with UCT, which does not incorporate prior knowledge, as well as PUCT (Rosin, 2011; Silver et al., 2017a; 2018) , which incorporates prior knowledge via a policy in the exploration term U k (s, a).

After K iterations, we return Q MCTS (s, a) := Q K (s, a) and select an action to execute in the environment via epsilon-greedy over Q MCTS (s 0 , a). After the action is executed, we store the resulting experience along with a copy of Q MCTS (s 0 , •) ≡ {Q MCTS (s 0 , a i )} i in the replay buffer. This process is illustrated in Figure 1 (left).

3.3. Q-LEARNING WITH AN AMORTIZATION LOSS:

During learning, the results of the search are amortized into an updated prior Q θ (Figure 1 , right).

We impose an amortization loss L A which encourages the distribution of Q-values output by the neural network to be similar to those estimated by MCTS. The amortization loss is defined to be the cross-entropy between the softmax of the Q-values before (Q θ ) and after (Q MCTS ) MCTS. This cross-entropy loss achieves better performance than alternatives like L2, as described in Section 4.2.

Setting

p MCTS = softmax τ (Q MCTS (s, •)) and p θ = softmax τ (Q θ (s, •))

, where τ = 1 is the softmax temperature, the loss is defined as:

EQUATION

where D is a batch of N experience tuples (s t , a t , r t , s t+1 , Q MCTS (s t , •)) sampled from the replay buffer. This amortization loss is linearly combined with a Q-learning loss,

EQUATION

where β Q and β A are coefficients to scale the loss terms. L Q may be any value-based loss function, such as that based on 1-step TD targets, n-step TD targets, or λ-returns (Sutton, 1988) . The amortization loss does make SAVE more sensitive to off-policy experience, as the values of Q MCTS stored in the replay buffer will become less useful and potentially misleading as Q θ improves; however, we did not find this to be an issue in practice.

4. EXPERIMENTS:

We evaluated SAVE in four distinct settings that vary in their branching factor, sparsity of rewards, and episode length. First, we demonstrate through a new Tightrope environment that SAVE performs well in settings where count-based policy approaches struggle, as discussed in Section 2.2. Next, we show that SAVE scales to the challenging Construction domain (Bapst et al., 2019) and that it alleviates the problem with off-policy actions discussed in Section 2.1. We also perform several ablations to tease apart the details of SAVE. Finally, we demonstrate that SAVE dramatically improves over Q-learning in a new and even more difficult construction task called Marble Run, as well as in more standard environments like Atari (Bellemare et al., 2013) . In all our experiments we use SAVE with a perfect model of the environment, though we expect our approach would work with learned models as well.

4.1. TIGHTROPE:

In Section 2.2, we hypothesized that approaches which use count-based policy learning rather than value-based learning (e.g. Anthony et al., 2017; Silver et al., 2018) may suffer in environments with large branching factors, many suboptimal actions, and small search budgets. To test this hypothesis, we developed a toy environment called Tightrope with these characteristics. Tightrope is a deterministic MDP consisting of 11 labeled states linked together in a chain. At each state, there are 100 actions to take, M % of which are terminal (meaning that when taken they cause the episode to end).

The other non-terminal actions will cause the state to transition to the next state in the chain. We considered two settings of the reward function: dense rewards, in which case the agent receives a reward of 0.1 when making it to the next state in the chain and 0 otherwise; and sparse rewards, in which case the agent receives a reward of 1 only when making it to the final state. In the sparse reward setting, we randomly selected one state in the chain to be the "final" state to form a curriculum over the length of the chain. With the exception of the final state in the sparse reward setting, the transition function of the MDP is exactly the same across episodes, with the same actions always having the same behavior. 

Function Approximation Results:

We also looked at the ability of SAVE and PUCT to solve the Tightrope environment when using function approximation, along with a model-free Q-learning baseline (see Section B.3). We evaluated all agents on the sparse reward version of Tightrope with 95% terminal actions, and used a search budget of 10 (except for Q-learning, which used a test budget of zero). The results, shown in Figure 2d , follow the same pattern as in the tabular setting.

4.2. CONSTRUCTION:

We next evaluated SAVE in three of the Construction tasks explored by Bapst et al. (2019) , in which the goal is to stack blocks to achieve a functional objective while avoiding collisions with obstacles.

In Connecting, the goal is to connect a target point in the sky to the floor. In Covering, the goal is to cover obstacles from above without touching them. Covering Hard is the same as Covering, except that only a limited number of blocks may be used. The Construction tasks are challenging for modelfree approaches because there is a combinatorial space of possible scenes and the physical dynamics are challenging to predict. However, they are also difficult for traditional search methods, as they have huge branching factors with up to tens of thousands of possible actions per state. Additionally, the simulator in the Construction tasks is expensive to query, making it infeasible to use with search budgets of more than 10-20.

To implement SAVE, we used the same agent architecture as Bapst et al. (2019) . We compared SAVE to a baseline version of SAVE without amortization loss (i.e., L(θ, D) = β Q L Q (θ, D)), similar to the MCTS agent described in Bapst et al. (2019) . We also compared to a Q-learning baseline which performs pure model-free learning during training (but which may also utilize MCTS at test time using the same search procedure as SAVE), as well as a UCT baseline which did not use any learning (but which did use a pretrained value function for bootstrapping). For SAVE-based agents, we used a training budget of 10 simulations and varied the budget at test time; for UCT, we used a constant budget of 1000 simulations at test time (see Appendix C). Results Figure 3a -c shows the results on the three construction tasks. The poor performance of UCT (dotted lines) highlights the need for prior knowledge to manage the huge branching factor in these domains. While model-free Q-learning improves performance, simply performing search on top of the learned Q-values only results in small gains in performance, if any. The performance of SAVE without amortization loss highlights exactly the issue discussed in Section 2.1. Without the amortization loss, the Q-learning component of SAVE only learns about actions which have been selected via search, and thus rarely sees highly suboptimal actions, resulting in a poorly approximated Q-function. Indeed, as we can see in the case where the search budget is zero, the agent's performance falls off dramatically, suggesting that the underlying Q-values are poor. Using search at test time can make up for this problem to some degree, but only when used with a budget very close to that with which it was trained: large search budgets can actually result in worse search performance (e.g. in Covering and Covering Hard) because the poor Q-values are also being used for bootstrapping during the search. It is only by leveraging search during training time and incorporating an amortization loss do we see a synergistic result: using SAVE results in higher rewards across all tasks, strongly outperforming the other agents.

Ablation Experiments In the past two sections, we compared SAVE to alternatives which do not include an amortization loss, or which use count-based policy learning rather than value-based learning. However, a number of additional questions remain regarding the architectural choices in SAVE. To address these, we ran a number of ablation experiments on the Covering task, with the results shown in Figure 3d . Specifically, we compared SAVE with versions that use an L2 loss (rather than cross entropy), that do not use the Q-learning loss, and that use the Q-values to guide search via PUCT rather than initializing Q 0 . Overall, we find that the choices made in SAVE result in the highest levels of performance. Of particular note is the ablation that uses the L2 loss, indicating that the softmax cross entropy loss plays an important role in SAVE's performance. We speculate this is true for two reasons. First, because we use small search budgets, the estimated Q MCTS is likely to be noisy, and thus it may be more robust to preserve just the relative magnitudes of action values rather than exact quantities. Second, the cross entropy loss means that Q θ need not represent the values of poor actions exactly, thus freeing up capacity in the neural network to more precisely represent the values of good actions. Details and further discussion is provided in Section C.3. We also compared to a policy-based PUCT agent like that described in Section 4.1, but found this did not achieve positive reward on the harder tasks like Covering. This result again highlights the same problem with count-based policy training and small search budgets, as discussed in Section 2.2. 

4.3. MARBLE RUN:

SAVE is able to achieve near-ceiling levels of performance on the original Construction tasks. Thus, we developed a new task in the style of the previous Construction tasks called Marble Run which is even more challenging in that it involves sparser rewards and a more complex reward function. Specifically, the goal in Marble Run is to stack blocks to enable a marble to get from its original starting position to a goal location, while avoiding obstacles. At each step, the agent may choose from a number of differently shaped rectangular blocks as well as ramp shapes, and may choose to make these blocks "sticky" (for a price) so that they stick to other objects in the scene. The episode ends once the agent has created a structure that would get the marble to the goal. The agent receives a reward of one if it solves the scene, and zero otherwise.

We used the same agent architecture and training setup as with the Construction tasks, except for the curriculum. Specifically, we found it was important to train agents on this task using an adaptive curriculum over difficulty levels rather than a fixed linear curriculum. Under the adaptive curriculum, we only allowed an agent to progress to the next level of difficulty after it was able to solve at least 50% of the scenes at the current level of difficulty. Further details of the Marble Run task and the curriculum are given in Appendix D.

Results Figure 4 shows the results for SAVE and Q-learning for the two different costs of sticky blocks, as as well as some example constructions. SAVE progresses more quickly through the curriculum and reaches higher levels of difficulty (see Figure D .1) and overall achieves much higher levels of reward at every difficulty level. Additionally, we found that the Q-learning agent reliably becomes unstable and collapses at around difficulty 4-5 (see Figure D .2), while SAVE does not have this problem. Qualitatively (Figure 4c-d ), SAVE is able to build structures which allow the marble to reach targets that are raised above the floor while also spanning multiple obstacles.

These results on Marble Run also allow us to address the trade-off between model-free experience versus planned experience. Specifically, with a search budget of 10, SAVE effectively sees 10 times as many transitions as a model-free agent trained on the same number of environment interactions. Would a model-free agent trained for 10 times as long achieve equivalent performance? As can be seen in Figure D .2, this is not the case: the model-free agent sees more episodes but results in worse performance. We find the same result in other Construction tasks as well (see Section C.4). This highlights the positive interaction that occurs when learning both from experience generated from planned actions and from the values estimated during search.

4.4. ATARI:

To demonstrate that SAVE is applicable to more standard environments, we also evaluated it on a subset of Atari games (Bellemare et al., 2013) . We implemented SAVE on top of R2D2, a distributed Q-learning agent that achieves state-of-the-art results on Atari (Kapturowski et al., 2018) . To allow for a fair comparison2 between purely model-free R2D2 and a version with SAVE, we controlled R2D2 to have the same replay ratio as SAVE and then tuned its hyperparameters to have approximately the same level of performance as the baseline version of R2D2 (see Appendix E). We find that SAVE outperforms or equals this controlled version of R2D2 in all games, with particularly high performance on Frostbite, Alien, and Zaxxon (shown in Figure 5 ). SAVE also outperforms the baseline version of R2D2 (see We introduced SAVE, a method for combining model-free Q-learning with MCTS. During training, SAVE leverages MCTS to infer a set of Q-values, and then uses a combination of real experience plus the estimated Q-values to fit a Qfunction, thus amortizing the value computation of previous searches via a neural network. The Q-function is used as a prior to guide future searches, enabling even stronger search performance, which in turn is further amortized via the Qfunction. At test time, SAVE can be used to achieve high levels of reward with only very small search budgets, which we demonstrate across four distinct domains: Tightrope, Construction (Bapst et al., 2019), Marble Run, and Atari (Bellemare et al., 2013; Kapturowski et al., 2018) . These results suggest that SAVEing the experience generated by search in an explicit Q-function, and initializing future searches with that information, offers important advantages for model-based RL.

When combining Q-values estimated both from prior searches and real experience, it may also be useful to account for the quality or confidence of the estimated Q-values. Count-based policy methods (Anthony et al., 2017; Silver et al., 2018) do this by leveraging an estimate of confidence based on visit counts: actions with high visit counts should both have high value (or else they would not have been visited so much) and high confidence (because they have been explored extensively). However, as we have shown, relying solely on visit counts can result in poor performance when using small search budgets (Section 4.1). A key future direction will be to amortize both the computation of value and of reliability, achieving the best of both SAVE and count-based methods. Encoding confidence estimates into the Q-values may also be helpful for applying SAVE to settings with learned models, which may have non-trivial approximation errors. In particular, it may be helpful to attenuate the contribution of search-estimated Q-values to the Q-prior both when an action has not been sufficiently explored and when model error is high.

Our work demonstrates the value of amortizing the Q-estimates that are generated during MCTS. Indeed, we have shown that by doing so, SAVE reaches higher levels of performance than modelfree approaches while using less computation than is required by other model-based methods. More broadly, we suggest that SAVE can be interpreted as a framework for ensuring that the valuable computation performed during search is preserved, rather than being used only for the immediate action or summarized indirectly via frequency statistics of the search policy. By following this philosophy and tightly integrating planning and learning, we expect that even more powerful hybrid approaches can be achieved.

A FURTHER AGENT DETAILS:

In all experiments except Tabular Tightrope (see Section B.2) and Atari (see Appendix E), we use a distributed training setup with 1 GPU learner and 64 CPU actors. Our setup was implemented using TensorFlow (Abadi et al., 2016) and Sonnet (Reynolds et al., 2017) , and gradient descent was performed using the Adam optimizer (Kingma & Ba, 2014) with the TensorFlow default parameter settings (except learning rate).

A.1 Q-LEARNING Except for in Atari (see Appendix E), we used a 1-step implementation of Q-learning, with the standard setup with experience replay and a target network (Mnih et al., 2015) . We controlled the rate of experience processed by the learner such that the average number of times each transition was replayed (the "replay ratio") was kept constant. For all experiments, we used a batch size of 16, a learning rate of 0.0002, a replay size of 4000 transitions (with a minimum history of 100 transitions), a replay ratio of 4, and updated the target network every 100 learning steps.

We used a variant of epsilon-greedy exploration described by Bapst et al. (2019) in which epsilon is changed adaptively over the course of an episode such that it is lower earlier in the episode and higher later in the episode, with an average value of over the whole episode. We annealed the average value of from 1 to 0.01 over 1e4 episodes.

A.2 SAVE:

Algorithm A.1 Pseudocode for the SAVE algorithm.

1: procedure SAVE(θ) 2:

while true do Estimate

Q MCTS (s, •) ← MCTS(s, Q θ ) 6:

Select a using epsilon-greedy from Q MCTS (s, •)

7:

Execute a in environment and receive s , r 8:

Add (s, a, r, s , Q MCTS (s, •)) to replay buffer 9:

s ← s 10:

while learning do 11:

Sample minibatch of experience from the replay buffer 12:

Update θ to minimize Equation 613: Traverse the search tree with π k (Equation 1) 20:

14: procedure MCTS(s 0 , Q θ ) 15: Q 0 (s, a) ← Q θ (s,

Expand new state s T and add it to the search tree 21:

Evaluate max a Q θ (s T , a) and backup returns (Equation 3) 22:

Set N k+1 (s, a) ← N k (s, a) and then increment counts of visited states and actions 23:

Compute estimates for Q k+1 (s, a) (Equation 4)

24: k ← k + 1 25: Return {Q K (s 0 , a i )} i

The SAVE agent is implemented as described in Section 3 and Algorithm A.1 provides additional pseudocode explaining the algorithm. In Algorithm A.1, we provide an example of using SAVE in an episode setting where learning happens after every episode; however, SAVE can be used in any Q-learning setup including in distributed setups where separate processes are concurrently acting and learning. In particular, in our experiments we use the distributed setup described in Section A.1. Note that when performing epsilon-greedy exploration (Line 6 of Algorithm A.1), we either choose an action uniformly at random with probability , and otherwise choose the action with the highest value of Q MCTS out of the actions which were explored during search (i.e., we do not consider actions that were not explored, even if they have a higher Q MCTS ). In all experiments (except tabular Tightrope), we use a UTC exploration constant of c = 2, though we have found SAVE's performance to be relatively robust to this parameter setting.

A.3 PUCT:

The PUCT search policy is based on that described by Silver et al. (2017a) and Silver et al. (2018) . Specifically, we choose actions during search according to Equation 1, with:

EQUATION

U k (s, a) = c • π(s, a) a N k (s, a) N k (s, a) + 1

where c is an exploration constant, π(s, a) is the prior policy, and N k (s, a) is the total number of times action a had been taken from state s at iteration k of the search. Like Silver et al. (2017a; 2018) , we add Dirichlet noise to the prior policy:

π(s, a) = (1 -) • π θ (s, a) + η,

where η ∼ Dir(1/n actions ). In our experiments we set = 0.25 and c = 2. During training, after search is complete, we sample an action to execute in the environment from π MCTS (s 0 , a) = N K (s 0 , a)/ a N K (s 0 , a). At test time, we select the action which has the maximum visit count (with random tie-breaking).

To train the PUCT agent, we used separate policy π θ (s, a) and value V θ (s) heads which were trained using a combined loss (Equation 6), with:

L Q = 1 N D V θ (s) -R 2 L A = - 1 N D π MCTS (s, •) log π θ (s, •)

where R is the Monte-Carlo return observed from state s. We used fixed values of β Q = 0.5 and β A = 0.5 in all our experiments with PUCT. We used the same replay and training setup as used in the Q-learning and SAVE agents, with two exceptions. First, we additionally include episodic Monte-Carlo returns R and policies π MCTS in the replay buffer so they can be used during learning. Second, we did not use -greedy exploration (because the Dirichlet noise in the PUCT term already enables sufficient exploration).

We tried several different hyperparameter settings and variants of the PUCT agent to attempt to improve the results. For example, we tried using a 1-step TD error for learning the values, which should have lower variance and thus result in more stable learning of values. We also tried reducing the replay ratio to 1 and the replay size to 400 in order to make the experience for training more on-policy. However, we did not find that these changes improved the results. We also tried different settings of for the Dirichlet noise, but found that lower values resulted in too little exploration, while higher values resulted in too much exploration.

B DETAILS ON TIGHTROPE B.1 ENVIRONMENT:

The Tightrope environment has 11 states which are connected together in a chain. Each state has 100 actions, M % of which will cause the episode to terminate when executed and the rest of which will cause the environment to transition to the next state. Each state is represented using a vector of 50 random values drawn from a standard normal distribution, which are the same across episodes. The indices of terminal actions are selected randomly and are different for each state but are consistent across episodes. Agents always begin in the first state of the chain.

In the sparse reward setting, we randomly select one of the states in the chain to be the "final" state (excluding the first state), to enable the agent to sometimes train on easy problems and sometimes train on hard problems. If the agent reaches this final state, it receives a reward of 1 and the episode terminates. If it takes a non-terminal action, it transitions to the next state in the chain and receives a reward of 0. Otherwise, if it takes a terminal action, the episode terminates and the agent receives a reward of 0.

In the dense reward setting, the "final" state is always chosen to be the last state in the chain. If the agent reaches the final state in the chain, it receives a reward of 0.1 and the episode terminates. If it takes a non-terminal action, it transitions to the next state in the chain and receives a reward of 0.1. Otherwise, if it takes a terminal action, the episode terminates with a reward of 0.

B.2 TABULAR EXPERIMENTS:

During training, we execute each tabular agent in the environment until the episode terminates.

Then, we perform a learning step using the experience generated from the previous episode. This process repeats for some number of episodes (in our experiments, 500). After training, we execute each agent in the environment 100 times and compute the average reward achieved across these 100 episodes. For all cases in which search is used, we use a UCT exploration constant of c = 0.1.

Q-Learning Tabular Q-learning begins with a table of state-action values initialized to zero. We perform epsilon-greedy exploration with = 0.1, and add the resulting experience to a replay buffer with maximum size of 1000 transitions. We perform episodic learning, where during each episode the Q-values are fixed and after the episode is complete we update the Q-values by performing a single pass through the experience in the replay buffer in a random order. We use a learning rate of β Q = 0.01. At test time, the Q-learning agent uses MCTS in the same manner as SAVE.

SAVE Tabular SAVE begins with a table of state-action values initialized to zero. During search, values are looked up in this table and used to initialize Q 0 . The values are also for bootstrapping.

During learning, we perform both Q-learning (as described in the Q-learning agent) as well as an update based on the gradient of the cross-entropy amortization loss (Equation 6). We use β Q = 0.01 and β A = 1.

PUCT Tabular PUCT begins with two tables; one with state values (initialized to zero) and one with action probabilities (initialized to the uniform distribution). During search, action probabilities are looked and used in the PUCT term, while state values are looked up and used for bootstrapping. Search proceeds as described in Section A.3. During learning, π MCTS is copied back into the action probability table (this is equivalent to an L2 update with a learning rate of 1); we also experimented with doing an update based on the cross entropy loss but found this resulted in worse performance. The value at episode t is given by:

EQUATION

where R t-1 (s) is the return obtained after visiting state s during episode t -1. In our experiments we used α = 0.5. We also experimented with using Q-learning rather than Monte-Carlo returns, but found that these resulted in similar levels of performance.

UCT The UCT agent is as described in Section 3.1, with V (s) at unexplored nodes estimated via a Monte-Carlo rollout under a uniform random policy. The only difference from regular UCT is that we did not require all actions to be visited before descending down the search tree; unvisited actions were initialized to a value of zero. For Tightrope, this is the optimal setting of the default Q-values because all possible rewards are greater than or equal to zero. Once an action is found with non-zero reward the best option is to stick with it, so it would not make sense to set the values optimistically. Actions that cause the episode to terminate have a reward of zero, so it would also not make sense to set the values pessimistically as this would lead to over-exploring terminal actions. Setting the values to the average of the parent would either have the effect of setting to zero or setting optimistically (if the parent had positive reward).

To select the final action to execute in the environment, the UCT agent selects a visited action with the maximum estimated value. We could consider alternate approaches here, such as selecting uniformly at random from unexplored actions if none of the visited actions have high enough expected values. We experimented with this approach, using a threshold value of zero (which is the expected value for bad actions in Tightrope), and find that this indeed improves performance (p = 0.02), though the effect size is quite small: on the dense setting with M = 95% we achieve a median reward of 0.08 (using this thresholding action selection policy) versus 0.07 (selecting the max of visited actions).

B.3 FUNCTION APPROXIMATION EXPERIMENTS:

We used the same learning setup for the Q-learning, SAVE, and PUCT agents as described in Appendix A. For the network architecture of our agents, we used a shared multilayer perceptron (MLP) torso with two layers of size 64 and ReLU activations. To predict Q-values, we used an MLP head with two layers of size 64 and ReLU activations, with a final layer of size 100 (the number of actions) with a linear activation. To predict a policy in the PUCT agent, we used the same network architecture as the Q-value head. To predict state values in the PUCT agent, we used a separate MLP head with two layers of size 64 and ReLU activations, and a final layer of size 1 with a linear activation. All network weights were initialized using the default weight initialization scheme in Sonnet (Reynolds et al., 2017) . For both the SAVE and PUCT agents we used loss coefficients of β Q = 0.5 and β A = 0.5.

We trained each agent 10 times and report results after 1e6 episodes in a version of Tightrope that has 95% terminal actions Figure 2 , right). During training, the SAVE and PUCT agents had access to a search budget of 10 simulations; the Q-learning agent did not use search. We also explored training agents with different numbers of terminal actions and different budgets. Qualitatively, we found the same results as in the tabular setting: the PUCT agent can perform well for larger budgets (50+), but struggles with small budgets, underperforming the model-free Q-learning agent. In contrast, SAVE performed well in all our experiments, even for small budgets like 5 or 10.

C DETAILS ON CONSTRUCTION:

C.1 AGENT DETAILS SAVE For SAVE, we annealed β Q from 1 to 0.1 and β PI from 0 to 4.5 over the course of 5e4 episodes. We found this allowed the agent to rely more on Q-learning early on in training to build a good Q-value prior, and then more on MCTS later in training once a good prior had already been established. Q-Learning The Q-Learning agent is as described in Section A.1. In particular, we follow the same setup as the GN-DQN agent described in Bapst et al. (2019) . During training, we use pure Q-learning with no search. At test time, we may allow the Q-learning agent to additionally perform MCTS, using the same search procedure as that used by SAVE (i.e., initializing the Q-values using the trained Q-function and initializing the visit counts to one).

SAVE without Amortization Loss:

The SAVE without an amortization loss is the same as the basic SAVE agent, except that it includes no amortization loss (i.e., L(θ, D) = β Q L Q (θ, D)). This is equivalent to the GN-DQN-MCTS agent described by Bapst et al. (2019) .

UCT UCT is as described in Section 3.1, with V (s) at unexplored nodes estimated via using a pretrained action-value function (trained using the same setup as the Q-learning agent). Additionally, unlike standard UCT we did not require all actions to be visited before descending down the search tree.

SAVE with L2 SAVE with an L2 loss is identical to SAVE except that it uses a different amortizaton loss:

L A (θ, D) = 1 N D Q MCTS (s, •) -Q θ (s, •) 2

Similar to the SAVE agent, we anneal β Q from 1 to 0.1 and β A from 0 to 0.045 over the course of 5e4 episodes.

SAVE without Q-Learning SAVE without the Q-learning loss is identical to SAVE except that we do not use Q-learning and we use the L2 amortization loss described in the previous paragraph:

L(θ, D) = β A L A (θ, D)

where we set β A = 0.025. The reason we use the L2 loss rather than the cross-entropy loss is that otherwise the Q-values will not actually be real Q-values, in that they will not have grounding in the actual scale of rewards. We did experiment with using only the cross-entropy loss with no Q-learning, and found slightly worse performance than when using the L2 loss and no Q-learning.

SAVE with PUCT SAVE with PUCT uses the same learning procedure as SAVE but a different search policy. Specifically, we use the PUCT search policy described in Section A.3 and Equation 7.

To do this, we set π(s, a) = σ(Q θ (s, a)), where σ is the softmax over actions with a temperature of 1. We use the same settings for Dirchlet noise to encourage exploration during search. After search is complete, we select an action using the same epsilon-greedy action procedure used by the SAVE agent rather than selecting based on visit counts. We experimented with selecting based on visit counts instead, but found this resulted in the same level of performance.

C.2 EXPERIMENTAL SETUP:

Observations are given as graphs representing the scene, with objects in the scene corresponding to nodes in the graph and edges between every pair of objects. All agents use the same network architecture (Battaglia et al., 2018) described in Bapst et al. (2019) to process these graphs. Briefly, we use a graph network architecture which takes a graph as input and returns a graph with Q-values on the edges of the graph. Each edge corresponds to a relative object-based action like "pick up block B and put it on block D". Each edge additionally has multiple actions associated with it which correspond to particular offset locations where the block should be placed, such as "on the top left". Here we expand on the results presented in the main text and in Figure 3d 2, green) , this is at the cost of higher variance across seeds and lower performance on average. This is likely because the L2 loss encourages the Q-function to exactly match the Q-values estimated by search. However, with a search budget of 10, those Qvalues will be very noisy. In contrast, the cross-entropy loss only encourages the Q-function to match the overall distribution shape of the Q-values estimated by search. This is a less strong constraint that allows the information acquired during search to be exploited while not relying on it too strongly. Indeed, we can observe that the agent with L2 amortization loss actually performs worse than the agent that has no amortization loss at all (Figure C.2, purple) when using a search budget of 10, suggesting that trying to match the Q-values during search too closely can harm performance.

Additionally, we can consider an interesting interaction between Q-learning and the amortization loss. Due to the search locally avoiding poor actions, Q-learning will rarely actually operate on low-valued actions, meaning most of its computation is spent refining the estimates for high-valued actions. The softmax cross entropy loss ensures that low-valued actions have lower values than high-valued actions, but does not force these values to be exact. Thus, in this regime we should have good estimates of value for high-valued actions and worse estimates of value for low-valued actions. In contrast, an L2 loss would require the values to be exact for both low and high valued actions. By using cross entropy instead, we can allow the neural network to spend more of its capacity representing the high-valued actions and less capacity representing the low-valued actions, which we care less about in the first place anyway.

With vs. without Q-learning Without Q-learning (Figure C.2, teal) , the SAVE agent's performance suffers dramatically. As discussed in the previous section, the Q-values estimated during search are very noisy, meaning it is not necessarily a good idea to try to match them exactly. Additionally, Q MCTS is on-policy experience and can become stale if Q θ changes too much between when Q MCTS was computed and when it is used for learning. Thus, removing the Q-learning loss makes the learning algorithm much more on-policy and therefore susceptible to the issues that come with on-policy training. Indeed, without the Q-learning loss, we can only rely on the Q-values estimated during search, resulting in much worse performance than when Q-learning is used.

UCT vs. PUCT Finally, we compared to a variant which utilizes prior knowledge by transforming the Q-values into a policy via a softmax and then using this policy as a prior with PUCT, rather than using it to initialize the Q-values (Figure C.2, brown) . With large amounts of search, the initial setting of the Q-values should not matter much, but in the case of small search budgets (as seen here), the estimated Q-values do not change much from their initial values. Thus, if the initial values are zero, then the final values will also be close to zero, which later results in the Q-function being regressed towards a nearly uniform distribution of value. By initializing the Q-values with the Qfunction, the values that are regressed towards may be similar to the original Q-function but will not be uniform. Thus, we can more effectively reuse knowledge across multiple searches by initializing the Q-values with UCT rather than incorporating prior knowledge via PUCT.

C.4 ADDITIONAL RESULTS:

We performed several other experiments to tease apart the questions regarding exploration strategy and data efficiency.

Exploration strategy When selecting the final action to perform in the environment, SAVE uses an epsilon-greedy exploration strategy. However, many other exploration strategies might be considered, such as UCB, categorical sampling from the softmax of estimated Q-values, or categorical sampling from the normalized visit counts. We evaluated how well each of these exploration strategies work, with the results shown in Figure C.3. We find that using epsilon-greedy works the best out of these exploration strategies by a substantial margin. We speculate that this may be because it is important for the Q-function to be well approximated across all actions, so that it is useful during MCTS backups. However, UCB and categorical methods will not uniformly sample the ac-tion space, meaning that some actions are very unlikely to be ever learned from. The amortization loss will not help either, as these actions will not be explored during search either. The error in the Q-values for unexplored actions will grow over time (due to catastrophic forgetting), leading to a poorly approximated Q-function that is unreliable. In contrast, epsilon-greedy consistently spends a little bit of time exploring these actions, preventing their values from becoming too inaccurate.

We expect this would be less of a problem if we were to use a separate state-value function for bootstrapping (as is done by AlphaZero).

Data efficiency With a search budget of 10, SAVE effectively sees 10 times as many transitions as a model-free agent trained on the same number of environment interactions. To more carefully compare the data efficiency of SAVE, we compared its performance to that of the Q-learning agent on the Covering task, controlling for the same number of environment interactions (including those seen during search). The results are shown in • Floor (in black) that supports the blocks placed by the agent.

• Available blocks (row of blue blocks at the bottom) that the agent picks and place in the scene (with replacement). • Blocks (blue blocks above the floor) that the agent has already placed. They may take a lighter blue color to indicate that they are sticky. A sticky block gets glued to anything it touches. • Goal (blue dot) that the agent has to reach with the marble.

• Marble (green circle) that the agent has to route to the goal.

• Obstacles (red blocks, including two vertical walls), that the agent has to avoid, by not touching them neither with the blocks or the marble.

All the initial positions for obstacles in the scene are sampled from a tessellation (similar to the Silhouette task in Bapst et al. (2019) ) made of rows with random sequences of blocks with sizes of 1 discretization unit in height and 1 or 2 discretization units in width (a discretization unit corresponds to the side of the first available block). The sampling process goes as follows:

1. Set the vertical position of the goal to the specified discrete height (according to level) corresponding to the center of one of the tessellation rows, and the vertical position of the marble 2 rows above that. 2. Uniformly sample a horizontal distance between the marble and the goal from a predefined range, and uniformly sample the absolute horizontal positions respecting that absolute distance. 3. Sample a number of obstacles (according to level) from the tessellation spanning up to the vertical position of the marble.

Obstacles are sampled from the tessellation sequentially. Before each obstacle is sampled, all objects in the tessellation that are too close (± 2 layers vertically and with less than 2 discretization units of clearance sideways) to the goal, the target, or previously placed obstacles, are removed from the tessellation in order to prevent unsolvable scenes. Then probabilities are assigned to all of the remaining objects in the tessellation according to one of the following criteria (the criteria itself is also picked randomly with different weights) designed to avoid generating trivial scenes:

• (Weight=4) Pick uniformly a tessellation object lying exactly on the floor and between the marble and the goal horizontally, since those objects prevent the marble from rolling freely on the floor (only applicable if the tessellation still has objects of this kind available). never actually gets to observe the marble's dynamics, and therefore does not get direct feedback about why the marble does or does not make it to the goal (such that it is getting stuck in a hole). An interesting direction for future work would be to incorporate this information into the agent's learning as well.

D.6 TERMINATION CONDITION:

There are several episode termination conditions that may be triggered before the task is solved:

• An agent places a block in a position that overlaps with an existing block or obstacle.

• An agent has placed a block that during the settlement phase touches an obstacle.

• An agent has placed a block that, at the end of the block settlement phase overlaps with the initial marble position.

• Maximum number of steps is reached.

Note that touching obstacles during the marble dynamics phase does not terminate the episode because we are purely evaluating the reward function and, during the restore state phase, all objects are returned to there previous locations. This makes it possible for the agent to correct for any obstacle collisions that happened during the marble dynamics phase, by placing additional blocks that re-route the marble.

D.7 ADDITIONAL RESULTS:

We used the same experimental setup as in the other Construction tasks (Appendix C). In particular, during training, for each seed of each agent we checkpoint the weights which achieve the highest reward on the highest curriculum level, and then use these checkpoints to evaluate performance in Figure 4 . Figure D.2 additionally shows details of the training performance at each level of difficulty in the curriculum. We can see that at around difficulty level 4-5, the Q-learning agent becomes unstable and crashes, while the SAVE agent stays stable and continues to improve. Indeed, as shown in Figure D.3, the Q-learning agent never makes it to difficulty level 6 (when sticky blocks are free) or even difficulty level 5 (when sticky blocks have a moderate cost). The SAVE agent is able to reach harder levels of difficulty, and does so with fewer learning steps. (Kapturowski et al., 2018) . "Controlled" is our version that is controlled to have the same replay ratio as SAVE. The rightmost column reports the percent change in reward of SAVE over the controlled version of R2D2. Bold scores indicate scores that are within 5% of the best score on a particular game. The last two rows show median and mean scores, respectively. The percentages in the last two rows show the median and mean across percent change, rather than the percent change of the median/mean scores.

E DETAILS ON ATARI E.1 EXPERIMENTAL SETUP:

We evaluated SAVE on a set of 14 Atari games in the Arcade Learning Environment (Bellemare et al., 2013) . The games were chosen as a combination of classical action Atari games such as Asteroids and Space Invaders, and games with a stronger strategic component such as Ms. Pacman and Frostbite, which are commonly used as evaluation environments for model-based agents (Buesing et al., 2018; Farquhar et al., 2018; Oh et al., 2017; Guez et al., 2019) .

SAVE was implemented on top of the R2D2 agent (Kapturowski et al., 2018) as described in Algorithm A.1. Concretely, this means we evaluate the function Q MCTS instead of Q θ to select an action in the actors, and optimize the combined loss function (Equation 6) instead of the TD loss in the learner. For hyperparameters, we used a search budget of 10, and β Q = 1, β A = 10. We did very little tuning to select these hyperparameters, only sweeping over two values of β A ∈ {1, 10}. We found while both of these settings resulted in similar performance, β A = 10 worked slightly better.

It is likely that with further tuning of these parameters, even larger increases in reward be achieved,

:

We could also consider initializing N (s, a) based on an estimate of previous visit counts, which we leave as an interesting direction for future work.

R2D2 is very sensitive to the speed of the learners and actors. If the actors are slower (which they will be when performing search), the replay ratio will increase which thus affects performance.

Ignoring underrepresented bins for which episodes are generated at less than 0.25 the expected generation rate according to a uniform prior across bins (which we only start estimating after the first 300 episodes, to discover a sufficient number of distinct bins). This is to avoid delayed curriculum progress just due to lack of recent statistics for those bins.

Figures and Tables:

D K 7 w 5 j 8 6 L 8 + 5 8 L F s 3 n H z m D P 7 A + f w B s o G M 1 Q = = < / l a t e x i t > Q MCTS < l a t e x i t s h a 1 _ b a s e 6 4 = " U s z o 5 c w f N a 3 0 + y W / X x M g o C u 8 e X A = " > A A A B + H i c b V D L S g M x F M 3 U V 6 2 P j r p 0 E y y C q z J T B b s s d O N G a L E v a I c h k 2 b a 0 C Q z J B m h D v 0 S N y 4 U c e u n u P N v z L S z 0 N Y D g c M 5 9 3 J P T h A z q r T j f F u F r e 2 d 3 b 3 i f u n g 8 O i 4 b J + c 9 l S U S E y 6 O

A C A X i c b V C 7 S g N B F J 3 1 G e N r 1 U a w G Q y C V d i N g p Y B G 8 s I 5 g H J E m Y n d 5 M h s w 9 m 7 k r C E h t / x c Z C E V v / w s 6 / c Z J s o Y k H B g 7 n 3 M u d c / x E C o 2 O 8 2 2 t r K 6 t b 2 w W t o r b O 7 t 7 + / b B Y U P H q e J Q 5 7 G M V c t n G q S I o I 4 C J b Q S B S z 0 J T T 9 4 c 3 U b z 6 A 0 i K O 7 n G c g B e y f i Q C w R k a q W s f d x B G m G l g i g 8 o j B J Q A i I O k 6 5 d c s r O D H S Z u D k p k R y 1 r v 3 V 6 c U 8 D S F C L p n W b d d J 0 M u Y Q s E l T I q d V E P C + J D 1 o W 1 o x E L Q X j Z L M K F n R u n R I F b m R U h n 6 u + N j I V a j 0 P f T I Y M B 3 r R m 4 r / e e 0 U g 2 s v E 1 G S o o k 1 P x S k k m J M p 3 X Q n l D A U Y 4 N

Figure 1: Illustration of SAVE. When acting, the agent uses a Q-function, Q θ , as a prior for the Q-values estimated during MCTS. Over K steps of search,Q 0 ≡ Q θ is built up to Q K , which is returned as Q MCTS (Equa-tions 1 and 4). From Q MCTS , an action a is selected via epsilon-greedy and the resulting experience (s, a, r, s , Q MCTS ) is added to a replay buffer. When learning, the agent uses real experience to update Q θ via Q-learning (L Q ) as well as an amortization loss (L A ) which regresses Q θ towards the Q-values estimated during search (Equation6).

Figure 2: Results on Tightrope. (a-c) Tabular results comparing SAVE, PUCT, UCT, and Q-learning (with MCTS at test time) for varying percentages of terminal actions on the x-axes and for different search budgets. The y-axes show reward for either the sparse or dense reward setting of Tightrope. Lines show medians across 20 seeds, with error bars showing 95% confidence intervals. (d) Results on Tightrope when using function approximation, comparing SAVE with PUCT and Q-learning. Lines show medians across 10 seeds, with shaded regions indicating min and max seeds.

Figure 3: Results on Construction. (a-c) Each subplot shows results for SAVE, SAVE without amortization loss, Q-learning with MCTS at test time, and pure search (UCT). The x-axis shows the effect of increasing the number of MCTS simulations at test time. During training, SAVE with and without amortization loss used a search budget of 10 simulations. UCT used a search budget of 1000 simulations. Points show medians across 10 seeds, and error bars indicate min and max seeds. (d) Ablation experiments on the Covering task. We compare SAVE to variants that do not have an amortization loss, which use an L2 amortization loss, which do not use the Q-Learning loss, and which use PUCT rather than UCT. Results are shown at the hardest level of difficulty for the Covering task with a test budget of 10. The colored bars show median reward across 10 seeds, and error bars show min and max seed.

Figure 4: (a-b) Results on the Marble Run environment for model-free Q-Learning as well as SAVE as a function of curriculum difficulty level, for two different settings of the cost of "sticky" blocks. Points indicate medians across 10 seeds, and error bars show min and max seeds. (c-d) Structures built by SAVE which solve the same scene for two different costs of sticky blocks (difficulty 6). Additional videos showing agent behavior are available at https://tinyurl.com/yxm4ma47.

Figure 5: Results on Atari.

Figure C.1: Learning curves on the Covering task. Each plot shows median performance across 10 seeds, with shaded regions showing the min and max seed.

Figure C.2: Detailed final results on the Covering task. Each plot shows median performance across 10 seeds, with error bars showing the min and max seed.

and Figure C.2. Cross-entropy vs. L2 loss While the L2 loss (Figure C.2, orange) can result in equivalent performance as the cross-entropy loss (Figure C.

Figure C.3: Performance of different exploration strategies on the Covering task.

Figure C.4, illustrating that SAVE converges to higher rewards given the same amount of data. We find similar results in the Marble Run environment, shown in Figure D.2. D DETAILS ON MARBLE RUN D.1 SCENE GENERATION Scenes contain the following types of objects (similar to Bapst et al. (2019)):

Figure D.2: Learning curves for the Marble Run environment. Each line shows the median reward across 10 seeds, and the shaded regions show min and max seed performance. Each color corresponds to a different level of curriculum difficulty. Difficulties less than the final difficulty are only evaluated while the agent is training at that curriculum level; the final level of difficulty is always evaluated.

Figure D.3: Curriculum progress in Marble Run. Light lines show individual curriculum progress per seed, and dark lines are computed over the median of these seeds. The x-axis shows the particular curriculum level and the y-axis indicates at which episode that level of difficulty was reached.

Tabular ResultsWe first examined the behavior of SAVE on Tightrope in a tabular setting to eliminate potential concerns about function approximation (see Section B.2). We compared SAVE to three other agents. UCT is a pure-search agent which runs MCTS using a UCT search policy with no prior. It uses Monte-Carlo rollouts following a random policy to estimate V (s). PUCT is based on AlphaZero(Silver et al., 2018) and uses a policy prior (which is learned from visit counts during MCTS) and state-value function (which is learned from Monte-Carlo returns). During search, the policy is used in the PUCT exploration term and the value function is used for bootstrapping. More details on PUCT in general are provided in Section A.3. Q-Learning performs one-step tabular Q-learning during training, and MCTS at test time using the same search procedure as SAVE.Figure2a-cillustrates the results in the tabular setting after 500 episodes. UCT, which does not use any learning, illustrates the difficulty of using brute-force search. Q-learning, which does not use any search during training, is slow to converge to a solution within the 500 episodes, particularly in the sparse reward setting; additionally, adding search at test time does not substantially improve things. Although the incorporation of learning with PUCT does improve the results, we can see that with small search budgets and high proportions of terminal actions, PUCT struggles to remember which actions are safe (nonterminal), especially in the sparse reward setting. In contrast, SAVE solves the Tightrope environment in all of the dense reward settings and most of the sparse reward settings. As the search budget increases, we see that both PUCT and SAVE reliably converge to a solution; thus, if a large search budget is available both methods may fare equally well. However, if only a small search budget is available, SAVE results in much more reliable performance.

Table content: <table/>

Table E.1 and Figure E.1).

Table content: <table><tr><td>5 DISCUSSION</td><td>1600%</td><td/><td/><td colspan="10">% change relative to R2D2</td><td/></tr><tr><td/><td>1000%</td><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td/><td>0</td><td/><td>2</td><td/><td>4</td><td/><td>6</td><td/><td>8</td><td/><td colspan="3">10 12</td></tr><tr><td/><td>200%</td><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td>100%</td><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td>0%</td><td>Frostbite</td><td>Alien</td><td>Zaxxon</td><td>Beam Rider</td><td>Ms. Pacman</td><td>Space Invaders</td><td>Name This Game</td><td>Centipede</td><td>River Raid</td><td>Crazy Climber</td><td>Asteroids</td><td>Up 'n' Down</td><td>Gravitar</td><td>Hero</td></tr></table>

Bapst et al. (2019) describe four Construction tasks: Silhouette, Connecting, Covering, and Covering Hard. We reported results on three of these tasks in the main text(Connecting, Covering, and  Covering Hard). The agents inBapst et al. (2019) already reached ceiling performance on Silhouette and thus we do not report results for that task here, except to report that SAVE also reaches ceiling performance.The agents used 10 MCTS simulations during training and were evaluated on 0 to 50 simulations at test time, with the exception of the UCT agent, which always used 1000 simulations at test time, and the Q-learning agent, which did not peform search during learning. We trained 10 seeds per agent and report results after 1e6 episodes. Figure C.1 show details of learning progress for each of the agents compared in the ablation experiments on the Covering task (Section 4.2), and Figure C.2shows detailed final performances evaluated at different test budgets. We evaluated all agents on the hardest level of difficulty of the particular task they were trained on for either 10000 episodes (Figure3a-c) or 1000 episodes (Figure3d and Figure C.2). In general, while we find that search at test time can provide small boosts in performance, the main gains are achieved by incorporating search during training.

Table content: <table/>

1: Results on Atari. Scores are final performance averaged over 3 seeds. "Baseline" is the standard version of R2D2

Table content: <table><tr><td>Level</td><td colspan="2">Baseline Controlled</td><td>SAVE</td><td>% Change</td></tr><tr><td>Alien</td><td>71925.1</td><td>96013.5</td><td>280227.3</td><td>191.9%</td></tr><tr><td>Asteroids</td><td colspan="3">251033.3 266306.7 274431.7</td><td>3.1%</td></tr><tr><td>Beam Rider</td><td>96654.4</td><td colspan="2">113930.6 195703.8</td><td>71.8%</td></tr><tr><td>Centipede</td><td colspan="3">517332.2 562742.3 767206.6</td><td>36.3%</td></tr><tr><td>Crazy Climber</td><td colspan="3">311203.8 271151.5 324726.4</td><td>19.8%</td></tr><tr><td>Frostbite</td><td>15814.2</td><td>11052.3</td><td colspan="2">202744.2 1734.4%</td></tr><tr><td>Gravitar</td><td>7854.0</td><td>11314.3</td><td>11484.1</td><td>1.5%</td></tr><tr><td>Hero</td><td>30515.9</td><td>44574.3</td><td>44796.0</td><td>0.5%</td></tr><tr><td>Ms. Pacman</td><td>25377.4</td><td>27776.3</td><td>47186.0</td><td>69.9%</td></tr><tr><td colspan="2">Name This Game 45027.1</td><td>40790.0</td><td>58621.1</td><td>43.7%</td></tr><tr><td>River Raid</td><td>33819.5</td><td>32720.8</td><td>41031.6</td><td>25.4%</td></tr><tr><td>Space Invaders</td><td>3639.2</td><td>42387.4</td><td>63684.7</td><td>50.2%</td></tr><tr><td>Up 'n' Down</td><td colspan="3">563661.0 568735.6 585475.6</td><td>2.9%</td></tr><tr><td>Zaxxon</td><td>116892.6</td><td>73073.1</td><td>213370.4</td><td>192.0%</td></tr><tr><td>Median</td><td>58476.1</td><td>58823.7</td><td>199224.0</td><td>40.0%</td></tr><tr><td>Mean</td><td colspan="3">149339.3 154469.2 222192.1</td><td>174.5%</td></tr></table>

Peer review (iclr2020):
This paper proposes SAVE that combines Q learning with MCTS. In particular, the estimated Q values are used as a prior in the selection and backup phase of MCTS, while the Q values estimated during MCTS are later used, together with the real experience, to train the Q function. The authors made several modifications to ‘standard’ setting in both Q learning and MCTS. Experimental results are provided to show that SAVE outperforms generic UCT, PUCT, and Q learning. Overall the paper is easy to follow. The idea of the paper is interesting in the sense that it tries to leverage the computation spent during search as much as possible to help the learning. I am not an expert in the of hybrid approach, so I can not make confident judgement on the novelty of the paper. The only concern I have is that the significance of the result in the paper: 1. The proposed method, including the modifications to MCTS and Q learning (section 3.2 and 3.3), is still a bit ad-hoc. The paper has not really justified why the proposed modification is a better choice except a final experimental result. Some hypotheses are made to explain the experimental results. But the authors have not verified those hypotheses. Just to list a few here: (a). The argument made in section 2.2 about count based prior; (b). the statement of noisy Q_MCTS to support the worse performance of L2 loss in section 4.2; (c). In the last paragraph of section 4.3, why would a model free agent with more episodes results in worse performance? 2. The baselines used in this paper are only PUCT and a generic Q learning. What are the performances of other methods that are mentioned in section 2.1, like Gu 2016, Azizzadenesheli 2018, Bapst 2019? Other comments: 1. What is the performance of tabular Q-learning in Figure 2 (a-c)?