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 longterm 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 stateoftheart 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 lowdimensional representations of highdimensional 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 realworld 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 humanlevel performance, which in turn seems pretty inhuman. Addressing the problems in a greater detail, we find that the slowgradient 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 lowreward samples outnumber highreward samples. Standard reward propagation approaches such as QLearning (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 minibatches  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 highlyrewarding 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 subproblems 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 tradesoff 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. Qlearning (45) is an offpolicy control method to find the optimal policy. Qlearning (45) uses temporal differences to estimate the value of . In Qlearning, 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 QNetwork
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 QNetwork (22) provides the basis of incorporating neural networks to approximate the action value function using Qlearning (45) for optimization. In this, the model is parameterized by weights and biases collectively denoted as . Qvalues 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 Qvalues are denoted as
. Instead of updating individual Qvalues, 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 Qvalues that are used in updating its current Qvalues, 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 QNetwork 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 ActorCritic algorithm (14), which learns both a policy and a statevalue 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 instancebased (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 modelbased 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 goto among the RL literature is modelfree 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 modelfree 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 longlasting 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 nonparametric growing table which is indexed by stateactions 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 Knearest states.
The main algorithm is given as follows :
Here, is a feature mapping which maps the observation to the state . In this paper, is represented as a projection to smallerdimensional 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 latentvariable probabilistic models such as a variational autoencoder
(13).This approach had been the Arcade Learning Environment (Atari) (22), and a firstperson 3dimensional 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 endtoend 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 Pnearest 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 Qlearning (45) updates with step Qlearning (26).
(16)  
(17) 
where is the learning rate of the update.
The algorithm for NEC is given at 2.
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 actorcritic (14) networks. Before every episode, the memory is cleared. At every timestep, the current observation, the onehot 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 actorLSTM and the criticLSTM. The standard policygradient 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 memorybased frameworks on (which are discussed later).
4.4 Integrating Episodic Memory with Reservoir Sampling
This (49) method introduces an endtoend 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 nsubsets 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 actorcritic
(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 .
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 Cdimensional 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.
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 readonly 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 readonly 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 oneshot 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 goaldirected 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 obstaclefree, 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.
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 deeplearning 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 QNetwork (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.
Hence, this algorithm is modified (4) to perform backward updates in the deeplearning 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 Qvalues of for all valid actions. is an matrix which stores the target Qvalues 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 Qfunction parameterized by .
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 Qnetworks (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 QNetworks
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 ith episode. is a growing table indexed by stateaction pairs and is implemented in a way similar to . The loss function given below is minimized to train :
(41) 
Though straightforward, this paper has reported various advantages over vanillaDQN. Because the memory stores optimal rewards, the reward propagation through the network is faster, compensating the disadvantage of slowlearning 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 nonfinal 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 nonfinal, 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 hyperparameter. 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 rollout 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 Atari2600 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 mazebased 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.
Generally, the 2Dmazes 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
 Andersen et al. (2007) Per Andersen, Richard Morris, David Amaral, John O’Keefe, Tim Bliss, et al. The hippocampus book. Oxford university press, 2007.
 Blundell et al. (2016) Charles Blundell, Benigno Uria, Alexander Pritzel, Yazhe Li, Avraham Ruderman, Joel Z Leibo, Jack Rae, Daan Wierstra, and Demis Hassabis. Modelfree episodic control. arXiv preprint arXiv:1606.04460, 2016.
 Chentanez et al. (2005) Nuttapong Chentanez, Andrew G Barto, and Satinder P Singh. Intrinsically motivated reinforcement learning. In Advances in neural information processing systems, pp. 1281–1288, 2005.
 Daw et al. (2005) Nathaniel D Daw, Yael Niv, and Peter Dayan. Uncertaintybased competition between prefrontal and dorsolateral striatal systems for behavioral control. Nature neuroscience, 8(12):1704, 2005.
 Gluck & Myers (1993) Mark A Gluck and Catherine E Myers. Hippocampal mediation of stimulus representation: A computational theory. Hippocampus, 3(4):491–516, 1993.
 Graves et al. (2013) Alex Graves, Abdelrahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In 2013 IEEE international conference on acoustics, speech and signal processing, pp. 6645–6649. IEEE, 2013.
 Graves et al. (2016) Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwińska, Sergio Gómez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538(7626):471, 2016.
 Hausknecht & Stone (2015) Matthew Hausknecht and Peter Stone. Deep recurrent qlearning for partially observable mdps. In 2015 AAAI Fall Symposium Series, 2015.

He et al. (2016)
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun.
Deep residual learning for image recognition.
In
Proceedings of the IEEE conference on computer vision and pattern recognition
, pp. 770–778, 2016.  Hochreiter & Schmidhuber (1997) Sepp Hochreiter and Jürgen Schmidhuber. Long shortterm memory. Neural computation, 9(8):1735–1780, 1997.
 Kennerley & Walton (2011) Steven W Kennerley and Mark E Walton. Decision making and reward in frontal cortex: complementary evidence from neurophysiological and neuropsychological studies. Behavioral neuroscience, 125(3):297, 2011.
 Khan et al. (2017) Arbaaz Khan, Clark Zhang, Nikolay Atanasov, Konstantinos Karydis, Vijay Kumar, and Daniel D Lee. Memory augmented control networks. arXiv preprint arXiv:1709.05706, 2017.
 Kingma & Welling (2013) Diederik P Kingma and Max Welling. Autoencoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
 Konda & Tsitsiklis (2000) Vijay R Konda and John N Tsitsiklis. Actorcritic algorithms. In Advances in neural information processing systems, pp. 1008–1014, 2000.
 Lake et al. (2015) Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Humanlevel concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
 Lee et al. (2018) Su Young Lee, Sungik Choi, and SaeYoung Chung. Sampleefficient deep reinforcement learning via episodic backward update. arXiv preprint arXiv:1805.12375, 2018.
 Lengyel & Dayan (2008) Máté Lengyel and Peter Dayan. Hippocampal contributions to control: the third way. In Advances in neural information processing systems, pp. 889–896, 2008.
 Lin et al. (2018) Zichuan Lin, Tianqi Zhao, Guangwen Yang, and Lintao Zhang. Episodic memory deep qnetworks. arXiv preprint arXiv:1805.07603, 2018.
 Loynd et al. (2018) Ricky Loynd, Matthew Hausknecht, Lihong Li, and Li Deng. Now i remember! episodic memory for reinforcement learning, 2018. URL https://openreview.net/forum?id=SJxE3jlA.
 Marr et al. (1991) David Marr, David Willshaw, and Bruce McNaughton. Simple memory: a theory for archicortex. In From the Retina to the Neocortex, pp. 59–128. Springer, 1991.
 McClelland et al. (1995) James L McClelland, Bruce L McNaughton, and Randall C O’reilly. Why there are complementary learning systems in the hippocampus and neocortex: insights from the successes and failures of connectionist models of learning and memory. Psychological review, 102(3):419, 1995.
 Mnih et al. (2013) Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
 Mnih et al. (2016) Volodymyr Mnih, 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.
 Parisotto & Salakhutdinov (2017) Emilio Parisotto and Ruslan Salakhutdinov. Neural map: Structured memory for deep reinforcement learning. arXiv preprint arXiv:1702.08360, 2017.
 Pathak et al. (2017) Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiositydriven exploration by selfsupervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 16–17, 2017.
 Peng & Williams (1994) Jing Peng and Ronald J Williams. Incremental multistep qlearning. In Machine Learning Proceedings 1994, pp. 226–232. Elsevier, 1994.
 Pritzel et al. (2017) Alexander Pritzel, Benigno Uria, Sriram Srinivasan, Adria Puigdomenech Badia, Oriol Vinyals, Demis Hassabis, Daan Wierstra, and Charles Blundell. Neural episodic control. In Proceedings of the 34th International Conference on Machine LearningVolume 70, pp. 2827–2836. JMLR. org, 2017.
 Ren et al. (2015) Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster rcnn: Towards realtime object detection with region proposal networks. In Advances in neural information processing systems, pp. 91–99, 2015.
 Savinov et al. (2018) Nikolay Savinov, Anton Raichuk, Raphaël Marinier, Damien Vincent, Marc Pollefeys, Timothy Lillicrap, and Sylvain Gelly. Episodic curiosity through reachability. arXiv preprint arXiv:1810.02274, 2018.
 Schulman et al. (2015) John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International Conference on Machine Learning, pp. 1889–1897, 2015.
 Schulman et al. (2017) John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
 Silver et al. (2014) David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin Riedmiller. Deterministic policy gradient algorithms. In ICML, 2014.
 Stöckel (2018) Andreas Stöckel. University of waterloo  cs885 ”reinforcement learning” paper presentation, 2018. URL https://cs.uwaterloo.ca/~ppoupart/teaching/cs885spring18/slides/cs885lecture20a.pdf.
 Stolle & Precup (2002) Martin Stolle and Doina Precup. Learning options in reinforcement learning. In International Symposium on abstraction, reformulation, and approximation, pp. 212–223. Springer, 2002.
 Sukhbaatar et al. (2015) Sainbayar Sukhbaatar, Jason Weston, Rob Fergus, et al. Endtoend memory networks. In Advances in neural information processing systems, pp. 2440–2448, 2015.
 Sutherland & Rudy (1989) Robert J Sutherland and Jerry W Rudy. Configural association theory: The role of the hippocampal formation in learning, memory, and amnesia. Psychobiology, 17(2):129–144, 1989.
 Sutskever et al. (2014) Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
 Sutton & Barto (2018) Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
 Sutton et al. (2000) Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in neural information processing systems, pp. 1057–1063, 2000.
 Tamar et al. (2016) Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. In Advances in Neural Information Processing Systems, pp. 2154–2162, 2016.
 Thompson (1986) Richard F Thompson. The neurobiology of learning and memory. Science, 233(4767):941–947, 1986.
 Tsitsiklis & Van Roy (1996) JN Tsitsiklis and B Van Roy. An analysis of temporaldifference learning with function approximationtechnical. Report LIDSP2322). Laboratory for Information and Decision Systems, Massachusetts Institute of Technology, 1996.
 Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
 Vitter (1985) Jeffrey S Vitter. Random sampling with a reservoir. ACM Transactions on Mathematical Software (TOMS), 11(1):37–57, 1985.
 Watkins & Dayan (1992) Christopher JCH Watkins and Peter Dayan. Qlearning. Machine learning, 8(34):279–292, 1992.
 Wayne et al. (2018) Greg Wayne, ChiaChun Hung, David Amos, Mehdi Mirza, Arun Ahuja, Agnieszka GrabskaBarwinska, Jack Rae, Piotr Mirowski, Joel Z Leibo, Adam Santoro, et al. Unsupervised predictive memory in a goaldirected agent. arXiv preprint arXiv:1803.10760, 2018.
 Weston et al. (2014) Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
 Wydmuch et al. (2018) Marek Wydmuch, Michał Kempka, and Wojciech Jaśkowski. Vizdoom competitions: Playing doom from pixels. IEEE Transactions on Games, 2018.
 Young et al. (2018) Kenny J. Young, Shuo Yang, and Richard S. Sutton. Integrating episodic memory into a reinforcement learning agent using reservoir sampling, 2018. URL https://openreview.net/forum?id=ByJDAIe0b.