1 Introduction
Multifunctionality is the term used to describe a neural network that has the ability to perform multiple tasks without changing any of its connections. Multifunctionality is an essential property of certain biological neural networks and has been an active area of research in neuroscience since the mid-1980s, with seminal work published in Mpitsos and Cohan (1986) and Getting (1989), followed by further review papers by Dickinson (1995) and Marder and Calabrese (1996), and more recently, reviewed in Briggman and Kristan, (2008). These studies have identified that a multifunctional neural network in principle resembles a multistable dynamical system. In this sense, for each task that the network performs, there is an attractor associated with it. This attractor is in coexistence with several other attractors in the network’s state space, and each attractor is related to one of the tasks that the network performs. Therefore, in order to perform a given task, the multifunctional network requires a cue in the form of an initial condition in the basin of attraction of the attractor associated with the task.
Taking all of the above into account, where this ability to harness multistability becomes immediately relevant is in the domain of machine learning (ML), as multifunctionality can be used to unlock additional computational capabilities of artificial neural networks (ANNs) that would otherwise have remained dormant. In Flynn et al. (2021b), multifunctionality was achieved in an artificial setting for the first time via the reservoir computing approach to ML. This involved training a “reservoir computer” (RC), which in this case was a dynamical system in the form of an ANN, to reconstruct a coexistence of chaotic attractors from different dynamical systems using the same set of trained weights. This RC was driven with input from these chaotic attractors, and the RC’s response dynamics to the different driving inputs were used to obtain a readout layer to replace the drive, after which the RC became a multistable system that reconstructed a coexistence of the chaotic attractors. In this example, to perform a particular task, i.e., to reconstruct a particular chaotic attractor, the multifunctional RC is like any other multistable dynamical system and only needs to be initialized with an initial condition in the basin of attraction of the corresponding attractor.
There are many additional phenomena that can arise and also factors to consider when training an RC to reconstruct more than one attractor simultaneously. For instance, it was shown in Flynn et al. (2021b) that multifunctionality becomes increasingly difficult to achieve with the increase in the difference of the time scales of the attractors that the RC is trained to reconstruct. Furthermore, in Flynn et al. (2023), where the RC was trained to solve the “seeing double” problem that involves training the RC to construct a coexistence of attractors that describe clockwise and anticlockwise trajectories on two circular orbits, it was shown that by manually shifting the location of the training data describing these orbits, the closer the orbits are to one another, the more difficult it is for the RC to achieve multifunctionality. Remarkably, for a small range of training parameters, it was found that the RC achieves multifunctionality even when the orbits are overlapping in state space (in the sense that the training data used to drive the RC contain identical data points from the different orbits). In Flynn et al. (2023) and Flynn (2023), it was shown that in certain cases, when the RC fails to achieve multifunctionality, it instead produces a variety of episodic switching patterns between different metastable states that resemble the dynamics it failed to reconstruct. Through further investigation of the seeing double problem, we have found a similar phenomenon to occur when the orbits are moved closer together. The purpose of this paper is to examine the origins of these switching dynamics in much greater detail.
We explore the origins of the transition from multifunctionality to metastable switching dynamics in much greater detail. We find that for a small change in the spectral radius of the RC’s internal connectivity matrix, the RC first fails to reconstruct one of the orbits as the corresponding reconstructed attractor becomes unstable, and it is only after a relatively long transient that the RC approaches the other reconstructed orbit (which is the only stable attractor present in the system). After another small change in the spectral radius, the other reconstructed orbit also becomes unstable, and this results in RC switching between the dynamics of these two unstable states. On closer inspection, we find that when the second attractor becomes unstable, there is a new attractor created that facilitates these switching dynamics. This new attractor is created through this sequence of attractors becoming unstable because due to the RC’s design, and it is prohibited from becoming globally unstable. We show that these switching dynamics appear when the orbits are brought closer together, touch, and overlap. From computing the probability density of different residence times in each of the metastable states, we find a sawtooth-like pattern consisting of multiple branches of exponentially distributed points, where each branch describes a particular path taken by the RC on each of the metastable states.
2 Methods
In this section, we introduce the particular RC that is studied, describe how this RC is trained to achieve multifunctionality, and outline the specifics of the seeing double problem, the task that the RC is trained to solve. We follow the same procedure as in Flynn et al. (2023).
2.1 Reservoir computing
2.1.1 Central philosophy of reservoir computing
Today, the term “reservoir computer” (RC) is generally used to describe a dynamical system that, for instance, can be realized as an ANN and trained to solve certain machine learning (ML) problems without explicitly training the internal structure of the system. As outlined in Nakajima and Fischer (2021), the reservoir computing approach to ML received its name in Verstraeten et al. (2005), where the term reservoir computer was coined as a means to establish a new ML framework based on the common concepts of echo-state networks (ESNs) Jaeger (2001) and liquid-state machines (LSMs) Maass et al. (2002). These are two independently proposed designs of ANNs with recurrent connections (RNNs) that share the following philosophy: instead of training all the weights in a network, it is sufficient to only optimize the weights of a readout layer in order to solve a particular problem. This ideological shift in training RNNs stems from the design of a suitable internal layer, known as the “reservoir,” which does not need to be trained according to a given task. The role of this reservoir is to enable the state of the RC to become a representation of the history of training input signals related to a particular task, and only a readout layer needs to be found in order to project this information out of the RC to solve the given task. Multifunctionality extends this philosophy by demonstrating that an RC’s response to several different sequences of training input signals, each of which is related to a particular task, can be harnessed to produce a single RC that performs all of these tasks using the same readout layer.
2.1.2 RC formulation
The RC that is studied throughout this paper was introduced in Lu et al. (2018); before this RC is trained, it is defined as the following ANN in the form of a non-autonomous dynamical system, which we refer to as the “open-loop RC”:
In Equation 1,  describes the state of the open-loop RC at a given time  and  is the number of artificial neurons in the network. Solutions of Equation 1 are computed using the  order Runge–Kutta method with time step .  is a decay-rate parameter that arises during the derivation of Equation 1 from the discrete-time design proposed by Jaeger (2001). The  “activation function” is a pointwise operation and is defined as . The adjacency matrix, , plays the role of the “reservoir.” The input strength parameter, , and the input matrix, , when multiplied together represent the weight given to the -dimensional driving input, , as it is projected into the open-loop RC. We use the superscript  to denote the vector transpose operation. The initial condition, specified in Equation 2, is the same for all experiments that were carried out.
The elements of  and  are the same that are used in Flynn et al. (2023) in order to provide a direct comparison to the results of this present paper.  was designed by first constructing a random sparse matrix, where each element is chosen independently to be nonzero with probability  (i.e., sparsity  or degree ), and these nonzero elements are chosen uniformly from . The elements of this random sparse matrix are subsequently rescaled so that the resultant matrix, which we then call , has a specific spectral radius denoted by , which is the magnitude of the largest eigenvalue of . The corresponding input matrix, , was designed such that each row has only one nonzero randomly assigned element that is chosen uniformly from . As a result, each neuron is driven with only one component of .
Building on the results of Flynn et al. (2023),  is again shown to play a significant role in producing the switching dynamics that are studied in this paper.  has also been a key parameter in previous results on training an RC to achieve multifunctionality; see: Flynn et al. (2021b,a, 2022); Morra et al. (2023). One of the main reasons why  is such an influential parameter of this RC is that it is used to tune how previous states of the RC impact the current state. This becomes particularly important in scenarios involving overlapping training data because there must be a sufficiently large weight placed on previous states in order for the RC to distinguish between identical data points from the different sets of training data. In this paper, we find that when  is not sufficiently large, the RC cannot easily distinguish between the different orbits, which, in certain scenarios, leads to the state of RC switching between the orbits.
2.1.3 Training a RC to achieve multifunctionality
We now outline the steps involved in training Equation 1 to achieve multifunctionality. To illustrate this procedure, we consider the case of training the open-loop RC in Equation 1 to reconstruct a coexistence of two attractors, , given access to a trajectory on each attractor described by  and . In the case of multifunctionality, the aim of the training is to determine a “readout function/layer,” defined as , which enables us to replace  in Equation 1 with  and form a new “closed-loop RC,” which is capable of reconstructing a coexistence of  and . In this paper,  is constructed as:
where  is the “readout matrix,” and  is given by:
where . The purpose of , as specified in Equation 4 is to prevent the occurrence of “mirror-attractors,” which can impede the ability of the RC to reconstruct attractors, as reported in Herteux and Räth (2020) and Flynn et al. (2021a). To compute  in Equation 3, we use a ridge regression technique, which consists of solving the following equation:
where  is the “ridge parameter” and is tuned to reduce the magnitudes of elements in  in order to discourage overfitting,  is the identity matrix, and  and  are the training data matrices, which are both constructed as concatenations of two smaller matrices, where  and . The elements of these  and  matrices are computed as follows: we first drive the open-loop RC in Equation 1 with input  for  and then repeat this process for . The corresponding responses of the open-loop RC to these driving inputs are denoted by  and . It is these responses that are used to generate the elements of  and , where
and similarly for . The elements of the corresponding  and  matrices are defined as:
and similarly for . The time  is chosen such that at this time, both  and  are determined by a history of driving inputs and are no longer dependent on the open-loop RC’s initial condition; the duration of time from  to  is known as “the listening stage.” The time  is chosen such that  and  contain a sufficiently long representation of a trajectory on  and , and the duration of time from  to  is known as “the training stage.” It is important to highlight that , , and all training parameters remain identical when generating  and .
2.1.4 The “closed-loop” RC
After following the steps outlined in the previous section and obtaining  from Equation 5,  in Equation 1 can then be replaced by . In Equation 8, we now define the resulting closed-loop RC as the following autonomous dynamical system:
where  denotes the state of the closed-loop RC at a given time . While  and  are both -dimensional vectors, the purpose of this notation is to distinguish between the dynamics of the closed-loop and open-loop RCs. Furthermore, we consider , where  is referred to as the “RC’s state space” and is used henceforth when discussing the dynamics of the closed-loop RC in . By computing the solutions of Equation 8, predictions of  for , denoted as , are given by:
Again, while both  and  are -dimensional vectors, we use the same convention to indicate that  is a prediction of  at time . We also define , where  is referred to as the “projected state space” and is used henceforth when discussing these projected dynamics of the closed-loop RC.
To test whether the closed-loop RC has achieved multifunctionality, as indicated by Equation 9, we initialize Equation 8 with  and , and from these initial conditions, we examine the long-term projected dynamics of the closed-loop RC in . We say the closed-loop RC has achieved multifunctionality if the long-term dynamical characteristics of  and , defined according to Equation 10, are indistinguishable from  and . If this is the case, then we can say that there exists a coexistence of attractors , and when the state of the closed-loop RC approaches either  or , the corresponding projected dynamics in  are referred to as the “reconstructed attractors,” , which resemble the long-term dynamics of  and . By resembling the long-term dynamics, it is meant that, for instance,  and  will have nearly identical Poincaré sections when computed for the same region of  and  as . If multifunctionality is achieved, then we refer to the resulting multistable closed-loop RC as the “multifunctional RC.”
We comment that  and  are not the only initial conditions that will allow the closed-loop RC to reconstruct  and , so long as the closed-loop RC is initialized with a point in the basin of attraction of either  or , the corresponding attractor will be reconstructed in .
2.2 Seeing double
The specifics of the “seeing double” problem are outlined in this section. This numerical experiment was introduced in Flynn et al. (2023) as a means to systematically study the issues related to multifunctionality and overlapping training data.
2.2.1 Numerical experiment setup
The seeing double problem consists of training an RC to construct a coexistence of attractors such that their dynamics in  follow trajectories along two circular orbits of equal radius and rotate in opposite directions. The difficulty of this task is varied by moving the centers of these orbits closer together or further apart. When these orbits are overlapping, the RC is therefore required to distinguish between points in  that are common to both cycles in order to exhibit multifunctionality.
The driving input to the RC is generated via
for , using the time-step . The resultant time-series of , given by Equation 11, corresponds to a trajectory around a circle of radius  and centered at .
As in Flynn et al. (2023), for a given , we set  in Equation (11) to generate a trajectory about the counter-clockwise circular orbit that we denote as , and points along this orbit are written as . For the corresponding , we generate a trajectory about the clockwise circular orbit that we denote as , and by setting  and , points along this orbit are written as . By changing , the centers of these cycles are moved equidistantly along the line . An overlapping region between  and  exists whenever , i.e., . Furthermore,  and  are said to be “entirely/completely overlapping” when . In this extreme case, the only difference between  and  is the direction of rotation on both cycles.
The values of  and  are used as the input to the open-loop RC in Equation 1 for . The open-loop RC’s responses to these driving input signals are denoted as  and . Following the steps outlined in Section 2.1.3, the values of , , , and  for  are used to produce the corresponding training data matrices , and  as per Equations 6, 7 in order to compute  in Equation 5. This  is then used to create the closed-loop RC in Equation 8.
We say that this closed-loop RC achieves multifunctionality and solves the seeing double problem once it reconstructs a coexistence of  and . To do this, the RC must construct a coexistence of two attractors,  and , that exist in  and resemble  and  when projected to  using  in Equation 3, with  computed as mentioned above. As per the same convention used earlier, the projected dynamics of  and  are referred to as the reconstructed attractors and are denoted by  and . To reconstruct the dynamics of  or  using this multifunctional RC, we initialize Equation 8 with  or  or some known point in the basin of attraction of  or . The subsequent states of Equation 8 when approaching  (i.e., ) are written as  and .
3 Results
3.1 Outline of experiments
The main aim of this paper is to improve our current understanding of how metastable switching dynamics emerge in an RC that fails to achieve multifunctionality. Figure 1 illustrates the particular phenomenon we are interested in studying. In panel (a), we show that when  and  are sufficiently far apart (when ), then for , the closed-loop RC achieves multifunctionality as  and  are more or less identical to  and . However, panel (b) shows that when the same RC is trained with , when  and  are slightly closer together but do not overlap, then the closed-loop RC fails to achieve multifunctionality, and instead, its state switches between regions of  associated with  and . To investigate the origins of these switching dynamics, we conduct the following experiments.
The results from the experiments reported in this section consist of training the RC in Equation 1 to solve the seeing double problem for  and 2.0. To illustrate the differences in the closed-loop RC’s (Equation 8) dynamics when trained at these values of , we chose a common  value , where multifunctionality is achieved for each . We then decrease  in small steps of 0.001 and track the changes in the dynamics of the reconstructed attractors,  and , by initializing the closed-loop RC with an initial condition corresponding to each attractor at the previous step and integrating the closed-loop RC forward in time up to . If  or  can no longer be tracked, i.e., have become unstable or cease to exist, we continue decreasing  and track the changes in the attractor that the state of the closed-loop RC subsequently approaches until . This method of attractor continuation enables us to investigate the origin of the switching dynamics we see in  at certain values of  and .
The results of this continuation procedure at each of the specified  values are shown in panel (e) of Figures 2–5, where we plot the local maxima of the reconstructed  variable, denoted by . In panels (a)–(d) of Figures 2–5, we illustrate some of the most significant changes in the closed-loop RC’s dynamics at particular  values, highlighting how the switching dynamics emerge. In Figures 2–5, the dashed blue and orange curves illustrate the location of  and , the corresponding solid curves describe the closed-loop RC’s reconstruction of  and  (denoted by  and ), and the blue and orange points are the corresponding  values obtained from tracking the changes in the dynamics of  and  and the subsequent attractor that the closed-loop RC’s state approaches when it fails to reconstruct  or , respectively. In circumstances where the closed-loop RC fails to reconstruct , , or produce switching dynamics between regions of  associated  and , the “untrained attractor” (an attractor that the closed-loop RC produces that was not present during the training) that the state of the closed-loop RC subsequently approaches is depicted using the color specified in the associated plot legends. While there may be other untrained attractors present in  for , in order to maintain the focus of this paper (which is to explore the origins of the switching dynamics), we only track the changes in the attractors that the state of the closed-loop RC approaches when it fails to reconstruct ,  or produce the switching dynamics. In addition, we also initialize the state of the closed-loop RC from many random initial conditions at several different  values when tracking the changes in  and , but we do not find any untrained attractors.
In panel (e) of Figures 2–5, the vertical dashed gray lines indicate the  values that the corresponding dynamics in  are illustrated in the accompanying panels (a)–(d). The black arrows in panel (a) of Figures 2–5 indicate  and ’s direction of rotation. These illustrations are generated by training the RC in Equation 1 at the specified  values and initializing the closed-loop RC with  and  (the last point in the training data corresponding to  and ), i.e., following the description in Section 2.1.3. We do this in order to observe whether there exists any transient behavior associated with  or  when the RC fails to reconstruct these attractors.
Furthermore, we also conducted this analysis for the case of , but we choose not to show these results as we found no switching dynamics nor significant changes in the closed-loop RC’s dynamics for changes in . For , the closed-loop RC achieves multifunctionality with a nearly perfect reconstruction of  and  for the range of  values that were investigated.
The results of the continuation analysis for each of the selected  values are outlined in Secs. 3.2–3.5. In Section 3.6, we examine the residence and escape times associated with the switching and transient dynamics observed in Secs. 3.2–3.5.
3.2 Continuation analysis for 
Figure 2E shows that for , there are no significant changes in the closed-loop RC’s ability to reconstruct a coexistence of  and  until , where  becomes unstable. In Figure 2A, we take a closer look at this behavior, and we see that the state of the closed-loop RC follows a significantly long chaotic transient when initialized with the associated  before eventually approaching , which is the only stable attractor present in  (confirmed by initializing the closed-loop RC from many random initial conditions). Based on the structure of this transient and the evidence of a saddle present at  (indicated by the red point in Figure 2A), there is evidence that  becomes unstable by colliding with this saddle.
There is stronger evidence to support the above claim in Figure 2B as we see for , the structure of the transient is highly influenced by this saddle (now located at  in , as indicated by the red point in Figure 2B), whose unstable directions appear to point predominately along the x-axis and stable directions point along the y-axis in . While we see here that the state of the closed-loop RC takes significantly less time to escape this transient, what is particularly interesting about this transient is that the state of the closed-loop RC follows a path that encircles  and switches back to the portion of  associated with  before switching back to and remaining on  for all future time.  is the only stable attractor present in  for , as further indicated by the dashed blue horizontal line associated with the reconstruction of  that is visible within this range of  values. It is also during this range of  values that  becomes chaotic through what appears to be a period-doubling bifurcation, which is quickly followed by a torus bifurcation. Furthermore, it appears that the closed-loop RC’s trajectory on  for  comes arbitrarily close to the saddle, indicating that a similar fate to  awaits  at smaller  values.
Figure 2E illustrates that when tracking the changes in  for decreasing  further, there are multiple values of  obtained that surround both blue and orange dashed horizontal lines. This indicates the emergence of the switching dynamics between regions of  where the previously stable  and  existed. These switching dynamics are found to occur for , and a variety of different switching patterns are exhibited. For instance, in Figure 2C, we show that these switching dynamics resemble a Lorenz-like chaotic attractor for , whereas in Figure 2D, a periodic switching pattern appears in the form of a limit cycle, which emerges from the chaotic attractor. Section 3.6 describes the long-term dynamics of the chaotic attractor shown in Figure 2C. Figure 2E shows that this periodic switching pattern returns to an aperiodic switching pattern at , indicated by the three clusters of  values.
The switching dynamics come to an end at , and the state of the closed-loop RC subsequently approaches a stable fixed point (FP), indicated by the sequence of green points, and we continue to track the changes in this FP until . We find a small range of  values where the FP coexists with the switching patterns by tracking the changes in this FP for increasing  values until it becomes unstable at . At this point, the state of the closed-loop RC returns to the limit cycle associated with the periodic switching pattern mentioned in the paragraph above.
3.3 Continuation analysis for 
For , we find that by moving  and  closer together so that they touch at , the switching dynamics begin at much larger  values, persist for a greater range of  values, and the switching patterns are first found to occur periodically before becoming chaotic. Figure 3E shows that as  is decreased,  becomes unstable at . Figure 3A illustrates the transient dynamics of the closed-loop RC when initialized with the associated . Here, we see that the state of the closed-loop RC follows one loop around the dashed orange circle  before diverging away to approach and then remain on the slightly oval-shaped . It is from these unstable directions of flow along the x-axis and stable flow along the y-axis that the nature of this transient also provides us with some evidence that there is a saddle located at  , as indicated by the red point in Figure 3A.
Figure 3B provides us with further information about this saddle (now located at , as indicated by the red point in Figure 3B) as it appears that  has become unstable at  by colliding with the saddle. Moreover, it is through this second collision that a new limit cycle is created that produces the switching dynamics nearby the point at which  and  touch in . This limit cycle consists of two weakly attracting connected regions of flow around  and . Taking a closer look at the transient dynamics exhibited by the closed-loop RC when initialized with , we see that its state comes arbitrarily close to the saddle before completing one loop around the dashed blue circle associated with ; however, on the second loop, the trajectory diverges away from  nearby the saddle and then approaches and subsequently remains on the new larger limit cycle that consists of loops around regions of  associated with  and . Initially, there are two values obtained for , the local maxima associated with  and a point nearby the saddle and the small branch of points nearby the dashed orange horizontal line seen in Figure 3E. Correspondingly, the sharp turning point on the new limit cycle nearby the saddle point shown in Figure 3B does not persist for many subsequent  values as the limit cycle starts to resemble a figure of 8 in , like the example shown in Figure 3C for .
As shown in Figure 3E, additional values of  are found for  as the limit cycle transitions to a chaotic attractor. In Figure 3D, we provide an example of the aperiodic switching patterns exhibited by this chaotic attractor for . Section 3.6 describes the long-term dynamics of this chaotic attractor. We are unable to track the changes in this chaotic attractor for , and the state of the closed-loop RC subsequently approaches an FP, whose behavior with respect to changes in  is described in the green branch of points in Figure 3E. There is a relatively small range of  values where this FP coexists with the chaotic attractor associated with the aperiodic switching patterns for . When tracking the changes in this FP for decreasing , we find a smaller range of  values where this FP coexists with a different period-1 limit cycle, whose corresponding  is described by the branch of red points in Figure 3E.
3.4 Continuation analysis for 
When decreasing  to 3.5, we find that by moving  and  closer together so that they overlap and share two common points, this improves the performance of the RC as it is achieves multifunctionality for a much larger range of  values and does not produce any switching dynamics. Figure 4E shows that by tracking the changes in  and  for decreasing , there is a growing difference between the obtained values for  and the corresponding true values with respect to  and . Figure 4A provides further insights into how  and  deform as  decreases. Figure 4B shows how  and  increasingly lose their resemblance to  and , with  having undergone a period-doubling bifurcation as  is decreased to . Figure 4C illustrates that for , both  and  display aperiodic dynamics (indicated by the increased thickness of the corresponding blue and orange curves). Figure 4E shows that as  is decreased further,  becomes unstable at  and the state of the closed-loop RC subsequently approaches , and at , we find that  becomes unstable and the state of the closed-loop RC subsequently approaches the FP described by the branch of green points. By tracking the changes in this FP for increasing , we find that this FP coexists with  and  until it becomes unstable at  and the state of the closed-loop RC returns to . Figure 4D illustrates that prior to  and  becoming unstable, these attractors are no longer chaotic and have returned to period-1 limit cycles.
3.5 Continuation analysis for 
When decreasing  to 2.0, we find that by increasing the amount of overlap between  and , the closed-loop RC produces switching dynamics within a relatively small range of  values in a similar fashion to those found for  and 5.0. Figure 5E shows that as  decreases, there is an increasingly large offset between the values of  for  and  and a small but noticeable difference between the values of  for  and .
Figure 5E shows that as  is decreased from ,  undergoes a sequence of period-doubling bifurcations, which results in  transitions to a chaotic attractor. In Figure 5A, we illustrate the dynamics of the closed-loop RC for , which shows the coexistence of the chaotic  and periodic which closely resemble the dynamics of . Figure 5E shows that by decreasing  further,  undergoes a period-doubling bifurcation starting from .  becomes unstable at , and after a bout of transient dynamics, the state of the closed-loop RC subsequently approaches the period-2 . We then continue to track the changes in , which also becomes chaotic at . In Figure 5B, we illustrate the chaotic dynamics of  and the relatively short duration of transient dynamics exhibited by the closed-loop RC when initialized from . This transient completes one loop around the region of  associated with ; however, on its second loop, the state of the closed-loop RC approaches the point , where it subsequently reverses along its trajectory to this point and then approaches the chaotic , remaining on  thereafter.
The densely populated range of  values, which spans across both dashed horizontal lines associated with  and  in Figure 5E, shows that the switching dynamics emerge at . For , in Figure 5C, we illustrate the dynamics of the large chaotic attractor that is born at , and trajectories on this attractor resemble aperiodic switching dynamics between regions of  associated with  and . For , Figure 5D illustrates that when the closed-loop RC is initialized with , its state follows a chaotic transient before approaching an FP located at , which is just outside the portion of  shown here.
3.6 Closer inspection of switching dynamics at  and 5.0
In this section, we aim to shed further light on the nature of the switching dynamics discussed so far. We consider the two examples of  and , which we refer to as case 1, and  and , which we refer to as case 2. We generate a much longer trajectory on these chaotic attractors in order to determine the distribution of residence times that the state of the closed-loop RC spends in the respective  and  regions of . When the state of the closed-loop RC is in the region of  associated with , we consider the system to be in a metastable state denoted as , and similarly, for , we consider to system to be in a different metastable state denoted as .
3.6.1 Algorithm to detect transitions
In order to identify when the state of the closed-loop RC is in  or , we construct a relatively simple algorithm based on the concept of a “non-ideal relay” (Krasnosel’skii and Pokrovskii, 2012). We use this algorithm to detect transition times from  to  and vice versa. The non-ideal relay aspect of the algorithm involves choosing two threshold values,  and , where we say that the closed-loop RC is in  once its state crosses  and remains below , and it is in  once its state crosses  and remains above . The benefit of using these two thresholds as opposed to one threshold is that it allows us to improve our estimate of when the system is in a particular state by reducing the effect of false alarm scenarios where, for instance, the state of the closed-loop RC is in  but briefly dips below the single threshold and does not spend any significant amount of time in the portion of  associated with .
The result of using this algorithm to detect transitions from  to  and vice versa in case 1 is illustrated in Figure 6A and that for case 2 is illustrated in Figure 6B, where we set  and . The green and red horizontal lines in Figure 6 are used to illustrate these threshold values. The green and red vertical lines shown here correspond to the detected transitions times where the state of the closed-loop RC first enters  and , respectively. The residence times in  and  are then calculated based on these transition times.
The benefit of using this double threshold algorithm is made clear in Figure 6A; if a single threshold of 0 was used instead, then when the state of the RC crosses 0 without switching from one metastable state to the other, like at , then all of these crossings would be considered transitions, which is evidently false.
Furthermore, what is also evident from Figure 6 is that there are at least three distinct types of switching patterns present where the state of the closed-loop RC can rapidly switch between  and  or spend a particular amount of time in  and  before switching.
3.6.2 Residence times
In order to construct a reasonably well-distributed sample of residence times in  and , we generate 10,000 examples of switchings between  and . To do this, we integrate the closed-loop RC forward in time up to  for case 1 and up to  for case 2. This tells us there are nearly twice as many switchings in a given duration of time for case 2 in comparison to case 1. From this sample of 10,000 switchings, we found that for case 1, the maximum and minimum residence times (in the arbitrary units of ) in  were  and 6.5, respectively, and for , they were  and 6.7, respectively. For case 2, the maximum and minimum residence times in  were  and 4.8, respectively, and for , they were  and 4.5, respectively. We then compute the probability density of these residence times by generating a histogram of residence times with 100 bins chosen from numbers spaced evenly on a log scale with limits set to the max and min values specified above. The resulting probability density of these residence times for case 1 is shown in Figure 7A and for case 2 is shown in Figure 7B.
What is most striking about the results shown in Figure 7 is that there is no single branch of exponentially distributed points; instead, for both cases 1 and 2, the probability density of the residence times in  and  are organized into a number of branches of exponentially distributed points.
We first outline the results shown in Figure 7B for case 2 as it is more straightforward to discuss. The probability density of residence times in  is organized into three branches of exponentially distributed points and two branches of exponentially distributed points for . From further investigation, we find that the points on these different branches correspond to scenarios where the state of the closed-loop RC follows either one or two loops (or partial loops) around  before switching to  and can follow up to three loops (or partial loops) about  before switching to . By partial loops, we mean that the state of the closed-loop RC may switch from  to  without completing a full loop around . Furthermore, from the dynamics of the chaotic attractor that produces these switching dynamics illustrated in Figure 3D, it is reasonable to have anticipated the exponential distribution of points on these branches shown in Figure 7B. It is also reasonable to have anticipated that the state of the closed-loop RC spends slightly longer amounts of time in  than  since  becomes unstable before  and is, therefore, relatively less attracting when the switching dynamics begin.
Figure 7A illustrates that for case 1, there are a number of less strongly defined branches of exponentially distributed points. The two most well-defined branches on the left hand side of this figure correspond to scenarios where the state of the closed-loop RC completes one or two loops (or partial loops) around ,  or rapidly switches between  and . The well-defined branch of orange points on the right-hand side of this figure corresponds to the significantly longer amounts of time that the state of the closed-loop RC spends in ,, like in the example shown in Figure 6A, where the state of the closed-loop RC is in  from  to 1,390. From further analysis, we find that by increasing the number of bins, the cloud of points in the middle Figure 6A corresponds to scenarios where the state of the closed-loop RC completes several loops (or partial loops) around  and . However, by increasing the number of bins, we also find that this results in an increasingly large accumulation of points at the bottom of these branches, which, in our opinion, diminishes the clarity of the message behind this figure, and for that reason, we do not present a version of Figure 6A with a larger number of bins.
3.6.3 Escape times
The purpose of this section is to provide further insights into the interesting transient dynamics associated with  becoming unstable when , as discussed in Section 3.2. Using the transition detection algorithm, we calculate the time it takes for the closed-loop RC to escape from transient behavior when initialized from , and we denote this duration of time as . We investigate the relationship between  and  for values of  when no switching dynamics occur for . In panels (a)–(d) of Figure 8, we plot the time series of the reconstructed  variable at particular  values. We use the same  and  thresholds as in the previous section, indicated by the red and green horizontal lines, respectively. The vertical red line depicts the detected value of .
Figures 8A–D indicate that as  increases and approaches the point at which  becomes stable,  naturally increases. However, panel (e) shows that while  increases as  increases,  increases in a non-trivial staircase-like manner where the length of each successive step decreases as  increases.
For instance,  is shown here to be relatively small and increasing at a relatively slow rate for ; however, by increasing  to 0.253, this results in a nearly two-fold increase in , but for , we find relatively large values and large variations in the values of  where  appears to almost regain stability. The inset plot shows one of these relatively long transients between the steps at . Here, we see from the change in time where local minima occur that the state of the closed-loop RC almost escapes from this transient activity at , as it does so for smaller  values, and again at . This change in time is indicative of the state of the closed-loop RC approaching the saddle point on the unstable  but fails to cross its separatrix. It is only for  that the RC escapes from the transient.
As indicated in panel (e), at each successive step along this staircase, the state of the closed-loop RC completes two additional cycles about the unstable  before escaping. While the calculated values of  depend on the choice of the initial condition relative to the point of escape on the unstable , this behavior of completing two additional cycles at each successive step may be more strongly dependent on the nature of  prior to becoming unstable as it exists as a period-2 limit-cycle (indicated by the two global maxima Figure 8D, also seen in Figure 2E albeit barely visible). Our results suggest that by increasing , the saddle point on the unstable  moves in a way that the state of the closed-loop RC needs to complete an additional round trip about the unstable period-2 nature of  until it reaches the point of escape.
4 Discussion
In this paper, we explore how switching dynamics emerge in a dynamical system in the form of an RC when trained to achieve multifunctionality by solving the seeing double problem. This problem involves training the open-loop RC in Equation (1) to reconstruct a coexistence of two circular orbits  and . We find that as  and  are moved closer together, the state of the closed-loop RC (Equation 8) begins to switch between what appears to be metastable states that resemble trajectories around regions of  associated with  and . To be more specific, we find that these switching dynamics occur just before  and  touch (as shown in Figure 2 for ), as they touch (as shown in Figure 3 for ), and after they touch (as shown in Figure 5 for ), whereby there is an overlap between  and . However, as shown in Figure 4, there is an intermediary regime whereby after  and  touch and begin to overlap (for ), the RC recovers its ability to achieve multifunctionality and does not succumb to these switching dynamics. It is only after there is a sufficiently large amount of overlap between  and  (for ) that the switching dynamics reappear.
Our results also shed further light on the key role played by  in this RC design and its connection to the concept of memory in terms of how the larger the value of , the greater the influence of previous states on the current state of the RC. What our results indicate is that if the orbits are close to touching each other, like for , or touch each other at only one point when , this requires the RC to place a greater weight on previous states (i.e., large ) in order to achieve multifunctionality as the dynamics nearby these touching regions are quite similar. On the other hand, if the orbits overlap and touch each other in two locations that are sufficiently far but not too far apart, like for , then the RC does not need to place such a large weight on previous states in order to achieve multifunctionality. However, once there is a larger amount of overlap between the orbits, like for , then the RC needs to place greater weight on previous states in order to achieve multifunctionality once again.
It is also worth noting that in panel (e) of Figures 2–5, prior to  or  becoming unstable as  decreases, there is a noticeable difference in the obtained values for  and the corresponding true values. This is most evident in panels (a)–(d) of Figure 4, where we see  and  stretched toward larger positive and negative values of , respectively. As  is decreased further, this effect appears to becomes increasingly noticeable. A similar sequence of events was shown to occur in Figures 14, 15, and 21 in Flynn et al. (2023), where, for , as  decreases,  and  are deformed in a similar way. This particular deformation may occur due to the design of , as each neuron receives input from only one component of the driving input signal because each row contains only one nonzero element; therefore, as  decreases, this increases the influence of the input, and this may increase the likelihood that the resulting dynamics of the closed-loop RC are stretched along the  and  diagonals. However, in order to provide a more rigorous answer, this requires conducting an extensive analysis across several random realizations of  and  and testing whether such a deformation effect persists when using different design principles to construct  and . We believe that such an investigation is highly worthwhile to conduct and is better suited to appear in a paper where this is the main focus.
From closer inspection of the transitions between these metastable states, which we refer to as  and , we find that there is a common sequence of events that occurs in each case in order to produce the switchings between  and . Starting from a set of training parameters where the closed-loop RC achieves multifunctionality, we track how the dynamics of  and  change with respect to changes in , the spectral radius of the RC’s internal connectivity matrix. We find that by decreasing  from the point where  and  coexist and resemble  and , there is a value of , where, for instance,  collides with a nearby saddle and becomes unstable, but there still exists some transient dynamics that the state of the closed-loop follows when initialized from a point on the previously stable . Then, by further decreasing , we find that there is a value of  where  also becomes unstable by colliding with a nearby saddle. However, when  becomes unstable, there is a new attractor born that facilitates the switching dynamics between the metastable states,  and , mentioned earlier. To be more specific, a trajectory on this new attractor consists of two regions of convergent flow where the trajectory inside these regions resembles a trajectory around  and  and a divergent flow whereby the state of the closed-loop RC switches from one region of convergent flow to the other.
We also investigate the long-term behavior of some of these new attractors that are born during the sequence of events discussed above. We integrated the closed-loop RC forward in time until we obtained 10,000 transitions between  and  for the chaotic attractors illustrated in Figure 2C, denoted as case 1, and in Figure 3D, denoted as case 2. We construct an algorithm based on the concept of a non-ideal relay to determine the time of transition between  and . In Figure 6, we provide an example of the transition times detected by this algorithm. Interestingly, by computing the probability density of residence times in  and , we obtain several branches of exponentially distributed points, as shown in Figure 7. From closer inspection, we find that each of these branches correspond to scenarios where the state of the closed-loop RC completes a given number of loops or partial loops around  and .
We remark that while these switching dynamics are found for a particular random realization of  and  (the internal and input connectivity matrices), the results presented in this paper are not solely dependent on these particular weights as we see similar behavior emerging from further experiments not shown here. Furthermore, there is a noticeable imbalance in the behavior of  and  despite the symmetry present in the training data. We believe that this is due to the particular random realization of the  and  matrices happening to favor the reconstruction of one orbit over the other at particular parameter settings. From further analysis (also not shown in this paper), we find some small differences in the values of  and the order of when  and  become unstable for different realizations of  and . As a further point, while the switching dynamics are induced by moving  and  closer together, it is still possible for switching dynamics to emerge between a reconstructed attractor and untrained attractors (attractors that the closed-loop RC produces that was not present during the training), or between the attractor, an RC with symmetry trained to reconstruct, and its mirrored counterpart as shown in Figure 2 in Herteux and Räth (2020). We suspect that when there is a competition between attractors, be it attractors that are manually moved closer together or attractors that compete with their mirrored counterpart or other untrained attractors, this sequence of attractors becoming unstable combined with the constraint that the RC is prohibited from exhibiting globally unstable dynamics (due to the choice of activation function) in turn creates a new attractor that is composed of different metastable states, which in turn produces these switching dynamics.
Out of the many examples of routes to metastable dynamics discussed in Rossi et al. (2024), there are a number of similarities between the results presented in this paper and phenomena such as chaotic itinerancy and heteroclinic cycles. In the case of chaotic itinerancy, which describes a switching process whereby the state of an autonomous dynamical system switches between several “attractor ruins” or “quasi-attractors” (these were previously coexisting attractors that retain much of their original features except trajectories on these quasi-attractors leak into each other), in our case, these quasi-attractors are described as the metastable states  and . In terms of heteroclinic cycles, this typically occurs when the unstable manifold of one saddle intersects with a stable manifold of the other saddle, which, in our case, these saddles would be the chaotic transients associated with  and . However, further work is required in order to determine which of these phenomena our results are most closely aligned with. Furthermore, a similar route to chaotic behavior has been observed in the past by Grebogi et al. (1985), whereby when two unstable orbits move toward each other by changing a parameter in the system, they coalesce at a bifurcation point and subsequently disappear; however, after the bifurcation, a chaotic transient is produced, which persists for parameter values far beyond the bifurcation point. In our case, we have one stable attractor and an unstable orbit/relatively long transient in the closed-loop RC that as  is varied, and there is a bifurcation where the stable attractor becomes unstable and a new attractor is born, which, depending on the circumstances, is either a chaotic attractor or limit cycle. Moreover, there is a valid reason why there is no transient produced after the second attractor becomes unstable. Due to the design of this closed-loop RC, it is prevented from ever becoming globally unstable, and since there is no other stable attractor present in the closed-loop RC when the second attractor becomes unstable, there is no option but for there to be a stable attractor born through these sequence of attractors becoming unstable.
While the routes to metastable behaviour mentioned above are well-studied phenomena they only arise in certain circumstances and rather than relying on there being a parameter in a dynamical system that so happens to produce these switching dynamics, the major advantage of the multifunctional reservoir computing setup studied in this paper is that we are able to systematically induce these switching dynamics by adjusting the location of  and . As a further remark, while the results presented in this paper are based on  and  rotating in opposite directions, this is not a necessary condition in order for switching dynamics to emerge in the RC. From additional experiments that are not reported on in the present paper, we find that when  and  rotate in the same direction then switching dynamics also emerge at particular values of  as  and  are moved closer together. In future work we intend to conduct a wider study that includes additional factors which may influence the emergence and behaviour of switching dynamics in a RC that are related to the training data, such as, in the context of the seeing double problem, differences in the frequency or relative size of  and , and the relationship between the training data and RC training parameters. The benefit of conducting such a step-by-step sequence of increasingly sophisticated experiments is that is provides a reasonable point of reference when attempting to make sense of how switching dynamics in a RC can emerge in more exotic scenarios involving, for instance, multiple chaotic attractors, or working with experimental data where transitions occur between states and multistability is suspected to play a role. Given the rich variety of interesting dynamics that we see arise when training the RC to reconstruct a coexistence of two circular orbits we expect that in these more complicated scenarios there are even more interesting dynamics waiting to be explored.
As a final comment, the work presented throughout this paper highlights the importance of studying the behavior of saddles and the bifurcations which take place as an RC, or any dynamical system-based machine learning approach, is trained to solve a given task. As strongly emphasized in Sussillo and Barak (2013), in order to open the black-box of machine learning approaches, it is necessary that we improve our understanding of the interaction between stable and unstable dynamics and pay closer attention to the influence of saddles that are present in the system.
Data availability statement
The raw data supporting the conclusions of this article will be made available by the authors, without undue reservation.
Author contributions
AF: conceptualization, investigation, methodology, writing–original draft, and writing–review and editing. AA: writing–original draft and writing–review and editing.
Funding
The author(s) declare that financial support was received for the research, authorship, and/or publication of this article. This work was partly supported by the Deutsche Forschungsgemeinschaft Project No. 411803875 and PIK Werkvertrag 2023-0336.
Acknowledgments
The authors would like to thank Aravind Kumar, and their Applied Mathematics colleagues at the School of Mathematical Sciences, in particular, Andrew Keane, Pierce Ryan, Serhiy Yanchuk, and Sebastian Wieczorek, for their influential conversations and input when discussing the contents of this paper.
Conflict of interest
The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
Publisher’s note
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors, and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.
References
Flynn, A. (2023). Theory and applications of multifunctional reservoir computers. 
Google Scholar
Flynn, A., Heilmann, O., Köglmayr, D., Tsachouridis, V. A., Räth, C., and Amann, A. (2022). “Exploring the limits of multifunctionality across different reservoir computers,” in 2022 international joint conference on neural networks (IJCNN), 1–8.
CrossRef Full Text | Google Scholar
Flynn, A., Herteux, J., Tsachouridis, V. A., Räth, C., and Amann, A. (2021a). Symmetry kills the square in a multifunctional reservoir computer. Chaos 31, 073122. doi:10.1063/5.0055699
PubMed Abstract | CrossRef Full Text | Google Scholar
Grebogi, C., Ott, E., and Yorke, J. A. (1985). Super persistent chaotic transients. Ergod. Theory Dyn. Syst. 5, 341–372. doi:10.1017/s014338570000300x
CrossRef Full Text | Google Scholar
Jaeger, H. (2001). The ‘echo state’ approach to analysing and training recurrent neural networks-with an erratum note. Bonn, Germany: German National Research Center for Information Technology GMD Technical. 
Google Scholar
Krasnosel’skii, M. A., and Pokrovskii, A. V. (2012). Systems with hysteresis. Springer Science and Business Media. 
Google Scholar
Maass, W., Natschläger, T., and Markram, H. (2002). Real-time computing without stable states: a new framework for neural computation based on perturbations. Neural Comput. 14, 2531–2560. doi:10.1162/089976602760407955
PubMed Abstract | CrossRef Full Text | Google Scholar
Morra, J., Flynn, A., Amann, A., and Daley, M. (2023). “Multifunctionality in a connectome-based reservoir computer,” in 2023 IEEE international conference on systems, man, and cybernetics (SMC) (IEEE), 4961–4966.
CrossRef Full Text | Google Scholar
Nakajima, K., and Fischer, I. (2021). Reservoir computing. Springer. 
Google Scholar
Rossi, K. L., Budzinski, R. C., Medeiros, E. S., Boaretto, B. R. R., Muller, L., and Feudel, U. (2024). Dynamical properties and mechanisms of metastability: a perspective in neuroscience. arXiv Prepr. doi:10.48550/arXiv.2305.05328
CrossRef Full Text | Google Scholar
Sussillo, D., and Barak, O. (2013). Opening the black box: low-dimensional dynamics in high-dimensional recurrent neural networks. Neural Comput. 25, 626–649. doi:10.1162/NECO_a_00409
PubMed Abstract | CrossRef Full Text | Google Scholar
Verstraeten, D., Schrauwen, B., and Stroobandt, D. (2005). “Reservoir computing with stochastic bitstream neurons,” in Proceedings of the 16th annual ProRISC workshop, 454–459. 
Google Scholar