R ECURRENT E XPERIENCE R EPLAY IN D ISTRIBUTED R EINFORCEMENT L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
Building on the recent successes of distributed training of RL agents, in this paper we investigate the training of RNN-based RL agents from distributed prioritized experience replay.
We study the effects of parameter lag resulting in representational drift and recurrent state staleness and empirically derive an improved training strategy.
Using a single network architecture and ﬁxed set of hyperparameters, the resulting agent, Recurrent Replay Distributed DQN, quadruples the previous state of the art on Atari-57, and matches the state of the art on
DMLab-30.
It is the ﬁrst agent to exceed human-level performance in 52 of the 57 Atari games.
I NTRODUCTION
Reinforcement learning (RL) has seen a rejuvenation of research interest recently due to repeated successes in solving challenging problems such as reaching human-level play on Atari 2600 games (Mnih et al., 2015), beating the world champion in the game of Go (Silver et al., 2017), and playing competitive 5-player DOTA (OpenAI, 2018b).
The earliest of these successes leveraged experience replay for data efﬁciency and stacked a ﬁxed number of consecutive frames to overcome the partial observability in Atari 2600 games.
However, with progress towards increasingly difﬁcult, partially observable domains, the need for more advanced memory-based representations increases, necessitating more principled solutions such as recurrent neural networks (RNNs).
The use of LSTMs (Hochreiter & Schmidhuber, 1997) within RL has been widely adopted to overcome partial observability (Hausknecht & Stone, 2015; Mnih et al., 2016; Espeholt et al., 2018;
Gruslys et al., 2018).
In this paper we investigate the training of RNNs with experience replay.
We have three primary contributions.
First, we demonstrate the effect of experience replay on parameter lag, leading to representational drift and recurrent state staleness, potentially exacerbated in the distributed training setting, and ultimately resulting in diminished training stability and performance.
Second, we perform an empirical study into the effects of several approaches to RNN training with experience replay, mitigating the aforementioned effects.
Third, we present an agent that integrates these ﬁndings to achieve signiﬁcant advances in the state of the art on Atari-57 (Bellemare et al., 2013) and matches the state of the art on DMLab-30 (Beattie et al., 2016).
To the best of our knowledge, our agent, Recurrent Replay Distributed DQN (R2D2), is the ﬁrst to achieve this using a single network architecture and ﬁxed set of hyper-parameters.
B ACKGROUND 2. R EINFORCEMENT L EARNING
Our work is set within the Reinforcement Learning (RL) framework (Sutton & Barto, 1998), in which an agent interacts with an environment to maximize the sum of discounted, γ ∈ [0 , 1) , rewards.
We model the environment as a Partially Observable Markov Decision Process (POMDP) given by the tuple ( S , A , T , R , Ω , O ) (Monahan, 1982; Jaakkola et al., 1995; Kaelbling et al., 1998).
The underlying Markov Decision Process (MDP) is deﬁned by ( S , A , T , R ), where S is the set of states, A the set of actions, T a transition function mapping state-actions to probability distributions over next states, and R : S ×
A → R is the reward function.
Finally, Ω gives the set of observations potentially received by the agent and O is the observation function mapping (unobserved) states to probability distributions over observations.
Within this framework, the agent receives an observation o ∈ Ω , which may only contain partial information about the underlying state s ∈ S .
When the agent takes an action a ∈
A the environment responds by transitioning to state s (cid:48) ∼ T ( ·| s, a ) and giving the agent a new observation o (cid:48) ∼ Ω( ·| s (cid:48) ) and reward r ∼ R ( s, a ) .
Although there are many approaches to RL in POMDPs, we focus on using recurrent neural networks (RNNs) with backpropagation through time (BPTT)
(Werbos, 1990) to learn a representation that disambiguates the true state of the POMDP.
The Deep Q-Network agent (DQN) (Mnih et al., 2015) learns to play games from the Ataribenchmark by using frame-stacking of 4 consecutive frames as observations, and training a convolutional network to represent a value function with Q-learning (Watkins & Dayan, 1992), from data continuously collected in a replay buffer (Lin, 1993).
Other algorithms like the A3C (Mnih et al., 2016), use an LSTM and are trained directly on the online stream of experience without using a replay buffer.
Hausknecht & Stone (2015) combined DQN with an LSTM by storing sequences in replay and initializing the recurrent state to zero during training.
2. D ISTRIBUTED R EINFORCEMENT L EARNING
Recent advances in reinforcement learning have achieved signiﬁcantly improved performance by leveraging distributed training architectures which separate learning from acting, collecting data from many actors running in parallel on separate environment instances (Horgan et al., 2018; Espeholt et al., 2018;
Gruslys et al., 2018; OpenAI, 2018b;a; Jaderberg et al., 2018).
Distributed replay allows the Ape-X agent (Horgan et al., 2018) to decouple learning from acting, with actors feeding experience into the distributed replay buffer and the learner receiving (randomized) training batches from it.
In addition to distributed replay with prioritized sampling (Schaul et al., 2016), Ape-X uses n -step return targets (Sutton, 1988), the double Q-learning algorithm (van Hasselt et al., 2016), the dueling DQN network architecture (Wang et al., 2016) and 4 -framestacking.
Ape-X achieved state-of-the-art performance on Atari-57, signiﬁcantly out-performing the best single-actor algorithms.
It has also been used in continuous control domains and again showed state-of-the-art results, further demonstrating the performance beneﬁts of distributed training in RL.
IMPALA (Espeholt et al., 2018) is a distributed reinforcement learning architecture which uses a ﬁrst-in-ﬁrst-out queue with a novel off-policy correction algorithm called V-trace, to learn sequentially from the stream of experience generated by a large number of independent actors.
IMPALA stores sequences of transitions along with an initial recurrent state in the experience queue, and since experience is trained on exactly once, this data generally stays very close to the learner parameters.
Espeholt et al.
(2018) showed that IMPALA could achieve strong performance in the Atari-57 and
DMLab
-30 benchmark suites, and furthermore was able to use a single large network to learn all tasks in a benchmark simultaneously while maintaining human-level performance.
2. T HE R ECURRENT R EPLAY D ISTRIBUTED DQN A GENT
We propose a new agent, the Recurrent Replay Distributed DQN (R2D2), and use it to study the interplay between recurrent state, experience replay, and distributed training.
R2D2 is most similar to Ape-X, built upon prioritized distributed replay and n -step double Q-learning (with n = 5 ), generating experience by a large number of actors (typically 256 ) and learning from batches of replayed experience by a single learner.
Like Ape-X, we use the dueling network architecture of Wang et al.
(2016), but provide an LSTM layer after the convolutional stack, similarly to Gruslys et al.
Instead of regular ( s, a, r, s (cid:48) )
transition tuples, we store ﬁxed-length ( m = 80 ) sequences of ( s, a, r ) in replay, with adjacent sequences overlapping each other by 40 time steps, and never crossing episode boundaries.
When training, we unroll both online and target networks (Mnih et al., 2015) on the same sequence of states to generate value estimates and targets.
We leave details of our exact treatment of recurrent states in replay for the next sections.
Like Ape-X, we use 4 -frame-stacks and the full 18 -action set when training on Atari.
On DMLab, we use single RGB frames as observations, and the same action set discretization as Hessel et al.
(2018b).
Following the modiﬁed Ape-X version in Pohlen et al.
(2018), we do not clip rewards, but instead use an invertible value function rescaling of the form h ( x ) = sign( x )( (cid:112) | x | + 1 − 1) + (cid:15)x which results in the following n -step targets for the Q-value function:
[Equation]
Here, θ − denotes the target network parameters which are copied from the online network parameters θ every 2500 learner steps.
Our replay prioritization differs from that of Ape-X in that we use a mixture of max and mean absolute n -step TD-errors
δ i over the sequence: p = η max i δ i + (1 − η )¯ δ .
We set η and the priority exponent to 0 .
This more aggressive scheme is motivated by our observation that averaging over long sequences tends to wash out large errors, thereby compressing the range of priorities and limiting the ability of prioritization to pick out useful experience.
Finally, compared to Ape-X, we used the slightly higher discount of γ = 0 . 997 , and disabled the loss-of-life-as-episode-end heuristic that has been used in Atari agents in some of the work since (Mnih et al., 2015).
A full list of hyper-parameters is provided in the Appendix.
We train the R2D2 agent with a single GPU-based learner, performing approximately 5 network updates per second (each update on a mini-batch of 64 length- 80 sequences), and each actor performing ∼ 260 environment steps per second on Atari ( ∼ 130 per second on DMLab).
T RAINING R ECURRENT RL A GENTS WITH E XPERIENCE R EPLAY
In order to achieve good performance in a partially observed environment, an RL agent requires a state representation that encodes information about its state-action trajectory in addition to its current observation.
The most common way to achieve this is by using an RNN, typically an LSTM (Hochreiter & Schmidhuber, 1997), as part of the agent’s state encoding.
To train an RNN from replay and enable it to learn meaningful long-term dependencies, whole state-action trajectories need to be stored in replay and used for training the network.
Hausknecht & Stone (2015) compared two strategies of training an LSTM from replayed experience:
• Using a zero start state to initialize the network at the beginning of sampled sequences.
• Replaying whole episode trajectories.
The zero start state strategy’s appeal lies in its simplicity, and it allows independent decorrelated sampling of relatively short sequences, which is important for robust optimization of a neural network.
On the other hand, it forces the RNN to learn to recover meaningful predictions from an atypical initial recurrent state (‘initial recurrent state mismatch’), which may limit its ability to fully rely on its recurrent state and learn to exploit long temporal correlations.
The second strategy on the other hand avoids the problem of ﬁnding a suitable initial state, but creates a number of practical, computational, and algorithmic issues due to varying and potentially environment-dependent sequence length, and higher variance of network updates because of the highly correlated nature of states in a trajectory when compared to training on randomly sampled batches of experience tuples.
The authors observed little difference between their two strategies for the empirical agent performance on a set of Atari games, and therefore opted for the simpler zero start state strategy.
One possible explanation for this is that in some cases, an RNN tends to converge to a more ‘typical’ state if allowed a certain number of ‘burn-in’ steps, and so recovers from a bad initial recurrent state on a sufﬁciently long sequence.
We also hypothesize that while the zero start state strategy may sufﬁce in the mostly fully observable Atari domain, it prevents a recurrent network from learning actual long-term dependencies in more memory-critical domains (e.g. on DMLab).
To ﬁx these issues, we propose and evaluate two strategies for training a recurrent neural network from randomly sampled replay sequences, that can be used individually or in combination:
• Stored state:
Storing the recurrent state in replay and using it to initialize the network at training time.
This partially remedies the weakness of the zero start state strategy, however
Initial state
Final state 4 Q eogl ltos eorm rw
M ea n
E p
i s o d e R e t
u r n # Updates2 41e # Updates2 41e # Updates2 41e # Updates2 41e lasertag three opponents small explore object rewards many explore obstructed goals large rooms watermaze
Stored
[Figure]
in
Computation of _ 4 Q eogl ltos eorm rw
[Figure]
[Figure]
ˆ ✓ o t +1 o t ) )
q (ˆ h t ) q
( h t )
q
(ˆ h t +1 )
q ( h t +1 )
ˆ ✓ ˆ ✓ · · · · · · ˆ ✓ o t + m ) h t |( h t , ( h t +1 , ( h t + m , q (ˆ h t + m ) q
( h t + m ) it may suffer from the effect of ‘representational drift’ leading to ‘recurrent state staleness’, as the stored recurrent state generated by a sufﬁciently old network could differ signiﬁcantly from a typical state produced by a more recent version.
• Burn-in: Allow the network a ‘burn-in period’ by using a portion of the replay sequence only for unrolling the network and producing a start state, and update the network
only on the remaining part of the sequence.
We hypothesize that this allows the network to partially recover from a poor start state (zero, or stored but stale) and ﬁnd itself in a better initial state before being required to produce accurate outputs.
In all our experiments we will be using the proposed agent architecture from Section 2.3 with replay sequences of length m = 80 , with an optional burn-in preﬁx of l = 40 or 20 steps.
Our aim is to assess the negative effects of representational drift and recurrent state staleness on network training and how they are mitigated by the different training strategies.
For that we will compare the Q-values produced by the network on sampled replay sequences when unrolled using one of these strategies and the Q-values produced when using the true stored recurrent states at each step (see Figure 1a, showing different sources for the hidden state).
More formally, let o t , . .
, o t + m and h t , . . .
, h t
+ m denote the replay sequence of observations and stored recurrent states, and denote by h t
+1 =
h ( o t , h t ; θ ) and q ( o t , h t ; θ ) the recurrent state and
Q-value vector output by the recurrent neural network with parameter vector θ , respectively.
We write ˆ h t for the start state used in the training step determined by one of the above strategies (either 0 , h t or the resulting recurrent state from unrolling the network with parameters ˆ θ on the sequence preﬁx o t − l , . . .
, o t − 1 ) and ˆ h t +1 , . . .
, ˆ h t + m (where ˆ h
i +
= h
( o i , ˆ h
i ; ˆ θ ) ) for the sequence of recurrent network states produced by the RNN at training time.
We estimate the impact of representational drift and recurrent state staleness by their effect on the Q-value estimates, by measuring Q-value discrepancy
[Equation]
t + j ; ˆ θ )) a | for the ﬁrst ( i = 0 ) and last ( i = m − 1 ) states of the replay sequence (see Figure 1a for an illustration).
The normalization by the maximal Q-value helps comparability between different environments and training stages, as the Q-value range of an agent can vary drastically between these.
Note that we are not directly comparing the Q-values produced at acting and training time, q ( o t , h t ; θ ) and q ( o t , ˆ h t ; ˆ θ ) , as these can naturally be expected to be distinct as the agent is being trained.
Instead we focus on the difference that results from applying the same network (parameterized by ˆ θ ) to the distinct recurrent states.
In Figure 1b, we are comparing agents trained with the different strategies on several DMLab environments in terms of this proposed metric.
It can be seen that the zero start state heuristic results in a signiﬁcantly more severe effect of recurrent state staleness on the outputs of the network.
As hypothesized above, this effect is greatly reduced for the last sequence states compared to the ﬁrst ones, after the RNN has had time to recover from the atypical start state, but the effect of staleness is still substantially worse here for the zero state than the stored state strategy.
Another potential downside of the pure zero state heuristic is that it prevents the agent from strongly relying on its recurrent state and exploit long-term temporal dependencies, see Section 5.
We observe that the burn-in strategy on its own partially mitigates the staleness problem on the initial part of replayed sequences, while not showing a signiﬁcant effect on the Q-value discrepancy for later sequence states.
Empirically, this translates into noticeable performance improvements, as can be seen in Figure 1c.
This itself is noteworthy, as the only difference between the pure zero state and the burn-in strategy lies in the fact that the latter unrolls the network over a preﬁx of states on which the network does not receive updates.
In informal experiments (not shown here) we observed that this is not due to the different unroll lengths themselves (i.e., the zero state strategy without burn-in, on sequences of length l + m , performed worse overall).
We hypothesize that the beneﬁcial effect of burn-in lies in the fact that it prevents ‘destructive updates’ to the RNN parameters resulting from highly inaccurate initial outputs on the ﬁrst few time steps after a zero state initialization.
The stored state strategy, on the other hand, proves to be overall much more effective at mitigating state staleness in terms of the Q-value discrepancy, which also leads to clearer and more consistent improvements in empirical performance.
Finally, the combination of both methods consistently yields the smallest discrepancy on the last sequence states and the most robust performance gains.
We conclude the section with the observation that both stored state and burn-in strategy provide substantial advantages over the naive zero state training strategy, in terms of (indirect) measures of the effect of representation drift and recurrent state staleness, and empirical performance.
Since they combine beneﬁcially, we use both of these strategies (with burn-in length of l = 40 ) in the empirical evaluation of our proposed agent in Section 4.
Additional results on the effects of distributed training on representation drift and Q-value discrepancy are given in the Appendix.
E XPERIMENTAL E VALUATION
In this section we evaluate the empirical performance of R2D2 on two challenging benchmark suites for deep reinforcement learning: Atari-57 (Bellemare et al., 2013) and DMLab-30 (Beattie et al., 2016).
One of the fundamental contributions of Deep Q-Networks (DQN) (Mnih et al., 2015) was to set as standard practice the use of a single network architecture and set of hyper-parameters across the entire suite of 57 Atari games.
Unfortunately, expanding past Atari this standard has not been maintained and, to the best of our knowledge, at present there is no algorithm applied to both Atari57 and DMLab-30 under this standard.
In particular, we will compare performance with Ape-X and
IMPALA for which hyper-parameters are tuned separately for each benchmark.
For R2D2, we use a single neural network architecture and a single set of hyper-parameters across all experiments.
This demonstrates greater robustness and generality than has been previously observed in deep RL.
It is also in pursuit of this generality, that we decided to disable the (Atari-speciﬁc) heuristic of treating life losses as episode ends, and did not apply reward clipping.
Despite this, we observe state-of-the-art performance in both Atari and DMLab, validating the intuitions derived from our empirical study.
A more detailed ablation study of the effects of these modiﬁcations is presented in the Appendix.
4. A TARI -
The Atari-57 benchmark is built upon the Arcade Learning Environment (ALE) (Bellemare et al., 2013), and consists of 57 classic Atari 2600 video games.
Initial human-level performance was achieved by DQN (Mnih et al., 2015), and since then RL agents have improved signiﬁcantly through
[Figure]
both algorithmic and architectural advances.
Currently, state of the art for a single actor is achieved by the recent distributional reinforcement learning algorithms IQN (Dabney et al., 2018) and Rainbow (Hessel et al., 2018a), and for multi-actor results, Ape-X (Horgan et al., 2018).
Figure 2 (left) shows the median human-normalized scores across all games for R2D2 and related methods (see Appendix for full Atari-57 scores and learning curves).
R2D2 achieves an order of magnitude higher performance than all single-actor agents and quadruples the previous state-ofthe-art performance of Ape-X using fewer actors (256 instead of 360), resulting in higher sampleand time-efﬁciency.
Table 1 lists mean and median human-normalized scores for R2D2 and other algorithms, highlighting these improvements.
In addition to achieving state-of-the-art results on the entire task suite, R2D2 also achieves the highest ever reported agent scores on a large fraction of the individual Atari games, in many cases ‘solving’ the respective games by achieving the highest attainable score.
In Figure 2 (right) we highlight some of these individual learning curves of R2D2.
As an example, notice the performance on M S .P
ACMAN is even greater than that of the agent reported in (van Seijen et al., 2017), which was engineered speciﬁcally for this game.
Furthermore, we notice that Ape-X achieves super-human performance for the same number of games as Rainbow ( 49 ), and that its improvements came from improving already strong scores.
R2D2 on the other hand is super-human on 52 out of 57 games, leaving only the ﬁve most challenging exploration problems with below human-level performance:
M ONTEZUMA ’ S R EVENGE , P ITFALL , P RIVATE E YE , S KIING and S OLARIS .
We believe progress on the exploration problem combined with an agent such as R2D2, can in the near future reach super-human performance across the entire Atari-57 suite.
4. DML AB -
DMLab-30 is a suite of 30 problems set in a 3D ﬁrst-person game engine, testing for a wide range of different challenges (Beattie et al., 2016).
While Atari can largely be approached with only frame-stacking, DMLab-30 requires long-term memory to achieve reasonable performance.
Perhaps because of this, and the difﬁculty of integrating recurrent state with experience replay, topperforming agents have, to date, always come in the form of actor-critic algorithms trained in (near) on-policy settings.
For the ﬁrst time we show state-of-the-art performance on DMLab-30 using a value-function-based agent.
We stress that, different from the state-of-the-art IMPALA architecture (Espeholt et al., 2018), the R2D2 agent uses the same set of hyper-parameters here as on the Atarisuite.
[Table]
[Table]
Here we are mainly interested in comparing to the IMPALA ‘experts’, not to its multi-task variant. Since the original IMPALA experts were trained on a smaller amount of data (approximately 333M environment frames) and since R2D2 uses the improved action set introduced in (Hessel et al., 2018b), we decided to re-run the IMPALA agent with improved action set and for a comparable training time (5B environment frames) for a fairer comparison, resulting in substantially improved scores for the IMPALA agent compared to the original in (Espeholt et al., 2018), see Table 1.
Figure 3 compares R2D2 with IMPALA.
We note that R2D2 matches the performance of the (shallow) IMPALA version, despite using the exact same set of hyperparameters and architecture as the variant trained on Atari, and in particular not using the ‘optimistic asymmetric reward clipping’ used by all IMPALA agents 1 .
To demonstrate the potential of our agent, we also devise a somewhat adapted R2D2 version for DMLab only (R2D2+) by adding asymmetric reward clipping, using the 15-layer ResNet from IMPALA (deep), and reducing the target update frequency from 2500 to 400 for better sample efﬁciency.
We observe that this modiﬁed version yields further substantial improvements over standard R2D2 and matches deep IMPALA in terms of sample efﬁciency as well as asymptotic performance.
Both our re-run of deep IMPALA and R2D2+ are setting new state-of-the-art scores on the DMLabbenchmark.
[Figure]
[Figure]
A NALYSIS OF A GENT P ERFORMANCE
Atari-57 is a class of environments which are almost fully observable (given 4 -frame-stack observations) [Figure] and agents trained on it are not necessarily expected to strongly beneﬁt from a memoryaugmented representation.
The main algorithmic difference between R2D2 and its predecessor,
Ape-X, is the use of a recurrent neural network [Figure] and it is therefore surprising by how large a margin
R2D2 surpasses the previous state of the art on Atari.
In this section we analyze the role of the
LSTM network and other algorithmic choices for the high performance of the R2D2 agent
[Figure] Since the performance of asynchronous or distributed RL agents can depend on subtle implementational details and even factors such as precise hardware setup, it is impractical to perform a direct comparison to the Ape-X agent as reported in (Horgan et al., 2018).
Instead, here we verify that the
LSTM and its training strategy play a crucial role for the success of R2D2 by a comparison of the
R2D2 agent with a purely feed-forward variant, all other parameters held ﬁxed.
Similarly, we consider the performance of R2D2 using reward clipping without value rescaling (Clipped) and using a smaller discount factor of γ = 0 .
99 (Discount).
The ablation results in Figure 4 show very clearly that the LSTM component is crucial for boosting the agent’s peak performance as well as learning speed, explaining much of the performance difference to Ape-X. Other design choices have more mixed effects, improving in some games and hurting performance in others.
Full ablation results (in particular, an ablation over the full Atari-57 suite of the feed-forward agent variant, as well as an ablation of the use of the life-loss-as-episode-termination heuristic) are presented in the Appendix.
In our next experiment we test to what extent the R2D2 agent relies on its memory, and how this is impacted by the different training strategies.
For this we select the Atari game M S .P
ACMAN , on which R2D2 shows state-of-the-art performance despite the game being virtually fully observable, and the DMLab task EMSTM WATERMAZE , which strongly requires the use of memory.
We train two agents on each game, using the zero and stored state strategies, respectively.
We then evaluate these agents by restricting their policy to a ﬁxed history length: at time step t , their policy uses an
LSTM unrolled over time steps o t − k
+1 , . . .
, o t , with the hidden state h t − k replaced by zero instead of the actual hidden state (note this is only done for evaluation, not at training time of the agents).
In Figure 5 (left) we decrease the history length k from ∞ (full history) down to 0 and show the degradation of agent performance (measured as mean score over 10 episodes) as a function of k .
We additionally show the difference of max-Q-values and the percentage of correct greedy actions (where the unconstrained variant is taken as ground truth).
We observe that restricting the agent’s memory gradually decreases its performance, indicating its nontrivial use of memory on both domains.
Crucially, while the agent trained with stored state shows higher performance when using the full history, its performance decays much more rapidly than for the agent trained with zero start states.
This is evidence that the zero start state strategy, used in past
RNN-based agents with replay, limits the agent’s ability to learn to make use of its memory.
While this doesn’t necessarily translate into a performance difference (like in M S .P ACMAN ), it does so whenever the task requires an effective use of memory (like EMSTM WATERMAZE ).
This advantage of the stored state compared to the zero state strategy may explain the large performance difference between R2D2 and its close cousin
Reactor
(Gruslys et al., 2018), which trains its LSTM policy from replay with the zero state strategy.
Finally, the right and middle columns of Figure 5 show a monotonic decrease of the quality of Qvalues and the resulting greedy policy as the available history length k is decreased to 0 , providing a simple causal link between the constraint and the empirical agent performance.
For a qualitative comparison of different behaviours learned by R2D2 and its feed-forward variant, we provide several agent videos at https://bit.ly/2Trv10F .
C ONCLUSIONS
Here we take a step back from evaluating performance and discuss our empirical ﬁndings in a broader context.
There are two surprising ﬁndings in our results.
First, although zero state initialization was often used in previous works (Hausknecht & Stone, 2015; Gruslys et al., 2018), we have found that it leads to misestimated action-values, especially in the early states of replayed sequences.
Moreover, without burn-in, updates through BPTT to these early time steps with poorly estimated outputs seem to give rise to destructive updates and hinder the network’s ability to recover from sub-optimal initial recurrent states.
This suggests that either the context-dependent recurrent state should be stored along with the trajectory in replay, or an initial part of replayed sequences should be reserved for burn-in, to allow the RNN to rely on its recurrent state and exploit long-term temporal dependencies, and the two techniques can also be combined beneﬁcially.
We have also observed that the underlying problems of representational drift and recurrent state staleness are potentially exacerbated in the distributed setting (see Appendix), highlighting the importance of robustness to these effects through an adequate training strategy of the RNN.
Second, we found that the impact of RNN training goes beyond providing the agent with memory.
Instead, RNN training also serves a role not previously studied in RL, potentially by enabling better representation learning, and thereby improves performance even on domains that are fully observable and do not obviously require memory (cf.
B REAKOUT results in the feed-forward ablation).
Finally, taking a broader view on our empirical results, we note that scaling up of RL agents through parallelization and distributed training allows them to beneﬁt from huge experience throughput and achieve ever-increasing results over broad simulated task suites such as Atari-57 and DMLab-30.
Impressive as these results are in terms of raw performance, they come at the price of high sample complexity, consuming billions of simulated time steps in hours or days of wall-clock time.
One widely open avenue for future work lies in improving the sample efﬁciency of these agents, to allow applications to domains that do not easily allow fast simulation at similar scales.
Another remaining challenge, very apparent in our results on Atari-57, is exploration: Save for the 5 hardest-exploration games from the Atari-57, R2D2 surpasses human-level performance on this task suite signiﬁcantly, essentially ‘solving’ many of the games therein.
A PPENDIX E FFECT OF D ISTRIBUTED RL A GENT T RAINING
In this section, we investigate the effects of distributed training of an agent using a recurrent neural network, where a large number of actors feed their experience into a replay buffer for a single learner.
On the one hand, the distributed setting typically presents a less severe problem of representational drift than the single-actor case, such as the one studied in (Hausknecht & Stone, 2015).
This is because in relative terms, the large amount of generated experience is replayed less frequently (on average, an experience sample is replayed less than once in the Ape-X agent, compared to eight times in DQN), and so distributed agent training tends to give rise to a smaller degree of ‘parameter lag’ (the mean age, in parameter updates, of the network parameters used to generate an experience, at the time it is being replayed).
On the other hand, the distributed setting allows for easy scaling of computational resources according to hardware or time constraints.
An ideal distributed agent should therefore be robust to changes in, e.g., the number of actors, without careful parameter re-tuning.
As we have seen in the previous section, RNN training from replay is sensitive to the issue of representational drift, the severity of which can depend on exactly these parameters.
To investigate these effects, we train the R2D2 agent with a substantially smaller number of actors.
This has a direct (inversely proportional) effect on the parameter lag (see Figure 6(left)).
Speciﬁcally, in our experiments, as the number of actors is changed from 256 to 64 , the mean parameter lag goes from 1500 to approximately 5500 parameter updates, which in turn impacts the magnitude of representation drift and recurrent state staleness, as measured by ∆ Q in Section 3.
The right two columns in Figure 6 show an overall increase of the average ∆ Q for the smaller number of actors, both for ﬁrst and last states of replayed sequences.
This supports the above intuitions and highlights the increased importance of an improved training strategy (compared to the zero state strategy) in the distributed training setting, if a certain level of empirical agent performance is to be maintained across ranges of extrinsic and potentially hardware dependent parameters.
[Figure] [Figure]
E XTENDED R ESULTS
In this section we give additional experimental results supporting our empirical study in the main text.
Figure 7 gives a more in-depth view of the ablation results from Figure 4.
We see that, with the exception of the feed-forward ablation, there are always games in which the ablated choice performs better.
Our choice of architecture and conﬁguration optimizes for overall performance and general (cross-domain) applicability, but for individual games there are different conﬁgurations that would yield improved performance.
Additionally in Figure 8 we compare R2D2 with variants using the life loss signal as episode termination.
Both ablation variants interrupt value function bootstrapping past the life loss events, but differ in that one (‘reset’) also resets the LSTM state at these events, whereas the other (‘roll’) only resets the LSTM state at actual episode boundaries, like regular R2D2.
Despite the fact that the life loss heuristic is generally helpful to speed up learning in Atari, we did not use it in our main
R2D2 agent for the sake of generality of the algorithm.
[Figure] In Figure 9 we compare the sample efﬁciency of R2D2 with recent state-of-the-art agents on Atariin terms of human-normalized median score.
As expected, the more distributed agents have worse sample efﬁciency early on, but also much improved long-term performance.
This is an interesting correlation on its own, but we add that R2D2 appears to achieve a qualitatively different performance curve than any of the other algorithms.
Note that, while Ape-X has a larger number of actors than R2D2 (360 compared to 256), its learner processes approximately 20 batches of size 512 per second, whereas R2D2 performs updates on batches of 64 × 80 observations (batch size × sequence length), at a rate of approximately 5 per second.
This results in a reduced ‘replay ratio’ (effective number of times each experienced observation is being replayed):
On average, Ape-X replays each observation approximately 1 .
3 times, whereas this number is only about 0 .
8 for R2D2, which explains the initial sample efﬁciency advantage of
Ape-X.
H YPER - PARAMETERS
R2D2 uses the same 3-layer convolutional network as DQN (Mnih et al., 2015), followed by an
LSTM with 512 hidden units, which feeds into the advantage and value heads of a dueling network (Wang et al., 2016), each with a hidden layer of size 512 .
On the four language tasks in the DMLab suite, we are using the same additional language-LSTM with 64 hidden units as IMPALA (Espeholt et al., 2018). [Figure] actors [Figure]
Sequence length m 80 (+ preﬁx of l = 40 in burn-in experiments)
[Table]
As is usual for agent training on Atari since (Mnih et al., 2015) [Table] we cap all (training and evaluation) episodes at 30 minutes ( 108 , 000 environment frames).
All reported scores are (undiscounted) episode returns.
For the R2D2 agent we always report ﬁnal scores (as opposed to some of the comparison agents that use best score attained during training)
[Table]
GAMES
IMPALA( S )
IMPALA( D )
R2D R2D2+ rooms collect good objects test 9.
rooms exploit deferred effects test 41.
rooms select nonmatching object 9.
rooms watermaze 32. rooms keys doors puzzle 48.
language select described object 644.
language select located object 585. language execute random task 472. language answer quantitative question 5.
lasertag one opponent large -0. lasertag three opponents large 0.
lasertag one opponent small -0. lasertag three opponents small 41.
natlab ﬁxed large map 55.
natlab varying map regrowth 26. natlab varying map randomized 37.
skymaze irreversible path hard 51.
skymaze irreversible path varied 79. psychlab arbitrary visuomotor mapping 35. psychlab continuous recognition 30. [Table]
[Table]
[Table]
[Table] [Table] [Table] [Table]
small 456.
[Table]
large 337.
[Table] few 60. [Table] many 80.
[Table]
chopper command 7387.
crazy climber 35829.
defender 18688.
demon attack 1971.
double dunk -16.
enduro 860.
ﬁshing derby -38.
freeway 29. frostbite 4334.
gopher 2412.
gravitar 3351.
hero 30826.
ice hockey 0.
jamesbond 302. kangaroo 3035.
krull 2665.
[Table]
solaris 12326.
space invaders 1668.
star gunner 10250.
surround 6.
tennis -8.
time pilot 5229.
tutankham 167.
up n down 11693.
venture 1187.
video pinball 17667.
wizard of wor 4756.
yars revenge 54576.
zaxxon 9173.
[Figure]
R2D2+
R2D
IMPALA
IMPALA (Deep)
IMPALA (original)
[Figure]