Optimized brute-force algorithms for the bifurcation analysis of a spin-glass-like neural network model
Diego Fasoli, Stefano Panzeri
1 Laboratory of Neural Computation, Center for Neuroscience and Cognitive Systems @UniTn, Istituto Italiano di Tecnologia, 38068 Rovereto, Italy
2 Center for Brain and Cognition, Computational Neuroscience Group, Universitat Pompeu Fabra, 08002 Barcelona, Spain
Corresponding Author. E-mail: firstname.lastname@example.org
Bifurcation theory is a powerful tool for studying how the dynamics of a neural network model depends on its underlying neurophysiological parameters. However, bifurcation theory has been developed mostly for smooth dynamical systems and for continuous-time non-smooth models, which prevents us from understanding the changes of dynamics in some widely used classes of artificial neural network models. This article is an attempt to fill this gap, through the introduction of algorithms that perform a semi-analytical bifurcation analysis of a spin-glass-like neural network model with binary firing rates and discrete-time evolution. Our approach is based on a numerical brute-force search of the stationary and oscillatory solutions of the spin-glass model, from which we derive analytical expressions of its bifurcation structure by means of the state-to-state transition probability matrix. The algorithms determine how the network parameters affect the degree of multistability, the emergence and the period of the neural oscillations, and the formation of symmetry-breaking in the neural populations. While this technique can be applied to networks with arbitrary (generally asymmetric) connectivity matrices, in particular we introduce a highly efficient algorithm for the bifurcation analysis of sparse networks. We also provide some examples of the obtained bifurcation diagrams and a Python implementation of the algorithms.
Neural complexity refers to the wide variety of dynamical behaviors that occur in neural networks [5, 27, 9]. This set of dynamical behaviors includes variations in the number of stable solutions of neuronal activity, the formation of neural oscillations, spontaneous symmetry-breaking, chaos and much more [16, 1]. Qualitative changes of neuronal activity, also known as bifurcations, are elicited by variations of the network parameters, such as the strength of the external input to the network, the strength of the synaptic connections between neurons, or other network characteristics.
Bifurcation theory is a standard mathematical formalism for studying neural complexity . It allows the construction of a map of neuronal activity, known as bifurcation diagram, that links points or sets in the parameters space to their corresponding network dynamics. In the study of firing-rate network models, bifurcation theory has been applied mostly to graded (smooth) neural networks with analog firing rates (e.g. [4, 3, 5, 27, 15, 9]), proving itself as an effective tool for deepening our understanding of network dynamics. The bifurcation analysis of smooth models is based on differential analysis, in particular on the Jacobian matrix of the system. However, the Jacobian matrix is not defined everywhere for artificial neuronal models with discontinuous activation function, such as networks of binary neurons. For this reason, bifurcation theory of smooth dynamical systems cannot be applied directly to these models. On the other hand, while the bifurcation analysis of non-smooth dynamical systems has recently received increased attention, it has been developed only for continuous-time models, described by non-smooth differential equations or by differential inclusions [22, 2, 21, 24] (see  for an example of application to firing-rate models). Yet, many interesting problems in neuroscience involve the use of non-smooth discrete-time models , therefore this gap prevents us from understanding the changes of dynamics in these artificial systems.
If we define the states of a binary network of size as the collection of the rates at which its cells are firing, then the number of possible stationary states is . Moreover, the number of possible oscillatory solutions is for large , as we prove in Appx. (A). In particular, the bifurcation analysis of the model would unveil the actual solutions in these large sets of states, for any given set of network parameters. This would represent a tremendous simplification in our comprehension of neural dynamics, providing great insight into the operation of the network .
In this article, we develop brute-force algorithms for the bifurcation analysis of the spin-glass-like neural network model introduced in . The network is composed of an arbitrary number of neurons with binary firing rates, connected through arbitrary (generally asymmetric) synaptic connections. The network dynamics is deterministic and evolves in discrete time steps. In  we proved that the bifurcation structure of the model can be studied semi-analytically, and in particular we were able to characterize the formation of multistability, neural oscillations and symmetry breaking in the stimuli space. While in  we derived the bifurcation diagrams of simple networks through hand calculations, in the present article we propose algorithms for automatic bifurcation analysis. Therefore our work complements standard numerical continuation softwares that are widely used for the bifurcation analysis of graded neuronal models, such as the MatCont Matlab toolbox  and XPPAUT .
Previous work focused on the emergence of complexity in ideal mean-field limits of spin-glass models, see e.g. [28, 6, 26]. On the contrary, in the present article we do not make use of any mean-field approximation. In particular, we consider exactly solvable finite-size networks to be used in real-world applications. In Sec. (2) we briefly review the model (SubSec. (2.1)) and we show how the analytical formula of the state-to-state transition probability matrix can be inverted for any network size to determine the portions of parameters space where multistability, neural oscillations and symmetry breaking occur (SubSec. (2.2)). The resulting formula can be written in any programming language. In particular, we propose a Python implementation, that the reader may find in the Supplementary Materials (scripts “Multistability_Diagram.py” and “Oscillation_Diagram.py”).
However, the inversion of the state-to-state transition probability matrix requires a priori knowledge of sets of candidate stationary and oscillatory solutions, as we showed in , and as we will explain in more detail in SubSec. (2.2). For this reason, in SubSec. (2.3) we introduce non-optimized algorithms that, through a brute-force searching procedure, generate the sets of all the potential stationary and oscillatory solutions (see the supplemental script “Non_Efficient_Algorithm.py” for a Python implementation). These algorithms can be applied to networks with any topology of the synaptic connections (dense or sparse), but their computational time increases exponentially with the network size.
Yet, the study of sparse systems is of particular interest in neuroscience. The average density of the synaptic connections, defined as the ratio between the actual and the maximum possible number of connections in the network, is approximately across the whole cortex, and it can increase up to in connection pathways linking cortical areas . For this reason, in SubSec. (2.4) we propose an optimized brute-force algorithm, whose efficiency in generating sets of candidate stationary and oscillatory solutions increases with the network sparseness (see the supplemental script “Sparse_Efficient_Algorithm.py” for a Python implementation).
Then, in SubSec. (2.5) we introduce some widely-used examples of network topologies to be tested, while in Sec. (3) we show the corresponding bifurcation diagrams generated by our codes. To conclude, in Sec. (4) we discuss the importance and the biological implications of our results. In particular, we discuss how our work advances the comprehension of neural networks with respect to previous work (SubSec. (4.1)), new insights into the dynamics of binary network models revealed by our algorithms (SubSec. (4.2)), and future directions that need to be pursued to address the limitations of our work (SubSec. (4.3)).
2 Materials and Methods
In SubSec. (2.1) we describe the spin-glass-like neural network model whose dynamics we would like to investigate. Moreover, in SubSec. (2.2) we introduce a technique for plotting the bifurcation diagram of the model, provided a set of candidate stationary states and a set of candidate oscillatory solutions are known. Then, in SubSec. (2.3) we propose non-optimized brute-force algorithms for generating the candidate sets. While these algorithms can be applied to networks with any topology of the synaptic connections, their computational time increases exponentially with the network size. For this reason, in SubSec. (2.4) we introduce an efficient algorithm that takes advantage of the sparseness of biological networks for increasing its computational speed. To conclude, in SubSec. (2.5) we introduce two standard examples of network topologies, whose bifurcation structure will be derived in Sec. (3) through the use of our algorithms.
2.1 The Network Model
We study the bifurcation structure of the following spin-glass-like network model :
In Eq. (1), is the number of neurons in the network, while and are the membrane potential and the external stimulus of the th neuron, respectively. is the synaptic weight from the th (presynaptic) to the th (postsynaptic) neuron. The collection of the synaptic weights, for , defines the synaptic connectivity matrix , which in this article is supposed to be arbitrary (generally asymmetric). In Eq. (1), represents the Heaviside step function:
where is the firing threshold. The firing rate of the th neuron is the binary variable defined as , so that if the neuron is not firing, and if it is firing at the maximum rate. Moreover, in Eq. (1) the parameter represents the number of presynaptic neurons that are directly connected to the th (postsynaptic) neuron. Therefore is a normalization factor, that prevents the divergence of the sum for .
The state-to-state transition probability matrix provides a convenient way to describe the dynamics of the firing rates . By defining as the binary string obtained by concatenating the firing rates at time , in  we proved that the entries of the matrix are:
where is the sign function, defined as follows:
represents the probability of the transition to occur, for specific firing-rate states and , given the network is in the state at the time instant . For example, if at the time instant the network is in the state and we want to check if the neurons flip their firing rates at the next time step (so that ), then if the transition occurs from to , and otherwise. In SubSec. (2.2) we will show how to use Eq. (3) for plotting the bifurcation diagram of the network.
2.2 Plotting the Bifurcation Diagrams
In this subsection we introduce a general way for plotting the bifurcation diagrams of networks with arbitrary topology of the synaptic connections. For a given network, its bifurcation diagram is composed of two panels, namely the multistability and the oscillation diagrams. These diagrams provide a complete picture of the relation between the stationary/oscillatory solutions of the network and the set of stimuli (see for example the left and right panels of Figs. (3) and (5)). In SubSecs. (2.2.1) and (2.2.2) we describe algorithms for calculating the multistability and the oscillation diagrams, which are implemented in the supplemental Python scripts “Multistability_Diagram.py” and “Oscillation_Diagram.py” respectively.
Finally, in the case of networks with homogeneous populations, we superimpose to these diagrams the regions of the stimuli space where the system undergoes spontaneous intra-population symmetry-breaking. In these regions, the stationary and oscillatory solutions calculated by our algorithms show non-homogeneous firing rates within one or more populations, despite the homogeneity of their neurophysiological parameters. More generally, given a neuron in population , our algorithms detect the formation of spontaneous symmetry-breaking in networks where all the terms and depend only on the populations , since this is the most general symmetry condition for the network, according to Eq. (1). Therefore, networks with homogeneous parameters represent only a special case of this condition.
2.2.1 Multistability Diagram
The firing-rate state is stationary if it satisfies the condition . From Eq. (3) we observe that this condition holds if:
for . By inverting Eq. (4) with respect to the stimulus , we get that the equation is satisfied whenever:
Generally, if some neurons share the same stimulus, so that for example the neurons with indexes in the set receive the same external current , then from Eq. (5) we get:
Eq. (6) provides the ranges of the stimuli (if any) where the firing-rate state is stationary. By calculating the ranges for every set , we get a complete picture of the relation between the stationary states and the set of stimuli (see for example the left panels of Figs. (3) and (5)). If the ranges corresponding to different states overlap, the overlapping area has multistability degree . In other words, for combinations of stimuli lying in that area, the network has stationary firing rates. Therefore Eq. (6) allows the analytical derivation of the multistability diagram, extending the analysis we performed in  to networks with arbitrary topology and size.
Note that Eq. (6) implies the calculation of the set for each (potentially) stationary firing-rate state . By defining as the set of the candidate stationary states to be checked, we observe that is actually stationary if . In SubSecs. (2.3) and (2.4) we will introduce two different algorithms for generating , which are called by the Python script “Multistability_Diagram.py”. Depending on the algorithm, the cardinality may be different for a given network topology. This will affect the overall speed with which the multistability diagram is plotted.
2.2.2 Oscillation Diagram
In principle, the same approach discussed in the previous subsection for the multistability diagram of the network can be extended to the study of neural oscillations. A sequence , defined as with , is an actual oscillatory solution (of period ) if every transition in satisfies the condition . Similarly to SubSec. (2.2.1), if some neurons share the same stimulus, so that the neurons with indexes in the set receive the same external current , then the sequence is an oscillatory solution of the network dynamics if:
where and . Finally, by calculating the ranges for every set , we get a complete analytical picture of the relation between the oscillatory solutions and the set of stimuli (see for example the right panels of Figs. (3) and (5)).
Similarly to the case of the multistability diagram, we observe that Eq. (7) implies the calculation of the set for each (potential) oscillatory solution. In SubSecs. (2.3) and (2.4) we will introduce two different algorithms for generating the set of the candidate oscillatory solutions, which are called by the Python script “Oscillation_Diagram.py”.
2.3 Non-Efficient Algorithms for Generating the Stationary and Oscillatory Solutions
In SubSec. (2.2) we described an algorithm for plotting the multistability and oscillation diagrams, provided some sets of candidate stationary and oscillatory solutions, and respectively, are known. In the present section we introduce non-optimized brute-force algorithms, implemented in the Python script “Non_Efficient_Algorithm.py”, that generate the sets and for networks with arbitrary topology.
2.3.1 Generation of the Set
The simplest way for generating the set is to fill it with all the states of the firing rates, from to . This approach allows the evaluation of the multistability diagram of small-size networks, since its computational time increases exponentially with . We observe that only the states in that satisfy the constraint (see SubSec. (2.2)) are actually stationary, therefore the set generated by this algorithm is usually oversized. In SubSec. (4.3) we will discuss a way to reduce for specific network topologies.
2.3.2 Generation of the Set
Unfortunately, the brute-force approach described above for the generation of the set is unfeasible for the study of neural oscillations, due to computational time. Indeed, the number of possible oscillations in a network of size is , which grows as for (see Appx. (A)). The best solution we found to reduce the computational time, given a network with arbitrary topology, is to obtain by discretizing the stimuli space, and then by solving iteratively Eq. (1) for every combination of stimuli and for every initial condition of the firing rates. In other words, we discretized the stimuli space through a grid composed of points, each one representing a combination of stimuli. Then we solved iteratively the equation , with , for each of the combinations of stimuli of the grid , and for each of the initial conditions . If the firing-rate vector calculated through Eq. (1) oscillates according to a sequence for a given initial condition , then . Finally, we filtered the set in order to remove duplicate oscillations, so that the set will contain every oscillation exactly once (for example, in a -neurons circuit, the oscillations and are circularly identical, therefore one must be discarded). Through this approach, we can derive the actual oscillations in the set , by solving Eq. (1) times. Generally , so that if we calculate the range through Eq. (7) for every oscillation in , the computational time required for deriving the oscillation diagram now increases as with the network size, rather than .
However, while being much faster, this algorithm does not guarantee that the resulting oscillation diagram is complete. Indeed, for some oscillations, the range could be smaller than the grid resolution. For this reason, the parameter must be chosen accurately in order to avoid relevant information loss (which may occur when is too small for a given network) and an excessive computational load of the algorithm (which may occur when is too large for the computational power available).
To conclude, we observe that the oscillation diagram may be calculated in a purely numerical way, by solving Eq. (1) for every combination of stimuli on the grid, without making use of the analytical formula (7). However, by relying on Eq. (7), our semi-analytical approach allows the analytical derivation of the oscillation diagram, which would not be possible otherwise. Moreover, it is easy to verify that the use of Eq. (7) allows a reduction of the resolution of the grid compared to a purely numerical approach, resulting in a much faster derivation of the oscillation diagram.
2.4 An Efficient Algorithm for Generating the Stationary and Oscillatory Solutions in Sparse Networks
We observe that the algorithms described in SubSec. (2.3) can be applied to networks with any topology of the synaptic connections (dense or sparse), but their computational time increases as with the network size. In this subsection we show that, for the specific case of sparse networks, it is possible to take advantage of the sparseness of the synaptic connections to define an efficient algorithm for the generation of the sets and . This approach, which we implemented in the Python script “Sparse_Efficient_Algorithm.py”, may outperform of several orders of magnitude the non-optimized approaches introduced in SubSec. (2.3).
2.4.1 Generation of the Set
As we saw in SubSec. (2.2.1), in order to identify the stationary states of the network we need to check if the condition (4) is satisfied for each neuronal index , given a set of stimuli . If the th neuron receives inputs from all the other neurons in the network (i.e. if for ), the condition (4) must be checked for all the binary states of length , from to . On the contrary, in sparse networks some synaptic weights are equal to zero. If some neurons do not project a synaptic connection to the th neuron (i.e. if for some index ), the corresponding firing rates will not affect the sum . Therefore for sparse networks there is no need to check Eq. (4) for all the binary states of length , unlike the case of dense networks. This observation allows us to introduce an efficient algorithm for finding the candidate stationary states of sparse neural networks, which is described below.
At step , we set and we call the set of neurons with indexes that do not project a synaptic connection to the th neuron (i.e. if and ). Moreover, we call the set of the remaining neurons. This is the set of neurons that can affect the condition (4) through their firing rates. In particular, the th neuron belongs to since it can affect the condition (4) through the term even in the case when (therefore if , and if , where is the incoming vertex degree of the th neuron, see Eq. (1)). At this step, we only need to check Eq. (4) for all the binary states of length . If no state satisfies Eq. (4), the network has no stationary solution and the algorithm is stopped. Otherwise we call the set of states that satisfy Eq. (4), and we switch to the neuronal index , as described below.
At step , we set and we call the set of neurons with indexes that do not project to the st neuron. Moreover we call the set of the remaining neurons, and . Then we generate all the binary states of length , and we use each of them to complete the states in , by creating new binary states of length . For example, we suppose that at step we got and , while at step we got . Then the states , , will be used to fill the states in according to the index , generating the new states , , , and , , , (the bits of the states are highlighted in bold). Then the algorithm checks the condition (4) for on the newly generated states (when is empty, the algorithm checks the condition directly on the states in ). If no state satisfies Eq. (4), then the network has no stationary solution, therefore the set is cleared and the algorithm is stopped. Otherwise is cleared and filled with the newly generated states that satisfy Eq. (4). Then we proceed to the neuronal index .
In a similar way, for , we define as the set of neurons with indexes which do not project to the th neuron. Moreover we call the set of the remaining neurons, and . The procedure described at step is repeated iteratively through the steps , , … by completing the states in through the binary strings of length . If the algorithm does not stop, when the th step has been completed the states in have length . We observe that quickly tends to for increasing . For example, if the network has a ring topology (i.e. if each neuron receives a connection only from the previous neuron and projects a connection only to the next one), we get for , for and , so that for .
At the end of the process, will contain the actual stationary states of the network (if any), namely all the states of length that satisfy the condition , if the stimuli are all known. The efficiency of the algorithm is directly proportional to the sparseness of the matrix and inversely proportional to the number of stationary states of the network. Moreover, further speed-up is achieved by sorting the neuronal indexes with ascending vertex degrees , before running the algorithm. This is due to the fact that the algorithm slows down when both and are large. However, we observe that if at some step a string of length does not satisfy the condition (4), then during the next steps the algorithm will not check all the binary states of length that contain that string. Since , if the vertex degrees are small , then the string length must be small. For this reason, the number of (non-stationary) states containing the string of length is large (). Being non-stationary, this large number of states will not fill the set , which therefore remains small. When the algorithm will proceed by iterating over the indexes with large degree (which are computationally more expensive, since the algorithm has to iterate over all the binary states of length ), the number of states in will be small. This reduces the computational load in the slowest part of the algorithm, resulting in an overall speed-up. On the contrary, for the same reason the algorithm slows down when the neurons are sorted with descending .
Fig. (1) shows a comparison between the computational time required by our algorithm for calculating the stationary states of a given network topology for a fixed set of stimuli , and the computational time required for performing the same calculation through the non-optimized brute-force approach introduced in SubSec. (2.3.1).
The figure shows that the speed gain of the algorithm for sparse networks with respect to the non-optimized algorithm is generally much larger than , and it increases with the network size and sparseness. The computational time of the non-optimized algorithm increases exponentially as regardless of the network sparseness. However, for small and highly dense networks this algorithm could outperform that for sparse networks ().
As we said, when the currents are all known, the algorithm for sparse networks generates a set containing the actual stationary states of the network. However, since our purpose is to plot the multistability diagram, we observe that the values of the currents that define the parameter space of the diagram are generally not fixed (see e.g. Fig. (2), where the currents and are unspecified since they represent the bifurcation parameters of the network). For this reason, in order to derive the multistability diagram, the algorithm described above must be adapted for generating a set whenever some inputs are unspecified. In what follows we propose two different solutions.
The first is to apply our algorithm for all the combinations of the bifurcation stimuli on a grid in the stimuli space, similarly to the method described in SubSec. (2.3.2) for the study of oscillations. This approach works for any set of stimuli (e.g. when all the neurons share the same stimulus or when each neuron receives a distinct external input), but it does not guarantee that the resulting multistability diagram is complete if the resolution of the grid is not high enough.
Unlike the first method described above, the second way to use our algorithm (which is the one we implemented in the Python script “Sparse_Efficient_Algorithm.py”) is specific to systems where the external currents that we vary during the bifurcation analysis are injected into a limited number of neurons. In other words, we suppose that the stimuli that span the bifurcation diagram are , where is an integer close or equal to (see e.g. the network considered in Eq. (9), where after a proper rearrangement of the neural indexes). We also suppose that the remaining stimuli, i.e. , are known and fixed, so that the algorithm for sparse networks can be applied for . The algorithm will generate a set containing incomplete stationary states, namely binary strings of length . Now, the binary states of length from to must be used to complete the states in , creating binary strings of length . For example, in the case of the -neurons network shown in Fig. (2), we suppose we got after the step (with ) has been completed, and that the states in are the firing rates of the neurons with indexes . Then , therefore the complete binary strings are (the bit corresponding to is highlighted in bold).
These are candidate stationary states, which can be used to derive the multistability diagram by inverting the relation in the currents . Note that the relation between and depends on the topology of the network. However, if is close or equal to , then is generally small, because most of the binary digits in every stationary firing-rate state are determined, through our algorithm, by the known currents . In this case, the overall efficiency of the algorithm will be high for large , since does not diverge exponentially with the network size.
2.4.2 Generation of the Set
The algorithm introduced in SubSec. (2.4.1) can be naturally extended to find the oscillatory solutions of the network, as we describe below. In SubSec. (2.2.2) we observed that the sequence , with , is an oscillatory solution if every transition satisfies the condition . For this reason, the initially empty set of the oscillatory solutions with fixed period is populated as follows. First, at the th step of the algorithm (for ), we need to generate all the binary states of length (where and are defined as in SubSec. (2.4.1), and ) for each time instant . In other words, the algorithm creates all the -tuples of states of length . Then, similarly to SubSec. (2.4.1), we have to use these states for completing those in the set , and to check if the states in satisfy the condition for . At the end of the th step, the set , if not empty, is cleared and filled with the newly generated states that satisfy the condition, before proceeding to the th step of the algorithm. The algorithm is stopped only if is empty or after the th step is completed. Then, similarly to the method of SubSec. (2.3.2), we discard the duplicate oscillations in the set . At the end of the process, if the currents are all known, the set will contain exactly once all the actual oscillatory solutions of the given network topology with fixed period . Whenever some external stimuli are unspecified, the algorithm is adapted as we discussed in SubSec. (2.4.1) for the stationary states.
We observe that this approach, which we implemented in the script “Sparse_Efficient_Algorithm.py”, detects only the oscillations with a fixed period . Therefore this procedure must be repeated for , where the maximum period is a user-defined parameter, that should be chosen according to the computational power available. Generally, for the algorithm is not guaranteed to find all the oscillatory solutions. However, setting close to or larger than results in an overall (at least exponential with ) slowing down of the algorithm, due to the generation of the -tuples. Therefore, similarly to SubSec. (2.3.2), the study of oscillations proves to be computationally expensive, requiring a compromise between precision and computational speed, which in this case is generally achieved by setting for large . We observe that increases with the network sparseness for a fixed network size , therefore in sparse networks the algorithm will detect more oscillation periods in a fixed amount of time, compared to dense networks. Unfortunately, it is not possible to know a priori the effective maximum period of the oscillations generated by a network. However, in the sparse topologies we analyzed, this was usually small, and oscillations with period equal to or larger than the network size appear much more rarely (see e.g. the right panels of Fig. (5), where random sparse networks of size showed only oscillations with period and ). Typically, oscillation periods larger than occur in systems with built-on-purpose, and usually very regular, topologies.
To conclude, we observe that more generally this technique can be used to calculate efficiently the whole state-to-state transition probability matrix . According to Eq. (3), this is defined as the binary matrix of the conditional probabilities of the firing rates. More precisely, , for , where the firing rate is the binary representation of length of the index (e.g., if , then ). Our algorithm provides all the firing-rate pairs such that , from which we can calculate the corresponding (decimal) indexes . In other words, the algorithm calculates efficiently and in a convenient sparse-matrix notation, since it provides only the coordinates of the non-zero entries of the matrix. The matrix describes all the possible transitions between the firing rates, which are not restricted to stationary and oscillatory solutions only. Eventually, the stationary and oscillatory solutions of the network may be calculated from through a cycle-finding algorithm (in particular, the stationary solutions may be considered as oscillations with period ). To the best of our knowledge, the fastest cycle-finding algorithm was introduced by Johnson , and is implemented in the function simple_cycles of the Python library NetworkX. However, this approach proved to be even slower than the non-optimized algorithm of SubSec. (2.3), therefore we will not consider it here any further.
2.5 Examples of Network Topologies
In this section we report two standard examples of network topologies, whose bifurcation diagrams will be studied in Sec. (3): fully-connected networks (SubSec. (2.5.1)) and sparse networks with random synaptic weights (SubSec. (2.5.1)). In these examples, we suppose that the networks are composed of one excitatory () and one inhibitory () population. Two-population networks are commonly considered a good approximation of a single neural mass , however our analysis may be extended to systems composed of an arbitrary number of populations, if desired. We define () to be the size of the excitatory (inhibitory) population, with . Note that can be arbitrary, but for illustrative purposes in this section we consider the case (rather than the ratio experimentally observed in biological systems ), because we found that the network complexity increases with the size of the inhibitory population. Interestingly, the same phenomenon was found to occur also in multi-population networks with graded activation function . Moreover, without further loss of generality, we index the neurons of the excitatory population as and the inhibitory neurons as , so that the synaptic connectivity matrix and the stimulus vector can be written as follows:
, for , is a matrix that describes the synaptic connections from the population to the population . The entries of the matrices and must be non-negative, while those of the matrices and must be non-positive, since the populations and are composed of excitatory and inhibitory neurons, respectively. Moreover, self-connections are not present in biological networks, so that the main diagonals of the matrices and should be set to zero (even though, more generally, our algorithms could be applied also to networks with self-connections). In a similar way, represents the collection of stimuli to the population . Note that and depend on the structure of the specific network we study, as we will show below. Finally, we will call the (homogeneous) firing threshold of all the neurons in the population .
2.5.1 Fully-Connected Networks
Our first example is a fully-connected network with homogeneous intra-population inputs, whose parameters are:
The parameters describe the strength of the homogeneous synaptic connections from the population to the population , while represents the stimulus current to each neuron of the population . Moreover, is the all-ones matrix (here we use the simplified notation ), while is the identity matrix and is the all-ones vector.
2.5.2 Sparse Random Networks
The second example we consider is a sparse network with random synaptic weights, whose parameters are:
is a sparse random matrix, whose entry , either for and , or for and , is equal to a non-zero random number with probability , while it is equal to zero with probability . For example, we suppose that the non-zero entries of are generated from a homogeneous and uniform (i.e. rectangular) distribution with support , where the parameters and describe the minimum and maximum strength of the synaptic connections, respectively. Moreover, in Eq. (9), represents the stimulus current to one neuron of the population , while is the all-zeros vector (so that the remaining neurons of the population do not receive any external input).
In this section we report the bifurcation diagrams generated by our algorithms for the network topologies described in SubSec. (2.5). In Fig. (3) we show the (codimension two) bifurcation diagrams of the fully-connected network (see SubSec. (2.5.1)) in the plane, for . The left and right panels have been obtained from Eqs. (6) and (7) respectively, for and .
In particular, we observe that the case is the same considered in , and whose bifurcation diagram was derived through hand calculations. Due to the homogeneity of the synaptic connections, the bifurcation diagrams show symmetric structures, characterized (also for , results not shown) by an increase of the maximum degree of multistability with the network size and by low-period oscillations. Interestingly, while spontaneous symmetry-breaking may occur in both the populations during neural oscillations, only the inhibitory one may undergo the formation of heterogeneous activity during the stationary states. As we discuss in SubSec. (4.3), for any homogeneous multi-population network it is generally possible to take advantage of this phenomenon, in order to speed up the non-optimized algorithm of SubSec. (2.3.1).
Moreover, in Fig. (4) we show some examples of changes of dynamics that occur in the state-to-state transition probability matrix of the fully connected network for . This figure shows that the graph of the matrix, as given by Eq. (3), changes its structure as a function of the stimuli. In particular, the graph undergoes changes in the degree of multistability and in the period of the oscillations, which are more conveniently described by Fig. (3) (top panels).
To conclude, Fig. (5) shows the bifurcation diagrams of the sparse random networks (see SubSec. (2.5.2)) in the plane, which have been obtained for and . As expected, the randomness of the synaptic connections is reflected in the irregular structure of both the multistability and the oscillation diagrams, as opposed to the regular structure of the fully-connected networks shown in Fig. (3). In the random networks, high multistability degrees and high-period oscillations can occur only by chance, depending on the randomness of the synaptic weights and on the sparseness of the synaptic topology.
We studied how the dynamics of the spin-glass-like neural network model (1) depends on its underlying parameters. The network is composed of a finite and arbitrary number of neurons with binary firing rates, that interact through arbitrary (generally asymmetric) synaptic connections. While in artificial neural networks with graded (smooth) activation functions this study is performed by means of standard bifurcation theory , the discontinuity of the activation function of the spin-glass model at the firing threshold prevents us from using this powerful tool.
Due to the discrete (binary) nature of the network, the number of possible stationary states and neural oscillations is finite. For this reason, in SubSec. (2.3) we developed brute-force algorithms for studying the bifurcations of the model. By taking advantage of the state-to-state transition probability matrix, these algorithms find the actual stationary and oscillatory solutions of the network, and build the corresponding bifurcation diagram in the parameters space. In particular, in Sec. (3) we provided examples that show how the network dynamics depends on the external stimuli, the network size and the topology of the synaptic connections. Similarly to the case of graded firing-rate network models [4, 3, 5, 27, 15, 9], this analysis revealed a complex bifurcation structure, encompassing several changes in the degree of multistability of the network, oscillations with stimulus-dependent frequency, and various forms of spontaneous symmetry-breaking of the neural activity.
The computational time of these algorithms increases as with the network size, regardless of the network topology. In particular, the study of neural oscillations proved very challenging due to combinatorial explosion, causing us to find a compromise between speed and precision. The best solution we found was to discretize the parameter space of the oscillation diagram and to run a searching algorithm for every combination of the parameters on the grid. While this solution allowed us to perform the study in exponential time, it may generate incomplete oscillation diagrams, due to the finite grid resolution.
Since biological networks are sparse , in SubSec. (2.4) we introduced an efficient algorithm that takes advantage of the limited number of synaptic connections. This algorithm may outperform of several orders of magnitude the non-optimized approaches introduced in SubSec. (2.3). While the computational time of the non-optimized algorithms increases as regardless of the network topology, the speed of the efficient algorithm increases with the network sparseness and is inversely proportional to the number of stationary/oscillatory solutions. For these reasons, the algorithms introduced in SubSec. (2.4) prove to be particularly convenient when applied to large sparse networks. However, for highly dense networks their speed decreases significantly, therefore in this case the algorithms of SubSec. (2.3) should be used instead.
While the study of multistability did not reveal any complication, the study of neural oscillations proved again to be computationally demanding, also for sparse networks. Our algorithm does not rely on the discretization of the parameter space, therefore it can detect areas at any resolution. Nevertheless, it outperforms the non-optimized algorithm of SubSec. (2.3) only in detecting oscillations with period . Since increases with the network sparseness for a fixed network size , in sparse networks the algorithm will detect more oscillation periods in a fixed amount of time, compared to dense networks. While generally it is not possible to know a priori the effective maximum period of the oscillations generated by a network (an exception is represented by symmetric networks, which can sustain only oscillations with period , see ), in the sparse random topologies we analyzed, this period was usually small (see e.g. the right panels of Fig. (5), where we showed that the networks corresponding to the topologies of Tab. (1) undergo only oscillations with period and ). Oscillations with period equal to or larger than the network size occur much more rarely by chance, usually in very small regions of the parameter space (a formal explanation of this phenomenon is reported in SubSec. (4.2)). Nevertheless, special (usually very regular) topologies may show large oscillation periods, therefore a complete analysis of these networks is beyond the capability of our algorithm for large . Moreover, while for most of the sparse random topologies we analyzed the algorithm proved to be very fast, for some networks the script “Sparse_Efficient_Algorithm.py” generated large sets of candidate oscillatory solutions (only few of which were actual neural oscillations), resulting in a considerable slowing down of the bifurcation analysis. This phenomenon occurs in those networks where the activity of the neurons that receive the fixed external stimuli does not provide enough information for determining which oscillations are allowed and which are not. In other words, depending on the topology of the synaptic connections, in these special networks the number of oscillatory solutions was strongly influenced by both the fixed stimuli and the free stimuli that define the parameter space of the oscillation diagram. Interestingly, this phenomenon occurred despite the free currents were injected only into a limited number of neurons by hypothesis (see SubSec. (2.4)). In these cases, a grid implementation of the algorithm (similar to that used in the script “Non_Efficient_Algorithm.py”) could be considerably faster, since at every point of the grid in the parameter space the algorithm for sparse networks would generate only actual oscillatory solutions (see SubSec. (2.4)).
In the following we discuss the advances of our results with respect to previous work (SubSec. (4.1)), the implications of our work to better understand neural network dynamics (SubSec. (4.2)), and future directions that need to be pursued to address the limitations of our results (SubSec. (4.3)).
4.1 Progress with Respect to Previous Work on Bifurcation Analysis
Previous studies on the complexity of dynamics in firing-rate network models focused either on ideal mean-field limits of spin-glass-like models with discontinuous firing rates (e.g. [28, 6, 26]), or on systems with graded (smooth) firing rates (e.g. [4, 3, 5, 27, 15, 9]). On the contrary, in this article we studied finite-size networks with discontinuous activation functions. The analysis of these models is typically more complex, since we can rely neither on mean-field approximations, nor on the powerful methods developed in bifurcation theory for smooth systems. Moreover, our model evolves in discrete-time steps according to the recurrence relation (1). This also prevents us from using the methods recently developed for the bifurcation analysis of non-smooth dynamical systems, which can be applied only to continuous-time models described by non-smooth differential equations or by differential inclusions [22, 2, 21, 24]. This proves that the model we considered in this article is particularly hard to tackle with standard mathematical techniques.
However, in  we showed that it is possible to derive the bifurcation structure of this model by combining a brute-force search of the stationary and oscillatory solutions of the network, with the analytical formula of the state-to-state transition probability matrix. Our proof of concept was limited to the specific case of a fully-connected network, whose bifurcation structure was calculated through tedious hand calculations. In the present article we developed fast algorithms that perform this analysis automatically, for any topology of the synaptic connections. Therefore our work complements standard numerical continuation softwares such as the MatCont Matlab toolbox  and XPPAUT , that are widely used in neuroscience for the bifurcation analysis of graded neuronal models (see e.g. [13, 29, 30, 9]).
4.2 New Insights into the Dynamics of Discrete Network Models
In his pioneering work , Little underlined the importance of identifying the states that characterize the long-term behavior of a neural network, which would provide a great simplification in our comprehension of the network dynamics. In particular, given a deterministic network model, this problem is equivalent to identifying the actual stationary and oscillatory solutions for . While the actual stationary states must be identified out of the set of possible solutions in a network of size , the problem of selecting the actual oscillations is even more formidable, since in large asymmetric networks the number of possible oscillatory solutions is (see Appx. (A)).
In our work, we developed algorithms that identify the actual stationary and oscillatory solutions of Eq. (1). The algorithms are particularly efficient when applied to sparse networks, providing great insight into the operation of the network. Moreover, the algorithms make use of this knowledge to deepen further our understanding of the network dynamics, by calculating the corresponding bifurcation structure. Interestingly, our algorithms revealed the formation of complex bifurcation diagrams also in small networks. The diagrams strongly depend on the network size, , and on the topology of the synaptic connections, . However, a detailed analysis of the network dynamics as a function of and is computationally very expensive (due to the large number of possible topologies for each fixed network size) and beyond the purpose of this article. Nevertheless, our study revealed that the spin-glass-like network model (1) can undergo three different kinds of bifurcations.
The first is a change in the degree of multistability of the network. This phenomenon occurs through the formation and destruction of stationary solutions, similarly to the limit-point (also known as saddle-node) bifurcations that occur in graded models .
The second kind of bifurcation is the formation of neural oscillations. If this phenomenon occurs through the annihilation of a stationary state (see e.g. the formation of the period- oscillation in the middle panels of Fig. (3)), then it may be interpreted as the discrete counterpart of the Andronov-Hopf bifurcation of graded models . Otherwise, the number of oscillatory solutions may change with no variation in the number of stationary states (see e.g. the transition between the blue and red areas in the top-right panel of Fig. (3)), similarly to the limit point of cycles bifurcation of graded models . It is interesting to observe that usually large-period oscillations occur more rarely and in smaller regions of the parameter space (for example, compare the green area of the period- oscillation in the middle-right panel of Fig. (3), with the blue and red areas of the period- and period- oscillations). The reason of this phenomenon can be easily deduced from Eq. (7): the larger the period of the oscillation, the more probable is that the function (respectively, ) will be large (respectively, small). In turn, this implies that the range where the large-period oscillation occurs will be narrower, and in particular if the oscillation will not occur at all.
The third kind of bifurcation is characterized by spontaneous symmetry-breaking. This phenomenon is similar to the branching-point bifurcations  that occur in homogeneous multi-population graded models (see e.g. ). Here we observe the formation of heterogeneous intra-population neural activity, even if Eq. (1) does not contain any term that breaks explicitly the network symmetry. In particular, the symmetry may be broken at the stationary states or during oscillations, in both excitatory and inhibitory neural populations, depending on the network topology and parameters.
To conclude, we observe that our algorithms also calculate the number of stationary and oscillatory solutions, as well as the number of areas with distinct degrees of multistability, the number of oscillations with a given period, etc. We propose that these measures could be used to quantify rigorously the complexity of the neural dynamics in relation to the network size.
4.3 Future Directions
Neural networks with discrete activation functions may be considered as caricatures of the corresponding graded models. By discretizing the activation function, we gain the possibility to solve exactly the network equations , but currently it is not known to which extent this approximation oversimplifies the dynamical behavior of the system. For this reason, in future work we will investigate a potential reduction of the underlying neural complexity of the network by comparing the two classes of models.
Moreover, note that while in this article we introduced new algorithms for the bifurcation analysis of Eq. (1), we did not perform an exhaustive analysis of the relationship between the neural dynamics and the network parameters. In Sec. (3) we showed some relevant examples of the codimension two bifurcation diagrams for specific networks sizes and topologies, while in future work we will systematically investigate, through a large scale analysis, to which extent the network parameters correlate with the neural complexity.
To conclude, we observe that while we introduced fast algorithms for the bifurcation analysis of sparse networks, efficient solutions for dense networks are still missing. Ad hoc solutions can be developed for specific network topologies. For example, in the case of multi-population fully-connected networks with homogeneous weights, such as that considered in Eq. (8), it is possible to prove that the symmetry of the excitatory populations is never broken when the network is in a stationary state. The same phenomenon occurs in homogeneous multi-population networks with graded activation function . Accordingly, the method described in SubSec. (2.3.1) can be easily modified in order to include in the set only the states with homogeneous excitatory firing rates. In the case of the two-populations network described by Eq. (8), this approach would generate a set with cardinality , rather than , reducing considerably the computational time for . However, this idea can be applied only to specific network topologies, and a general method for speeding up the bifurcation analysis of dense networks with arbitrary topology is still missing. This represents another challenge that needs to be addressed in future work, and that will complete the tools at our disposal for studying the dynamical behavior of binary neuronal network models.
Appendix A: Asymptotic Estimation of the Number of Possible Oscillatory Solutions in Large Networks
In this appendix we want to determine how the number of possible oscillatory solutions in an asymmetric network of size grows for . Given any finite , we define and we observe that is the total number of sets (known as -combinations) containing distinct neural states among which the network may oscillate. For example, for , the oscillations and occur among the states in the -combinations and , respectively. Now we observe that any given set of states gives rise to distinct oscillations. For example, and are two distinct oscillations generated by the set , while the oscillations and are (circularly) identical. Therefore, by summing over all the oscillation periods from to (the case corresponds to the stationary states and therefore is not considered), we get that the total number of distinct oscillations is (see also ). Then, by observing that:
we finally get the following asymptotic expansion:
in the limit
We thank Anna Cattani for useful feedback. This research was supported by the Autonomous Province of Trento, Call “Grandi Progetti 2012,” project “Characterizing and improving brain mechanisms of attention - ATTEND”.
The funders had no role in study design, data collection and analysis, decision to publish, interpretation of results, or preparation of the manuscript.
-  P. Ashwin, S. Coombes, and R. Nicks. Mathematical frameworks for oscillatory network dynamics in neuroscience. J. Math. Neurosci., 6:2, 2016.
-  J. Awrejcewicz and C. H. Lamarque. Bifurcation and chaos in nonsmooth mechanical systems. World Scientific, 2003.
-  R. D. Beer. On the dynamics of small continuous-time recurrent neural networks. Adapt. Behav., 3(4):469–509, 1995.
-  R. M. Borisyuk and A. B. Kirillov. Bifurcation analysis of a neural network model. Biol. Cybern., 66(4):319–325, 1992.
-  B. Cessac. Increase in complexity in random neural networks. J. Phys. I France, 5:409–432, 1995.
-  J. R. L. De Almeida and D. J. Thouless. Stability of the Sherrington-Kirkpatrick solution of a spin glass model. J. Phys. A: Math. Gen., 11(5):983–990, 1978.
-  A. Dhooge, W. Govaerts, and Y. A. Kuznetsov. MATCONT: A MATLAB package for numerical bifurcation analysis of ODEs. ACM Trans. Math. Softw., 29(2):141–164, 2003.
-  B. Ermentrout. Simulating, analyzing, and animating dynamical systems: A guide to XPPAUT for researchers and students. SIAM, Philadelphia, PA, USA, 2002.
-  D. Fasoli, A. Cattani, and S. Panzeri. The complexity of dynamics in small neural circuits. PLoS Comput. Biol., 12(8):e1004992, 2016.
-  D. Fasoli, A. Cattani, and S. Panzeri. Pattern storage, bifurcations and higher-order correlation structure of an exactly solvable asymmetric neural network model. arXiv:1702.03183 [q-bio.NC], 2017.
-  E. Goles-Chacc, F. Fogelman-Soulie, and D. Pellegrin. Decreasing energy functions as a tool for studying threshold networks. Discrete Appl. Math., 12(3):261–277, 1985.
-  F. Grimbert. Mesoscopic models of cortical structures. PhD thesis, University of Nice - Sophia Antipolis, 2008.
-  F. Grimbert and O. Faugeras. Bifurcation analysis of Jansen’s neural mass model. Neural Comput., 18(12):3052–3068, 2006.
-  J. Harris and B. Ermentrout. Bifurcations in the Wilson–Cowan equations with nonsmooth firing rate. SIAM J. Appl. Dyn. Syst., 14(1):43–72, 2015.
-  R. Haschke and J. J. Steil. Input space bifurcation manifolds of recurrent neural networks. Neurocomputing, 64:25–38, 2005.
-  E. M. Izhikevich. Dynamical systems in neuroscience. MIT Press, 2007.
-  D. B. Johnson. Finding all the elementary circuits of a directed graph. SIAM J. Comput., 4(1):77–84, 1975.
-  N. Karayiannis and A. N. Venetsanopoulos. Artificial neural networks: Learning algorithms, performance evaluation, and applications. Springer US, 1993.
-  R. Kötter. Neuroscience databases: A practical guide. Springer US, 2003.
-  Y. A. Kuznetsov. Elements of applied bifurcation theory, volume 112. Springer-Verlag New York, 1998.
-  R. I. Leine and D. H Van Campen. Bifurcation phenomena in non-smooth dynamical systems. Eur. J. Mech. A-Solid, 25(4):595– 616, 2006.
-  R. I. Leine, D. H. Van Campen, and B. L. Van De Vrande. Bifurcations in nonlinear discontinuous systems. Nonlinear Dyn., 23(2):105–164, 2000.
-  W. A. Little. The existence of persistent states in the brain. Math. Biosci., 19(1):101–120, 1974.
-  O. Makarenkov and J. S. W. Lamb. Dynamics and bifurcations of nonsmooth systems: A survey. 241(22):1826–1844, 2012.
-  H. Markram, M. Toledo-Rodriguez, Y. Wang, A. Gupta, G. Silberberg, and C. Wu. Interneurons of the neocortical inhibitory system. Nat. Rev. Neurosci., 5(10):793–807, 2004.
-  M. Mézard, N. Sourlas, G. Toulouse, and M. Virasoro. Replica symmetry breaking and the nature of the spin glass phase. J. Phys., 45:843–854, 1984.
-  F. Pasemann. Complex dynamics and the structure of small neural networks. Network-Comp. Neural, 13:195–216, 2002.
-  D. Sherrington and S. Kirkpatrick. Solvable model of a spin-glass. Phys. Rev. Lett., 35:1792–1796, 1976.
-  M. Storace, D. Linaro, and E. De Lange. The Hindmarsh-Rose neuron model: Bifurcation analysis and piecewise-linear approximations. Chaos, 18(3):033128, 2008.
-  J. Touboul, F. Wendling, P. Chauvel, and O. Faugeras. Neural mass activity, bifurcations, and epilepsy. Neural Comput., 23(12):3232–3286, 2011.