Making Efficient Use of Demonstrations to Solve Hard Exploration Problems

1 INTRODUCTION . Reinforcement learning from demonstrations has proven to be an effective strategy for attacking problems that require sample efficiency and involve hard exploration . For example , Aytar et al . ( 2018 ) , Pohlen et al . ( 2018 ) and Salimans and Chen ( 2018b ) have shown that RL with demonstrations can address the hard exploration problem in Montezuma ’ s Revenge . Večerík et al . ( 2017 ) , Merel et al . ( 2017 ) and Paine et al . ( 2018 ) have demonstrated similar results in robotics . Many other works have shown that demonstrations can accelerate learning and address hard-exploration tasks ( e.g . see Hester et al. , 2018 ; Kim et al. , 2013 ; Nair et al. , 2018 ; Kang et al. , 2018 ) . In this paper , we attack the problem of learning from demonstrations in hard exploration tasks in partially observable environments with highly variable initial conditions . These three aspects together conspire to make learning challenging : 1 . Sparse rewards induce a difficult exploration problem , which is a challenge for many state of the art RL methods . An environment has sparse reward when a non-zero reward is only seen after taking a long sequence of correct actions . Our approach is able to solve tasks where standard methods run for billions of steps without seeing a single non-zero reward . 2 . Partial observability forces the use of memory , and also reduces the generality of information provided by a single demonstration , since trajectories can not be broken into isolated transitions using the Markov property . An environment has partial observability if the agent can only observe a part of the environment at each timestep . 3 . Highly variable initial conditions ( i.e . changes in the starting configuration of the environment in each episode ) are a big challenge for learning from demonstrations , because the demonstrations can not account for all possible configurations . When the initial conditions are fixed it is possible to be extremely efficient through tracking ( Aytar et al. , 2018 ; Peng et al. , 2018 ) ; however , with a large variety of initial conditions the agent is forced to generalize over environment configurations not present in demonstrations . Generalizing between different initial conditions is known to be difficult ( Ghosh et al. , 2017 ; Langlois et al. , 2019 ; Zolna et al. , 2019 ) . Our approach to these problems combines demonstrations with off-policy , recurrent Q-learning in a way that allows us to make very efficient use of the available data . In particular , we vastly outperform behavioral cloning using the same set of demonstrations in all of our experiments . ∗indicates joint first authorship , both authors equally contributed to this project . Another desirable property of our approach is that our agents are able to learn to outperform the demonstrators , and in some cases even to discover strategies that the demonstrators were not aware of . In one of our tasks the agent is able to discover and exploit a bug in the environment in spite of all the demonstrators completing the task in the intended way . Learning from a small number of demonstrations under highly variable initial conditions is not straight-forward . We identify a key parameter of our algorithm , the demo-ratio , which controls the proportion of expert demonstrations vs agent experience in each training batch . This hyper-parameter has a dramatic effect on the performance of the algorithm . Surprisingly , we find that the optimal demo ratio is very small ( but non-zero ) across a wide variety of tasks . The mechanism our agents use to efficiently extract information from expert demonstrations is to use them in a way that guides ( or biases ) the agent ’ s own autonomous exploration of the environment . Although this mechanism is not obvious from the algorithm construction , our behavioral analysis confirms the presence of this guided exploration effect . To demonstrate the effectiveness of our approach we introduce a suite of tasks ( which we call the Hard-Eight suite ) that exhibit our three targeted properties . The tasks are set in a procedurallygenerated 3D world , and require complex behavior ( e.g . tool use , long-horizon memory ) from the agent to succeed . The tasks are designed to be difficult challenges in our targeted setting , and several state of the art methods ( themselves ablations of our approach ) fail to solve them . The main contributions of this paper are , firstly we design a new agent that makes efficient use of demonstrations to solve sparse reward tasks in partially observed environments with highly variable initial conditions . Secondly , we provide an analysis of the mechanism our agents use to exploit information from the demonstrations . Lastly , we introduce a suite of eight tasks that support this line of research . 2 RECURRENT REPLAY DISTRIBUTED DQN FROM DEMONSTRATIONS We propose a new agent , which we refer to as Recurrent Replay Distributed DQN from Demonstrations ( R2D3 ) . R2D3 is designed to make efficient use of demonstrations to solve sparse reward tasks in partially observed environments with highly variable initial conditions . This section gives an overview of the agent , and detailed pseudocode can be found in Section 2.1 . The architecture of the R2D3 agent is shown in Figure 1 . There are several actor processes , each running independent copies of the behavior against an instance of the environment . Each actor streams its experience to a shared agent replay buffer , where experience from all actors is aggregated and globally prioritized ( Schaul et al. , 2016 ; Horgan et al. , 2018 ) using a mixture of max and mean of the TD-errors with priority exponent η = 1.0 as in Kapturowski et al . ( 2018 ) . The actors periodically request the latest network weights from the learner process in order to update their behavior . In addition to the agent replay , we maintain a second demo replay buffer , which is populated with expert demonstrations of the task to be solved . Expert trajectories are also prioritized using the scheme of Kapturowski et al . ( 2018 ) . Maintaining separate replay buffers for agent experience and expert demonstrations allows us to prioritize the sampling of agent and expert data separately . The learner process samples batches of data from both the agent and demo replay buffers simultaneously . A hyperparameter ρ , the demo ratio , controls the proportion of data coming from expert demonstrations versus from the agent ’ s own experience . The demo ratio is implemented at a batch level by randomly choosing whether to sample from the expert replay buffer independently for each element with probability ρ . Using a stochastic demo ratio in this way allows us to target demo ratios that are smaller than the batch size , which we found to be very important for good performance . The objective optimized by the learner uses of n-step , double Q-learning ( with n = 5 ) and a dueling architecture ( Wang et al. , 2016 ; Hessel et al. , 2018 ) . In addition to performing network updates , the learner is also responsible for pushing updated priorities back to the replay buffers . In each replay buffer , we store fixed-length ( m = 80 ) sequences of ( s , a , r ) tuples where adjacent sequences overlap by 40 time-steps . The sequences never cross episode boundaries . Given a single batch of trajectories we unroll both online and target networks ( Mnih et al. , 2015 ) on the same sequence of states to generate value estimates with the recurrent state initialized to zero . Proper initialization of the recurrent state would require always replaying episodes from the beginning , which would add significant complexity to our implementation . As an approximation of this we treat the first 40 steps of each sequence as a burn-in phase , and apply the training objective to the final 40 steps only . An alternative approximation would be to store stale recurrent states in replay , but we did not find this to improve performance over zero initialization with burn-in . 2.1 R2D3 AGENT . In this section , we provide the pseudocode for the R2D3 . First , the agent has a single learner process which samples from both demonstration and agent buffers in order to update its policy parameters , the pseudocode of the R2D3 learner can be found in Algorithm 1 . Algorithm 1 Learner Inputs : replay of expert demonstrations D , replay of agent experiencesR , batch size B , sequence length m , and number of actors A. Initialize policy weights θ. Initialize target policy weights θ′ ← θ . Launch A actors and replicate policy weights θ to each actor . for nsteps do Sample transition sequences ( st : t+m , at : t+m , rt : t+m ) from replay D with probability ρ or from replayR with probability ( 1− ρ ) , to construct a mini-batch of size B . Calculate loss using target network . Perform a gradient descent step to update θ . If t mod ttarget = 0 , update the target policy weights θ′ ← θ . If t mod tactor = 0 , replicate policy weights to the actors . end for The R2D3 agent has A parallel actor processes which interact with a copy of the environment in order to obtain data which is then inserted into the agent buffer . The agents periodically update their parameters to match those being updated on the learner . The pseudocode for the actors is provided in Algorithm 2 . Algorithm 2 Actor repeat Sample action from behavior policy a← π ( s ) Execute a and observe s′ and r Store ( s , a , s′ , r ) inR until learner finishes . 3 BACKGROUND . Exploration remains one of the most fundamental challenges for reinforcement learning . So-called “ hard-exploration ” domains are those in which rewards are sparse , and optimal solutions typically have long and sparsely-rewarded trajectories . Hard-exploration domains may also have many distracting dead ends that the agent may not be able to recover from once it gets into a certain state . In recent years , the most notable such domains are Atari environments , including Montezuma ’ s Revenge and Pitfall ( Bellemare et al. , 2013 ) . These domains are particularly tricky for classical RL algorithms because even finding a single non-zero reward to bootstrap from is incredibly challenging . A common technique used to address the difficulty of exploration is to encourage the agent to visit under-explored areas of the state-space ( Schmidhuber , 1991 ) . Such techniques are commonly known as intrinsic motivation ( Chentanez et al. , 2005 ) or count-based exploration ( Bellemare et al. , 2016 ) . However , these approaches do not scale well as the state space grows , as they still require exhaustive search in sparse reward environments . Additionally , recent empirical results suggest that these methods do not consistently outperform -greedy exploration ( Taïga et al. , 2019 ) . The difficulty of exploration is also a consequence of the current inability of our agents to abstract the world and learn scalable , causal models with explanatory power . Instead they often use low-level features or handcrafted heuristics and lack the generalization power necessary to work in a more abstract space . Hints can be provided to the agent which bias it towards promising regions of the state space either via reward-shaping ( Ng et al. , 1999 ) or by introducing a sequence of curriculum tasks ( Bengio et al. , 2009 ; Graves et al. , 2017 ) . However , these approaches can be difficult to specify and , in the case of reward shaping , often lead to unexpected behavior where the agent learns to exploit the modified rewards . Another hallmark of hard-exploration benchmarks is that they tend to be fully-observable and exhibit little variation between episodes . Nevertheless , techniques like random no-ops and “ sticky actions ” have been proposed to artificially increase episode variance in Atari ( Machado et al. , 2018 ) , an alternative is to instead consider domains with inherent variability . Other recent work on the Obstacle Tower challenge domain ( Juliani et al. , 2019 ) is similar to our task suite in this regard . Reliance on determinism of the environment is one of the chief criticisms of imitation leveled by Juliani ( 2018 ) , who offers a valuable critique on Aytar et al . ( 2018 ) , Ecoffet et al . ( 2019 ) and Salimans and Chen ( 2018a ) . In contrast , our approach is able to solve tasks with substantial per-episode variability . GAIL ( Ho and Ermon , 2016 ) is another imitation learning method , however standard GAIL does not work in the following settings : 1 ) POMDPs ( Gangwani et al. , 2019 ; Żołna et al. , 2019 ) , 2 ) from pixels ( Li et al. , 2017 ; Reed et al. , 2018 ) , 3 ) off policy ( Kostrikov et al. , 2018 ) and 4 ) with variable initial conditions ( Zolna et al. , 2019 ) . Our setting combines all of these , so we leave extending GAIL to this combined setting for future work .

Summary: In this work, R2D3 (Recurrent Replay Distributed DQN from Demonstration), which combines R2D2 [1] with imitation learning (IL), is proposed. Similar to the existing works on “reinforcement learning (RL) with demonstration” such as DQfD, DDPGfD, policy optimization with demonstration (POfD) [2], hard exploration conditions (sparse reward, partial observability, high variance in initial states) are assumed, which is difficult to achieve good performance with RL without demonstration in general. Eight tasks in such conditions were devised and used to test the performance of R2D3.