DEEP REINFORCEMENT LEARNING AGENTS
Year: 2020

Abstract:
As deep reinforcement learning driven by visual perception becomes more widely used there is a growing need to better understand and probe the learned agents. Understanding the decision making process and its relationship to visual inputs can be very valuable to identify problems in learned behavior. However, this topic has been relatively under-explored in the research community. In this work we present a method for synthesizing visual inputs of interest for a trained agent. Such inputs or states could be situations in which specific actions are necessary. Further, critical states in which a very high or a very low reward can be achieved are often interesting to understand the situational awareness of the system as they can correspond to risky states. To this end, we learn a generative model over the state space of the environment and use its latent space to optimize a target function for the state of interest. In our experiments we show that this method can generate insights for a variety of environments and reinforcement learning methods. We explore results in the standard Atari benchmark games as well as in an autonomous driving simulator. Based on the efficiency with which we have been able to identify behavioural weaknesses with this technique, we believe this general approach could serve as an important tool for AI safety applications.

heading: 1 INTRODUCTION
text: Humans can naturally learn and perform well at a wide variety of tasks, driven by instinct and practice; more importantly, they are able to justify why they would take a certain action. Artificial agents should be equipped with the same capability, so that their decision making process is interpretable by researchers. Following the enormous success of deep learning in various domains, such as the application of convolutional neural networks (CNNs) to computer vision (LeCun et al., 1998; Krizhevsky et al., 2012; Long et al., 2015; Ren et al., 2015), a need for understanding and analyzing the trained models has arisen. Several such methods have been proposed and work well in this domain, for example for image classification (Simonyan et al., 2013; Zeiler & Fergus, 2014; Fong & Vedaldi, 2017), sequential models (Karpathy et al., 2016) or through attention (Xu et al., 2015).
Deep reinforcement learning (RL) agents also use CNNs to gain perception and learn policies directly from image sequences. However, little work has been so far done in analyzing RL networks. We found that directly applying common visualization techniques to RL agents often leads to poor results. In this paper, we present a novel technique to generate insightful visualizations for pre-trained agents.
Currently, the generalization capability of an agent is—in the best case—evaluated on a validation set of scenarios. However, this means that this validation set has to be carefully crafted to encompass as many potential failure cases as possible. As an example, consider the case of a self-driving agent, where it is near impossible to exhaustively model all interactions of the agent with other drivers, pedestrians, cyclists, weather conditions, even in simulation. Our goal is to extrapolate from the training scenes to novel states that induce a specified behavior in the agent.
In our work, we learn a generative model of the environment as an input to the agent. This allows us to probe the agent’s behavior in novel states created by an optimization scheme to induce specific
actions in the agent. For example we could optimize for states in which the agent sees the only option as being to slam on the brakes; or states in which the agent expects to score exceptionally low. Visualizing such states allows to observe the agent’s interaction with the environment in critical scenarios to understand its shortcomings. Furthermore, it is possible to generate states based on an objective function specified by the user. Lastly, our method does not affect and does not depend on the training of the agent and thus is applicable to a wide variety of reinforcement learning algorithms.
Our contributions are:
1. We introduce a series of objectives to quantify different forms of interestingness and danger of states for RL agents.
2. We evaluate our algorithm on 50 Atari games and a driving simulator, and compare performance across three different reinforcement learning algorithms.
3. We quantitatively evaluate parts of our model in a comprehensive loss study (Tab. 1) and analyze generalization though a pixel level analysis of synthesized unseen states (Tab. 2).
4. An extensive supplement shows additional comprehensive visualizations on 50 Atari games.
We will describe our method before we will discuss relevant related work from the literature.

heading: 2 METHODS
text: We will first introduce the notation and definitions that will be used through out the remainder of the paper. We formulate the reinforcement learning problem as a discounted, infinite horizon Markov decision process (S,A, γ, P, r), where at every time step t the agent finds itself in a state st ∈ S and chooses an action at ∈ A following its policy πθ(a|st). Then the environment transitions from state st to state st+1 given the model P (st+1|st, at). Our goal is to visualize RL agents given a user-defined objective function, without adding constraints on the optimization process of the agent itself, i.e. assuming that we are given a previously trained agent with fixed parameters θ.
We approach visualization via a generative model over the state space S and synthesize states that lead to an interesting, user-specified behavior of the agent. This could be, for instance, states in which the agent expresses high uncertainty regarding which action to take or states in which it sees no good way out. This approach is fundamentally different than saliency-based methods as they always need an input for the test-set on which the saliency maps can be computed. The generative model constrains the optimization of states to induce specific agent behavior.

heading: 2.1 STATE MODEL
text: Often in feature visualization for CNNs, an image is optimized starting from random noise. However, we found this formulation too unconstrained, often ending up in local minima or fooling examples (Figure 3a). To constrain the optimization problem we learn a generative model on a set S of states generated by the given agent that is acting in the environment. The model is inspired by variational autoencoders (VAEs) (Kingma & Welling, 2013) and consists of an encoder f(s) = (fµ(s), fσ(s)) ∈ R2×n that maps inputs to a Gaussian distribution in latent space and a decoder g(z(s)) = ŝ that reconstructs the input. z(s) = fµ(s) + fσ(s) is a sample from the predicted distribution, that is obtained via the reparametrization trick, where is sampled from N (0, In). The training of our generator has three objectives. First, we want the generated samples to be close to the manifold of valid states s. To avoid fooling examples, the samples should also induce correct behavior in the agent and lastly, sampling states needs to be efficient. We encode these goals in three corresponding loss terms. L(s) = Lp(s) + ηLa(s) +KL( f(s), N (0, In) ), (1) The role of Lp(s) is to ensure that the reconstruction g(z(s)) is close to the input s such that ‖ g(z(s))− s ‖22 is minimized. We observe that in the typical reinforcement learning benchmarks, such as Atari games, small details—e.g. the ball in Pong or Breakout—are often critical for the decision making of the agent. However, a typical VAE model tends to yield blurry samples that are not able to capture such details. To address this issue, we model the reconstruction error Lp(s) with an attentive loss term, which leverages the saliency of the agent to put focus on critical regions of the
reconstruction. The saliency maps are computed by guided backpropagation of the policy’s gradient with respect to the state.
Lp(s) = d∑ i=1 (g(z(s))i − si)2 |∇π(s)i|∑d j=1 | ∇π(s)j | , (2)
where i and j iterate over all d pixels in the image/gradient. As discussed earlier, gradient based reconstruction methods might not be ideal for explaining a CNN’s reasoning process (Kindermans et al., 2017a). Here however, we only use it to focus the reconstruction on salient regions of the agent and do not use it to explain the agent’s behavior for which these methods are ideally suited. This approach puts emphasis on details (salient regions) when training the generative model.
Since we are interested in the actions of the agent on synthesized states, the second objective La(s) is used to model the perception of the agent:
La(s) = ‖A(s)−A( g(z(s)) ) ‖22, (3)
where A is a generic formulation of the output of the agent. For a DQN for example, π(s) = maxaA(s)a, i.e. the final action is the one with the maximal Q-value. This term encourages the reconstructions to be interpreted by the agent the same way as the original inputs s. The last term KL( f(s),N (0, In) ) ensures that the distribution predicted by the encoder f stays close to a Gaussian distribution. This allows us to initialize the optimization with a reasonable random vector later and forms the basis of a regularizer. Thus, after training, the model approximates the distribution of states p(s) by sampling z directly from N (0, In). The generative model (f and g) is trained with (1). We will then use the generator inside an optimization scheme to generate state samples that satisfy a user defined target objective.

heading: 2.2 SAMPLING STATES OF INTEREST
text: Training a generator with the objective function of Equation 1 allows us to sample states that are not only visually close to the real ones, but which the agent can also interpret and act upon as if they were states from a real environment.
We can further exploit this property and formulate an energy optimization scheme to generate samples that satisfy a specified objective. The energy operates on the latent space x = (xµ, xσ) of the generator and is defined as the sum of a target function T on agent’s policy and a regularizer R
E(x) = T (π( g(xµ + xσ ) ) + αR(x). (4)
The target function can be defined freely by the user and depends on the agent that is being visualized. For a DQN, one could for example define T as the Q-value of a certain action, e.g. pressing the brakes of a car. In section 2.3, we show several examples of targets that are interesting to analyze. The regularizer R can again be chosen as the KL divergence between x and the normal distribution:
R(x) = KL(x,N (0, In) ), (5)
forcing the samples that are drawn from the distribution x to be close to the Gaussian distribution that the generator was trained with. We can optimize equation 4 with gradient descent on x as detailed in algorithm 1.

heading: 2.3 TARGET FUNCTIONS
text: Depending on the agent, one can define several interesting target functions T – we present and explore seven below, which we refer to as: T+, T−, T±, S+, S−, and action maximization. For a DQN the previously discussed action maximization is interesting to find situations in which the agent assigns a high value to a certain action e.g. Tleft(s) = −Aleft(s). Other states of interest are those to which the agent assigns a low (or high) value for all possible actions A(s) = q = (q1, . . . , qm). Consequently, one can optimize towards a low Q-value for the highest valued action with the following objective:
T−(q) =
∑m i=1 qie
βqi∑m k=1 e βqk , (6)
Algorithm 1 Optimize x for target T 1: Input: Target objective T , step size λ, regularizer weight α, trained generator g 2: Output: x 3: xµ ← 0 4: xσ ← In 5: while not converged do 6: ← sample from N (0, In) 7: z ← xµ + xσ . sample z from x 8: s← g(z) . generate state s using g 9: xµ ← xµ − λ ∂∂xµ (T (π(s)) + αR(x)) . gradient step using (4) and (5) 10: xσ ← xσ − λ ∂∂xσ (T (π(s)) + αR(x)) 11: end while
(a) Kung Fu Master - T± enemies on both sides (b) Kung Fu Master - T+ easy, many points to score (c) Kung Fu Master - T− no enemies
(d) Pong - T+ scoring a point (e) Space Invaders - T+ shooting an enemy (f) Enduro - T+ overtaking an opponent
(g) Name This Game - T± whether to refill air (h) Seaquest - T− out of oxygen (i) Beamrider - Tleft avoiding the enemy
Figure 1: Qualitative Results: Visualization of different target functions (Sec. 2.3). T+ generates high reward and T− low reward states; T± generates states in which one action is highly beneficial and another is bad. For a long list of results, with over 50 Atari games, please see the appendix.
where β > 0 controls the sharpness of the soft maximum formulation. Analogously, one can maximize the lowest Q-value with T+(q) = −T−(−q). We can also optimize for interesting situations in which one action is of very high value and another is of very low value by defining
T±(q) = T−(q)− T+(q). (7)
Finally, we can optimize for overall good states with S+(q) = ∑m i=1 qi and overall bad states with S− = S−(−q).

heading: 3 RELATED WORK
text: We divide prior work into two parts. First we discuss the large body of visualization techniques developed primarily for image recognition, followed by related efforts in reinforcement learning.

heading: 3.1 FEATURE VISUALIZATION
text: In the field of computer vision, there is a growing body of literature on visualizing features and neuron activations of CNNs. As outlined in (Grün et al., 2016), we differentiate between saliency methods, that highlight decision-relevant regions given an input image, methods that synthesize an image (pre-image) that fulfills a certain criterion, such as activation maximization (Erhan et al., 2009) or input reconstruction, and methods that are perturbation-based, i.e. they quantify how input modification affects the output of the model.

heading: 3.1.1 SALIENCY METHODS
text: Saliency methods use the gradient of a prediction at the input image to estimate importance of pixels. Following gradient magnitude heatmaps (Simonyan et al., 2013) and class activation mapping (Zhou et al., 2016), more sophisticated methods such as (Mahendran & Vedaldi, 2016; Selvaraju et al., 2016) have been developed (Zintgraf et al., 2017) distinguish between regions in favor and regions speaking against the current prediction. (Sundararajan et al., 2017) distinguish between sensitivity and implementation invariance.
An interesting observation is that such methods seem to generate believable saliency maps even for networks with random weights (Adebayo et al., 2018a). (Kindermans et al., 2017b) show that saliency methods do not produce analytically correct explanations for linear models and further reliability issues are discussed in (Adebayo et al., 2018b; Hooker et al., 2018; Kindermans et al., 2017a).

heading: 3.1.2 PERTURBATION METHODS
text: Perturbation methods modify a given input to understand the importance of individual image regions. (Zeiler & Fergus, 2014) slide an occluding rectangle across the image and measure the change in the prediction, which results in a heatmap of importance for each occluded region. This technique is revisited by (Fong & Vedaldi, 2017) who introduce blurring/noise in the image, instead of a rectangular occluder, and iteratively find a minimal perturbation mask that reduces the classifier’s score, while (Dabkowski & Gal, 2017) train a network for masking salient regions.

heading: 3.1.3 INPUT RECONSTRUCTION
text: As our method synthesizes inputs to the agent, the most closely related work includes input reconstruction techniques. (Long et al., 2014) reconstruct an image from nearest neighbor patches in feature space. (Mahendran & Vedaldi, 2015) propose to reconstruct images by inverting CNN representations, while (Dosovitskiy & Brox, 2015) learn to reconstruct the input from its encoding.
When maximizing the activation of a specific class or neuron, regularization is crucial because the optimization procedure—starting from a random noise image and maximizing an output—is vastly under-constrained and often tends to generate fooling examples that fall outside the manifold of realistic images (Nguyen et al., 2015). In (Mahendran & Vedaldi, 2016) total variation (TV) is used for regularization, while (Baust et al., 2018) propose an update scheme based on Sobolev gradients. In (Nguyen et al., 2015) Gaussian filters are used to blur the pre-image or the update computed in every iteration. Since there are usually multiple input families that excite a neuron, (Nguyen et al., 2016c) propose an optimization scheme for the distillation of these clusters. More variations of regularization can be found in (Olah et al., 2017; 2018). Instead of regularization, (Nguyen et al., 2016a;b) use a denoising autoencoder to reconstruct pre-images for image classification.

heading: 3.2 EXPLANATIONS FOR REINFORCEMENT LEARNING
text: In deep reinforcement learning however, feature visualization is to date relatively unexplored. (Zahavy et al., 2016) apply t-SNE (Maaten & Hinton, 2008) on the last layer of a deep Q-network (DQN) to cluster states of behavior of the agent. (Mnih et al., 2016) also use t-SNE embeddings for visualization, while (Greydanus et al., 2017) examine how the current state affects the policy in a vision-based approach using saliency methods. (Wang et al., 2016) use saliency methods from (Simonyan et al., 2013) to visualize the value and advantage function of their dueling Q-network. (Huang et al., 2018) finds critical states of an agent based on the entropy of the output of a policy. (Uesato et al., 2018) adversarially search for initial states of the agent and environment that make it fail. Interestingly, we could not find prior work using activation maximization methods for visualization. In our experiments we show that the typical methods fail in the case of RL networks and generate images far outside the manifold of valid game states, even with all typical forms of regularization. This is additionaly motivated by the insight that agents are vulnerable to adversarial states and can be manipulated even by other agents in the environment (Gleave et al., 2019).

heading: 4 EXPERIMENTS
text: In this section we thoroughly evaluate and analyze our method on Atari games (Bellemare et al., 2013) using the OpenAI Gym (Brockman et al., 2016) and a driving simulator. We present qualitative results for three different reinforcement learning algorithms, show examples on how the method helps finding flaws in an agent, analyze the loss contributions and compare to previous techniques.

heading: 4.1 IMPLEMENTATION DETAILS
text: In all our experiments we use the same factors to balance the loss terms in Equation 6: λ = 10−4 for the KL divergence and η = 10−3 for the agent perception loss. The generator is trained on 10, 000 frames (using the agent and an -greedy policy with = 0.1). Optimization is done with Adam (Kingma & Ba, 2015) with a learning rate of 10−3 and a batch size of 16 for 2000 epochs. Training takes approximately four hours on a Titan Xp. Our generator uses a latent space of 100 dimensions, and consists of four encoder stages comprised of a 3 × 3 convolution with stride 2, batch-normalization (Ioffe & Szegedy, 2015) and ReLU layer. The starting number of filters is 32 and is doubled at every stage. A fully connected layer is used for mean and log-variance prediction. Decoding is inversely symmetric to encoding, using deconvolutions and halving the number of channels at each of the four steps.
For the experiments on the Atari games we train a double DQN (Wang et al., 2016) for two million steps with a reward discount factor of 0.95. The input size is 84× 84 pixels. Therefore, our generator performs up-sampling by factors of 2, up to a 128 × 128 output, which is then center cropped to 84× 84 pixels. The agents are trained on grayscale images, for better visual quality however, our
generator is trained with color frames and convert to grayscale using a differentiable, weighted sum of the color channels. In the interest of reproducibility we will make the visualization code available.

heading: 4.2 VISUALIZATIONS ON ATARI GAMES
text: In Figure 1, we show qualitative results from various Atari games using different target functions T , as described in Section 2.3. From these images we can validate that the general visualizations that are obtained from the method are of good quality and can be interpreted by a human. T+ generates generally high value states independent of a specific action (first row of Figure 1), while T− generates low reward situations, such as close before losing the game in Seaquest (Figure 1.e) or when there are no points to score (Figure 1.i). Critical situations can be found by maximizing the difference between lowest and highest estimated Q-value with T±. In those cases, there is clearly a right and a wrong action to take. In Name This Game (Figure 1.d) this occurs when close to the air refill pipe, which prevents suffocating under water; in Kung Fu Master when there are enemies coming from both sides (Figure 1.g), the order of attack is critical, especially since the health of the agent is low (yellow/blue bar on top). An example of maximizing the value of a single action (similar to maximizing the confidence of a class when visualizing image classification CNNs) can be seen in (Figure 1.f) where the agent sees moving left and avoiding the enemy as the best choice of action.
4.3 ACKTR
To show that this visualization technique generalizes over different RL algorithms, we also visualize ACKTR (Wu et al., 2017). We use the code and pretrained RL models from a public repository (Kostrikov, 2018) and train our generative model with the same hyperparameters as above and without any modifications on the agent. We present the T± objective for the ACKTR agent in Figure 4 to visualize states with both high and low rewards, for example low oxygen (surviving vs. suffocating) or close proximity to enemies (earning points vs. dying).
Compared to the DQN visualizations the ACKTR visualizations, are almost identical in terms of image quality and interpretability. This supports the notion that our proposed approach is independent of the specific RL algorithm.

heading: 4.4 INTERPRETATION OF VISUALIZATIONS
text: Analyzing the visualizations on Seaquest, we make an interesting observation. When maximizing the Q-value for the actions, in many samples we see a low or very low oxygen meter. In these cases the submarine would need to ascend to the surface to avoid suffocation. Although the up action is the only sensible choice in this case, we also obtain visualized low oxygen states for all other actions. This implies that the agent has not understood the importance of resurfacing when the oxygen is low. We then run several roll outs of the agent and see that the major cause of death is indeed suffocation and not collision with enemies. This shows the impact of visualization, as we are able to understand a flaw of the agent. Although it would be possible to identify this flawed behavior directly by analyzing the 10, 000 frames of training data for our generator, it is significantly easier to review a handful of samples from our method. Further, as the generator is a generative model, we can synthesize states that are not part of its training set.

heading: 4.5 ABLATION STUDIES (LOSS TERMS)
text: In this section we analyze the three loss terms of our generative model. The human perceptual loss is weighted by the (guided) gradient magnitude of the agent in Equation 2. In Figure 2 we visualize this mask for a DQN agent for random frames from the dataset. The masks are blurred with an averaging filter of kernel size 5. We observe that guided backpropagation results in precise saliency maps focusing on player and enemies that then focus the reconstructions on what is important for the agent.
To study the influence of the loss terms we perform an experiment in which we evaluate the agent not on the real frames but on their reconstructions. If the reconstructed frames are perfect, the agent with generator goggles achieves the same score as the original agent. We can use this metric to understand the quantitative influence of the loss terms. In Pong, the ball is the most important visual aspect of the game for decision making.
In Table 1 we see that the VAE baseline scores much lower than our model. This can be explained as follows. Since the ball is very small, it is mostly ignored by the reconstruction loss of a VAE. The contribution of one pixel to the overall loss is negligible and the VAE never focuses on reconstructing the important part of the image. Our formulation is built to regain the original performance of the agent, by reweighing the loss on perceptually salient regions of the agent. Overall, we see that our method always improves over the baseline but does not always match the original performance.

heading: 4.6 COMPARISON WITH ACTIVATION MAXIMIZATION
text: For image classification tasks, activation maximization works well when optimizing the pre-image directly (Mahendran & Vedaldi, 2015; Baust et al., 2018). However we find that for reinforcement learning, the features learned by the network are not complex enough to reconstruct meaningful pre-images, even with sophisticated regularization techniques. The pre-image converges to a fooling example maximizing the class but being far away from the manifold of states of the environment.
In Figure 3.a we compare our results with the reconstructions generated using the method of (Baust et al., 2018) for a DQN agent. We obtain similarly bad pre-images with TV-regularization (Mahendran & Vedaldi, 2016), Gaussian blurring (Nguyen et al., 2015) and other regularization tricks such as random jitter, rotations, scaling and cropping (Olah et al., 2017). This shows that it is not possible to directly apply common techniques for visualizing RL agents and explains why a learned regularization from our generator is needed to produce meaningful examples.

heading: 4.7 EXPERIMENTS WITH A DRIVING SIMULATOR
text: Driving a car is a continuous control task set within a much more complex environment than Atari games. To explore the behavior of our proposed technique in this setting we have created a 3D driving simulation environment and trained an A2C agent maximizing speed while avoiding pedestrians that are crossing the road.
In our first set of experiments we trained an A2C agent to maximize speed while avoiding swerving and pedestrians that are crossing the road. The input to the agent are eight temporal frames comprised of depth, semantic segmentation and a gray-scale image (Figure 5). With this experiment we visualize three random samples for two target functions. The moving car and person categories, appear most prominently when probing the agent for the break action. However, we are also able to identify a
(a) SeaQuest visualization
T±.
(b) Closest training frame
(L2).
(c) Closest training frame
(T±).
Figure 7: Generating novel states. We show a frame generated by our method under the T± objective and retrieve the closest frame from the training set using L2 distance and the objective function. Both frames are very different, showing that the method is able to generate novel states. For a quantitative evaluation, please see Tab. 2.
flaw: unnecessary braking on empty roads as shown in the left most image of the right most block of three frames. Inappropriate breaking is a well known issue in this problem domain.
In a second set of experiments, we use our simulator to build two custom environments and validate that we can identify problematic behavior in the agent. The agent is trained with four temporal semantic segmentation frames (128 × 128 pixels) as input (Figure 6). We train the agent in a “reasonable pedestrians” environment, where pedestrians cross the road carefully, when no car is coming or at traffic lights. With these choices, we model data collected in the real world, where it is unlikely that people unexpectedly run in front of the car. We visualize states in which the agent expects a low future return (T− objective) in Figure 6. It shows that the agent is aware of other cars, traffic lights and intersections. However, there are no generated states in which the car is about to collide with a person, meaning that the agent does not recognize the criticality of pedestrians. To verify our suspicion, we test this agent in a “distracted pedestrians” environment where people cross the road looking at their phones without paying attention to approaching cars. We find that the agent does indeed run over humans. With this experiment, we show that our visualization technique can identify biases in the training data just by critically analyzing the sampled frames.

heading: 4.8 NOVEL STATES
text: To be able to generate novel states is useful, since it allows the method to model new scenarios that were not accounted for during training of the agent. This allows the user to identify potential problems without the need to include every possible permutation of situations in the simulator or real-world data collection.
While one could simply examine the experience replay buffer to find scenarios of interest, our approach allows unseen scenarios to be synthesized. To quantitatively evaluate the assertion that our generator is capable of generating novel states, we sample states and compare them to their closest frame in the training set under an MSE metric. We count a pixel as different if the relative difference in a channel exceeds 25% and report the histogram in Table 2. The results show that there are very few samples that are very close to the training data. On average a generated state is different in 25% of the pixels, which is high, considering the overall common layout of the road, buildings and sky.
We examine these results visually for Atari SeaQuest in Fig. 7, where we show a generated frame and the L2-closest frame from the training set additional to the closest frame in the training set based on the objective function. Retrieval with L2 is, as usual not very meaningful on images since the actual interesting parts of the images are dominated by the background. Thus we have also included a retrieval experiment based on the objective score which shows the submarine in a similar gameplay situation but with different enemy locations. The results in Tab. 2 and Fig. 7 confirm that the method is able to generate unseen states and does not overfit to the training set.
To understand whether one could simply sample states from the replay buffer or a validation set, we compare the distribution of the target function values in Fig. 8 (on the example of the “Boxing” environment). It is clear that our method is able to generate states with a much more targeted distribution towards the objective. In all three cases, we are even able to generate states that score higher target values than any state in the validation set. This confirms that we are able to generate targeted and novel critical states and thus cannot be obtained from the validation set alone.

heading: 5 DISCUSSION AND CONCLUSIONS
text: We have presented a method to synthesize inputs to deep reinforcement learning agents based on generative modeling of the environment and user-defined objective functions. The agent perception loss helps the reconstructions to focus on regions of the current state that are important to the agent and avoid generating fooling examples. Training the generator to produce states that the agent perceives as those from the real environment enables optimizing its latent space to sample states of interest. Please consult the appendix for more extensive visualization experiments.
We believe that understanding and visualizing agent behavior in safety critical situations is a crucial step towards creating safer and more robust agents using reinforcement learning. We have found that the methods explored here can indeed help accelerate the detection of problematic situations for a given learned agent. For our car simulation experiments we have focused upon the identification of weaknesses in constructed scenarios; however, we see great potential to apply these techniques to much more complex simulation environments with less obvious safety critical weaknesses.

heading: ACKNOWLEDGMENTS
text: We would like to thank Iro Laina, Alexandre Piché, Simon Ramstedt, Evan Racah and Adrien Ali Taiga for helpful discussions and proofreading. We thank the Open Philanthropy project for supporting C.R. while he was an intern at Mila, where this work began.

Review summaries:
This paper proposes a generative technique to sample "interesting" states useful for analyzing the behavior of deep reinforcement learning agents. In this context, the concept of "interesting" is defined via user-specific target functions, e.g. states that arise as a consequence of taking specific actions (such as actions associated with high or low Q-values for example). The approach is evaluated in the Atari domain and in an autonomous driving simulator. Results are mainly presented as visualizations of interesting states that are described verbally.

This paper proposes a new visualization tool in order to understand the behavior of agents trained using deep RL. Specifically, they train a generative model of game states, and then optimize an energy-based distribution over state embeddings according to some target function, and then by sampling from the resulting distribution they create a diverse set of realistic states that score highly according to the target function. They propose a few target cost functions, which allow them to optimize for states in which the agent takes a particular action, states which are high reward (worst Q-value is large), states which are low reward (best Q-value is small), and critical states. They demonstrate results on Atari games as well as a simulated driving environment.