M ODEL B ASED R EINFORCEMENT L EARNING FOR A TARI
A BSTRACT
Model-free reinforcement learning (RL) can be used to learn effective policies for complex tasks, such as Atari games, even from image observations.
However, this typically requires very large amounts of interaction – substantially more, in fact, than a human would need to learn the same games.
How can people learn so quickly?
Part of the answer may be that people can learn how the game works and predict which actions will lead to desirable outcomes.
In this paper, we explore how video prediction models can similarly enable agents to solve Atari games with fewer interactions than model-free methods.
We describe Simulated Policy Learning (SimPLe), a complete model-based deep RL algorithm based on video prediction models and present a comparison of several model architectures, including a novel architecture that yields the best results in our setting.
Our experiments evaluate
SimPLe on a range of Atari games in low data regime of 100k interactions between the agent and the environment, which corresponds to two hours of real-time play.
In most games SimPLe outperforms state-of-the-art model-free algorithms, in some games by over an order of magnitude
I NTRODUCTION
Human players can learn to play Atari games in minutes (Tsividis et al., 2017).
However, some of the best model-free reinforcement learning algorithms require tens or hundreds of millions of time steps – the equivalent of several weeks of training in real time.
How is it that humans can learn these games so much faster?
Perhaps part of the puzzle is that humans possess an intuitive understanding of the physical processes that are represented in the game: we know that planes can ﬂy, balls can roll, and bullets can destroy aliens.
We can therefore predict the outcomes of our actions.
In this paper, we explore how learned video models can enable learning in the Atari Learning Environment (ALE) benchmark Bellemare et al. (2015); Machado et al.
(2017) with a budget restricted to 100K time steps – roughly to two hours of a play time.
Although prior works have proposed training predictive models for next-frame, future-frame, as well as combined future-frame and reward predictions in Atari games (Oh et al.
; Chiappa et al.
(2017); Leibfried et al.
, no prior work has successfully demonstrated model-based control via predictive models that achieve competitive results with model-free RL.
Indeed, in a recent survey (Section 7.2 in Machado et al.
this was formulated as the following challenge: “ So far, there has been no clear demonstration of successful planning with a learned model in the ALE ”.
Using models of environments, or informally giving the agent ability to predict its future, has a fundamental appeal for reinforcement learning.
The spectrum of possible applications is vast, including learning policies from the model (Watter et al., 2015;
Finn et al., 2016; Finn & Levine, 2016;
Ebert et al., 2017; Hafner et al., 2018; Piergiovanni et al., 2018; Rybkin et al., 2018; Sutton & Barto,
Observations
Policy
World Model World Model
W o r l d M o d e l
T r a i n i n g
Self-Supervised*
RL
A g e n t T r a i n i n g
I n W o r l d M o d e l
Policy
Observations A g e n t E v a l u a t i o n
I n R e a l W o r l d
Interaction
A g e n t T r a i n i n g
I n W o r l d M o d e l A g e n t E v a l u a t
i
o
n i n
R e a l W o r l d
World Model Training
P o li c y
O b s e r v a t i o n s
W o r l d M o d e l
2017, Chapter 8), capturing important details of the scene (Ha & Schmidhuber, 2018), encouraging exploration (Oh et al., 2015), creating intrinsic motivation (Schmidhuber, 2010) or counterfactual reasoning (Buesing et al., 2018). One of the exciting beneﬁts of model-based learning is the promise to substantially improve sample efﬁciency of deep reinforcement learning (see Chapter 8 in Sutton & Barto (2017)). Our work advances the state-of-the-art in model-based reinforcement learning by introducing a system that, to our knowledge, is the ﬁrst to successfully handle a variety of challenging games in the
ALE benchmark.
To that end, we experiment with several stochastic video prediction techniques, including a novel model based on discrete latent variables.
We present an approach, called Simulated
Policy Learning (SimPLe), that utilizes these video prediction techniques and trains a policy to play the game within the learned model.
With several iterations of dataset aggregation, where the policy is deployed to collect more data in the original game, we learn a policy that, for many games, successfully plays the game in the real environment (see videos on the project webpage https://goo.gl/itykP8 ).
In our empirical evaluation, we ﬁnd that SimPLe is signiﬁcantly more sample-efﬁcient than a highly tuned version of the state-of-the-art Rainbow algorithm (Hessel et al., 2017) on almost all games.
In particular, in low data regime of 100 k samples, on more than half of the games, our method achieves a score which Rainbow requires at least twice as many samples.
In the best case of Freeway , our method is more than 10x more sample-efﬁcient, see Figure 3.
Since the publication of the ﬁrst preprint of this work, it has been shown in van Hasselt et al.
; Kielak (2020) that Rainbow can be tuned to have better results in low data regime.
The results are on a par with SimPLe – both of the model-free methods are better in 13 games, while SimPLe is better in the other 13 out of the totalgames tested (note that in Section 4.2 van Hasselt et al.
(2019) compares with the results of our ﬁrst preprint, later improved).
R ELATED W ORK
Atari games gained prominence as a benchmark for reinforcement learning with the introduction of the Arcade Learning Environment (ALE)
Bellemare et al.
The combination of reinforcement learning and deep models then enabled RL algorithms to learn to play Atari games directly from images of the game screen, using variants of the DQN algorithm (Mnih et al., 2013; 2015; Hessel et al., 2017) and actor-critic algorithms
(Mnih et al., 2016; Schulman et al., 2017; Babaeizadeh et al., 2016; Wu et al., 2017; Espeholt et al., 2018).
The most successful methods in this domain remain model-free algorithms (Hessel et al., 2017; Espeholt et al., 2018).
Although the sample complexity of these methods has substantially improved recently, it remains far higher than the amount of experience required for human players to learn each game (Tsividis et al., 2017).
In this work, we aim to learn
Atari games with a budget of just 100K agent steps (400K frames), corresponding to about two hours of play time.
Prior methods are generally not evaluated in this regime, and we therefore optimized
Rainbow (Hessel et al., 2017) for optimal performance on 1M steps, see Appendix E for details.
Oh et al.
(2015) and Chiappa et al.
(2017) show that learning predictive models of Atarienvironments is possible using appropriately chosen deep learning architectures.
Impressively, in some cases the predictions maintain low L 2 error over timespans of hundreds of steps.
As learned simulators of Atari environments are core ingredients of our approach, in many aspects our work is motivated by Oh et al.
(2015) and Chiappa et al.
(2017), however we focus on using video prediction in the context of learning how to play the game well and positively verify that learned simulators can be used to train a policy useful in original environments.
An important step in this direction was made by Leibfried et al.
(2016), which extends the work of Oh et al.
by including reward prediction, but does not use the model to learn policies that play the games.
Most of these approaches, including ours, encode knowledge of the game in implicit way.
Unlike this, there are works in which modeling is more explicit, for example Ersen & Sariel (2014) uses testbed of the Incredible Machines to learn objects behaviors and their interactions.
Similarly Guzdial et al.
(2017) learns an engine predicting interactions of predeﬁned set of sprites in the domain of Super Mario Bros.
Perhaps surprisingly, there is virtually no work on model-based RL in video games from images.
Notable exceptions are the works of Oh et al.
Ha & Schmidhuber (2018), Holland et al.
Leibfried et al.
(2018) and Azizzadenesheli et al.
Oh et al.
(2017) use a model of rewards to augment model-free learning with good results on a number of Atari games.
However, this method does not actually aim to model or predict future frames, and achieves clear but relatively modest gains in efﬁciency.
Ha & Schmidhuber (2018) present a way to compose a variational autoencoder with a recurrent neural network into an architecture that is successfully evaluated in the VizDoom environment and on a 2D racing game.
The training procedure is similar to Algorithm 1, but only one iteration of the loop is needed as the environments are simple enough to be fully explored with random exploration.
Similarly, Alaniz (2018) utilizes a transition model with Monte Carlo tree search to solve a block-placing task in Minecraft.
Holland et al.
(2018) use a variant of Dyna (Sutton, 1991) to learn a model of the environment and generate experience for policy training in the context of
Atari games.
Using six Atari games as a benchmark Holland et al.
(2018) measure the impact of planning shapes on performance of the Dyna-DQN algorithm and include ablations comparing scores obtained with perfect and imperfect models.
Our method achieves around 330% of the Dyna-DQN score on Asterix, 120% on Q-Bert, 150% on Seaquest and 80% on Ms. Pac-Man.
Azizzadenesheli et al.
(2018) propose an algorithm called Generative Adversarial Tree Search (GATS) and for ﬁve
Atari games train a GAN-based world model along with a Q-function.
Azizzadenesheli et al.
(2018) primarily discuss various failure modes of the GATS algorithm.
Our method achieves aroundtimes the score of GATS on Pong and 10 times on Breakout.
Outside of games, model-based reinforcement learning has been investigated at length for applications such as robotics (Deisenroth et al., 2013).
Though most of such works do not use image observations, several recent works have incorporated images into real-world (Finn et al., 2016;
Finn & Levine, 2016; Babaeizadeh et al., 2017; Ebert et al., 2017; Piergiovanni et al., 2018; Paxton et al., 2018;
Rybkin et al., 2018; Ebert et al., 2018) and simulated (Watter et al., 2015; Hafner et al., 2018) robotic control.
Our video models of Atari environments described in Section 4 are motivated by models developed in the context of robotics.
Another source of inspiration are discrete autoencoders proposed by van den Oord et al.
(2017) and Kaiser & Bengio (2018).
The structure of the model-based RL algorithm that we employ consists of alternating between learning a model, and then using this model to optimize a policy with model-free reinforcement learning.
Variants of this basic algorithm have been proposed in a number of prior works, starting from Dyna Q Sutton (1991) to more recent methods that incorporate deep networks Heess et al.
; Feinberg et al.
; Kalweit & Boedecker (2017); Kurutach et al.
S IMULATED P OLICY L EARNING (S IM PL E )
Reinforcement learning is formalized in Markov decision processes (MDP).
An MDP is deﬁned as a tuple ( S , A , P, r, γ ) , where S is a state space, A is a set of actions available to an agent, P is the unknown transition kernel, r is the reward function and γ ∈ (0 , 1) is the discount factor. In this work [Figure] t
i [Figure] we refer to MDPs as environments and assume that environments do not provide direct access to the state (i.e., the RAM of Atari 2600 emulator).
Instead we use visual observations, typically 210 × RGB images.
A single image does not determine the state.
In order to reduce environment’s partial observability, we stack four consecutive frames and use it as the observation.
A reinforcement learning agent interacts with the MDP by issuing actions according to a policy.
Formally, policy π is a mapping from states to probability distributions over A .
The quality of a policy is measured by the value function E π (cid:16)(cid:80) + ∞ t {+=
+} γ t r t +1 | s 0 =
s (cid:17) , which for a starting state s estimates the total discounted reward gathered by the agent.
policy π
Initialize model parameters θ of env (cid:48) Initialize empty set D while not done do (cid:46) collect observations from real env.
D ← D ∪ COLLECT( env , π ) (cid:46) update model using collected data. θ ← TRAIN_SUPERVISED ( env (cid:48) , D ) (cid:46) update policy using world model.
π ← TRAIN_RL ( π , env (cid:48) ) end while
In Atari 2600 games our goal is to ﬁnd a policy which maximizes the value function from the beginning of the game.
Crucially, apart from an Atari 2600 emulator environment env we will use a neural network simulated environment env (cid:48) which we call a world model and describe in detail in Section 4.
The environment env (cid:48) shares the action space and reward space with env and produces visual observations in the same format, as it will be trained to mimic env .
Our principal aim is to train a policy π using a simulated environment env (cid:48) so that π achieves good performance in the original environment env .
In this training process we aim to use as few interactions with env as possible.
The initial data to train env (cid:48) comes from random rollouts of env .
As this is unlikely to capture all aspects of env , we use the iterative method presented in Algorithm 1.
W ORLD M ODELS
In search for an effective world model we experimented with various architectures, both new and modiﬁed versions of existing ones.
This search resulted in a novel stochastic video prediction model (visualized in Figure 2) which achieved superior results compared to other previously proposed models.
In this section, we describe the details of this architecture and the rationale behind our design decisions.
In Section 6 we compare the performance of these models.
Deterministic Model.
Our basic architecture, presented as part of Figure 2, resembles the convolutional feedforward network from Oh et al.
The input X consists of four consecutive game frames and an action a .
Stacked convolution layers process the visual input.
The actions are one-hot-encoded and embedded in a vector which is multiplied channel-wise with the output of the convolutional layers.
The network outputs the next frame of the game and the value of the reward.
In our experiments, we varied details of the architecture above.
In most cases, we use a stack of four convolutional layers with 64 ﬁlters followed by three dense layers (the ﬁrst two have 1024 neurons).
The dense layers are concatenated with 64 dimensional vector with a learnable action embedding.
Next, three deconvolutional layers of 64 ﬁlters follow.
An additional deconvolutional layer outputs an image of the original 105 × 80 size.
The number of ﬁlters is either 3 or 3 × 256 .
In the ﬁrst case, the output is a real-valued approximation of pixel’s RGB value.
In the second case, ﬁlters are followed by softmax producing a probability distribution on the color space.
The reward is predicted by a softmax attached to the last fully connected layer.
We used dropout equal to 0 .
2 and layer normalization.
Loss functions.
The visual output of our networks is either one ﬂoat per pixel/channel or the categorical 256-dimensional softmax.
In both cases, we used the clipped loss max( Loss, C ) for a constant C .
We found that clipping was crucial for improving the models (measured with the correct reward predictions per sequence metric and successful training using Algorithm 1).
We conjecture that clipping substantially decreases the magnitude of gradients stemming from ﬁne-tuning of big areas of background consequently letting the optimization process concentrate on small but important areas (e.g. the ball in Pong).
In our experiments, we set for loss
% (as
03 ) we get no gradients from that pixel
Scheduled sampling.
The model env (cid:48) consumes its own predictions from previous steps and due to compounding errors, the model may drift out of the area of its applicability.
Following Bengio et al.
; Venkatraman et al.
, we mitigate this problem by randomly replacing in training some frames of the input X by the prediction from the previous step while linearly increasing the mixing probability to 100% around the middle of the ﬁrst iteration of the training loop.
Stochastic Models.
A stochastic model can be used to deal with limited horizon of past observed frames as well as sprites occlusion and ﬂickering which results to higher quality predictions.
Inspired by Babaeizadeh et al.
(2017), we tried a variational autoencoder (Kingma & Welling, 2013) to model the stochasticity of the environment.
In this model, an additional network receives the input frames as well as the future target frame as input and approximates the distribution of the posterior.
At each timestep, a latent value z t is sampled from this distribution and passed as input to the original predictive model.
At test time, the latent values are sampled from an assumed prior N ( 0 , I ) .
To match the assumed prior and the approximate, we use the Kullback–Leibler divergence term as an additional loss term (Babaeizadeh et al., 2017).
We noticed two major issues with the above model.
First, the weight of the KL divergence loss term is game dependent, which is not practical if one wants to deal with a broad portfolio of Atari games.
Second, this weight is usually a very small number in the range of [10 − 3 , 10 − 5 ] which means that the approximated posterior can diverge signiﬁcantly from the assumed prior.
This can result in previously unseen latent values at inference time that lead to poor predictions.
We address these issues by utilizing a discrete latent variable similar to Kaiser & Bengio (2018).
As visualized in Figure 2, the proposed stochastic model with discrete latent variables discretizes the latent values into bits (zeros and ones) while training an auxiliary LSTM-based Hochreiter &
Schmidhuber (1997) recurrent network to predict these bits autoregressively.
At inference time, the latent bits will be generated by this auxiliary network in contrast to sampling from a prior.
To make the predictive model more robust to unseen latent bits, we add uniform noise to approximated latent values before discretization and apply dropout (Srivastava et al., 2014) on bits after discretization.
More details about the architecture is in Appendix C.
P OLICY T RAINING
We will now describe the details of SimPLe, outlined in Algorithm 1.
In step 6 we use the proximal policy optimization (PPO) algorithm (Schulman et al., 2017) with γ = 0 .
The algorithm generates rollouts in the simulated environment env (cid:48) and uses them to improve policy π .
The fundamental difﬁculty lays in imperfections of the model compounding over time.
To mitigate this problem we use short rollouts of env (cid:48) .
Typically every N = 50 steps we uniformly sample the starting state from the ground-truth buffer D and restart env (cid:48) (for experiments with the value of γ and N see Section 6.4).
Using short rollouts may have a degrading effect as the PPO algorithm does not have a way to infer effects longer than the rollout length.
To ease this problem, in the last step of a rollout we add to the reward the evaluation of the value function.
Training with multiple iterations re-starting from trajectories gathered in the real environment is new to our knowledge.
It was inspired by the classical
Dyna-Q algorithm and, notably, in the Atari domain no comparable results have been achieved.
The main loop in Algorithm 1 is iterated 15 times (cf.
Section 6.4).
The world model is trained for 45 K steps in the ﬁrst iteration and for 15 K steps in each of the following ones.
Shorter training in later iterations does not degrade the performance because the world model after ﬁrst iteration captures already part of the game dynamics and only needs to be extended to novel situations.
In each of the iterations, the agent is trained inside the latest world model using PPO.
In every PPO epoch we used 16 parallel agents collecting 25, 50 or 100 steps from the simulated environment env (cid:48)
(see Section 6.4 for ablations).
The number of PPO epochs is z · 1000 , where z equals to 1 in all passes except last one (where z = 3 ) and two passes number 8 and 12 (where z = 2 ).
This gives 800 K · z interactions with the simulated environment in each of the loop passes.
In the process of training the agent performs 15 .
2 M interactions with the simulated environment env (cid:48) .
E XPERIMENTS
We evaluate SimPLe on a suite of Atari games from Atari Learning Environment (ALE) benchmark.
In our experiments, the training loop is repeated for 15 iterations, with 6400 interactions with the environment collected in each iteration.
We apply a standard pre-processing for Atari games: a frame skip equal to 4, that is every action is repeated 4 times.
The frames are down-scaled by a factor of 2 .
Because some data is collected before the ﬁrst iteration of the loop, altogether 6400 · 16 = 102 ,interactions with the Atari environment are used during training.
This is equivalent to 409 , 600 frames from the Atari game (114 minutes at 60 FPS).
At every iteration, the latest policy trained under the learned model is used to collect data in the real environment env .
The data is also directly used to train the policy with PPO.
Due to vast difference between number of training data from simulated environment and real environment (15M vs 100K) the impact of the latter on policy is negligible.
We evaluate our method on 26 games selected on the basis of being solvable with existing state-ofthe-art model-free deep RL algorithms 2 , which in our comparisons are Rainbow Hessel et al.
(2017) and PPO Schulman et al.
For Rainbow, we used the implementation from the Dopamine package and spent considerable time tuning it for sample efﬁciency (see Appendix E).
For visualization of all experiments see https://goo.gl/itykP8 and for a summary see
Figure 3.
It can be seen that our method is more sample-efﬁcient than a highly tuned Rainbow baseline on almost all games, requires less than half of the samples on more than half of the games and, on Freeway , is more than 10x more sample-efﬁcient.
Our method outperforms PPO by an even larger margin.
We also compare our method with ﬁxed score baselines (for different baselines) rather than counting how many steps are required to match our score, see Figure 4 for the results.
For the qualitative analysis of performance on different games see Appendix B.
6. S AMPLE E FFICIENCY
The primary evaluation in our experiments studies the sample efﬁciency of SimPLe, in comparison with state-of-the-art model-free deep RL methods in the literature.
To that end, we compare with
Rainbow (Hessel et al., 2017; Castro et al., 2018), which represents the state-of-the-art Q-learning method for Atari games, and PPO (Schulman et al., 2017), a model-free policy gradient algorithm (see
Appendix E for details of tuning of Rainbow and PPO).
The results of the comparison are presented in Figure 3.
For each game, we plot the number of time steps needed for either Rainbow or PPO to reach the same score that our method reaches after 100 K interaction steps.
The red line indicates 100 K steps: any bar larger than this indicates a game where the model-free method required more steps.
SimPLe outperforms the model-free algorithms in terms of learning speed on nearly all of the games, and in the case of a few games, does so by over an order of magnitude.
For some games, it reaches the same performance that our PPO implementation reaches at 10 M steps.
This indicates that model-based reinforcement learning provides an effective approach to learning Atari games, at a fraction of the sample complexity.
The results in these ﬁgures are generated by averaging 5 runs for each game.
The model-based agent is better than a random policy for all the games except Bank Heist .
Interestingly, we observed that the best of the 5 runs was often signiﬁcantly better.
For 6 of the games, it exceeds the average human score (as reported in Table 3 of Pohlen et al.
This suggests that further stabilizing
SimPLe should improve its performance, indicating an important direction for future work.
In some cases during training we observed high variance of the results during each step of the loop.
There are a number of possible reasons, such as mutual interactions of the policy training and the supervised training or domain mismatch between the model and the real environment.
We present detailed numerical results, including best scores and standard deviations, in Appendix D.
6. N UMBER OF FRAMES
We focused our work on learning games with 100 K interaction steps with the environment.
In this section we present additional results for settings with 20 K, 50 K, 200 K, 500 K and 1 M interactions; see Figure 5 (a).
Our results are poor with 20 K interactions.
For 50 K they are already almost as good as with 100 K interactions.
From there the results improve until 500 K samples – it is also the point at which they are on par with model-free PPO.
Detailed per game results can be found in Appendix F.
This demonstrates that SimPLe excels in a low data regime, but its advantage disappears with a bigger amount of data.
Such a behavior, with fast growth at the beginning of training, but lower asymptotic performance is commonly observed when comparing model-based and model-free methods (Wang et al.
As observed in Section 6.4 assigning bigger computational budget helps in 100 K setting.
We suspect that gains would be even bigger for the settings with more samples.
[Figure] Finally [Figure] we veriﬁed if a model obtained with SimPLe using 100 K is a useful initialization for modelfree PPO training.
Based on the results depicted in Figure 5 (b) we can positively answer this conjecture.
Lower asymptotic performance is probably due to worse exploration.
A policy pre-trained with SimPLe was meant to obtain the best performance on 100 K, at which point its entropy is very low thus hindering further PPO training [Figure]
6. E NVIRONMENT STOCHASTICITY
A crucial decision in the design of world models is the inclusion of stochasticity.
Although Atari is known to be a deterministic environment, it is stochastic given only a limited horizon of past observed frames (in our case 4 frames).
The level of stochasticity is game dependent; however, it can be observed in many Atari games.
An example of such behavior can be observed in the game
Kung Fu Master – after eliminating the current set of opponents, the game screen always looks the same (it contains only player’s character and the background).
The game dispatches diverse sets of new opponents, which cannot be inferred from the visual observation alone (without access to the game’s internal state) and thus cannot be predicted by a deterministic model.
Similar issues have been reported in Babaeizadeh et al. (2017), where the output of their baseline deterministic model was a blurred superposition of possible random object movements. As can be seen in Figure 11 in the Appendix, the stochastic model learns a reasonable behavior – samples potential opponents and renders them sharply.
Given the stochasticity of the proposed model, SimPLe can be used with truly stochastic environments.
To demonstrate this, we ran an experiment where the full pipeline (both the world model and the policy) was trained in the presence of sticky actions, as recommended in (Machado et al., 2017, Section 5).
Our world model learned to account for the stickiness of actions and in most cases the end results were very similar to the ones for the deterministic case even without any tuning, see Figure 6.
6. A BLATIONS
To evaluate the design of our method, we independently varied a number of the design decisions.
Here we present an overview; see Appendix A for detailed results.
Model architecture and hyperparameters.
We evaluated a few choices for the world model and our proposed stochastic discrete model performs best by a signiﬁcant margin.
The second most important parameter was the length of world model’s training.
We veriﬁed that a longer training would be beneﬁcial, however we had to restrict it in all other ablation studies due to a high cost of training on all games.
As for the length of rollouts from simulated env (cid:48) , we use
N = 50 by default.
We experimentally shown that
N = 25 performs roughly on par, while N = 100 is slightly worse, likely due to compounding model errors.
The discount factor was set to γ = 0 .unless speciﬁed otherwise.
We see that γ = 0 .
95 is slightly better than other values, and we hypothesize that it is due to better tolerance to model imperfections.
But overall, all three values of γ perform comparably.
Model-based iterations.
The iterative process of training the model, training the policy, and collecting data is crucial for non-trivial tasks where random data collection is insufﬁcient.
In a game-by-game analysis, we quantiﬁed the number of games where the best results were obtained in later iterations of training.
In some games, good policies could be learned very early.
While this might have been due to the high variability of training, it does suggest the possibility of much faster training (i.e. in fewer step than 100k) with more directed exploration policies.
In Figure 9 in the Appendix we present the cumulative distribution plot for the (ﬁrst) point during learning when the maximum score for the run was achieved in the main training loop of Algorithm 1.
Random starts.
Using short rollouts is crucial to mitigate the compounding errors in the model.
To ensure exploration, SimPLe starts rollouts from randomly selected states taken from the real data buffer D. Figure 9 compares the baseline with an experiment without random starts and rollouts of length 1000 on Seaquest which shows much worse results without random starts.
C ONCLUSIONS AND F UTURE W ORK
We presented SimPLe, a model-based reinforcement learning approach that operates directly on raw pixel observations and learns effective policies to play games in the Atari Learning Environment.
Our experiments demonstrate that SimPLe learns to play many of the games with just 100 K interactions with the environment, corresponding to 2 hours of play time.
In many cases, the number of samples required for prior methods to learn to reach the same reward value is several times larger.
Our predictive model has stochastic latent variables so it can be applied in highly stochastic environments.
Studying such environments is an exciting direction for future work, as is the study of other ways in which the predictive neural network model could be used.
Our approach uses the model as a learned simulator and directly applies model-free policy learning to acquire the policy.
However, we could use the model for planning.
Also, since our model is differentiable, the additional information contained in its gradients could be incorporated into the reinforcement learning process.
Finally, the representation learned by the predictive model is likely be more meaningful by itself than the raw pixel observations from the environment.
Incorporating this representation into the policy could further accelerate and improve the reinforcement learning process.
While SimPLe is able to learn more quickly than model-free methods, it does have limitations.
First, the ﬁnal scores are on the whole lower than the best state-of-the-art model-free methods.
This can be improved with better dynamics models and, while generally common with model-based RL algorithms, suggests an important direction for future work.
Another, less obvious limitation is that the performance of our method generally varied substantially between different runs on the same game.
The complex interactions between the model, policy, and data collection were likely responsible for this.
In future work, models that capture uncertainty via Bayesian parameter posteriors or ensembles (Kurutach et al., 2018; Chua et al., 2018) may improve robustness.
Finally, the computational and time requirement of training inside world model are substantial (see Appendix C), which makes developing lighter models an important research direction.
In this paper our focus was to demonstrate the capability and generality of SimPLe only across a suite of Atari games, however, we believe similar methods can be applied to other environments and tasks which is one of our main directions for future work.
As a long-term challenge, we believe that model-based reinforcement learning based on stochastic predictive models represents a promising and highly efﬁcient alternative to model-free RL.
Applications of such approaches to both high-ﬁdelity simulated environments and real-world data represent an exciting direction for future work that can enable highly efﬁcient learning of behaviors from raw sensory inputs in domains such as robotics and autonomous driving.
A CKNOWLEDGMENTS
We thank Marc Bellemare and Pablo Castro for their help with Rainbow and Dopamine.
The work of Konrad Czechowski, Piotr Kozakowski and Piotr Miło´s was supported by the Polish National
Science Center grants UMO-2017/26/E/ST6/00622.
The work of Henryk Michalewski was supported by the Polish National Science Center grant UMO-2018/29/B/ST6/02959.
This research was supported by the PL-Grid Infrastructure.
In particular, Konrad Czechowski, Piotr Kozakowski, Henryk
Michalewski, Piotr Miło ´ s and Bła ˙
zej Osi ´ nski extensively used the Prometheus supercomputer, located in the Academic Computer Center Cyfronet in the AGH University of Science and Technology in
Kraków, Poland.
Some of the experiments were managed using https://neptune.ai .
We would like to thank the Neptune team for providing us access to the team version and technical support.
parametric
els
reinforcement learning
[Table]
Full source code to reproduce our experiments is integrated in an open source library.
To preserve anonymity we provide a copy of the library source code here: http://bit.ly/2wjgn1a
A A BLATIONS
To evaluate the design of our method, we independently varied a number of the design decisions: the choice of the model, the γ parameter and the length of PPO rollouts.
The results for 7 experimental conﬁgurations are summarized in the Table 1.
Models.
To assess the model choice, we evaluated the following models: deterministic, deterministic recurrent, and stochastic discrete (see Section 4).
Based on Table 1 it can be seen that our proposed stochastic discrete model performs best.
Figures 7a and 7b show the role of stochasticity and recurrence.
Steps.
See Figure 7d.
As described in Section 5 every N steps we reinitialize the simulated environment with ground-truth data.
By default we use N = 50 , in some experiments we set N =or N = 100 .
It is clear from the table above and Figure 7d that 100 is a bit worse than either 25 or 50 , likely due to compounding model errors, but this effect is much smaller than the effect of model architecture.
Gamma.
See Figure 8b.
We used the discount factor γ = 0 . 99 unless speciﬁed otherwise.
We see that γ = 0 .
95 is slightly better than other values, and we hypothesize that it is due to better tolerance to model imperfections.
But overall, all three values of γ seem to perform comparably at the same number of steps
Model-based iterations.
The iterative process of training the model, training the policy, and collecting data is crucial for non-trivial tasks where simple random data collection is insufﬁcient.
In the game-by-game analysis, we quantiﬁed the number of games where the best results were obtained in later iterations of training.
In some games, good policies could be learned very early.
While this might have been due simply to the high variability of training, it does suggest the possibility that much faster training – in many fewer than 100k steps – could be obtained in future work with more directed exploration policies.
We leave this question to future work.
In Figure 9 we present the cumulative distribution plot for the (ﬁrst) point during learning when the maximum score for the run was achieved in the main training loop of Algorithm 1.
On Figure 7c we show results for experiments in which the number samples was ﬁxed to be 100K but the number of training loop varied.
We conclude that 15 is beneﬁcial for training.
Long model training Our best results were obtained with much 5 times longer training of the world models, see Figure 8a for comparison with shorter training.
Due to our resources constraints other ablations were made with the short model training setting.
Random starts.
Using short rollouts is crucial to mitigate the compounding errors under the model.
To ensure exploration SimPLe starts rollouts from randomly selected states taken from the real data buffer D. In Figure 9 we present a comparison with an experiment without random starts and rollouts of length 1000 on Seaquest .
These data strongly indicate that ablating random starts substantially deteriorate results.
B Q UALITATIVE A NALYSIS
This section provides a qualitative analysis and case studies of individual games.
We emphasize that we did not adjust the method nor hyperparameters individually for each game, but we provide speciﬁc qualitative analysis to better understand the predictions from the model.
Solved games.
The primary goal of our paper was to use model-based methods to achieve good performance within a modest budget of 100 k interactions.
For two games, Pong and Freeway , our method, SimPLe, was able to achieve the maximum score.
Exploration.
Freeway is a particularly interesting game.
Though simple, it presents a substantial exploration challenge.
The chicken, controlled by the agents, is quite slow to ascend when exploring randomly as it constantly gets bumped down by the cars (see the left video https://goo.gl/YHbKZ6 ).
This makes it very unlikely to fully cross the road and obtain a non-zero reward.
Nevertheless, SimPLe is able to capture such rare events, internalize them into the predictive model and then successfully learn a successful policy.
However, this good performance did not happen on every run.
We conjecture the following scenario in failing cases.
If at early stages the entropy of the policy decayed too rapidly the collected experience stayed limited leading to a poor world model, which was not powerful enough to support exploration (e.g. the chicken disappears when moving to high).
In one of our experiments, we observed that the ﬁnal policy was that the chicken moved up only to the second lane and stayed waiting to be hit by the car and so on so forth.
Pixel-perfect games.
In some cases (for Pong , Freeway , Breakout ) our models were able to predict the future perfectly, down to every pixel.
This property holds for rather short time intervals, we observed episodes lasting up to 50 time-steps.
Extending it to long sequences would be a very exciting research direction.
See videos https://goo.gl/uyfNnW .
Benign errors.
Despite the aforementioned positive examples, accurate models are difﬁcult to acquire for some games, especially at early stages of learning.
However, model-based RL should be tolerant to modest model errors.
Interestingly, in some cases our models differed from the original games in a way that was harmless or only mildly harmful for policy training.
For example, in Bowling and Pong , the ball sometimes splits into two.
While nonphysical, seemingly these errors did not distort much the objective of the game, see Figure 10 and also https://goo.gl/JPi7rB .
In Kung Fu Master our model’s predictions deviate from the real game by spawning a different number of opponents, see Figure 11.
In Crazy Climber we observed the bird appearing earlier in the game.
These cases are probably to be attributed to the stochasticity in the model.
Though not aligned with the true environment, the predicted behaviors are plausible, and the resulting policy can still play the original game.
Failures on hard games.
On some of the games, our models simply failed to produce useful predictions.
We believe that listing such errors may be helpful in designing better training protocols and building better models.
The most common failure was due to the presence of very small but highly relevant objects.
For example, in Atlantis and Battle Zone bullets are so small that they tend to disappear.
Interestingly, Battle Zone has pseudo-3D graphics, which may have added to the difﬁculty.
See videos https://goo.gl/uiccKU .
[Figure] freeway
[Figure]
[Figure]
) Effect of stochasticity
[Figure]
freeway
[Figure]
[Figure]
freeway ms pacman kung fu master crazy climber kangaroo krull pong qbert asterix assault
[Figure]
amidar
[Figure]
frostbite seaquest alien
[Figure]
gopher jamesbond
[Figure]
(a) of extended model
[Figure]
Another interesting example comes from Private Eye in which the agent traverses different scenes, teleporting from one to the other.
We found that our model generally struggled to capture such large global changes.
C A RCHITECTURE DETAILS
The world model is a crucial ingredient of our algorithm.
Therefore the neural-network architecture of the model plays a crucial role.
The high-level overview of the architecture is given in
Section 4 and Figure 2.
We stress that the model is general, not Atari speciﬁc, and we believe it could handle other visual prediction tasks.
The whole model has around 74 M parameters and the inference/backpropagation time is approx.
5 s/ 0 .
7 s respectively, where inference is on batch sizeand backpropagation on batch size 2 , running on NVIDIA Tesla P100.
This gives us around 32 ms per frame from our simulator, in comparison one step of the ALE simulator takes approximately 0 .
4 ms.
Below we give more details of the architecture.
First, the frame prediction network:
Layer
Number of outputs Other details
Input frame denseDownscale convolution kernel 4x4, stride 2x
Downscale convolution kernel 4x4, stride 2x
Downscale convolution kernel 4x4, stride 2x
Downscale convolution kernel 4x4, stride 2x
Downscale convolution kernel 4x4, stride 2x
Downscale convolution kernel 4x4, stride 2x
Action embeddingLatent predictor embeddingLatent predictor LSTMLatent predictor output denseReward predictor hiddenReward predictor output denseMiddle convolution kernel 3x3, stride 1x
Middle convolution kernel 3x3, stride 1x
Upscale transposed convolution kernel 4x4, stride 2x Upscale transposed convolution kernel 4x4, stride 2x
Upscale transposed convolution kernel 4x4, stride 2x Upscale transposed convolution kernel 4x4, stride 2x
Upscale transposed convolution kernel 4x4, stride 2x Upscale transposed convolution kernel 4x4, stride 2x
Output frame denseThe latent inference network, used just during training:
Layer
Number of outputs
Other details
Downscale convolution kernel 8x8, stride 4x
Downscale convolution kernel 8x8, stride 4x
All activation functions are ReLU, except for the layers marked as "output", which have softmax activations, and LSTM internal layers.
In the frame prediction network, the downscale layers are connected to the corresponding upscale layers with residual connections.
All convolution and transposed convolution layers are preceded by dropout 0.15 and followed by layer normalization.
The latent predictor outputs 128 bits sequentially, in chunks of 8.
D N UMERICAL RESULTS
Below we present numerical results of our experiments.
We tested SimPLe on 7 conﬁgurations (see description in Section A).
For each conﬁguration we run 5 experiments.
For the evaluation of the i -th experiments we used the policy given by softmax ( logits ( π i ) /T ) , where π i is the ﬁnal learnt policy in the experiment and T is the temperature parameter.
We found empirically that T = 0 .
5 worked best in most cases.
A tentative explanation is that polices with temperatures smaller than 1 are less stochastic and thus more stable.
However, going down to T = 0 proved to be detrimental in many cases as, possibly, it makes policies more prone to imperfections of models.
In Table 2 we present the mean and standard deviation of the 5 experiments.
We observed that the median behaves rather similarly, which is reported it in Table 4.
In this table we also show maximal scores over 5 runs.
Interestingly, in many cases they turned out to be much higher.
This, we hope, indicates that our methods has a further potential of reaching these higher scores.
Human scores are "Avg. Human" from Table 3 in Pohlen et al.
P ub li s h e d a s a c on f e r e n ce p a p e r a t
I C L
R
[Table]
P ub li s h e d a s a c on f e r e n ce p a p e r a t
I C L
R
[Table]
P ub li s h e d a s a c on f e r e n ce p a p e r a t
I C L
R
[Table]
YarsRevenge
[Table]
[Table]
E B ASELINES OPTIMIZATION
To assess the performance of SimPle we compare it with model-free algorithms.
To make this comparison more reliable we tuned Rainbow in the low data regime.
To this end we run an hyperparameter search over the following parameters from https://github.com/google/dopamine/ blob/master/dopamine/agents/rainbow/rainbow_agent.py :
• update_horizon in {1, 3}, best parameter =• min_replay_history in {500, 5000, 20000}, best parameter =• update_period in {1, 4}, best parameter =• target_update_period {50, 100, 1000, 4000}, best parameter =• replay_scheme in { uniform , prioritized }, best parameter =
prioritized
Each set of hyperparameters was used to train 5 Rainbow agents on the game of Pong untilmillion of interactions with the environment.
Their average performance was used to pick the best hyperparameter set.
For PPO we used the standard set of hyperparameters from https://github.com/openai/ baselines .
F R ESULTS AT DIFFERENT NUMBERS OF INTERACTIONS
[Figure]
[Figure] [Figure]