Deep Reinforcement Learning for Doom using Unsupervised Auxiliary Tasks
Recent developments in deep reinforcement learning have enabled the creation of agents for solving a large variety of games given a visual input. These methods have been proven successful for 2D games, like the Atari games, or for simple tasks, like navigating in mazes. It is still an open question, how to address more complex environments, in which the reward is sparse and the state space is huge. In this paper we propose a divide and conquer deep reinforcement learning solution and we test our agent in the first person shooter (FPS) game of Doom. Our work is based on previous works in deep reinforcement learning and in Doom agents. We also present how our agent is able to perform better in unknown environments compared to a state of the art reinforcement learning algorithm.
Recent advances in deep learning enabled the combination of neural networks and reinforcement learning. The first successful work in deep reinforcement learning Mnih et al. , was a Q-learning agent in which the state action value function was approximated by a deep network. In order to increase the performance and the stability of the agent, an experience replay buffer was proposed. This agent was able to achieve superhuman results in a large number of Atari games.
Despite the large success of this work, it could only be used with off-policy learning algorithms. This drawback was overcome by the introduction of an asynchronous framework Mnih et al.  in reinforcement learning. This development enabled the combination of deep networks and on-policy algorithms, and resulted in the removal of the experience buffer. Additionally, the new agents were much more stable and their performance increased compared to previous works. As a result, deep reinforcement learning was able to perform decently in more complex environments, like 3D mazes.
The huge success of deep reinforcement learning resulted in an increased interest of the research community for various applications. One interesting research question is how to improve the existing algorithms in order to be able to successfully act in more complex environments like Doom, Starcraft, etc. These environments are much more complex, with a large set of states and sparse rewards. This results in a lack of a standard procedure in order to address such tasks, despite the fact that there were many successful applications of deep reinforcement learning the recent years.
This paper is focused on the creation of an agent using state of the art deep reinforcement algorithms. Additionally, inspired from previous works we propose a specific solution for the game of Doom based on three unsupervised auxiliary tasks; the value function replay, the reward prediction and the pixel control.
The structure of the paper is as follows: in section II we discuss the theoretical background around deep reinforcement learning, while in section III we refer to major works in agents for the game of Doom. In section IV we introduce our agent and in section V we perform an experimental evaluation. Finally, in section VI we conclude our work and discuss future research directions.
Ii Theoretical background
Ii-a Reinforcement Learning and the Actor-Critic Algorithm
A decision making problem can be defined as a Markov Decision Process (MDP), which is described from the tuple , where is the set of states, is the set of actions, is the reward function and is the transition function. We define the policy function, which is the function that decides the action based on the state . In every MDP, given a policy , we define the state value function as the expected sum of discounted rewards from the current state until the end of the episode , where is called discount factor and takes values between and . The goal of reinforcement learning is to compute the policy function that maximizes the expected sum of discounted rewards . In our work, we use the actor-critic Konda et al.  algorithm in order to compute the policy of our agent. Using the policy gradient theorem and the definition of the state value function , we can compute the parameters of the policy function by minimizing the error below.
For the approximation of the state value function we will minimize the standard TD error:
For the approximation of the policy and the state value function we will use the deep architecture that was proposed by Mnih et al. . The policy and the state value networks share all the layers except the output layer; the policy output layer is a softmax function and the state value output layer is liner with one node.
Ii-B Asynchronous framework
The asynchronous framework was proposed by Mnih et al.  in order to combine on-policy algorithms with deep learning. There is a global neural network which is responsible for learning the policy and the state value function. Furthermore, it creates a number of parallel processes and each process has a copy of the global network and interacts with the environment independently from the other processes. After a given number of (local) steps each process updates asynchronously the weights of the global network. The combination of actor-critic and the asynchronous framework resulted in the asynchronous advantage actor-critic (a3c) (Mnih et al. ). The a3c algorithms led not only to better results in a plethora of environments but also significantly reduced the training steps.
Ii-C Unsupervised auxiliary tasks
The unsupervised auxiliary tasks were used in combination with a3c algorithm (Jaderberg et al. ) in order to enhance the learning ability of the neural network that was used for the policy approximation. In order to use the auxiliary tasks, an experience replay buffer is included. In this work we used three auxiliary tasks, which are described below:
Value function replay: We uniformly sample from the experience replay and we update again the state value function using the temporal difference error:.
Reward prediction: In the deep network, which is responsible for the policy and the value function approximation, we add one more softmax output. This output predicts the sign of the reward based on the last three frames. As a result there are three output nodes; one for zero reward, one for positive reward and one for negative reward. In order to avoid the class imbalance problem, we sample from the experience replay in a way that ensures that half of the samples have zero reward and the rest of them have negative or positive reward.
Pixel change: In the deep network, a deconvolutional layer is added. This layer is responsible for encouraging the agent to maximize the difference between two consecutive frames, due to the fact that changes in the sensory input many times lead to rewarding events. For this purpose, we consider a pseudo-reward - the absolute difference between two consecutive frames - and we maximize it using the Peng et al.  n-step Q-learning algorithm.
Iii Relevant work
Recently, there has been a great number of works trying to address the problem of visual Doom. Wu et al.  used a3c and curriculum learning in order to create a Doom agent. Lample et al.  used a divide and conquer method in order to divide the action space. Then, they trained one agent for firing at the enemy monsters, the action agent, and one agent for navigating in the mazes of the game, the navigation agent. In order to decide, which agent had to act at each timestep they tried to detect if there is an enemy monster in the current frame. If an enemy exists, the action agent will act, otherwise the navigation agent will act. In the next section, we will discuss our method, which is based on Lample et al.  method, using a different way in order to determine which agent is going to act at each timestep.
In our work, we used a similar approach as Lample et al. . We separated the action space and we trained an agent for firing at the enemy monsters and one for navigating in the complex mazes and gathering objects. Additionally, from the set of the available moves we only kept five (5) for the action agent (FIRE, MOVE_FORWARD, TURN_RIGHT, TURN_LEFT, MOVE_BACKWARD) and three (3) for the navigation agent (MOVE_FORWARD, TURN_RIGHT, TURN_LEFT). This is the minimum set of necessary actions for our agent. By reducing the number of actions, we significantly reduce the complexity of our system and the algorithms converge faster to a good policy. Both agents are trained using the UNREAL (Jaderberg et al. ) algorithm, which is the combination of the a3c and the auxiliary tasks.
We used the same architecture that was proposed by Jaderberg et al. . The input is a RGB image with dimensions . The network has two convolutional layers with 16 filters and 32 filters respectively. After the convolutional layers, a fully connected layer with 256 nodes is connected. All three layers use ReLU for activation function. Finally, the last hidden layer is a LSTM with 256 nodes and it is unrolled for 20 steps. The policy output is a softmax function, while the state value output is a linear function. At the output of the second convolutional layer we add a fully connected layer with 3 softmax output nodes. This layer is responsible for the reward prediction auxiliary task. For the pixel change task we connect a ReLU fully connected layer and a deconvolutional layer in the output of the LSTM.
The agents try to minimize the cumulative error of the individual components; the policy error , the value function error , the value function replay error , the reward prediction error and the pixel change error . In order to minimize the error below we used a shared RMSProp optimizer (Mnih et al. ).
We used the Vizdoom (Kempka et al. ) platform for training and evaluating our agents. This platform provides a large number of environments and game settings for training reinforcement learning agents based on visual input. The platform allows to shape the reward of the environment. This is necessary in order to efficiently train our agents. Without the reward shaping it would be impossible to train our agents due to the sparse reward of the environment. The reward shaping for the action and the navigation agent can be seen in the table below:
|Agent||kill||death||missed shoot||lost health||object gathered|
Having defined our action and our navigation agent, we now have to decide which agent is going to act given a frame. For this purpose, we will use one of the auxiliary tasks of the navigation agent; the reward prediction. From the table I, we can understand that the navigation agent receives a negative reward only when it loses health or it is killed. From this we can conclude that there is an enemy close to our agent when it receives a negative reward. As a result, when there is a prediction for negative reward from the navigation agents, there is an enemy in the given frame. Otherwise, there is a prediction for zero or positive reward. Experimentally, the combined agent performs better if the action agent acts when there is a prediction for positive reward. Therefore, if there is a prediction for positive or negative reward, the action agent will act, otherwise the navigation agent will act.
Below you can find the experimental setup and the results both for training and testing.
V-a Experimental setup for training the agents
We train both action and navigation agents using eight (8) parallel threads on four (4) different Doom maps. As a result two (2) actor learner threads are trained for each one of the four (4) maps. In order to increase the learning capacity of our agents, we trained both of them in environments with dense rewards for 80 million global steps. Thus, the action agent was trained in environments that have a large number of enemy monsters, while the navigation agent was trained in environments that have a plethora of objects to pick up.
We need to formally define a set of measurements in order to evaluate our work. Since the reward that the agent receives from the game is based on a variety of the game’s feature, we considered the following measurements: The goal of the action agent is to maximize the number of kills, while minimizing the number of deaths. Similarly, the goal of navigation agent is to maximize the number of objects it picks up, while minimizing the number of deaths. In the Figures 2 and 3, one can find the the object-death ratio and the kill-death ratio for the navigation and the action agent respectively.
V-B Experimental setup for testing the agents
After evaluating our agents during their training, we tested the action agent and the combined agent both in known and unknown environments. We evaluated both agents in the four (4) maps that were used for training and two (2) unknown map. In the known maps, we severely decreased the number of enemy monsters compared to those that were used for training. The testing episode duration is 15 minutes in the known maps and in the second unknown map. In the first unknown map the episode terminates when the agent is killed. You can find the results in the table below:
|Action agent||Combined agent|
From Table II, it can be observed that the combined agent performs better than the action agent in the unknown environments. In the known environments the action agent tends to perform better than the combined agent in kills and deaths statistics. This is not surprising due to the fact that the action agent is trained in these environment in order to act independently. Finally, it is clear that the combined agent gathered far more objects than the action agent. This happened because the primary goal of the action agent is to fire at the enemy monsters, while the combined agent aims both for firing at the enemy monsters and for gathering objects.
After presenting our results we evaluated their statistical significance due to the fact that Doom environments are stochastic with high variation. We performed t-tests between the values of the combined and the action agent for all the evaluation metrics in all six environments. Their p-values are depicted in the following table. Generally speaking, we can conclude that our results are statistical significant with 95% confidence (p-value below 0.05).
Vi Discussion and future work
In this work, we proposed a system (agent) for learning to efficiently play the game of Doom. Our agent, uses a divide and conquer method based on Lample et al.  and a deep architecture for reinforcement learning based on Jaderberg et al. . Lample et al.  method requires high-level informations from the environment in order to be used, like the existence or not of an enemy or an object in a frame. Our method requires only the reward signal.
In the future, we would like to evaluate how the divide and conquer method could be applied in other similar tasks. Additionally, we consider that the unsupervised auxiliary tasks are an interesting method, both for enhancing the learning capabilities of the agent and for learning features of the trained system. As a result, we are confident that the divide and conquer method combined with the auxiliary tasks could solve a variety of problems.
-  Mnih, Volodymyr and Kavukcuoglu, Koray and Silver, David and Graves, Alex and Antonoglou, Ioannis and Wierstra, Daan and Riedmiller, Martin, “Playing atari with deep reinforcement learning,” In NIPS Deep Learning Workshop. 2013.
-  Mnih, Volodymyr, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. “Asynchronous methods for deep reinforcement learning.” In International Conference on Machine Learning, pp. 1928-1937. 2016.
-  Konda, Vijay R., and John N. Tsitsiklis. ”Actor-critic algorithms.” In Advances in neural information processing systems, pp. 1008-1014. 2000.
-  Jaderberg, Max, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z. Leibo, David Silver, and Koray Kavukcuoglu. ”Reinforcement learning with unsupervised auxiliary tasks.” arXiv preprint arXiv:1611.05397 (2016).
-  Wu, Yuxin, and Yuandong Tian. ”Training agent for first-person shooter game with actor-critic curriculum learning.” (2016).
-  Peng, Jing, and Ronald J. Williams. ”Incremental multi-step Q-learning.” In Machine Learning Proceedings 1994, pp. 226-232. 1994.
-  Lample, Guillaume, and Devendra Singh Chaplot. ”Playing FPS Games with Deep Reinforcement Learning.” In AAAI, pp. 2140-2146. 2017.
-  Kempka, MichaÅ, Marek Wydmuch, Grzegorz Runc, Jakub Toczek, and Wojciech JaÅkowski. ”Vizdoom: A doom-based ai research platform for visual reinforcement learning.” In Computational Intelligence and Games (CIG), 2016 IEEE Conference on, pp. 1-8. IEEE, 2016.