{'fraction_non_alphanumeric': 0.045973570542701965, 'fraction_numerical': 0.009494076893469615, 'mean_word_length': 4.491780178487553, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Context-dependent representation in recurrent neural networks

In order to assess the short-term memory performance of non-linear random neural networks, we introduce a measure to quantify the dependence of a neural representation upon the past context. We study this measure both numerically and theoretically using the mean-field theory for random neural networks, showing the existence of an optimal level of synaptic weights heterogeneity. We further investigate the influence of the network topology, in particular the symmetry of reciprocal synaptic connections, on this measure of context dependence, revealing the importance of considering the interplay between non-linearities and connectivity structure.


Introduction
The ability of the neural representation of a signal to depend on its past context and the capacity of short-term memory are essential for most perceptive and cognitive processes, from vision to langage processing and decision making [29,41,6,3]. Although adaptation and plasticity may play a crucial role to shape short-term memory, we study here the hypothesis that this phenomenon may be also explained by dynamical network effects in particular due to the recurrent nature of neural networks connectivity [12,44,31,32]. To study this question from a theoretical standpoint, we consider the following classical model of recurrent neural network (RNN) [46,1,38,28], often called rate model : where x(t) ∈ R n describes the states of the n neurons, u(t) ∈ R m represents the signal, S(.) is typically a sigmoid function (e.g. tanh(.)), M is a n × m matrix projecting the input into the recurrent network, and W is a n × n matrix representing the internal connectivity of the recurrent network (W ij is the connection strength from neuron j to neuron i, and is often called synaptic weight). We will make various assumptions on the matrices V and W, and in particular we will investigate the disordered system where V ij are independent N (0, κ 2 /m), and W ij are either independent N (0, σ 2 /n) (random asymmetric connectivity) or constrained to be symmetric with W ij = W ji ∼ N (0, σ 2 /4n) (random symmetric connectivity). The parameter σ characterizes the synaptic weights heterogeneity and is one of the most important parameter in this study because it controls the amount of recurrence in the generation of the representation. The variables η(t) are independent random centered Gaussian vectors in R n with diagonal covariance 2 I. In this model, we have assumed a form of "network noise" that is associated with the network dynamics. However, it is also possible to consider at least two other natural sources of noise, namely an "input noise" in which u(t) + η(t) replaces u(t), or an "output noise" in which the observation of the network state x(t) is perturbed by a measurement noise x(t) + η(t).
Most attempts to study theoretically short-term memory in similar random neural networks models have been focused on the linear case S(x) = x because of the difficulty to handle this question in the non-linear regime. In the context of machine learning applications, [27] has shown the ability of this system to reconstruct faithfully up to n time-steps in the past. In [22], Fisher Information was used to assess how short-term memory depends upon the connectivity structure and the network size (see below). More recently, [11,24] have studied the relevance of applying compressed sensing concepts to this problem, showing the possibility for very long short-term memory, scaling exponentially with n, for the recovery of sparse signals.
Before investigating the interplay between non-linearity and connectivity properties, which is the principal objective of the present article, we study statistical and information-theoretic measures (section 2.1) of the dependence of x(t) upon past stimulus u(t − k) for the linear model, and further introduce a new measure, the context capacity (section 2.2), that will be easier to study in the non-linear case (section 3).

Linear model S(x) = x
Preliminary results. For simplicity, we consider in this section the case of 1D input timeseries, i.e. m = 1 and V = v ∈ R n . We introduce the transfer matrix: With this notation, in the absence of noise x(T ) can be written as x(T ) = Mu where u is the T -dimensional vector (u(0), ..., u(T − 1)). Then, in the case of network noise x(T ) = Mu + T k=0 W k η(t − k) , in the case of input noise x(T ) = M(u + η) and finally in the case of output noise x(T ) = Mu + η. From these expressions, it is possible to estimate the covariance structure of x(T ), assuming that the time-series u is a Gaussian process with zero mean and covariance matrix C: where Ω is defined according to the type of noise considered: • Network noise : • Output noise : Ω = 2 I.

Some statistical and information-theoretic measures
From the expression x(T ) = Mu in the absence of noise, one observes readily that when T = n, if the square matrix M is invertible (which is almost surely the case with random connectivity matrices), then the time-series u of length T can be recovered exactly with the observation of n = T neurons. However, this basic result does not take into account the impact of noise on the representation. In other words, if the matrix M is not well conditioned, then a small perturbation can lead to huge errors.
The Cramer-Rao bound states that the variance of the reconstruction error for any estimator of u cannot be smaller than the inverse of the Fisher Information, therefore providing a universal bound for the input recovery problem. This measure of short-term memory has been studied in a remarkable work by [22] for the linear model with network noise, where it was shown that the Fisher matrix is given by Here, the diagonal element I kk is the Fisher information that x(t) contains about the input at time t − k, and characterizes the memory decay of the network representation. Interestingly, this measure of memory is independent of the input and characterizes only the recurrent neural network. After rescaling by the noise level I ≡ 2 I, one defines the total memoryĪ = T r(I) which satisfies the following fundamental distinction: if W is a normal matrix, thenĪ = 1, and otherwise,Ī ≤ n and may behave extensively with network size. This result shows that the underlying structure of the connectivity W may have a profound impact on the dependence of the representation upon past context. In particular, random symmetric (normal) connectivity matrices appear to be less efficient than asymmetric ones (non-normal) in terms of short-term memory.
To further quantify this statement, one can evaluate the mutual information between x(T ) and u, which is related to the Fisher information by 1 : FIG. 2 (left), the mutual information is displayed as a function of σ for both the symmetric and asymmetric model, showing a clear superiority of the asymmetric model. To understand theoretically this observation, it is possible to use random matrix theory to evaluate the mutual information for n → ∞, assuming C = µ 2 I T and an output noise setting, for which Ω = 2 I. When W is random asymmetric then while the case of symmetric connectivity yields where L is a checkerboard matrix filled with rescaled Catalan numbers: 2p p , and L ij = 0 if i + j is odd. Indeed, to prove this result one only needs to evaluate the entries of the matrix M M. For random asymmetric matrices, in the large n limit: whereas for random symmetric matrices: where the Catalan numbers arise as the even moments of the semi-circular law.
The above determinant appears to be rather difficult to compute analytically, however it is still possible to compare the mutual information for these two cases. Applying Hadamard inequality to the determinant inĨ sym :Ĩ and using the inequality C p ≤ 4 p , one concludes that the mutual information for symmetric linear RNN is smaller than the one for asymmetric case: In fact, for any symmetric connectivity matrix with an eigenvalue distribution compactly supported in [−σ, σ] (not only the semi-circular law), the same conclusion remains valid. Therefore, we have shown in this section that, in the linear model, RNN with symmetric connectivities capture less information about the past inputs than asymmetric ones.

Context capacity
All the previous estimations were heavily relying on the linear relationship between x and u, enabling the use of linear algebra and (random) matrix tools. However, as noticed for instance in [22], extending the above analysis to non-linear models is very challenging. To circumvent this difficulty, we introduce a new measure that quantifies how much the representation of a signal depends upon its past context, and that is amenable to analysis in the non-linear setting. To define our measure of context-dependence, we decompose the input time-series into two parts: the context is the input from time t = 1 to t = t 0 , and the signal is the input from time t = t 0 + 1 up to some time t = t 0 + τ . From this decomposition, we first define the context sensitivity χ as follows (FIG. 1, left panel): (a) we consider the context to be randomly generated according to a given probability law. At each trial, an independent source of noise η is also generated. (b) the signal is kept fixed to a specific time-seriesū (c) we estimate the across-trial variance χ(τ ) of the representations x(t 0 + τ ) obtained for each realization. This variance can be explained by two sources of variability, namely the various contexts generated before the signal and the presence of noise in the construction of the representation. In order to normalize this variance with respect to the pure impact of noise, we introduce a measure of the variability of the representation due to noise only, called the unreliability coefficient ρ (FIG. 1,  right panel): (a) we consider the context to be a fixed time-series (say a fixed random sample generated according to the same given probability law), whereas t each trial, an independent source of noise η is generated. (b) the signal is kept fixed to a specific time-seriesū (c) we estimate the across-trial variance ρ(τ ) of the representations x(t 0 + τ ) obtained for each realization. Finally, we are in position to define the context capacity C(τ ) as the ratio of the context sensitivity over the unreliability coefficient: If the representation is context-independent, then C(τ ) = 1, and the higher is C(τ ), the more context-dependent is the representation, and moreover, one expects C(τ ) to be a decreasing function of τ . Before studying the non-linear system, we first evaluate the context capacity in the linear case to study its relationship with the above statistical and information-theoretic measures. We make the assumption that t 0 is large. To compute the context sensitivity, we consider that, before time t = t 0 , both the noise and the input are treated as random processes. Therefore x(t 0 ) is centered and has covariance Cov(x(t 0 )) = MCM + Ω. Then, at time T = t 0 + τ , x(T ) is no longer centered, and has covariance Cov( Since t 0 → ∞, one has the identity W τ ΩW τ + Ω τ = Ω, and the context sensitivity is given by To compute the unreliability coefficient, the input is always considered as deterministic, so the covariance of x(T ) is Cov(x(T )) = Ω. Therefore, the unreliability coefficient is Finally, the context capacity is given by: To investigate the impact of connectivity symmetry, we wish to analyze this formula from the RMT point of view, assuming C = µ 2 I. First we need the following trace lemma: in the limit n → ∞, • for the asymmetric random model, 1 n T r(W k W k ) → σ 2k , • while for the symmetric random model, 1 Since t 0 → ∞, one first remark that: It remains to evaluate T r(Ω), which can be done using the trace lemma, yielding: T r(Ω) ∼ n 1 1 − σ 2 Finally we obtain that when n → ∞ and T is fixed, This formula is very simple and shows that the context capacity for the linear random asymmetric RNN is given by the product of the signal/noise ratio µ 2 2 times a geometrically decaying term σ 2τ which is maximal when σ approaches ones. Notice that the same product was already appearing in the expression of the mutual informationĨ asym .
The situation is, again, different for symmetric connectivity. Indeed, the diagonal terms of , and we apply the trace lemma to obtain that when n → ∞ and T is fixed, where, for σ < 1: with p(x) the density of the real eigenvalue distribution of W. In the case of the semi-circular law, using the generating function of the Catalan numbers, one obtains: As for the mutual informationĨ sum , this formula involves Catalan numbers and is more explicit because the evaluation of the trace is more straightforward than the evaluation of the determinant. From this result, using C k ≤ 4 k , we deduce that the context capacity for symmetric random model is lower than its asymmetric counterpartC sym (τ ) ≤C asym (τ ). Therefore the context capacity behaves similarly as more standard measures such as the mutual information, and, as we will see in the next section, offers an interesting alternative to investigate the interplay between non-linearity and connectivity properties.

Non-linear model
According to the mean-field theory [38,9,20,8], in particular in the case of input-driven systems [36,33,21], σ is the most important parameter in this system since it controls an order-disorder phase transition between a "stimulus-driven regime" for σ < σ critical and a "chaotic regime" for σ > σ critical . It has been argued that the regime close to criticality in such systems may be relevant in terms of information processing capabilities, both in the fields of neuroscience [2] and artificial intelligence [5,4]. Therefore, our first aim is to understand how this heterogeneity parameter affects the context capacity in the disordered neural network model. To measure the capacity C we need to specify how we generate various contexts and select a given signal. For simplicity, we assume that the input u(t) is a one-dimensional white noise process. In FIG. 2.(middle), we display the context capacity C(τ ) for different values of τ as a function of the synaptic heterogeneity σ for the random asymmetric model. As expected, the context capacity C(τ ) is a decreasing function of τ . More interestingly, it displays a maximal value for an intermediate value of σ > 1, revealing a trade-off between recurrence-induced memory and non-linear instabilities. To understand this observation from a theoretical standpoint, our strategy is to develop a mean-field approximation of C(τ ). To estimate the context sensitivity, we consider for each trial k ∈ {1, ..., K} the solution with the same initial condition x(0) and where η (k) are independent realization of the random process η(t) defined above, and: -for 1 ≤ t ≤ t 0 , u (k) (t) are independent standard Gaussian variables, representing various contexts, -for t 0 + 1 ≤ t ≤ t 0 + τ , for all trials, all the u (k) (t) are equal toū(t), which is a frozen realization of a white noise process. In this problem, there are two different sources of randomness: the weights matrices W and V are randomly drawn once and for all, while the stochastic process η and the various contexts are drawn at each trial k. The first source of randomness, although frozen, will be responsible, in the large n limit, for a phenomenon of self-averaging, which is a well-established property of the mean-field theory [24,34,10]. More precisely, population averages of the form 1 n n i=1 f (x i (t)) converge to the expectation E W,V [f (x i (t))] over the law of the pair (W, V), which is actually a quantity independent of i. To estimate the across-trials variance of x First, the trace term γ(t) := ρ k,k (t) K can be obtained using classical mean-field theory. Indeed, where the variables a (k) ) i are asymptotically (for large n) independent Gaussian random variable with common zero mean and co-variance: where t + = t + 1. Here, we denote by E(.) the expectation with respect to the joint law of (W, M, η, [u] t 0 1 ). In fact, we only need to consider here the variance E a  i (t) , which neither depend on i, since we took the average over (W, M), nor on k since we took the average over η and [u] t 0 1 . When considering k = l, the third term of the above sum is equal to 2 by assumption on η, and the second one is given by κ 2 u 2 . The first term is more problematic, since W and x could be, in principle, correlated. However, and this is the key point in the mean-field theory, this dependence decays when n becomes very large, and in this asymptotic regime one can pretend x and W are independent (see [34,10] for a rigorous justification, and [33] for a recent exposition of the application of the theory in the case of input-driven systems). Therefore, the first term in the sum can be approximated by σ 2 γ(t), and we obtain formally: E (a i (t) 2 ) = σ 2 γ(t) + κ 2 u 2 + 2 . Knowing the mean and variance of a (k) i , since x(t+1) = S(a(t)), one can write a recurrent equation, also called the mean-field equation: Then, the second term to compute is the average of the sample covariance ρ k,l that we denote by λ(t). The situation is slightly different: since λ(t + 1) = [S(a is not sufficient, and we further need to estimate the covariance between a (k) i and a (l) i for k = l. The first term in the sum ( * ) is again given by σ 2 λ(t), the second and third terms are equal to zero since all the trials are independent. Therefore, we obtain: where: We have obtained a deterministic dynamical system describing the variance across trials v(t) = γ(t) − λ(t), holding from time t = 1 up to time t = t 0 − 1: To compute the context sensitivity coefficient χ, one needs to solve the above dynamical system from time 1 to t 0 − 1. Then, at time t = t 0 , one switches to a system where u (k) =ū is now the signal and is the same for all trials, so that from time t = t 0 to t = t 0 + τ : To summarize, after solving (E), followed by (E'), one obtains χ(τ ) = γ(t 0 + τ ) − λ(t 0 + τ ).
To compute the unreliability coefficient ρ, the only difference is that the context u is now frozen and does not change across trials. For each trial k ∈ {1, ..., K}, we consider x (k) the solution of Therefore, the above derivation remains valid, with only minor modifications, yielding a slightly modified version of the mean-field dynamical system, for t = 1 to t = t 0 − 1: and for t = t 0 to t = t 0 + τ we obtain exactly the same system (E') defined above. Therefore, after solving (E"), followed by (E'), one obtains ρ(τ ) = γ(t 0 +τ )−λ(t 0 +τ ) and finally C(τ ) = χ(τ )/ρ(τ ).
In FIG. 2 (middle), theoretical predictions are compared with numerical simulations showing a good agreement.
In light of the results obtained for the linear model, the next natural question is to compare the context capacity according to the connectivity properties, and in particular the symmetry of W. So far, our theoretical results were based on mean-field theory, which heavily relies on the assumption of independent coefficients W ij (asymmetric random model). Indeed, symmetry introduces a large amount of dependence in the matrix W and mean-field theory fails for the symmetric random model [17,18,19]. However, it is possible to evaluate numerically the context capacity in the symmetric case: as shown in FIG. 2 (right), C is much much lower in the symmetric case for small values of σ, corresponding to an "almost-linear" regime, in accordance with results for the linear model, whereas it becomes much higher for larger values of σ, a regime where the non-linear effects become prominent. Indeed, in this regime, the asymmetric model displays chaotic dynamics hence a poor context sensitivity due to a high unreliability, while the symmetric model has an energy function [16], which prevents chaos and ensures a higher context capacity. With this new observation, it appears that the subtle interplay between connectivity properties and non-linearities is crucial for shaping the way neural networks remember their inputs, and that studying the problem only from a linear algebra perspective may be misleading.

Discussion
The problem of short-term memory in recurrent neural network has been investigated using a variety of models, from discrete-time networks [27,22], to continuous-time networks [26,7] and spiking networks [30,43]. Using various approaches from statistics to information theory and dynamical systems, existing literature has mainly focused on three major questions: • How does memory relate to the number of nodes in the network ?
Since [27], it has been shown that the relationship between the memory capacity and the number n of nodes in the network is essentially linear. Beyond this linear relationship between the memory span and n, a recent study [11] has shown the ability of linear recurrent network to perform a compressed sensing operation and to achieve exponentially long memory for sparse inputs, echoing ideas introduced in [23].
• What is the role of non-linearities ?
While short-term memory in linear random recurrent networks has been studied extensively in [22,25], the case of non-linear models is less well understood as the increase of the amount of recurrence (e.g. through the special radius of the connectivity matrix) controls simultaneously the memory and the amount of nonlinearity in the representation. This tradeoff between memory and nonlinearity has been investigated in particular from a theoretical perspective in [14], which shows how these two components can be defined and measured, and how it imposes constraints on the overall performance of reservoir computing systems.
• What is the impact of the connectivity structure ?
As discussed in Section 2, the impact of connectivity structure on memory has been investigated in [22], showing the importance of non-normality of W. In [45,25], the specific case of orthogonal connectivity matrices is also studied, showing the robustness of such structures to noisy perturbations, a type of matrix also under consideration in [11] to demonstrate the RIP property. Furthermore, in a series of articles [35,39,37,40], several authors have explored the impact of connectivity structure in terms of prediction performance, showing that simple deterministic connectivity, such as linear chains, may perform very well in various tasks. The relationship between memory and performance is not straightforward as it may be very task-dependent. However, a recent study [13] of the performance of linear ESN has identified a connection between the Fisher memory curve of [22] and the mean-square-error prediction performance. Finally, various works have been interested in understanding the interplay between connectivity structure and autonomous non-linear reservoir dynamics (e.g. [15,42]) but not in the perspective of understanding short-term memory properties.
The interplay between connectivity structure and non-linearity may have important consequences for short-term memory and theoretical studies of this problem remain scarce. The present theoretical analysis of short-term memory and context-dependent representation in recurrent neural networks, although limited by its modeling assumptions (choice of the dynamical system, connectivity models), has contributed to advance the understanding of this phenomenon: