Memory Capacity of Networks with Stochastic Binary Synapses

In standard attractor neural network models, specific patterns of activity are stored in the synaptic matrix, so that they become fixed point attractors of the network dynamics. The storage capacity of such networks has been quantified in two ways: the maximal number of patterns that can be stored, and the stored information measured in bits per synapse. In this paper, we compute both quantities in fully connected networks of N binary neurons with binary synapses, storing patterns with coding level , in the large and sparse coding limits (). We also derive finite-size corrections that accurately reproduce the results of simulations in networks of tens of thousands of neurons. These methods are applied to three different scenarios: (1) the classic Willshaw model, (2) networks with stochastic learning in which patterns are shown only once (one shot learning), (3) networks with stochastic learning in which patterns are shown multiple times. The storage capacities are optimized over network parameters, which allows us to compare the performance of the different models. We show that finite-size effects strongly reduce the capacity, even for networks of realistic sizes. We discuss the implications of these results for memory storage in the hippocampus and cerebral cortex.


Introduction
Attractor neural networks have been proposed as long-term memory storage devices [1,2,3]. In such networks, a pattern of activity (the set of firing rates of all neurons in the network) is said to be memorized if it is one of the stable states of the network dynamics. Specific patterns of activity become stable states thanks to synaptic plasticity mechanisms, including both long term potentiation and depression of synapses, that create positive feed-back loops through the network connectivity. Attractor states are consistent with the phenomenon of selective persistent activity during delay periods of delayed response tasks, which has been documented in numerous cortical areas in behaving monkeys [4,5,6,7]. A long standing question in the field has been the question of the storage capacity of such networks. Much effort has been devoted to compute the number of attractor states that can be imprinted in the synaptic matrix, in networks of binary neurons [8,9,10,11]. Models storing patterns with a covariance rule [12,1,8,11] were shown to be able to store a number of patterns that scale linearly with the number of synapses per neuron. In the sparse coding limit (in which the average fraction of selective neurons per pattern f goes to zero in the large N limit), the capacity was shown to diverge as 1=(f D log (f )D). These scalings lead to a network storing on the order of 1 bit per synapse, in the large N limit, for any value of the coding level. Elizabeth Gardner [10] computed the maximal capacity, in the space of all possible coupling matrices, and demonstrated a similar scaling for capacity and information stored per synapse.
These initial studies, performed on the simplest possible networks (binary neurons, full connectivity, unrestricted synaptic weights) were followed by a second wave of studies that examined the effect of adding more neurobiological realism: random diluted connectivity [9], neurons characterized by analog firing rates [13], learning rules in which new patterns progressively erase the old ones [14,15]. The above mentioned modifications were shown not to affect the scaling laws described above. One particular modification however was shown to have a drastic effect on capacity. A network with binary synapses and stochastic on-line learning was shown to have a drastically impaired performance, compared to networks with continuous synapses [16,17]. For finite coding levels, the storage capacity was shown to be on the order of ffiffiffiffi ffi N p , not N stored patterns, while the information stored per synapse goes to zero in the large N limit. In the sparse coding limit however (f * log (N)=N), the capacity was shown to scale as 1=f 2 , and therefore a similar scaling as the Gardner bound, while the information stored per synapse remains finite in this limit. These scaling laws are similar to the Willshaw model [18], which can be seen as a particular case of the Amit-Fusi [17] rule. The model was then subsequently studied in greater detail by Huang and Amit [19,20] who computed the storage capacity for finite values of N, using numerical simulations and several approximations for the distributions of the 'local fields' of the neurons. However, computing the precise storage capacity of this model in the large N limit remains an open problem.
In this article we focus on a model of binary neurons where binary synapses are potentiated or depressed stochastically depending on the states of pre and post synaptic neurons [17]. We first introduce analytical methods that allow us to compute the storage capacity in the large N limit, based on a binomial approximation for the synaptic inputs to the neurons. We first illustrate it on the Willshaw model and to recover the well-known result on the capacity of this model [18,21,22]. We then move to a stochastic learning rule, in which we study two different scenarios: (i) in which patterns are presented only once -we will refer to this model as the SP (Single Presentation) model [17]; (ii) in which noisy versions of the patterns are presented multiple-times -the MP (Multiple presentations) model [23]. For both models we compute the storage capacity and the information stored per synapse in the large N limit, and investigate how they depend on the various parameters of the model. We then study finite size effects, and show that they have a huge effect even in networks of tens of thousands of neurons. Finally we show how capacity in finite size networks can be enhanced by introducing inhibition, as proposed in [19,20]. In the discussion we summarize our results and discuss the relevance of the SP and MP networks to memory maintenance in the hippocampus and cortex.

Results
Storage capacity in the N?? limit The network. We consider a network of N binary (0,1) neurons, fully connected through a binary (0,1) synaptic connectivity matrix. The activity of neuron i (i~1:::N) is described by a binary variable, s i~0 ,1. Each neuron can potentially be connected to every other neurons, through a binary connectivity matrix W. This connectivity matrix depends on P random uncorrelated patterns ('memories')j j u , m~1, . . . ,P that are presented during the learning phase. The state of neuron i~1, . . . ,N in pattern m~1, . . . ,P is where f is the coding level of the memories. We study this model in the limit of low coding level, f ?0 when N??. In all the models considered here, P scales as 1=f 2 in the sparse coding limit. Thus, we introduce a parameter a~Pf 2 which stays of order 1 in the sparse coding limit. After the learning phase, we choose one of the P presented patternsj j m 0 , and check whether it is a fixed point of the dynamics: where is the total synaptic input (''field'') of neuron i, h is a scaled activation threshold (constant independent of N), and H is the Heaviside function. Field averages. When testing the stability of patternj j m 0 after learning P patterns, we need to compute the distribution of the fields on selective neurons (sites i such that j m 0 i~1 ), and of the fields on non-selective neurons (sites i such that j m 0 i~0 ). The averages of those fields are fNg z and fNg respectively, where and Patternj j m 0 is perfectly imprinted in the synaptic matrix if g z~1 and g~0. However, because of the storage of other patterns, g z and g take intermediate values between 0 and 1. Note that here we implicitly assume that the probability of finding a potentiated synapse between two neurons i,j such that j j is the same. This is true for the models we consider below. g z and g are function of a, f , and other parameters characterizing learning.
Information stored per synapse. One measure of the storage capability of the network is the information stored per synapse: where P max is the size of a set of patterns in which each pattern is a fixed point of the dynamics with probability one. When a is of order one, for the information per synapse to be of order one in the large N limit, we need to take f as

Author Summary
Two central hypotheses in neuroscience are that long-term memory is sustained by modifications of the connectivity of neural circuits, while short-term memory is sustained by persistent neuronal activity following the presentation of a stimulus. These two hypotheses have been substantiated by several decades of electrophysiological experiments, reporting activity-dependent changes in synaptic connectivity in vitro, and stimulus-selective persistent neuronal activity in delayed response tasks in behaving monkeys. They have been implemented in attractor network models, that store specific patterns of activity using Hebbian plasticity rules, which then allow retrieval of these patterns as attractors of the network dynamics. A long-standing question in the field is how many patterns (or equivalently, how much information) can be stored in such networks? Here, we compute the storage capacity of networks of binary neurons and binary synapses. Synapses store information according to a simple stochastic learning process that consists of transitions between synaptic states conditioned on the states of pre-and post-synaptic neurons. We consider this learning process in two limits: a one shot learning scenario, where each pattern is presented only once, and a slow learning scenario, where noisy versions of a set of patterns are presented multiple times, but transition probabilities are small. The two limits are assumed to represent, in a simplified way, learning in the hippocampus and neocortex, respectively. We show that in both cases, the information stored per synapse remains finite in the large N limit, when the coding is sparse. Furthermore, we characterize the strong finite size effects that exist in such networks.
In this case the information stored per synapse has the simple expression: Computing the storage capacity. Our goal here is to compute the size P max~a =f 2 of the largest set of patterns that can be stored in the connectivity matrix. The criterion for storage that we adopt is that if one picks a pattern in this set, then this pattern is a fixed point of the dynamics with probability 1. We thus need to compute the probability P ne of no error in retrieving a particular pattern m 0 . To compute this probability, we first need to estimate the probabilities that a single selective/non-selective neuron is in its right state when the network is initialized in a state corresponding to pattern m 0 . For a pattern with M selective neurons, and neglecting correlations between neurons (which is Clearly, for P ne to go to 1 in the large N limit, the probabilities for the fields of single neurons to be on the wrong side of the threshold have to vanish in that limit. A first condition for this to happen is g z whwg -if these inequalities are satisfied, then the average fields of both selective and non-selective neurons are on the right side of the threshold. When g z and g are sufficiently far from h, the tail probabilities of the distribution of the fields are where W(g z ,h), W(g,h) are the rate functions associated with the distributions of the fields (see Methods). Neglecting again correlations between inputs, the distributions of the fields are binomial distributions, and the rate functions are Inserting Eqs. (11,12,13,8) in Eq. (10), we find that where X s~{ bW(g z ,h) ln Nz ln ln Nzo( ln ln N) For P ne to go to 1 in the large N limit, we need both X s and X n to go to {? in that limit. This will be satisfied provided These inequalities are equivalent in the large N limit to the inequalities where f is given by the equation W(gzf,h)~1=b.
The maximal information per synapse is obtained by saturating inequalities (16) and (17), and optimizing over the various parameters of the model. In practice, for given values of a, and parameters of the learning process, we compute g and g z ; we can then obtain the optimal values of the threshold h and the rescaled coding level b as and compute the information per synapse using Eq. (9). We can then find the optimum of i in the space of all parameters. Before applying these methods to various models, we would like to emphasize two important features of these calculations: N In Eq. (16), note that the r.h.s. goes to zero extremely slowly as N goes to ? (as ln ln N= ln N) -thus, we expect huge finite size effects. This will be confirmed in section 'Finite-size networks' where these finite size effects are studied in detail. N In the sparse coding limit, a Gaussian approximation of the fields gives a poor approximation of the storage capacity, since the calculation probes the tail of the distribution.

Willshaw model
The capacity of the Willshaw model has already been studied by a number of authors [18,21,22]. Here, we present the application of the analysis described in the previous section to the Willshaw model, for completeness and comparison with the models described in the next sections. In this model, after presenting P patterns to the network, the synaptic matrix is described as follows: W ij~1 if at least one of the P presented patterns had neuron i and j co-activated, W ij~0 otherwise. Thus, after the learning phase, we have, Saturating the inequalities (19,20) with g fixed, one obtains the information stored per synapse, The information stored per synapse is shown as a function of g in Figure 1a. A maximum is reached for g~0:5 at i W~l n 2~0:69 bits=synapse, but goes to zero in both the g?0 and g?1 limits. The model has a storage capacity comparable to its maximal value, i opt w0:5i W in a large range of values of g (between 0:1 and 0:9). We can also optimize capacity for a given value of b, as shown in Figure 1b. It reaches its maximum at b~1:4, and goes to zero in the small and large b limits. Again, the model has a large storage capacity for a broad range of b, i opt w0:5i W for b between 0:4 and 10.
Previous studies [18,21] have found an optimal capacity of 0:69 bits=synapse. Those studies focused on a feed-forward network with a single output neuron, with no fluctuations in the number of selective neurons per pattern, and required that the number of errors on silent outputs is of the same order as the number of selective outputs in the whole set of patterns. In the calculations presented here, we have used a different criteria, namely that a given pattern (not all patterns) is exactly a fixed point of the dynamics of the network with a probability that goes to one in the large N limit. Another possible definition would be to require that all the P patterns are exact fixed points with probability one. In this case, for patterns with fixed numbers of selective neurons, the capacity drops by a factor of 3, ln (2)=3~0:23 bits=synapse, as already computed by Knoblauch et al [22].

Amit-Fusi model
A drawback of the Willshaw learning rule is that it only allows for synaptic potentiation. Thus, if patterns are continuously presented to the network, all synapses will eventually be potentiated and no memories can be retrieved. In [17] Amit and Fusi introduced a new learning rule that maintains the simplicity of the Willshaw model, but allows for continuous on-line learning. The proposed learning rule includes synaptic depression. At each learning time step m, a new patternj j m with coding level f is presented to the network, and synapses are updated stochastically: The evolution of a synapse W ij during learning can be described by the following Markov process: where a~f 2 q z is the probability that a silent synapse is potentiated upon the presentation of pattern m and b~2f (1{f )q { is the probability that a potentiated synapse is depressed. After a sufficient number of patterns has been presented the distribution of synaptic weights in the network reaches a stationary state. We study the network in this stationary regime.
For the information capacity to be of order 1, the coding level has to scale as ln N N , as in the Willshaw model, and the effects of potentiation and depression have to be of the same order [17]. Thus we define the depression-potentiation ratio d as, We can again use Eq. (9) and the saturated inequalities (19,20) to compute the maximal information capacity in the limit N??. This requires computing g and g z , defined in the previous section, as a function of the different parameters characterizing the network. We track a patternj j m 0 that has been presented P time steps in the past. In the following we refer to P as the age of the pattern. In the sparse coding limit, g corresponds to the probability that a synapse is potentiated. It is determined by the depressionpotentiation ratio d, and where a~Pf 2 . Our goal is to determine the age P of the oldest pattern that is still a fixed point of the network dynamics, with probability one. Note that in this network, contrary to the Willshaw model in which all patterns are equivalent, here younger patterns, of age P'vP, are more strongly imprinted in the synaptic matrix, g z (P')wg z (P), and thus also stored with probability one. Choosing an activation threshold and a coding level that saturate inequalities (19) and (20), information capacity can be expressed as: The optimal information i SP~0 :083 bits=synapse is reached for q z~1 , h~0:72, b~2:44 , a~0:14 , d~2:57 which gives g~0:28 , g z~0 :72.
The dependence of i opt on the different parameters is shown in Figure 2. Panel a shows the dependence on g the fraction of activated synapses in the asymptotic learning regime. Panels b, c and d show the dependence on d, b and q z . Note from panel c that there is a broad range of values of b that give information capacities similar to the optimal one. One can also observe that the optimal information capacity is about 9 times lower in the SP model than in the Willshaw model. This is the price one pays to have a network that is able to continuously learn new patterns. However, it should be noted that at maximal capacity, in the Willshaw model, every pattern has a vanishing basin of attraction while in the SP model, only the oldest stable patterns have vanishing basins of attraction. This feature is not captured by our measure of storage capacity.

Multiple presentations of patterns, slow learning regime
In the SP model, patterns are presented only once. Brunel et al [23] studied the same network of binary neurons with stochastic binary synapses but in a different learning context, where patterns are presented multiple times. More precisely, at each learning time step t, a noisy versionj j m(t),t of one of the P prototypesj j m is presented to the network, Here x is a noise level: if x~0, presented patterns are identical to the prototypes, while if x~1, the presented patterns are uncorrelated with the prototypes. As for the SP model this model achieves a finite non-zero information capacity i opt in the large N limit if the depression-potentiation ratio d is of order one, and if the coding level scales with network size as f ! ln N N . If learning is slow, q z ,q { %1, and the number of presentations of patterns of each class becomes large the probabilities g and g z are [23]: and g z~X z?
We inserted those expressions in Eqs. (19,20) to study the maximal information capacity of the network under this learning protocol. The optimal information i MP~0 :69 bits/synapse is reached at x~0 for h?1, b?1:44 , d?0, a?0:69 which gives g? 1 2 , g z ?1. In this limit, the network becomes equivalent to the Willshaw model. The maximal capacity is about 9 times larger than for a network that has to learn in one shot. On Figure 3a we plot the optimal capacity as a function of g. The capacity of the slow learning network with multiple presentations is bounded by the capacity of the Willshaw model for all values of g, and it is reached when the depression-potentiation ratio d?0. For this value, no depression occurs during learning: the network loses palimpsest properties, i.e. the ability to erase older patterns to store new ones, and it is not able to learn if the presented patterns are noisy. The optimal capacity decreases with d, for instance at d~1 (as many potentiation events as depression events at each pattern presentation), i opt~0 :35 bits=synapse. Figure 3c shows the dependence as a function of b~f N ln N . In Figure 3d, we show the optimized capacity for different values of the noise x in the presented patterns. This quantifies the trade-off between the storage capacity and the generalization ability of the network [23].

Finite-size networks
The results we have presented so far are valid for infinite size networks. Finite-size effects can be computed for the three models we have discussed so far (see Methods). The main result of this section is that the capacity of networks of realistic sizes is very far from the large N limit. We compute capacities for finite networks in the SP and MP settings, and we validate our finite size calculations by presenting the results of simulations of large networks of sizes N~10,000, N~50,000. We summarize the finite size calculations for the SP model (a more general and detailed analysis is given in Methods). In the finite network setting, conditional on the tested pattern m 0 having Mz1 selective neurons, the probability of no error P ne is given by  (19) and (20).
In the above equations, the first order corrections scale as ln ln N ln N , which has a dramatic effect on the storage capacity of finite networks. In Figure 4a,b, we plot P ne (where the bar denotes an average over the distribution of M) as a function of the age of the pattern, and compare this with numerical simulations. It is plotted for N~10,000 and N~50,000 for learning and network parameters chosen to optimize the storage capacity of the infinite-size network (see Section 'Amit-Fusi model'). We show the result for two different approximations of the field distribution: a binomial distribution (magenta), as used in the previous calculations for infinite size networks; and a gaussian (red) approximation (see Methods for calculations) as used by previous authors [19,20,24]. For these parameters the binomial approximation gives an accurate estimation of P ne , while the gaussian calculation overestimates it. The curves we get are far from the step functions predicted for N?z? by Eq. (45). To understand why, compare Eqs. (15), and (31) Figure 4c we plot P ne as a function of a a opt where a opt~0 :14 is the value of a that optimizes capacity in the large N limit, h~0:73 and the other parameters are the one that optimizes capacity. We see that we are still far from the large N limit for N~10 100 . Networks of sizes 10 4 {10 6 have capacities which are only between 20% and 40% of the predicted capacity in the large N limit. Neglecting fluctuations in the number of selective neurons, we can derive an expression for the number of stored patterns P that includes the leading finite size correction for the SP model, where c 1 and c 2 are two constants (see Methods). If we take fluctuations in the number of selective neurons into account, it introduces other finite-size effects as can be seen from Eqs. (43) and (44)  . In Figure 4d we plot P ne for different values of N. We see that finite size effects are even stronger in this case.
To plot the curves of Figure 4, we chose parameters to be those that optimize storage capacity for infinite network sizes. When N is finite, those parameters are no longer optimal. To optimize parameters at finite N, since the probability of error as a function of age is no longer a step function, it is not possible to find the last pattern stored with probability one. Instead we define the capacity P c as the pattern age for which P ne~1 2 . Using Eqs. (31) and performing an average over the distribution of M, we find parameters optimizing pattern capacity for fixed values of b.
Results are shown on Figure 5a,b for N~10,000 and N~50,000. We show the results for the different approximations used to model the neural fields: the blue line is the binomial approximation, the cyan line the gaussian approximation and the magenta one is a gaussian approximation with a covariance term that takes into account correlations between synapses (see Methods and x. This illustrates the trade-off between the storage capacity and the generalization ability of the network. doi:10.1371/journal.pcbi.1003727.g003 [19,20]). For f v 1 ffiffiffiffi ffi N p the storage capacity of simulated networks (black crosses) is well predicted by the binomial approximation while the gaussian approximations over-estimates capacity. For f w 1 ffiffiffiffi ffi N p , the correlations between synapses can no longer be neglected [17]. The gaussian approximation with covariance captures the drop in capacity at large f .
For N~10,000, the SP model can store a maximum of P c~7 ,800 patterns at a coding level f~0:0015 (see blue curve in figure 5c). As suggested in Figures 4c,d, the capacity of finite networks is strongly reduced compare to the capacity predicted for infinite size networks. More precisely, if the network of size N~10,000 had the same information capacity as the infinite size network (27), it would store up to P~70,000 patterns at coding level f~0:0007. Part of this decrease in capacity is avoided if we consider patterns that have a fixed number fN of selective neurons. This corresponds to the red curve in figure 4c. For fixed sizes the capacity is approximately twice as large. Note that finitesize effects tend to decrease as the coding level increases. In Figure 5c, f~5:10 {4 , and the capacity is 3% of the value predicted by the large N limit calculation. The ratio of actual to asymptotic capacities increases to 10% at f~1:10 {3 and 21% at f~1:10 {2 . In Figure 5d, we do the same analysis for the MP model with N~10,000. Here we have also optimized all the parameters, except for the depression-potentiation ratio which is set to d~1, ensuring that the network has the palimpsest property and the ability to deal with noisy patterns. For N~10,000, the MP model with d~1 can store up to P c~7 0,000 patterns, at f~0:001 (versus P c~7 ,800 at f~0:0015 for the SP model). One can also compute the optimized capacity for a given noise level. At x~0:1, P c~2 0,900 for f~0:0012 and d~4:3 or at x~0:2, P c~8 ,900 for f~0:0018 and d~6:9.

Storage capacity with errors
So far, we have defined the storage capacity as the number of patterns that can be perfectly retrieved. However, it is quite common for attractor neural networks to have stable fixed point attractors that are close to, but not exactly equal to, patterns that are stored in the connectivity matrix. It is difficult to estimate analytically the stability of patterns that are retrieved with errors as it requires analysis of the dynamics at multiple time steps. We therefore used numerical simulations to check whether a tested pattern is retrieved as a fixed point of the dynamics at a sufficiently low error level. To quantify the degree of error, we introduce the overlap ms s Ã ,j j m 0 between the network fixed points s Ã and the tested patternj j m 0 , with M selective neurons In Figure 6a we show P c (m), the number of fixed-point attractors that have an overlap larger than m with the corresponding stored pattern, for m~1, m~0:99 and m~0:7. Note that only a negligible number of tested patterns lead to fixed points with m smaller than 0:7, for N~10,000 neurons. Considering fixed points with errors leads to a substantial increase in capacity, e.g. for f~0:0018 the capacity increases from P c (m~1)~7,800 to P c (m~0:7)~10,400. In Figure 6b, we quantify the information capacity in bits stored per synapse, defined as in Eq. (6), i~P c {f log 2 f {(1{f ) log 2 (1{f ) ð Þ =N. Note that in the situation when retrieval is not always perfect this expression is only an approximation of the true information content. The coding level that optimizes the information capacity in bits per synapse i is larger (f opt^0 :003) than the one that optimizes the number of stored patterns P c (f opt^0 :002), since the information content of individual patterns decreases with f . Finally, note that the information capacity is close to its optimum in a broad range of coding levels, up to f *0:01.

Increase in capacity with inhibition
As we have seen above, the fluctuations in the number of selective neurons in each pattern lead to a reduction in storage capacity in networks of finite size (e.g. Figure 5c,d). The detrimental effects of these fluctuations can be mitigated by adding a uniform inhibition g to the network [19]. Using a simple instantaneous and linear inhibitory feed-back, the local fields become For infinite size networks, adding inhibition does not improve storage capacity since fluctuations in the number of selective neurons vanish in the large N limit. However, for finite size networks, minimizing those fluctuations leads to substantial increase in storage capacity. When testing the stability of patterñ j j m 0 , if the number of selective neurons is unknown, the variance of the field on non-selective neurons is Nf (g{2ggzg 2 ), and Nf (g z {2gg z zg 2 ) for selective neurons (for small f ). The variance for non-selective neurons is minimized if g~g, yielding the variance obtained with fixed size patterns. The same holds for selective neurons at g~g z . Choosing a value of g between g and g z brings the network capacity towards that of fixed size patterns. In Figure 7a, we show the storage capacity as a function of f for these three scenarios. Optimizing the inhibition g increases the maximal capacity by 28% (green curve) compared to a network with no inhibition (blue curve). Red curve is the capacity without pattern size fluctuations. Inhibition increases the capacity from P c~7 ,800 at f~0:0018 to P c~1 2,000. In Figure 7b, information capacity measured in bits per synapse is shown as a function of f in the same three scenarios. Note again that for f~1ffiffiffiffi ffi N p~0:01, the capacity is quite close to the optimal capacity.

Discussion
We have presented an analytical method to compute the storage capacity of networks of binary neurons with binary synapses in the sparse coding limit. When applied to the classic Willshaw model, in the infinite limit, we find a maximal storage capacity of ln 2~0:69 bits=synapse, the same than found in previous studies, although with a different definition adapted to recurrent networks, as discussed in the section 'Willshaw model'. We then used this method to study the storage capacity of a network with binary synapses and stochastic learning, in the single presentation (SP)  scenario [17]. The main advantage of this model, compared to the Willshaw model, is its palimpsest property, that allows it to do online learning in an ever changing environment. Amit and Fusi showed that the optimal storage capacity was obtained in the sparse coding limit, f ! ln N N and with a balance between the effect of depression and potentiation. The storage capacity of this network has been further studied for finite size networks in [19,20]. We have complemented this work by computing analytically the storage capacity in the large N limit. The optimal capacity of the SP model is 0:083 bits=synapse, which is about 9 times lower than the one of the Willshaw model. This decrease in storage capacity is similar to the decrease seen in palimpsest networks with continuous synapses -for example, in the Hopfield model the capacity is about 0:14 bits=synapse, while in a palimpsest version the capacity drops to about 0:05 bits=synapse. The reason for this decrease is that the most recently seen patterns have large basins of attraction, while older patterns have smaller ones. In the Willshaw model, all patterns are equivalent, and therefore they all have vanishing basins of attraction at the maximal capacity.
We have also studied the network in a multiple presentation (MP) scenario, with in which patterns presented to the network are noisy versions of a fixed set of prototypes, in the slow learning limit in which transition probabilities go to zero [23]. In the extreme case in which presented patterns are the prototypes, all synaptic weights are initially at zero, and if the synapses do not experience depression, this model is equivalent to the Willshaw model with a storage capacity of 0:69 bits=synapse, which is about 9 times larger than the capacity of the SP model. A more interesting scenario is when depression is present. In this case then the network has generalization properties (it can learn prototypes from noisy versions of them), as well as palimpsest properties (if patterns drawn from a new set of prototypes are presented it will eventually replace a previous set with the new one). We have quantified the trade-off between generalization and storage capacity (see Figure 3d). For instance, if the noisy patterns have 80% of their selective neurons in common with the prototypes to be learned, the storage capacity is decreased from 0:69 to 0:12 bits=synapse.
A key step in estimating storage capacity is deriving an accurate approximation for the distribution of the inputs neurons receive. These inputs are the sum of a large number of binary variables, so the distribution is a binomial if one can neglect the correlations between these variables, induced by the learning process. Amit and Fusi [17] showed that these correlations can be neglected when f %1= ffiffiffiffi ffi N p . Thus, we expect the results with the binomial approximation to be exact in the large N limit. We have shown that a Gaussian approximation of the binomial distribution gives inaccurate results in the sparse coding limit, because the capacity depends on the tail of the distribution, which is not well described by a Gaussian. For larger coding levels (f *1= ffiffiffiffi ffi N p ), the binomial approximation breaks down because it does not take into account correlations between inputs. Following [19] and [20], we use a Gaussian approximation that includes the covariance of the inputs, and show that this approximation captures well the simulation results in this coding level range.
We computed storage capacities for two different learning scenarios. Both are unsupervised, involve a Hebbian-type plasticity rule, and allow for online learning (providing patterns are presented multiple times for the MP model). It is of interest to compare the performance of these two particular scenarios with known upper bounds on storage capacity. For networks of infinite size with binary synapses such a bound has been derived using the Gardner approach [25]. In the sparse coding limit, this bound iŝ 0:29 bits=synapse with random patterns (in which fluctuations in the number of selective neurons per pattern fluctuates), and 0:45 bits=synapse if patterns have a fixed number of selective neurons [26]. We found a capacity of i SP~0 :083 bits=synapse for the SP model and i MP~0 :69 bits=synapse for the MP model, obtained both for patterns with fixed and variable number of selective neurons. The result for the MP model seems to violate the Gardner bound. However, as noticed by Nadal [21], one should be cautious in comparing these results: in our calculations we have required that a given pattern is stored perfectly with probability one, while the Gardner calculation requires that all patterns are stored perfectly with probability one. As mentioned in the section 'Willshaw model', the capacity of the Willshaw and MP models drops to i opt~0 :23 bits=synapse in the case of fixed-size patterns, if one insists that all patterns should be stored perfectly, which is now consistent with the Gardner bound. This means that the MP model is able to reach a capacity which is roughly half the Gardner bound, a rather impressive feat given the simplicity of the rule. Note that supervised learning rules can get closer to these theoretical bounds [27].
We have also studied finite-size networks, in which we defined the capacity as the number of patterns for which the probability of exact retrieval is at least 50%. We found that networks of reasonable sizes have capacities that are far from the large N limit. For networks of sizes 10 4 {10 6 storage capacities are reduced by a factor 3 or more (see Figure 4). These huge finite size effects can be understood by the fact that the leading order corrections in the large N limit are in ln ( ln N) ln N -and so can never be neglected unless N is an astronomical number (see Methods). A large part of the decrease in capacity when considering finite-size networks is due to fluctuations in the number of selective neurons from pattern to pattern. In the last section, we have used inhibition to minimize the effect of these fluctuations. For instance, for a network of N~10,000 neurons learning in one shot, inhibition allows to increase capacity from P~7,800 to P~12,000. For finite size networks, memory patterns that are not perfectly retrieved can still lead to fixed points where the activity is significantly correlated with the memory patterns. We have investigated with simulations how allowing errors in the retrieved patterns modifies storage capacity. For N~10,000, the capacity increases from P~7,800 to P~10,400, i.e. by approximately 30%. Our study focused on networks of binary neurons, connected through binary synapses, and storing very sparse patterns. These three assumptions allowed us to compute analytically the storage capacity of the network in two learning scenarios. An important question is how far real neural networks are from such idealized assumptions. First, the issue of whether real synapses are binary, discrete but with a larger number of states, or essentially continuous, is still unresolved, with evidence in favor of each of these scenarios [28,29,30,31,32]. We expect that having synapses with a finite number Kw2 of states will not modify strongly the picture outlined here [17,33,20]. Second, it remains to be investigated how these results will generalize to networks of more realistic neurons. In strongly connected networks of spiking neurons operating in the balanced mode [34,35,36,37], the presence of ongoing activity presents strong constraints on the viability of sparsely coded selective attractor states. This is because 'non-selective' neurons are no longer silent, but are rather active at low background rates, and the noise due to this background activity can easily wipe out the selective signal [35,38]. In fact, simple scaling arguments in balanced networks suggest the optimal coding level would become f *1= ffiffiffiffi ffi N p [3,39]. The learning rules we have considered in this paper lead to a vanishing information stored per synapse with this scaling. Finding an unsupervised learning rule that achieves a finite information capacity in the large N limit in networks with discrete synapses for such coding levels remains an open question. However, the results presented here show that for networks of realistic sizes, the information capacity at such coding levels is in fact not very far from the optimal one that is reached at lower coding levels (see vertical lines in Figure 5-7). Finally, the coding levels of cortical networks during delay period activity remain poorly characterized. Experiments in IT cortex [40,41,42] are consistent with coding levels of order 1%. Our results indicate that in networks of reasonable sizes, these coding levels are not far from the optimal values.
The SP and MP models investigated in this paper can be thought of as minimal models for learning in hippocampus and neocortex. The SP model bears some resemblance to the function of hippocampus, which is supposed to keep a memory of recent episodes that are learned in one shot, thanks to highly plastic synapses. The MP model relates to the function of neocortex, where a longer-term memory can be stored, thanks to repeated presentations of a set of prototypes that occur repeatedly in the environment, and perhaps during sleep under the supervision of the hippocampus. The idea that hippocampal and cortical networks learn on different time scales has been exploited in several modeling studies [43,44,45], in which the memories are first stored in the hippocampus and then gradually transferred to cortical networks. It would be interesting to extend the type of analysis presented here to coupled hippocampo-cortical networks with varying degrees of plasticity.

Capacity calculation for infinite size networks
We are interested at retrieving patternj j m that has been presented during the learning phase. We set the network in this states s~j j m and ask whether the network remains in this state while the dynamics (2) is running. At the first iteration, each neuron i is receiving a field Where M+1 is the number of selective neurons in patternj j m , with M~O( ln N). Where we use the standard 'Landau' notations: a~O(F (N)) means that a=F (N) goes to a finite limit in the large N limit, while a~o(F (N)) means that a=F(N) goes to zero in the large N limit. and N?z?. We recall that g z~P (W ij~1 Dj m i~j m j~1 ) and g~P(W ij~1 D(j m i ,j m j )=(1,1)). Thus X i k is a binary random variable which is 1 with probability, either g z if i is a selective neuron (sites i such that j m i~1 ), or g if i is a non-selective neuron (sites i such that j m i~0 ). Neglecting correlations between W ij1 and W ij2 (it is legitimate in the sparse coding limit we are interested in, see [17]), the X i k 's are independent and the distribution of the field on selective neurons can be written as where we used Stirling formula for M,S&1, with W defined in (13 In the limit N?z? we are considering in this section, and if MgvfNhvMg z , the sums corresponding to the probabilities P(h s i ƒfNh),P(h n i §fNh) are dominated by their first term (corrections are made explicit in the following section). Keeping only higher order terms in M in Eqs. (36) and (37) When the number of selective neurons per pattern is fixed at fN, we choose Mh for the activation threshold and these equations become: X s~{ ln NbW(g z ,h)zO( ln ln N) X n~l n N({bW(g,h)z1)zO( ln ln N) ð41Þ where b~f N ln N For random numbers of selective neurons we need to compute the average over M: P ne (N)~P N M~0 P(M)P ne (M,N). Since M is distributed according to a binomial of average Nf and variance Nf (1{f )^Nf , for sufficiently large Nf , this can be approximated as M~fNzz ffiffiffiffiffiffi fN p where z is normally distributed: where m f~M g z , s 2 s~M g z (1{g z ) ð62Þ The probability that those fields are on the wrong side of the threshold are: and Following the same calculations presented, and keeping only terms that are relevant in the limit N?z?, the probability that there is no error is given by: where the rate function W G is Calculations with the binomial versus the gaussian approximation differ only in the form of W. Finite size terms can be taken into account in the same way it is done in the previous Methods section for the binomial approximation.
In all above calculations we assumed that fields are sums of independent random variables (35). For small f correlations are negligible [17,19]. It is possible to compute the covariances between the terms of the sum (see Eq. (3.9) in [19]), and take them into account in the gaussian approximation. This can be done using