A Short Survey On Memory Based Reinforcement Learning

04/14/2019 ∙ by Dhruv Ramani, et al. ∙ 0

Reinforcement learning (RL) is a branch of machine learning which is employed to solve various sequential decision making problems without proper supervision. Due to the recent advancement of deep learning, the newly proposed Deep-RL algorithms have been able to perform extremely well in sophisticated high-dimensional environments. However, even after successes in many domains, one of the major challenge in these approaches is the high magnitude of interactions with the environment required for efficient decision making. Seeking inspiration from the brain, this problem can be solved by incorporating instance based learning by biasing the decision making on the memories of high rewarding experiences. This paper reviews various recent reinforcement learning methods which incorporate external memory to solve decision making and a survey of them is presented. We provide an overview of the different methods - along with their advantages and disadvantages, applications and the standard experimentation settings used for memory based models. This review hopes to be a helpful resource to provide key insight of the recent advances in the field and provide help in further future development of it.

READ FULL TEXT VIEW PDF

Authors

page 15

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Reinforcement Learning (RL) (38) involves an agent to learn to take actions based on it’s current situation to maximize a long term reward objective. The actions it takes aren’t labeled for training, and the agent has to learn which action to take by trying them all out and settling for the best one. The action it takes has an affect on both the reward it gets immediately and it’s long term future. This originates from animal learning in psychology and hence it can mimic human learning ability to select actions that maximize long-term profit in their interactions with the environment. This is the reason why RL has been widely used in robotics and autonomous systems.

The recent advancement of deep learning has had a significant impact on many areas in machine learning, improving the state-of-the-art in tasks such as object detection (28), speech recognition (6), and language translation (37)

. The most important property of deep learning is that deep neural networks can automatically find compact low-dimensional representations of high-dimensional data. Deep learning has similarly accelerated progress in RL, with the use of deep neural networks for reinforcement learning tasks, hence defining the field of “deep reinforcement learning”. Deep reinforcement learning involves usage of deep neural networks as a function approximator, thus overcoming the curse of dimensionality. This makes it a promising approach to solving complex real-world problems.

However, even after the rapid advancements in deep reinforcement learning, the standard architectures are still found to be very sample inefficient and slow. In a setting where the agent learns to play arcade games (22), deep reinforcement learning systems require millions of interactions with game emulator, amounting to hundreds of hours of game play to achieve human-level performance, which in turn seems pretty inhuman. Addressing the problems in a greater detail, we find that the slow-gradient based update of neural networks requires these algorithms to incur large number of steps to generalize, improve and assimilate the information for policy improvement. For environments with sparse reward signal, modelling the policy with a neural network becomes even more challenging. The low frequency of guiding signals or rewards can be seen as a form of class imbalance where low-reward samples outnumber high-reward samples. Standard reward propagation approaches such as Q-Learning (45) cause reward information to be propagated one step at a time through history. However, this flow of information can be fairly efficient if updates happen in reverse order in which the transitions occur. Also, approaches like DQN(22) involve random sampling of experience from the replay memory, to train on uncorrelated mini-batches - requiring the usage of a target network which further slows down this propagation.

In order to tackle these shortcomings of the current deep reinforcement learning algorithms, a good idea would be to make decisions based on the experiences which provided high rewards in the past. This involves the agent to be less reflexive according to their immediate perception and make decisions based on the memories it has gathered over an extended time interval. Neither neural network weights, nor activations support storage and retrieval of experiences as the weights change too slowly to store samples as individual experiences. Usage of some variant of recurrent neural networks is common in the partially observable setting

(8), however these have trouble learning over long sequences. Also, these approaches do not involve storage of observations as discrete entities, hence the comparison of the new observation with a detailed instance of a rare highly-rewarding past observation becomes very unclear.

Seeking inspiration from the rapid complementary approach of decision making in the brain (11), there have been various recent attempts that try to incorporate external memory modules which enrich the quality of decisions made by the agent (as per the returns accumulated), and make the learning process faster. In the brain, this form of fast learning is supported by the hippocampus and related medial temporal lobe structures (1; 41). Incorporation of this instance based learning strategy serves as a faster rough approximation over a slow generalized decision making system. The recent advancement of memory networks (47; 35) has attracted a growing amount of interest in the research community to solve the challenging task of designing deep reinforcement learning agents with external memory. In this paper, we provide a review of novel methods which solve this problem. We cover different memory architectures which have been proposed to aid decision making of reinforcement learning agents, different ways in which these proposed architectures are used to solve different sub-problems within reinforcement learning, the environments proposed to test these methods and the applications of these methods.

2 Background

In this paper we consider a sequential decision making setup, in which an agent interacts with an environment

over discrete time steps. We model the reinforcement learning problem using a Markov Decision Process (MDP), unless otherwise specified. A MDP is defined as a tuple,

, where is the state space, is the action space, and is the initial state distribution. At each time step within an episode, the agent observes a state , takes action , receives a reward and transitions to a new state . A reward signal is a scalar defining the desirability of an event. A policy is a mapping from a state to an action .

The agent seeks to maximize the expected discounted return, which is defined as

(1)

In this formulation, is a discount factor that trades-off the importance of immediate and future rewards. The state value function

provides an estimate of the expected amount of the return the agent can accumulate over the future when following a policy

, starting from any particular state . The action value function provides the expected return the agent gets when it starts from any particular state , takes an action and continues to follow the policy .

(2)
(3)

termed as the optimal action value function is the expected value of taking an action in state and then following the optimal policy. In a value based agent, the agent tries to learn an approximation of this and carry out planning and control by acting greedily on it. Q-learning (45) is an off-policy control method to find the optimal policy. Q-learning (45) uses temporal differences to estimate the value of . In Q-learning, the agent maintains a table of and represents the current estimate of . This can be learnt by iteratively updating the value using the following :

(4)

2.1 Deep Q-Network

In all the above mentioned equations, the value functions are stored in a tabular form. Because of the memory constraints, lack of generalization and lookup costs, learning to approximate these function is preferred over the tabular setting. Function approximation is a way for generalization when the state and/or action spaces are large or continuous. Function approximation aims to generalize from examples of a function to construct an approximate of the entire function. With the coming of deep learning renaissance, these functions are approximated using neural networks. Deep Q-Network (22) provides the basis of incorporating neural networks to approximate the action value function using Q-learning (45) for optimization. In this, the model is parameterized by weights and biases collectively denoted as . Q-values are estimated online by querying the output nodes of the network after performing a forward pass given a state input. Each output unit denotes a separate action. The Q-values are denoted as

. Instead of updating individual Q-values, updates are now made to the parameters of the network to minimize a differentiable loss function :

(5)
(6)

the neural network model naturally generalizes beyond the states and actions it has been trained on. However, because the same network is generating the next state target Q-values that are used in updating its current Q-values, such updates can oscillate or diverge (42). To tackle this problem and to ensure that the neural network doesn’t get biased, various techniques are incorporated. Experience Replay is performed in which experiences are recorded in a replay memory and then sampled uniformly at training time. This is done to promote generalization. A separate target network provides update targets to the main network, decoupling the feedback resulting from the network generating its own targets. is identical to the main network except its parameters are updated to match every 10,000 iterations.

At each training iteration , an experience is sampled uniformly from the replay memory . The loss of the network is determined as follows:

(7)

where is the stale update target given by the target network . The actions are taken by acting -greedily on .

The Deep Q-Network has formed the basis of growth for deep reinforcement learning and various modifications have been proposed to make tackle the problems more efficiently. Some of these methods are Double DQN, Prioritized Experience Replay etc.

2.2 Policy Gradient Algorithms

The policy is defined as a stochastic or a deterministic function that maps states to the corresponding action which the agent should take . In a policy based agent, the agent tries to learn the policy instead of acting greedily on a value function. Again, in the current times - the policy is represented using a neural network and policy optimization is used to find an optimal mapping. Considering first the vanilla policy gradient algorithm (39), a stochastic, parameterized policy is to be optimized. Since we don’t know the ground truth labels for the action to take, we go back to maximizing the expected return . The policy is optimized using gradient ascent, to maximize the expected return.

(8)

where the gradient estimator is of the form

(9)

Majority of the implementations which use automatic differentiation software, optimize the network using an objective whose gradient is equal to the policy gradient estimator, which is obtained by differentiating

(10)

In order to reduce the variance in the sample estimate for the policy gradient, the return can be replaced by the advantage function

which describes how much better or worse it is than other actions on average.

Among the most popular methods to optimize policies is the Actor-Critic algorithm (14), which learns both a policy and a state-value function, and the value function is used for bootstrapping, i.e., updating a state from subsequent estimates, to reduce variance and accelerate learning. Some of the other commonly used algorithms for policy optimization are TRPO (30), PPO (31) and the deterministic (32) counterparts .

3 Episodic Memory

Episodic control, introduced by involves learning successful policies based on the episodic memory, which is a key component of human life. In the brain, this form of learning is supported by the hippocampus and related medial temporal lobe structures. Hippocampal learning is thought to be instance-based (20; 36), in contrast to the cortical system which represents generalised statistical summaries of the input distribution (21). It is found that humans utilize multiple learning, memory and decision making systems in order to efficiently carry out the task in different situations. For eg. - when information of the environment is available, the best strategy is model-based planning associated with prefrontal cortex (4). However, when there aren’t enough resources to plan, a less intensive decision making system needs to be employed. The common go-to among the RL literature is model-free decision making systems. However, as pointed out earlier - these methods require very high amount of repeated interactions with environment, so there’s surely a scope of improvement (when is there not?). This is where episodic control systems come into play and increase the efficiency of model-free control systems by involvement of an external memory system which can represent the hippocampus and inculcate instance based learning in agents. An important observation that supports this approach is that, single experiences with high returns can have prolonged impact on future decision making in humans. For eg. Vasco Da Gamma’s discovery of the sea route to India had an almost immediate and long-lasting effect for the Portuguese. Considering a less extreme eg. - like recalling the plot of a movie as it unfolds, we realize that even in our day to day lives episodic memory plays a crucial role. In reinforcement learning, the experiences of an agent are termed as observations - and in episodic control, the agent leverages the information and advantages of past observations in order to facilitate the decision making progress. For RL agents, (17) proposed “episodic control”, which is given as

… each time the subject experiences a reward that is considered large enough (larger than expected a priori) it stores the specific sequence of State- action pairs leading up to this reward, and tries to follow such a sequence whenever it stumbles upon a State included in it. If multiple successful sequences are available for the same State, the one that yielded maximal reward is followed.

Majority of the work which involve episodic memory are based on this. In the next sections, we will go through various models and methods which involve episodic memory for decision making. Majority of the research which involves external memory in RL tasks involves episodic control. Due to this and the biological backdrop to it, this approach for decision making seems promising.

4 Memory Modules

In this section, we go through various papers which have proposed a new memory module/method which can be used for episodic control. All of the methods presented below propose a novel method to incorporate memory into the reinforcement learning setting. These modules can be used to solve various different kind of problems in reinforcement learning.

4.1 Model Free Episodic Control

This (2) can be considered one of the first few works which involved external memory in the reinforcement learning scene. It considers a deterministic environment, given the near deterministic situations in the real world and the specialised learning mechanisms in the brain which exploit this structure. The episodic model which represents the hippocampus for instance based learning here is represented by a non-parametric growing table which is indexed by state-actions pair. It is represented by - and is used to rapidly record and replay the sequence of actions that so far yielded the highest return from a given start State. Size of the table is limited by removing the least recently updated entry once the maximum size of the table is reached.

At the end of each episode, the table is updated in the following way :

(11)

Thus, the values stored in do not correspond to estimates of the expected return, rather they are estimates of the highest potential return for a given State and action.

The value is estimated in the following way :

(12)

For the states which have never been visited, is approximated by taking average of the K-nearest states.

The main algorithm is given as follows :

for each episode do
     for  do
         Receive observation from environment.
         Let .
         Estimate return for each action via (equation 12)
         Let
         Take action , receive reward
     end for
     for  do
         Update using according to (equation 11).
     end for
end for
Algorithm 1 Model-Free Episodic Control.

Here, is a feature mapping which maps the observation to the state . In this paper, is represented as a projection to smaller-dimensional space ie. , where and where is the dimensionality of the observation and

is a random matrix drawn from a standard Gaussian.

can also be represented as a latent-variable probabilistic models such as a variational autoencoder

(13).

This approach had been the Arcade Learning Environment (Atari) (22), and a first-person 3-dimensional environment, and it was found that it provided faster results as compared to standard function approximators.

4.2 Neural Episodic Control

This (27) was the first end-to-end architecture which involved using memory in RL and was entirely differentiable. The agent in this method consists of three components - a DQN (22)

inspired convolutional neural network that processes pixel images

and brings it down to an embedding space . This is then used to index a set of memory modules (one per action). These readouts from the action memories are converted to using a final network. Figure 1 shows the architecture during a single pass.

The memory architecture in this paper is defined as a Differential Neural Dictionary (DND) - in which each action has a simple memory module , where and

are dynamically sized arrays of vectors, each containing the same number of vectors. The keys here correspond to the embedding

which represent the state and the value correspond to the respective values. For each key , the lookup from the dictionary is performed as a weighted summation of the P-nearest corresponding values.

(13)

where is the th element of the array and

(14)

Here, is represented as a Gaussian or an inverse kernel. In the experiments performed, is taken as :

(15)

The writes to the DND are append only, and if the key already exits it’s updated. The values are updated by performing standard Q-learning (45) updates with -step Q-learning (26).

(16)
(17)

where is the learning rate of the update.

Figure 1: Neural Episodic Control - Architecture of episodic memory module for a single action . Pixels representing the current state enter through a convolutional neural network on the bottom left and an estimate of exits top right. Gradients flow through the entire architecture.

The algorithm for NEC is given at 2.

: replay memory.
: a DND for each action .
: horizon for -step estimate.
for each episode do
     for  do
         Receive observation from environment with embedding .
         Estimate for each action via equation 13 from
          -greedy policy based on
         Take action , receive reward
         Append to .
         Append to .
         Train on a random minibatch from .
     end for
end for
Algorithm 2 Neural Episodic Control

4.3 Masked Experience Memory

This architecture proposed in (19) provides a new memory module which uses mask vectors in the read operation which provides distributed weightage to the past memories based on the current observations for control. The write operation appends the last observation into the fixed size memory store, while the oldest memory is dropped from the store. The read operation compares the current observation with all the previously written observations in the memory store and returns a vector calculated as a weighted sum of all memories.

(18)

is the number of dimension vectors in the memory module and is called the read vector. is defined as the weighted () summation over memories similarity () to the current read vector.

(19)

is defined as the masked summation of the euclidean distance between the current observation/read key and the memory elements :

(20)
(21)

the mask weight vector and attention distribution sharpness parameter are trained by gradient descent. The architecture used is a LSTM (10) based actor-critic (14) networks. Before every episode, the memory is cleared. At every time-step, the current observation, the one-hot representation of the last action taken, the reward received and the memory readout (from the current observation) is concatenated and passed as an input to both, the actor-LSTM and the critic-LSTM. The standard policy-gradient training procedure is followed. The key contribution of this architecture is the usage of attention (43) mechanism which causes the agent to learn which memory segments to focus on. This paper also proposed novel tasks to test memory-based frameworks on (which are discussed later).

4.4 Integrating Episodic Memory with Reservoir Sampling

This (49) method introduces an end-to-end trainable episodic memory module. Instead of assigning credit to the recorded state by explicitly backpropogating through time, the set of states from the memory are drawn from a distribution over all n-subsets of visited states which are parameterized by weights. To draw from such a distribution without maintaining all visited states in memory, a reservoir sampling technique is used.

The model is based on advantage actor critic (14) architecture, consisting of separate value and policy networks. In addition to that, there’s an external memory module consisting of past visited states with associated important weights . Other than this, other trainable networks include a query network (), write network (). The state

is given separately to the query, write, value and networks at each time step. The query network outputs a vector of size equal to the input state size which is used to choose a past state from the memory, which is taken as an input by the policy. The write network assigns a weight to each new state determining how likely it is to stay in memory. The policy network assigns probabilities to each action conditioned on current state and recalled state. The value network estimates expected return (value) from the current state.

(22)

The model is trained using stochastic gradient descent, using standard RL loss functions for actor-critic

(14) method. The query network is trained on the loss , by freezing the other networks. With the write network, the weights learned by the network are used in a reservoir sampling algorithm such that the probability of a particular state being in the memory at given future time is proportional to associated weights and to obtain estimates of the gradient of the return with respect to the weight.

For sampling from the memory, a distribution with respect to the weights is learnt. The expected return is calculated based on this distribution and the policy and other networks are trained using policy gradient algorithm. However, sampling the samples from this distributions involve usage of a reservoir sampling (44) algorithm which allows a steady distribution even while the contents of the memory change. The sampling algorithm is too big to covered in this review, and can be read in the paper.

4.5 Neural Map

The proposed Neural Map (24) memory module was specifically designed for episodic decision making in 3D environments, under a partial observable setting. This method provides a lot of weightage on the area where the agent is currently located for the storage of memory and decision making. The write operator for the memory is selectively limited to affect the part of the neural map which represents agent’s current position. If the position of the agent is given by with and and the neural map is a feature block, where is the feature dimension, is the vertical extent of the map and is the horizontal extent. There exists a coordinate normalization function which maps every unique to , where and .

Figure 2: (33) Neural Map - The method involves operation on the external memory based on the current position of the agent within the environment.

Let be the current state embedding, be the current neural map, and be the current position of the agent within the neural map. The Neural Map is defined by the following set of equations:

(23)
(24)
(25)
(26)
(27)
(28)

where represents the feature at position at time , represents a concatenation operation, and is the output of the neural map at time which is then processed by another deep network to get the policy outputs . The global operation produces a -dimensional feature vector by passing the neural map through a deep convolutional network, hence summarizing the current instance of the memory. The read operation is used to check for certain features in the map and is given as :

(29)
(30)
(31)
(32)

Where is the current state embedding, is the current global read vector and they first produce a query vector . The inner product of the query vector and each feature in the neural map is then taken to get scores at all positions . Soft attention (43) is appplied over these scores to get the context vector . Based on the representations calculated above and the current coordinates of the agent, the write operation is performed using a deep neural network which gives a new C-dimensional write candidate vector at the current position

(33)

This write vector is used to update the memory in the following way :

(34)

For experimentation, the agent had been trained on a 3D Maze environment, where the only observation given was the current forward view of the agent. The memory represents a 2D map of the whole maze. The visualized activations for the mapping provided key insights about the rewarding trajectories which the agent should take.

4.6 Memory, RL, and Inference Network (MERLIN)

This (46) seminal paper combined external memory systems, reinforcement learning and variational inference (13) over states into a unified system based on concepts from psychology and neuroscience - predictive sensory coding, the hippocampal representation theory of Gluck and Myers(5), and the temporal context model and successor representation. Information from various sensory input modalities (image , egocentric velocity , previous reward and action , and a text instruction ) are taken as observation and are encoded to . All of these encoders were taken as ResNet (9) modules.

Figure 3: MERLIN - The architecture consists of two sub-networks, one for policy prediction and other for observation inference. Both use a common external memory and are modelled by a recurrent neural network.

Based on variational inference, which treats inference as an optimization problem - the model considers a prior distribution which predicts the next state variable conditioned on a history maintained in memory of the previous state variables and actions: . The posterior distribution corrects this prior based on the new observations to form a better estimate of the state variable:

. The mean and log standard deviation of the prior distribution

are concatenated with the embedding and passed through a network to form an intermediate variable , which is added to the prior to make a Gaussian posterior distribution , from which the state variable is sampled. This is inserted into row of the memory matrix and passed to the recurrent network . The memory is represented using a Differentiable Neural Computer (DNC) (7) and the recurrent network is represented by a deep LSTM (10). The recurrent network has several read heads each with a key , which is used to find matching items in memory. The state variable is passed as input to the read-only policy and is passed through decoders that produce reconstructed input data (, , and ) and the return prediction . These decoders were taken as dual of the respective encoders with transposed convolutions wherever required. The MBP is to be optimized to produce predictions that are consistent with the probabilities of observed sensory sequences from the environment: . This objective can be intractable, hence based on the standard variational inference procedure, the MBP is trained instead to optimise the variational lower bound (VLB) loss, which acts as a tractable surrogate.

(35)

This loss consists of a reconstruction loss and a KL divergence between and . To implement the reconstruction term, several decoder networks take

as input, and each one transforms back into the space of a sensory modality. The difference between the decoder outputs and the ground truth data is the loss term. The KL divergence between the prior and posterior probability distributions ensures that the predictive prior is consistent with the posterior produced after observing new sensory inputs.

The policy, which has read-only access to the memory, is the only part of the system that is trained conventionally according to standard policy gradient algorithms. To emphasise the independence of the policy from the MBP, the gradients are blocked from the policy loss into the MBP.

MERLIN also excelled at solving one-shot navigation problems from raw sensory input in randomly generated, partially observed 3D environments. It had also effectively learned the ability to locate a goal in a novel environment map and quickly return to it. Even though, it wasn’t explicitly programmed, MERLIN showed evidence of hierarchical goal-directed behaviour, which was detected from the MBP’s read operations.

4.7 Memory Augmented Control Network

This model (12) was specifically created to target partially observable environment with sparse rewards, both being a common and tricky problems in reinforcement learning because of lack of immediate feedback leading to hard to model navigation policies. Similar to the options framework (34) in hierarchical reinforcement learning, this architecture breaks the planning problem into two levels. At a lower level, a planning module computes optimal policies using a feature rich representation of the locally observed environment. The higher level policy is used to augment the neural memory to produce an optimal policy for the global environment. In the set of experiments, the agent operates in an unknown environment and must remain safe by avoiding collisions. Let be a hidden labeling of the states into free and occupied . The agent has access to a sensor that reveals the labeling of nearby states through an observations , where captures the local field of view of the agent at state . The agent’s task is to reach a goal region , which is assumed obstacle-free, i.e., for all . The information available to the agent at time to compute its action is , where is the set of possible sequences of observations, states, and actions. A policy is to be learnt such that the agent is able to reach the goal state without any obstacles in between. The partial observability requires consideration of memory in order to learn successfully.

Figure 4: MACN - The architecture uses convolutional layers to extract features from the environment. The value maps are generated with these features. The controller network uses the value maps and low level features to emit read and write heads in addition to doing its own planning computation.

A partially observable markov decision process based on the history space is defined by , where is a discount factor, is a deterministic transition function, and is the reward function, defined as follows:

(36)
(37)

At any instance, the agent observes a small part of the environment (local observed space). This approach computes optimal policies for these locally observed spaces and then uses these to compute a policy optimal in the global space. The read and write operators on the memory are defined as

(38)
(39)

where are the read weights, are write weights, is an erase vector and is a write vector. The write vector and the erase vector are emitted by the controller. At a lower level, planning is done in a local space given by within the boundaries of our locally observed environment space. This setting can be formulated as a fully observable markov decision process given by and planning in this is done by calculating an optimal policy for this local space given by . Let be the list of optimal policies calculated from such consecutive observation spaces []. These two are mapped by training a convolutional neural network using standard policy gradient approaches.

Hence, in this model a value iteration network (40) is used to learn the value maps of the observation space . These value maps are used as keys for the differential memory, and are found to perform better planning than just standard CNN embeddings. These local value maps (used to calculate local policies) are concatenated with a low level feature representation of the environment and sent to a controller network. The controller network interfaces with the memory through an access module (another network layer) and emits read heads, write heads and access heads. In addition, the controller network also performs its own computation for planning. The output from the controller network and the access module are concatenated and sent through a linear layer to produce an action. This entire architecture is then trained end to end.

5 Usage of Episodic Memory

The memory architectures presented above have been used to carry out various different tasks in reinforcement learning. Majority of the literature surveyed involves usage of external memory systems to make the existing deep-learning based algorithms more efficient, in terms of the number of interactions, enhancing reward propagation and having strong priors from the past for decision making. In this section, we go through various algorithms which don’t propose a new memory module - however, are heavily depend upon the usage of episodic memory to accomplish the respective task.

5.1 Episodic Backward Update

This method (16) involves episodic memory to train a Deep Q-Network (22) with backward updates through time. It is based on the observation that whenever we observe an event, we scan through our memory in a backward manner and recognize the relationships between the current observation and the past experiences (17). The simple backward update of the Q value function in the tabular setting - which first generates the entire episode and performs backward update as defined in algorithm 3 is very unstable if applied to deep reinforcement learning settings.

Initialize the Q- table

with zero matrix.


for all state action pairs .
Experience an episode
for  to 1 do
     
end for
Algorithm 3 Simple Episodic Backward Update (single episode, tabular)

Hence, this algorithm is modified (4) to perform backward updates in the deep-learning setting by using episodic memory. All the transitions within the samples epidsode are used, where is denoted as a set of four length- vectors: ; ; and . Episodic memory based module is used as temporary target - and it is initialized to store all the target Q-values of for all valid actions. is an matrix which stores the target Q-values of all states for all valid actions. Therefore, the -th column of is a column vector that contains for all valid actions , where is the target Q-function parameterized by .

Initialize replay memory to capacity
Initialize on-line action-value function with random weights
Initialize target action-value function with random weights
for episode = 1 to  do
     for  to Terminal  do
         With probability select a random action
         Otherwise select
         Execute action , observe reward and next state
         Store transition in
         Sample a random episode from , set
         Generate temporary target Q table,
         Initialize target vector
         
         for  to 1 do
              
              
         end for
         Perform a gradient descent step on with respect to
         Every C steps reset
     end for
end for
Algorithm 4 Episodic Backward Update

The target vector is used to train the network by minimizing the loss between each and for all from 1 to . Adopting the backward update idea, one element in the -th column of the is replaced using the next transition’s target . Then is estimated as the maximum value of the newly modified -th column of . This procedure is repeated in a recursive manner and the backward update is finally applied to Deep Q-networks (22). This algorithm has been tested 2D maze environment and the Arcade Learning Environment (22) and provides a novel way to perform backward updates on deep architectures using episodic memory.

5.2 Episodic Memory Deep Q-Networks

This method (18) tries to improve the efficiency of DQN (22) by incorporating episodic memory - mimicking the competitive and cooperative relationship between Striattum and Hippocampus in the brain. This approach combines the generalization strength of DQN (22)

and the fast converging property of episodic memory, by distilling the information in the memory to the parametric model. The DQN function is paramterized by

and is represented by , while the episodic memory targets are represented by , given by :

(40)

where represents the number of episodes that the agent has experienced, and represents future return when taking action under state in i-th episode. is a growing table indexed by state-action pairs and is implemented in a way similar to . The loss function given below is minimized to train :

(41)

Though straight-forward, this paper has reported various advantages over vanilla-DQN. Because the memory stores optimal rewards, the reward propagation through the network is faster, compensating the disadvantage of slow-learning resulted by single step reward update. Introducing the memory module also makes this DQN highly sample efficient. This architecture had been tested on the Atari suite (22) and had significantly outperformed the original model.

5.3 Episodic Curiosity through Reachability

This paper (29) specifically address the environments with sparse rewards. This is unsurprisingly common, most of the environments provide no or negative rewards for non-final states, and a positive reward for the final state. Due to very infrequent supervision signal, a common trend among researchers is to introduce rewards which are internal to the agent and is thus called Intrinsic Motivation (3) or Curiosity Driven Learning (25).

This paper provides an internal reward when it reaches specific states which is non-final, and is considered as novel as per the method. The states which require effort to reach (based on the number of environment steps taken to reach it are considered as novel. To estimate this, a neural network

is trained to predict the number of steps that separate two observations. This is binarized, hence the network predicts a value close to

if the number of steps that separate them is less than , which is a hyper-parameter. is also a neural network, which brings the observation to a lower embedding. Among the two observations - one is the current observation and the second is a roll-out from an episodic memory bank which stores the past observations. If the predicted number of steps between these two observations is greater than a certain threshold, the agent rewards itself with a bonus, and adds this observation to the episodic memory. The episodic memory of size stores the embeddings of the past observations. At every time step, the current observation o goes through the embedding network producing the embedding vector . This embedding vector is compared with the stored embeddings in the memory buffer via the comparator network where is the current number of elements in memory. This comparator network fills the reachability buffer with values

(42)

Then the similarity score between the memory buffer and the current embedding is computed as

(43)

The internal reward, called the curiosity bonus is calculated as :

(44)

where and

are hyperparameters. After the bonus computation, the observation embedding is added to memory if the bonus b is larger than a novelty threshold

.

6 Standard Testing Environments

Through various methods reviewed above, almost all of them shared common environments in which these memory based modules had been tested. The first standard testing environment is the Arcade Learning Environment (Atari) (22). The Arcade Learning Environment is a suite of arcade games originally developed for the Atari-2600 console. These games are relatively simple visually but require complex and precise policies to achieve high expected reward, and form an interesting set of tasks as they contain diverse challenges such as sparse rewards and vastly different magnitudes of scores across games. This is a good choice as it acts like a baseline, as the most common algorithms like DQN (22) and A3C (23) have been applied in this domain.

The second common environment is a 2D and 3D maze-based environment, where memory is a crucial part for optimal planning. These mazes generally involve an agent to successfully navigate a 2D grid world populated with obstacles at random positions. The task is made harder by having random start and goal positions. These normally involve a partially observable markov decision process as the agent has only a single source of observation - the scene in front of it, while has no idea about the full map of the maze.

Figure 5: 2D Maze Environment - The left side (a) represents the fully observable maze while the right side (b) represents the agent observations.

Generally, the 2D-mazes are generated using random generator. Hence, test set therefore represents maze geometries that have never been seen during training, and measure the agent’s ability to generalize to new environments. For testing in more complicated 3D environments, the 2D maze environment is implemented in 3D using the ViZDoom (48)

environment and a random maze generator. In this environment, the indicator is a torch of either red or green color that is always at a fixed location in view of the player’s starting state. The goals are red/green towers that are randomly positioned throughout the maze. Other than these, some of the more recent approaches involve testing on the memory game of Concentration. The game is played with a deck of cards in which each card face appears twice. At the start of each game, the cards are arranged face down on a flat surface. A player’s turn consists of turning over any two of the cards. If their faces are found to match, the player wins those two cards and removes them from the table, then plays again. If the two cards do not match, the player turns them face down again, then play passes to the next player. The game proceeds until all cards have been matched and removed from the table. The winning strategy is to remember the locations of the cards as their faces are revealed, then use those memories to find matching pairs. The Concentration game is converted to a reinforcement learning environment using the Omniglot

(15) dataset.

All of the above mentioned environments provide a benchmark for new upcoming reinforcement learning algorithms which involve external memory. Each of these environments tackle different aspect such as speed of learning, partial observability, long scale decision making etc. which shows the importance of memory in the future advancement of reinforcement learning.

7 Conclusions

In this paper we have presented a brief survey on memory based reinforcement learning. We focused on different memory modules and methods which enable episodic memory to be used for learning how to control and plan for an agent. We cover different methods which use these modules for different reinforcement learning based problems and give their advantages and disadvantages. We provide a brief but detailed insights to each of these methods and cover the common testing environments which are normally used. This paper had been written to promote the idea of usage of external memory in reinforcement learning and provide insights on how these methods have been based on/adapted from the learning procedures which occur in the brain. This paper hopes to be a useful resource to provide a detailed overview of the field and to help in the future development of it.

References