Title: IMPLEMENTING INDUCTIVE BIAS FOR DIFFERENT NAVIGATION TASKS THROUGH DIVERSE RNN ATTR-RACTORS

Abstract: Navigation is crucial for animal behavior and is assumed to require an internal representation of the external environment, termed a cognitive map. The precise form of this representation is often considered to be a metric representation of space. An internal representation, however, is judged by its contribution to performance on a given task, and may thus vary between different types of navigation tasks.
Here we train a recurrent neural network that controls an agent performing several navigation tasks in a simple environment. To focus on internal representations, we split learning into a task-agnostic pre-training stage that modifies internal connectivity and a task-specific Q learning stage that controls the network's output. We show that pre-training shapes the attractor landscape of the networks, leading to either a continuous attractor, discrete attractors or a disordered state. These structures induce bias onto the Q-Learning phase, leading to a performance pattern across the tasks corresponding to metric and topological regularities. By combining two types of networks in a modular structure, we could get better performance for both regularities. Our results show that, in recurrent networks, inductive bias takes the form of attractor landscapes -which can be shaped by pre-training and analyzed using dynamical systems methods. Furthermore, we demonstrate that non-metric representations are useful for navigation tasks, and their combination with metric representation leads to flexibile multiple-task learning.

1. INTRODUCTION:

Spatial navigation is an important task that requires a correct internal representation of the world, and thus its mechanistic underpinnings have attracted the attention of scientists for a long time (O' Keefe & Nadel, 1978) . A standard tool for navigation is a euclidean map, and this naturally leads to the hypothesis that our internal model is such a map. Artificial navigation also relies on SLAM (Simultaneous localization and mapping) which is based on maps (Kanitscheider & Fiete, 2017a) . On the other hand, both from an ecological view and from a pure machine learning perspective, navigation is firstly about reward acquisition, while exploiting the statistical regularities of the environment. Different tasks and environments lead to different statistical regularities. Thus it is unclear which internal representations are optimal for reward acquisition. We take a functional approach to this question by training recurrent neural networks for navigation tasks with various types of statistical regularities. Because we are interested in internal representations, we opt for a two-phase learning scheme instead of end-to-end learning. Inspired by the biological phenomena of evolution and development, we first pre-train the networks to emphasize several aspects of their internal representation. Following pre-training, we use Q-learning to modify the network's readout weights for specific tasks while maintaining its internal connectivity.

We evaluate the performance for different networks on a battery of simple navigation tasks with different statistical regularities and show that the internal representations of the networks manifest in differential performance according to the nature of tasks. The link between task performance and network structure is understood by probing networks' dynamics, exposing a low-dimensional manifold of slow dynamics in phase space, which is clustered into three major categories: continuous attractor, discrete attractors, and unstructured chaotic dynamics. The different network attractors encode different priors, or inductive bias, for specific tasks which corresponds to metric or topology invariances in the tasks. By combining networks with different inductive biases we could build a modular system with improved multiple-task learning.

Overall we offer a paradigm which shows how dynamics of recurrent networks implement different priors for environments. Pre-training, which is agnostic to specific tasks, could lead to dramatic difference in the network's dynamical landscape and affect reinforcement learning of different navigation tasks.

2. RELATED WORK:

Several recent papers used a functional approach for navigation (Cueva & Wei, 2018; Kanitscheider & Fiete, 2017b; Banino et al., 2018) . These works, however, consider the position as the desired output, by assuming that it is the relevant representation for navigation. These works successfully show that the recurrent network agent could solve the neural SLAM problem and that this could result in units of the network exhibiting similar response profiles to those found in neurophysiological experiments (place and grid cells). In our case, the desired behavior was to obtain the reward, and not to report the current position.

Another recent approach did define reward acquisition as the goal, by applying deep RL directly to navigation problems in an end to end manner (Mirowski et al., 2016) . The navigation tasks relied on rich visual cues, that allowed evaluation in a state of the art setting. This richness, however, can hinder the greater mechanistic insights that can be obtained from the systematic analysis of toy problems -and accordingly, the focus of these works is on performance.

Our work is also related to recent works in neuroscience that highlight the richness of neural representations for navigation, beyond Euclidian spatial maps (Hardcastle et al., 2017; Wirth et al., 2017) .

Our pre-training is similar to unsupervised, followed by supervised training (Erhan et al., 2010) . In the past few years, end-to-end learning is a more dominant approach (Graves et al., 2014; Mnih et al., 2013) . We highlight the ability of a pre-training framework to manipulate network dynamics and the resulting internal representations and study their effect as inductive bias.

3. RESULTS:



3.1. TASK DEFINITION:

Navigation can be described as taking advantage of spatial regularities of the environment to achieve goals. This view naturally leads to considering a cognitive map as an internal model of the environment, but leaves open the question of precisely which type of map is to be expected. To answer this question, we systematically study both a space of networks -emphasizing different internal models -and a space of tasks -emphasizing different spatial regularities. To allow a systematic approach, we design a toy navigation problem, inspired by the Morris water maze (Morris, 1981 ). An agent is placed in a random position in a discretized square arena (size 15), and has to locate the reward location (yellow square, Fig 1A) , while only receiving input (empty/wall/reward) from the 8 neighboring positions. The reward is placed in one of two possible locations in the room according to an external context signal, and the agent can move in one of the four cardinal directions. At every trial, the agent is placed in a random position in the arena, and the network's internal state is randomly initialized as well. The platform location is constant across trials for each context (see Methods). The agent is controlled by a RNN that receives the proximal sensory input, as well as a feedback of its own chosen action (Fig. 1B ). The network's output is a value for each of the 4 possible actions, the maximum of which is chosen to update the agent's position. We use a vanilla RNN (see Appendix for LSTM units) described by:

h t+1 = 1 - 1 τ h t + 1 τ tanh (W h t + W i f (z t ) + W a A t + W c C t ) (1) Q(h t ) = W o h t + b o (2)

where h t is the activity of neurons in the networks(512 neurons as default), W is connectivity matrix, τ is a timescale of update. The sensory input f (z t ) is fed through connections matrix W s , and action feedback is fed throughW a . The context signal C t is fed through matrix W c . The network outputs a Q function, which is computed by a linear transformation of its hidden state.

Beyond the basic setting (Fig. 1A ), we design several variants of the task to emphasize different statistical regularities (Fig. 1C ). In all cases, the agent begins from a random position and has to reach the context-dependent reward location in the shortest time using only proximal input. The "Hole" variant introduces a random placement of obstacles (different numbers and positions) in each trial. The "Bar" variant introduces a horizontal or vertical bar in random positions in each trial.

The various "Scale" tasks stretch the arena in the horizontal or vertical direction while maintaining the relative position of the rewards. The "Implicit context" task is similar to the basic setting, but the external context input is eliminated, and instead, the color of the walls indicates the reward position. For all these tasks, the agent needs to find a strategy that tackles the uncertain elements to achieve the goals. Despite the simple setting of the game, the tasks are not trivial due to identical visual inputs in most of the locations and various uncertain elements adding to the task difficulty. 

3.2. TRAINING FRAMEWORK:

We aim to understand the interaction between internal representation and the statistical regularities of the various tasks. In principle, this could be accomplished by end-to-end reinforcement learning of many tasks, using various hyper-parameters to allow different solutions to the same task. We opted for a different approach -both due to computation efficiency (see Appendix III) and due to biological motivations. A biological agent acquires navigation ability during evolution and development, which shapes its elementary cognitive ability such as spatial or object memory. This shaping provides a scaffold upon which the animal could adapt and learn quickly to perform diverse tasks during life. Similarly, we divide learning into two phases, a pre-training phase that is task agnostic and a Q learning phase that is task-specific (Fig. 2A ). During pre-training we modify the network's internal and input connectivity, while Q learning only modifies the output.

Pre-training is implemented in an environment similar to the basic task, with an arena size chosen randomly between 10 to 20. The agent's actions are externally determined as a correlated random walk, instead of being internally generated by the agent. Inspired by neurophysiological findings, we emphasize two different aspects of internal representation -landmark memory (Identity of the last encountered wall) and position encoding (O' Keefe & Nadel, 1978) . We thus pre-train the internal connectivity to generate an ensemble of networks with various hyperparameters that control the relative importance of these two aspects, as well as which parts of the connectivityW, W a , W i are modified. We term networks emphasizing the two aspects respectively MemNet and PosNet, and call the naive random network RandNet (Fig. 2A ). This is done by stochastic gradient descent on the following objective function:

EQUATION

with z = (x, y) for position, I for landmark memory (identity of the last wall encountered), A for action. The term on action serves as a regularizer. The three probability distributions are estimated from hidden states of the RNN, given by:

EQUATION

P (A|h t-1 , h t ) = exp(W a [h t-1 , h t ] + b a ) a exp(W a [h t-1 , h t ] + b a )

(5)

EQUATION

where W m , W p , W a are readout matrices from hidden states and [h t-1 , h t ] denotes the concatenation of last and current hidden states. Tables 1, 2 ,3 in the Appendix show the hyperparameter choices for all networks. The ratio between α and β controls the tradeoff between position and memory.

The exact values of the hyperparameters were found through trial and error.

Having obtained this ensemble of networks, we use a Q-learning algorithm with TD-lambda update for the network's outputs, which are Q values. We utilize the fact that only the readout matrix W o is trained to use a recursive least square method which allows a fast update of weights for different tasks (Sussillo & Abbott, 2009) . This choice leads to a much better convergence speed when compared to stochastic gradient descent. The update rule used is:

EQUATION

)

where H is a matrix of hidden states over 120 time steps, αI is a regularizer and λ controls forgetting rate of past data.

We then analyze the test performance of all networks on all tasks (Figure 2B and Table 3 in appendix). Figure 2B, C show that there are correlations between different tasks and between different networks. We quantify this correlation structure by performing principal component analysis of the performance matrix. We find that the first two PCs in task space explain 79% of the variance. The first component corresponds to the difficulty (average performance) of each task, while the coefficients of the second component are informative regarding the nature of the tasks (Fig. 2B , right): Bar (-0.49), Hole(-0.25), Basic(-0.21), Implicit context (-0.12), ScaleX (0.04), ScaleY (0.31), Scale (0.74). We speculate these numbers characterize the importance of two different invariances inherent in the tasks. Negative coefficients correspond to metric invariance. For example, when overcoming dynamic obstacles, the position remains invariant. This type of task was fundamental to establish metric cognitive maps in neuroscience (O' Keefe & Nadel, 1978) . Positive coefficients correspond to topological invariance, defined as the relation between landmarks unaffected by the metric information.

Observing the behavior of networks for the extreme tasks of this axis indeed confirms the speculation. Fig. 3A shows that the successful agent overcomes the scaling task by finding a set of actions that captures the relations between landmarks and reward, thus generalizing to larger size arenas. Fig3B shows that the successful agent in the bar task uses a very different strategy. An agent that captures the metric invariance could adjust trajectories and reach the reward each time when the obstacle is changed. This ability is often related to the ability to use shortcuts (O' Keefe & Nadel, 1978) . The other tasks intepolate between the two extremes, due to the presence of both elements in the tasks. For instance, the implicit context task requires the agent to combine landmark memory (color of the wall) with position to locate the reward.

We thus define metric and topological scores by using a weighted average of task performance using negative and positive coefficients respectively. Fig. 3C shows the various networks measured by the two scores. We see that random networks (blue) can achieve reasonable performance with some hyperparameter choices, but they are balanced with respect to the metric topological score. On the other hand, PostNet networks are pushed to the metric side and MemNet networks to the topological side. This result indicates that the inductive bias achieved via task agnostic pre-training is manifested in the performance of networks on various navigation tasks. 

3.3. LINKING REPRESENTATION TO DYNAMICS:

What are the underlying structures of different networks that encode the bias for different tasks?

We approach this question by noting that RNNs are nonlinear dynamical systems. As such, it is informative to detect fixed points and other special areas of phase space to better understand their dynamics. For instance, a network that memorizes a binary value might be expected to contain two discrete fixed points (Fig. 4A ). A network that integrates a continuous value might contain a line attractorKim et al. ( 2017); Kakaria & de Bivort (2017), and , a network that integrates position might contain a plane attractor -a 2D manifold of fixed points -because this would enable updating x and y coordinates with actions, and maintaining the current position in the absence of action (Burak & Fiete, 2009) . Trained networks, however, often converge to approximate fixed points (slow points) (Sussillo & Barak; Mante et al., 2013; Maheswaranathan et al., 2019) , as they are not required to maintain the same position for an infinite time. We thus expect the relevant slow points to be somewhere between the actual trajectories and true fixed points. We detect these areas of phase space using adaptations of existing techniques (Appendix 5.3, (Sussillo & Barak) ). Briefly, we drive the agent to move in the environment, while recording its position and last seen landmark (wall). This results in a collection of hidden states. Then, for each point in this collection, we relax the dynamics towards approximate fixed points. This procedure results in points with different hidden state velocities for the three networks (Fig. 4B ) -RandNet does not seem to have any slow points, while PosNet and MemNet do, with MemNet's points being slower. The resulting manifold of slow points for a typical PosNet is depicted in Figure 4C , along with the labels of position and stimulus from which relaxation began. It is apparent that pretraining has created in PosNet a smooth representation of position along this manifold. The MemNet manifold represents landmark memory as 4 distinct fixed points without a spatial representation. Note that despite the dominance of position representation in PosNet, landmark memory still modulates this representation (Fig 3A , M ) -showing that pretraining did not result in a perfect plane attractor, but rather in an approximate collection of 4 plane attractors (Fig. 3D , MP). This conjunctive representation can also be appreciated by considering the decoding accuracy of trajectories conditioned on the number of wall encounters. As the agent encounters the wall, the decoding of position from the manifold improves, implying the ability to integrate path integration and landmark memory (Fig Appendix 8 ).

We thus see that the pre-training biases are implemented by distinct attractor landscapes, from which we could see both qualitative differences between networks and a trade-off between landmark memory and position encoding. The continuous attractors of PosNet correspond to a metric representation of space, albeit modulated by landmark memory. The discrete attractors of MemNet encode the landmark memory in a robust manner, while sacrificing position encoding. The untrained RandNet, on the other hand, has no clear structure, and relies on a short transient memory of the last landmark. 3 .

The above analysis was performed on three typical networks and is somewhat time-consuming. In order to get a broader view of internal representations in all networks, we use a simple measure of the components of the representation. Specifically, we drove the agent to move in an arena of infinite size that was empty except a single wall (of a different identity in each trial). We then used GLM (generalized linear model) to determine the variance explained by both position and the identity of the wall encountered from the network's hidden state. Figure 6A shows these two measures for all the networks. The results echo those measured with the battery of 7 tasks (Fig. 3C ), but are orders of magnitude faster to compute. Indeed, if we correlate these measures with performance on the different tasks, we see that they correspond to the metric-topological axis as defined by PCA (Fig. 5B , compare with Fig. 2B , right). 

3.4. A MODULAR SYSTEM THAT COMBINES ADVANTAGES OF BOTH DYNAMICS:

Altogether, we showed a differential ability of networks to cope with different environmental regularities via inductive bias encoded in their dynamics. Considering the tradeoff is a fundamental property of single module RNN, it is natural to ask if we could combine advantages from both dynamics into a modular system. Inspired by Park et al. (2001) . We design a hierarchical system composed of the representation layer on the bottom and selector layer on top. The representation layer concatenates PosNet and MemNet modules together, each evaluating action values according to its own dynamics. The second layer selects the more reliable module based on the combined representation by assigning a value (reliability) to each module. The module with maximal reliability makes the final decision. Thus, the control of the agent shifts between different dynamics according to current input or history. The modular system significantly shifts the metric-topological balance (Fig2C, Fig3B). The reliability V is learned similarly as Q(Appendix 5.7).

h 1 t+1 = 1 - 1 τ h 1 t + 1 τ tanh W pos h 1 t + W 1 i f (z t ) + W 1 a A t + W 1 c C t (11) h 2 t+1 = 1 - 1 τ h2 t + 1 τ tanh W mem h 2 t + W 2 i f (z t ) + W 2 a A t + W 2 c C t (12) Q1(h 1 t ) = W 1 o h 1 t + b 1 o (13) Q2(h 1 t ) = W 2 o h 1 t + b 2 o (14) V (h 1 t , h 2 t ) = W sel ([h 1 t , h 2 t ]) + b sel (15)

4. DISCUSSION:

Our work explores how internal representations for navigation tasks are implemented by the dynamics of recurrent neural networks. We show that pre-training networks in a task-agnostic manner can shape their dynamics into discrete fixed points or into a low-D manifold of slow points. These distinct dynamical objects correspond to landmark memory and spatial memory respectively. When performing Q learning for specific tasks, these dynamical objects serve as priors for the network's representations and shift its performance on the various navigation tasks. Here we show that both plane attractors and discrete attractors are useful. It would be interesting to see whether and how other dynamical objects can serve as inductive biases for other domains. In tasks outside of reinforcement learning, for instance, line attractors were shown to underlie network computations (Mante et al., 2013; Maheswaranathan et al., 2019) .

An agent that has to perform several navigation tasks will require both types of representations. A single recurrent network, however, has a trade-off between adapting to one type of task or to another. The attractor landscape picture provides a possible dynamical reason for the tradeoff. Position requires a continuous attractor, whereas stimulus memory requires discrete attractors. While it is possible to have four separated plane attractors, it is perhaps easier for learning to converge to one or the other. A different solution to learn multiple tasks is by considering multiple modules, each optimized for a different dynamical regime. We showed that such a modular system is able to learn multiple tasks, in a manner that is more flexible than any single-module network we could train.

Pre-training alters network connectivity. The resulting connectivity is expected to be between random networks (Lukoševičius & Jaeger, 2009) and designed ones (Burak & Fiete, 2009) . It is perhaps surprising that even the untrained RandNet can perform some of the navigation tasks using only Qlearning of the readout (with appropriate hyperparameters, see Tables 2,3 and section 4 "Linking dynamics to connectivity" in Appendix). This is consistent with recent work showing that some architectures can perform various tasks without learning (Gaier & Ha, 2019) . Studying the connectivity changes due to pre-training may help understand the statistics from which to draw better random networks (Appendix section 4).

Apart from improving the understanding of representation and dynamics, it is interesting to consider the efficiency of our two-stage learning compared to standard approaches. We found that end-toend training is much slower, cannot learn topological tasks and has weaker transfer between tasks (See Appendix section 5.2). Thus it is interesting to explore whether this approach could be used to accelerate learning in other domains, similar to curriculum learning (Bengio et al., 2009) .

5. APPENDIX:



5.1. PERFORMANCE MEASURE FOR EACH TASK:

When testing the agent on a task, we perform a trial for each possible initial position of the agent. Note that the hidden state is randomly initialized in each trial, so this is not an exhaustive search of all possible trial types. We then measure the time it takes the agent to reach the target. This time is normalized by an approximate optimal strategy -moving from the initial position to a corner of the arena (providing x and y information), and then heading straight to the reward. If the agent fails to reach the target after 120 steps, the trial score is -1:

Score = T /T opt T < T max -1 T > T max (16)

5.2. TWO-STAGE VERSUS END-TO-END LEARNING:

To check the effectiveness of our two-stage learning (pre-training followed by Q-Learning), we contrast it with an end-to-end approach. We considered two approached to training: a classic deep Q learning version Mnih et al. (2013) and a method adapted from RDPG Heess et al. (2015) . The naive Q learning is separated into a play phase and training phase. During the play phase the agent collects experience as s t , a t , h t r t into a replay buffer. The action value Q is computed through TD lambda method as Q(h, a) as target function. During the training phase the agent samples the past experience through replay buffer perform gradient descent to minimize the difference between expected Q(h, a) and target Q. We found that for most tasks the deep Q learning method was better than the adapted RDPG, and thus used it for our benchmarks. We used both LSTM and vanilla RNN for these test.

We found that, for the basic task, all networks achieve optimal performance, but our approach is significantly more data-efficient even with random networks (fig. 6A ). For all topological tasks, the end-to-end approach fails with both vanilla RNN and LSTM (fig 6C table 3 ). The end to end approach performs relatively well in metric tasks, except for the implicit context task (fig 6B table 3), which converges to a similar performance as PosNet but with a much slower convergence speed (10 5 trials vs 10 4 trials).

For the end-to-end approaches, a critical question is whether an internal representation emerges, which enables better performance in similar tasks. For instance, do networks that were successfully end-to-end trained in the basic task develop a representation that facilitates learning the bar task? To answer this question, we use networks that were end-to-end trained on one task and use them as a basis for RLS Q-learning of a different task. This allows comparison with the pre-trained networks.

Figure 7 shows that pre-training provides a better substrate for subsequent Q-learning -even when considering generalization within metric tasks. For the implicit context task, the difference is even greater.

5.3. EXPLORING THE LOW D NETWORK DYNAMICS:

Recurrent neural networks are nonlinear dynamical systems. As such, they behave differently in different areas of phase space. It is often informative to locate fixed points of the dynamics, and use their local dynamics as anchors to understand global dynamics. When considering trained RNNs, it is reasonable to expect approximate fixed points rather than exact ones. This is because a fixed point corresponds to maintaining the same hidden state for infinite time, whereas a trained network is only exposed to a finite time. These slow points (Sussillo & Barak; Mante et al., 2013) can be detected in several manners (Sussillo & Barak; Katz & Reggia, 2017) . For the case of stable fixed points (attractors), it is also possible to simulate the dynamics until convergence. In our setting, we opt for the latter option. Because the agent never stays in the same place, we relax the dynamics towards attractors by providing as action feedback the average of all 4 actions. The relevant manifold (e.g. a plane attractor) might contain areas that are more stable than others (for instance a few true fixed points), but we want to avoid detecting only these areas. We thus search for the relevant manifold in the following manner. We drive the agent to move in the environment, while recording its position and last seen stimulus (wall). This results in a collection of hidden states, labelled by position and stimulus that we term the m = 0 manifold. For each point on the manifold, we continue simulating the dynamics for m extra steps while providing as input the average of all 4 actions, resulting in further m = 0 manifolds. If these states are the underlying scaffold for the dynamics, they should encode the position (or memory). We therefore choose m by a cross-validation method -decoding new trajectories obtained in the basic task by using the k = 15-nearest neighbors in each m-manifold. The red curve in Figure 8A shows the resulting decoding accuracy for position using PosNet, where the accuracy starts to fall around m = 25, indicating that further relaxation leads to irrelevant fixed points.

5.4. ATTRACTOR LANDSCAPE FOR DIFFERENT RECURRENT ARCHITECTURES:

We tested the qualitative shape of the slow manifolds that emerge pre-training other unit types. Specifically, we pre-trained an LSTM network using the same parameters as PosNet1 and MemNet1 (Table 1 ). Figures 9 show a qualitatively similar behvior to that described in the main text. Note that MemNet has slow regions instead of discrete points, and we suspect discrete attractors might appear with longer relaxation times. The differences between the columns also demonstrate that slow points, revealed by relaxation, are generally helpful to analyze dynamics of different types of recurrent networks.

5.5. PRE-TRAINING PROTOCOLS AND PERFORMANCE OF NETWORKS:

As explained in the main text, pre-training emphasizes decoding of either landmark memory or the position of the agent. We used several variants of hyperparameters to pre-train the networks. Equation 17, which is written again for convenience, defines the relevant parameters: 

The agent was driven to explore an empty arena (with walls) using random actions, with a probability p of changing action (direction) at any step. Table 1 shows the protocols (hyperparameters), Table 

1, 0, 0 W , W a , W i 0.2 PosNet2 1, 0, 0 W 0.2 PosNet3 1, 0, 0 W 1 PosNet4 1, 1, 0 W , W a , W i 0.2 PosNet5 1, 0.1, 0 W , W a , W i 0.2 MemNet1 0, 0.8, 0.2 W 1 MemNet2 0, 0.9, 0.1 W 1 MemNet3 0, 0.7, 0.3 W 1 MemNet4 0, 0.8, 0.2 W , W a , W i 1 MemNet5 0, 0.8, 0.2 W 0.2

Different hyper parameter for RandNets:

EQUATION

Number of neurons used 512, time constant τ is taken to be 2, the choice of hyper parameters is according to standard reservoir computing litterature (Jaeger, 2010; Lukoševičius & Jaeger) . The weights are taken from a standard Normal distribution. It is crucial to choose an appropriate standard deviation for success of training (Appendix section 5), which is summarized in 2, each unit represents 1/ √ N The results of modular network are obtained from combining the PosNet 1 and MemNet 25 from table . Both the learning of Q function and V function is learned in the the same way as main results equ (7,8,9, 10).

5.7. LINKING DYNAMICS TO CONNECTIVITY:

Pretraining modified the internal connectivity of the networks. Here, we explore the link between connectivity and and dynamics. We draw inspiration from two observations in the field of reservoir computing (Lukoševičius & Jaeger, 2009) . On the one hand, the norm of the internal connectivity has a large effect on network dynamics and performance, with an advantage to residing on the edge of chaos (Jaeger, 2010) . On the other hand, restricting learning to the readout weights (which is then fed back to the network, Sussillo & Abbott (2009) ) results in a low-rank perturbation to the connectivity, the possible contributions of which were recently explored (Mastrogiuseppe & Ostojic, 2018) .

We thus analyzed both aspects. Fig. 10A shows the norms of several matrices as they evolve through pre-training, showing an opposite trend for PosNet and MemNet with respect to the internal connectivity W . To estimate the low-rank component, we performed singular value decomposition on the change to the internal connectivity induced by pre-training (Fig. 10B ).

EQUATION

The singular values of the actual change were compared to a shuffled version, revealing their lowrank structure (Fig. 10C, D ). Note that pretraining was not constrained to generate such a lowrank perturbation. Furthermore, we show that the low-rank structure is partially correlated to the network's inputs, possibly contributing to their effective amplification through the dynamics (Fig. 10E-H ). Because we detected both types of connectivity changes (norm and low-rank), we next sought to characterize their relative contributions to network dynamics, representation and behavior.

In order to assess the effect of matrix norms, we generated a large number of scaled random matrices and use the GLM analyse in figure 5 to access its influence on dynamics. We see the trade-off between landmark memory and path integration is affected by norm (Fig. 10E ). But the actual numbers, however, are much lower for the scaled random matrices compared to the pretrained ones -indicating the importance of the low-rank component (Fig. 10F ) . Indeed, when removing even only the leading 5 ranks from ∆W , Network encoding and performance on all tasks approaches that of RandNet.

5.8. BEHAVIOR OF DIFFERENT NETWORKS:

Different networks develop diverse strategies for metric and topological tasks. In this section, we give examples of typical trajectories of PosNet, MemNet, RanNet in the basic, bar and scaling tasks. 

:



Figures and Tables:

Figure 1: Navigation task and network architecture(A) Basic task setting. The agent begins in a random position and has to locate the reward, which is in a context-dependent location. Input is only provided from the 8 neighboring cells. (B) The agent is controlled by an RNN that receives input from proximal visual stimuli and its action feedback. An external context is provided to indicate which of two possible reward locations is active. (C) Tasks used: Basic, Random obstacles placed in each trial (either holes or bars), scaling the arena in either direction or both, implicit context signal (wall color) instead of external context.

Figure 2: Training scheme and performance analysis. (A) Two-stage learning framework. Task agnostic pre-training of the internal connectivity is done while emphasizing either position decoding (PosNet) or the identity of the last wall (landmark memory, MemNet). Following pre-training, Q learning of the output is performed for each task. This is also done on networks that were not pretrained (RandNet). (B) Example trajectories of PosNet on the basic task, starting from 9 different initial conditions. The numbers are the scores for each trial (see Appendix). (C) Task performance for all networks on all tasks. The score is an average of trials from all starting positions, where each trial is scored by the time relative to the shortest path, or -1 if the agent fails to reach the reward after 120 steps. Bars on the left are coefficients of the second principal component, corresponding to metric vs. topological tasks. The columns show different realizations of Posnet, RanNet and Mem-Net. The last column is a modular network introduced in last section of Results. (D) Correlation between all tasks, showing a clustering into two main groups (metric and topological). Parameters for all networks are in Appendix Tables 1,2,3.

Figure 3: Different strategies for different regularities. (A) A MemNet network solving the scaling task. The agent uses a sequence of landmark-conditioned actions, and thus generalizes to larger arenas. (B) A PosNet network solving the bar task. The agent appears to understand its metric position, and uses it to move in novel paths towards the reward. (C) Performance of all networks in all tasks, projected onto the metric and topological scores.

Figure 4: Diverse attractor landscapes underly diverse agent priors. (A) Velocity of points before and after the relaxation procedure. PosNet and MemNet converged to approximate fixed points (slow points), while RandNet did not. (B) Illustration of possible slow point structures (purple), along with trajectories around them (red). A pair of points can encode a discrete memory, a line attractor can integrate a single variable, and a plane attractor can integrate two variables (e.g. x, y). (C) Attractor landscape for PosNet and MemNet projected into the first 3 PCs of the hidden state. Coloring is according to either X,Y coordinates or the identity of the last wall encountered (landmark memory, M). Note how the position is smoothly encoded on the manifold for PosNet, and memory is encoded by four discrete points for MemNet. The memory panels show a fit of a plane to the X,Y coordinates, conditioned upon a given landmark memory -showing that PosNet also has memory information, and not just position. The networks used are 1,13,20 from Table3.

Figure 5: Components of the internal representation. (A) Variance of the hidden state explained by position and memory for all networks. Note the clear separation between the different pre-training regimes. The crosses denote networks used in Fig. 4. (B) Correlation of the two components with performance on all tasks. The strength of the relevant components in the internal representation are predictive of task performance following Q-learning. Note the similarity with the PCA coefficients in Fig. 2B, right.

Figure 6: Learning curves for end-to-end training, compared to the Q-learning phase of the twostage learning. Each curve represents a single network. Curves shown for Basic, Bar and Scaling tasks.

Figure 7: Generalization or transfer of end-to-end networks. Q-Learning of various tasks from a starting point of either pre-trained networks, or from end-to-end trained networks. The FromPos and FromMem curves denote PosNet and MemNet respecively. Each panel shows a learning curve for a different task.

Figure 8: The accuracy of decoding position (A) or landmark memory (B) from the attractor manifold as a function of the number of relaxation steps. Panel A shows a drop in accuracy around m = 25, indicating that at this stage the process converges to irrelevant fixed points. (C) Conjunctive coding of memory and position. The accuracy of decoding position from the attractor manifold as a function of the number of wall encounters. Only PosNet shows an improvement in decoding with the added information. This is consistent with the joint representation of position and memory in the attractors.

Figure 9: Slow points analysis for LSTM PosNet and MemNet(pretrained for landmark). Similar to Figure 4 in the main text. The three columns show points in phase space during a random walk and after 10 or 20 relaxation steps. The different rows are colored according to X, Y and identity of last wall. The PosNet is on top and MemNet is at bottom

Figure 10: Connectivity changes during pre-training. (A) Top, Evolution of norm during pretraining for both PosNet (red) and MemNet (green). Bottom, low rank effect. The network can be decomposed into two parts, a random part, and a learned low-rank structure through SVD. (B) SVD of ∆W compared to a shuffled version of ∆W , showing that most of the learned structure is concentrated in the first few ranks for PosNet(top).The same low-rank effect observed for MemNet(bottom). (C-D) Measuring the overlap between action feedback matrix or input matrix and output vector v of ∆W for PosNet (C) and MemNet (D). (E) The variance of hidden states explained by a GLM model containing position and landmark memory. Each pixel represents a scaled random matrix, with the colored circles showing the norms of the pre-trained networks. The red, blue and green dots correspond to norm of selected PosNet, RandNet, MemNet for dynamics analysis. (F) Effect of gradually removing the leading ranks from ∆W , measured by the variance explained in the GLM.

Figure 11: PosNet in basic task



Table content: <table><tr><td/><td>: Pretraining protocols</td></tr><tr><td>hyperparameters</td><td/></tr><tr><td>protocol name</td><td>loss(α, β, γ) Weights adjusted p</td></tr><tr><td>PosNet1</td><td/></tr></table>



Table content: <table><tr><td/><td colspan="3">: Random Networks</td></tr><tr><td/><td colspan="2">hyperparameters</td></tr><tr><td>name</td><td>W</td><td colspan="2">W a W i</td></tr><tr><td colspan="2">RandNet1 1</td><td>1</td><td>10</td></tr><tr><td colspan="2">RandNet2 1</td><td>5</td><td>10</td></tr><tr><td colspan="3">RandNet3 0.5 1</td><td>10</td></tr><tr><td colspan="3">RandNet4 0.5 5</td><td>10</td></tr><tr><td colspan="3">RandNet5 1.2 1</td><td>10</td></tr><tr><td colspan="3">RandNet6 1.2 5</td><td>10</td></tr><tr><td>5.6 MODULAR NETWORK PROTOCOL</td><td/><td/></tr></table>

Performance of all networks on all tasks

Table content: <table><tr><td>protocol</td><td>BSC HO</td><td colspan="2">BAR SC</td><td>SX</td><td>SY</td><td>IM</td></tr><tr><td>1.PosNet1</td><td>0.91 0.79</td><td>0.73</td><td colspan="2">-0.36 0.90</td><td>0.19</td><td>0.78</td></tr><tr><td>2.PosNet1</td><td>0.97 0.78</td><td>0.79</td><td colspan="2">-0.47 0.89</td><td>0.53</td><td>0.11</td></tr><tr><td>3.PosNet1</td><td>0.95 0.74</td><td colspan="3">-0.04 -0.16 0.70</td><td>0.70</td><td>0.66</td></tr><tr><td>4.PosNet1</td><td>0.97 0.82</td><td>0.68</td><td>0.03</td><td>0.89</td><td>0.21</td><td>0.69</td></tr><tr><td>5.PosNet1</td><td>0.88 0.74</td><td>0.73</td><td colspan="2">-0.36 0.88</td><td>0.20</td><td>0.78</td></tr><tr><td>6.PosNet1</td><td>0.91 0.63</td><td>0.48</td><td colspan="2">-0.41 0.62</td><td>0.04</td><td>-0.21</td></tr><tr><td>7.PosNet1</td><td>0.94 0.64</td><td>0.51</td><td>0.26</td><td>0.64</td><td>0.15</td><td>-0.31</td></tr><tr><td>8.PosNet2</td><td>0.89 0.62</td><td>0.14</td><td colspan="2">-0.25 0.76</td><td>0.24</td><td>0.84</td></tr><tr><td>9.PosNet3</td><td>0.93 0.48</td><td>0.41</td><td>0.04</td><td>0.22</td><td colspan="2">-0.24 0.73</td></tr><tr><td>10.PosNet4</td><td>0.83 0.58</td><td>0.72</td><td colspan="2">-0.07 0.16</td><td>0.58</td><td>-0.22</td></tr><tr><td>11.PosNet5</td><td>0.86 0.69</td><td>0.48</td><td colspan="2">-0.19 0.21</td><td>0.65</td><td>0.01</td></tr><tr><td>12.PosNet6</td><td>0.80 0.17</td><td>0.11</td><td colspan="2">-0.33 0.07</td><td>0.36</td><td>-0.10</td></tr><tr><td>13.RandNet1</td><td>0.89 0.52</td><td colspan="2">-0.15 0.26</td><td>0.79</td><td colspan="2">-0.17 -0.14</td></tr><tr><td>14.RandNet2</td><td>0.84 0.25</td><td colspan="3">-0.89 -0.03 0.62</td><td colspan="2">-0.29 -0.10</td></tr><tr><td>15.RandNet3</td><td>0.51 0.05</td><td colspan="3">-0.93 -0.39 0.30</td><td colspan="2">-0.35 -0.09</td></tr><tr><td>16.RandNet4</td><td colspan="6">0.65 -0.31 -0.94 -0.37 -0.23 -0.04 -0.17</td></tr><tr><td>17.RandNet5</td><td>0.91 0.22</td><td>0.15</td><td colspan="2">-0.16 0.62</td><td>0.06</td><td>-0.47</td></tr><tr><td>18.RandNet6</td><td>0.88 0.70</td><td colspan="3">-0.36 -0.44 0.63</td><td>0.11</td><td>-0.33</td></tr><tr><td>19.MemNet1</td><td>0.65 0.27</td><td colspan="2">-0.84 0.62</td><td>0.92</td><td>0.62</td><td>-0.20</td></tr><tr><td>20.MemNet1</td><td>0.79 0.15</td><td colspan="2">-0.94 0.48</td><td>0.64</td><td>0.43</td><td>-0.14</td></tr><tr><td>21.MemNet1</td><td>0.82 0.28</td><td colspan="2">-0.30 0.37</td><td>0.69</td><td>0.45</td><td>-0.15</td></tr><tr><td>22.MemNet1</td><td colspan="3">0.73 -0.09 -0.51 0.65</td><td>0.84</td><td>0.58</td><td>-0.29</td></tr><tr><td>23.MemNet1</td><td>0.84 0.54</td><td>0.39</td><td colspan="2">-0.07 0.85</td><td>0.26</td><td>-0.41</td></tr><tr><td>24.MemNet2</td><td>0.76 0.52</td><td colspan="2">-0.87 0.58</td><td>0.47</td><td>0.90</td><td>-0.29</td></tr><tr><td>25.MemNet3</td><td colspan="3">0.76 -0.11 -0.46 0.65</td><td>0.83</td><td>0.61</td><td>-0.28</td></tr><tr><td>26.MemNet4</td><td>0.73 0.35</td><td colspan="2">-0.64 0.43</td><td>0.91</td><td>0.50</td><td>-0.10</td></tr><tr><td>27.MemNet5</td><td>0.75 0.08</td><td colspan="3">-0.86 -0.37 0.12</td><td colspan="2">-0.12 -0.04</td></tr><tr><td colspan="2">28.End2End1 0.89 0.67</td><td>0.70</td><td colspan="3">-0.16 -0.09 0.18</td><td>0.14</td></tr><tr><td colspan="2">29.End2End2 0.67 0.8</td><td>0.73</td><td colspan="2">-0.62 0.51</td><td colspan="2">-0.61 -0.36</td></tr><tr><td>30.Modular</td><td>0.96 0.76</td><td>0.76</td><td>0.62</td><td>0.92</td><td>0.59</td><td>0.86</td></tr></table>

Peer review (iclr2020):
## Overview This paper explores how pre-training a recurrent network on different navigational objectives confers different benefits when it comes to solving downstream tasks. First, networks are pretrained on an objective that either emphasizes position (path integration) or landmark memory (identity of the last wall encountered). This pretraining generates recurrent networks of two classes, called PosNets and MemNets (in addition to no pre-training, called RandNets). Surprisingly, the authors found that pre-training confers different benefits that manifests as differential performance of PosNets and MemNets across the suite. Some evidence is provided that this difference has to do with the requirements of the task. Moreover, the authors show how the different pretraining manifests as different dynamical structures (measured using fixed point analyses) present in the networks after pre-training. In particular, the PosNets contained a 2D plane attractor (used to readout position), whereas the MemNets contained clusters of fixed points (corresponding to the previously encountered landmark). Overall, I thought this was a very interesting paper--it is one of the first papers I have seen that demonstrates how different pre-training requirements both change network dynamics (as measured by fixed points), and how those differences can yield different benefits on downstream navigational tasks. ## Major comments/concerns - I think the presentation the pretraining objective (eq 3) could be clearer. Is eq 3 what is minimized during pre-training? How are alpha, _x0008_eta, and gamma chosen? alpha is used to separate the two types of networks (MemNet from PosNet), which is the critical difference studied in the paper, so it would helpful to go into more detail about what alpha controls and how it was chosen. - For the first task, I am surprised that the agent is able to navigate the environment using only the eight neighboring locations. What is the size of the arena? What fraction of the states are simply surrounded on all sides by empty space? It would be informative to show some trajectories of agents solving the basic task. - For Fig 3A and 3B, it would be nice to show the other network*s performance (i.e. show the PosNet on the scaling task in 3A, and the MemNet on the bar task in 3B). - How come there are no networks that are able to solve both sets of tasks? That is, how come there are no networks in the upper right region of Fig 3C? Does this suggest that an agent needs to combine two separate RNNs to solve the whole suite of tasks? - What happens if you train recurrent networks with more sophisticated cell architectures (e.g. a GRU or an LSTM)? These are typically easier to train (and using automatic differentiation techniques are also amenable to fixed point analysis). ## Minor comments - In eq. (1), use `left(` and `ight)` to make the first set of parentheses have an appropriate height. - Typo on the first line after eq. (6) (matrices) - Relevant reference on comparing networks using dynamics around approximate fixed points: https://arxiv.org/abs/1907.08549.