Examining cognitive flexibility and stability through the lens of dynamical systems

Cognitive stability and flexibility are regarded as key ingredients of goal-directed behavior. This review introduces dynamical systems as a theoretical framework for studying cognitive flexibility and stability. Following a gentle introduction to dynamical systems theory, we discuss how cognitive flexibility and stability can be operationalized and examined through the lens of such models. Drawing from recent advances in dynamical systems theory, we argue that various models of cognitive flexibility and stability, ranging from models of spiking neurons to models of human task switching to models of collective animal behavior, can be understood in terms of the same mathematical principles of low-dimensional dynamical systems. These principles suggest a trade-off between cognitive flexibility and stability inherent to dynamical system models of varying complexity. We conclude by discussing the consequences of this unified view and examine its explanatory scope in terms of behavioral and neural correlates of cognitive flexibility and stability


Introduction
Cognitive flexibility and stability play a crucial role in supporting goal-directed behavior [19,36].On the one hand, cognitive flexibility enables rapid behavioral adjustments in response to changing task demands [2,47].On the other hand, cognitive stability supports sustained focus on a task amidst potential distractions [5,19].Together, both faculties characterize the dynamics of goaldirected information processing in the brain and resulting behavior.
Recent years have seen a proliferation of dynamical system models aimed at elucidating the concept of cognitive flexibility and stability.These models span a broad spectrum, from ordinary differential equations [13,20,39,54,57] to complex recurrent neural networks [16,26,27,48,59], offering insights into behavioral and neural correlates of cognitive flexibility and stability.This article offers a gentle introduction to dynamical systems as a theoretical tool for understanding cognitive flexibility and stability.Drawing from classic ideas from dynamical systems theory, we argue that a diverse array of models -aimed at addressing flexibility and stability at different scales -can be unified under a small set of mathematical principles.We conclude by discussing the implications of this view and examine the capacity of dynamical systems models to account for both behavioral and neural correlates of cognitive flexibility and stability.

A gentle introduction to dynamical systems as models of cognitive flexibility and stability
A dynamical system is a collection of variables along with a set of rules for how they evolve in time (see Table 1 for a summary of relevant terms).For a finite number of variables, such rules are typically described by a system of ordinary differential equations in continuous time or by difference equations in discrete time.The state of a dynamical system is the value that its variables take on at a particular instant in time, and its state space is the collection of all possible values the system state could reach.For example, when modeling cognitive flexibility, the state may represent the amount of attention allocated to a given task, and the state space may characterize the set of possible attentional states (Figure 1a,b).
Recurrent neural network models are examples of dynamical systems that have been remarkably effective at describing a broad range of cognitive phenomena [29].
Within these models, cognitive representations are stored as attractors -sets of states on which the system settles over time.They can be thought of as basins in an energy well.In this analogy, the state of the system would correspond to the position of a ball rolling along a potential energy landscape spanning the state space (Figure 1b,c).The dynamic system determines the direction in which the ball will roll, and attractors are the locations or trajectories on which the ball will settle, given enough time.To illustrate these concepts, we can examine a simple dynamical system that describes the evolution of a single state variable x, Here, x may represent the focus on Task A (e.g.x < 0) versus Task B (e.g.x > 0; cf. Figure 1c).dx dt is the rate of change of x over time, and {g, I} are parameters of the model.I is an external input provided to the dynamical system.The input may correspond to a task cue from the environment (e.g.I < 0 for a cue signaling the relevance of Task A and I > 0 for signaling Task B) or an internal representation of a task cue maintained in a different system, for example, in working memory [59].Both the current attentional state x and the external input I are transformed by a saturating function (tanh), which is a common type of activation function in neural network models, ensuring that −1 < x < 1.The parameter g regulates the rate of adaptation based on the current attentional state x and external cue I.When g is small, −x makes the attentional state of the system converge (decay) to x = 0 in the absence of a task cue, yielding indecision between the two tasks. ))implicitly defines the fixed points or equilibria of Equation 1, or values Table 1 Summary of relevant terminology for dynamical systems models.

State
The value that the variables of a dynamical system take on at a given time.

State space
The set of all possible states that a dynamical system can take on.The dimensionality of the state space is defined by the number of independent variables required to describe the system fully.Attractor A set of states on which the system settles over time.Fixed point/equilibirum Points in the state space at which the state no longer changes.A fixed point is an attractor if nearby states settle to it over time.

Bifurcation diagram
A plot that captures how the fixed points in the model change as its bifurcation parameter is varied.Bifurcation point Value of bifurcation parameter at which the number and/or the stability properties of fixed points change.

Pitchfork bifurcation
A bifurcation diagram with a transition from one to three fixed points as the bifurcation parameter is varied.

Figure 1
Current Opinion in Behavioral Sciences Example of a dynamical system model of cognitive stability and flexibility as described in Ref. [39].Both cognitive stability and flexibility are a function of the attractor depth.Note that similar dynamics have been proposed in many other contexts involving binary choice, e.g. to underlie switches between percepts in vision [22], choices in perceptual decision-making [46,61], and collective decisions in honeybee swarms [55].
of x at which its rate of change is zero, that is, = 0 dx dt .Fixed points, to which nearby trajectories in the state space settle over time, are a common type of attractor.In Figure 2a, we plot the magnitude of x at equilibrium (i.e. the fixed points) against the parameter g and three different choices of I.This type of plot is referred to as a bifurcation diagram, and the parameter g as a bifurcation parameter.Due to the characteristic shape of this plot, this symmetric bifurcation diagram is called a pitchfork bifurcation.The point (g, x) = (0, 0) at which new solutions appear is the critical point or bifurcation point.Such bifurcations provide useful insights into how parameters of the dynamical system modulate flexibility and stability.

Operationalizations of cognitive flexibility and stability
In dynamical system models, the cognitive stability and flexibility are often conceptualized in terms of the depth and distance of attractor basins in a potential energy landscape [13,40,57].Deep attractor basins confer robustness to noise (e.g.small forces acting on the ball in a potential energy landscape; cf.purple line in Figure 1c), representing a system that is highly stable.Cognitive flexibility can be operationalized in terms of the time required to switch from one attentional state into another (Figure 1b).This time may be proportional to the distance between the branches of a pitchfork bifurcation, representing the distance of attractors (Figure 2a).
Deeper attractor basins and larger distances between attractors increase the time required to switch between attentional states [39,57].
The formalization of cognitive stability and flexibility in terms of attractor basins suggests a relationship between the two: Deeper attractors confer greater cognitive stability at the expense of cognitive flexibility [14,40,42,57].This balance is regulated by the parameters of the dynamical system.

Dynamical system parameters influencing the balance between cognitive flexibility and stability
The bifurcation diagrams shown in Figure 2 provide insight into which parameters of a dynamical system model can affect the balance between cognitive flexibility and stability by modulating the potential energy landscape.From Figure 2b, we can see the complementary role of the bifurcation parameter g and the input parameter I. Increasing the bifurcation parameter g increases the depth and distance of both of the potential wells (attractors).The balance of stability and flexibility is, therefore, directly modulated by the choice of this parameter and, therefore, by the parametrized distance of the system from its bifurcation point.The parameter g has been suggested to mimic the effects of neuromodulatory neurotransmitters, such as dopamine and norepinephrine, which are thought to increase the sensitivity of neurons to incoming inputs [7,32,50,57].Meanwhile, the input parameter I (e.g.representing influence from a task cue) increases the relative difference in depth between the two potential wells.In fact, for a fixed g, a sufficiently large input I removes one of the potential wells, isolating the equilibrium favored by the input.This means that a greater influence of task cues can lead to cognitive stability in the model shown in Equation 1.
The bifurcation point plays a crucial role in regulating cognitive flexibility and stability.When g is near the bifurcation point, a small input I is sufficient to remove one of the potential wells.This makes the system more flexible, enabling it to switch between states (e.g.modes of attention) more quickly as a function of external input.When g is far away from the bifurcation point, a significantly larger input I is necessary to remove one of the wells.This corresponds to the system being more stable.

Unifying principles of cognitive stability and flexibility
Dynamic models of cognitive stability and cognitive flexibility vary in their complexity and level of description.For example, variables in these models may represent a psychological state of attention [20,39], average firing rates of neural populations [25,57], or membrane potentials associated with individual neurons [14].Their time evolution may be described by a low-dimensional set of equations, for example, describing mechanistic circuits, or by a high-dimensional recurrent neural network with hundreds or thousands of parameters.At first glance, the diversity of these models might suggest competing theoretical frameworks.However, examining models of cognitive flexibility through the lens of dynamical systems theory presents a unified perspective [6,21].Indeed, we argue that the behavior of these models can mimic one another and are related to generic properties of a bifurcation in a dynamical system.
A fundamental result from dynamical systems theory tells us that all models that contain a pitchfork bifurcation have qualitatively similar properties when their parameters are near the bifurcation point [18].It is therefore sufficient to understand a simple system such as Equation 1 and its perturbations to fully map out the qualitative properties of any model with a pitchfork bifurcation, including models that are high in descriptive detail and in state dimension.Formally, the connection between a complex dynamic model of cognitive processing and Equation 1 can be established using mathematical techniques such as Lyapunov-Schmidt reduction and center manifold reduction [18,23].Figure 1b,c illustrates an example of a reduction from a twodimensional (2D) model to a one-dimensional (1D) model.Informally, these reductions amount to identifying which parameters or combinations of parameters play an analogous role to the key parameters in simpler models, for example, to g and I in Equation 1, in how they shape the bifurcation diagram of the model (cf. Figure 2).
The unifying principle of a pitchfork birfurcation suggests that the trade-off between cognitive stability and flexibility can be observed across different levels of information processing.At the level of models for single neurons, deep attractors can confer stability in the firing pattern at the expense of firing rate adaptation to external stimuli [14,32].At the level of populations of neurons representing individual tasks, deeper attractors can improve focus on the task at the expense of switching between tasks [39,42,57].Finally, in systems with multiple agents, deeper attractors can confer stability at the expense of inflexibility in animal collective decision-making [11,53], social networks [3], or networked systems of engineered decision-makers [31].

Explanatory scope
Dynamical system models offer valuable insights into how individuals adjust to changing environmental demands.The adaptability to changing task demands is often explored in laboratory settings through cued task switching experiments [12,30].In this context, cognitive flexibility is evaluated by measuring switch costs -the performance decline, observed either as increased reaction times or error likelihood, when participants switch tasks compared with repeating the same task.In contrast, cognitive stability is assessed by how well participants can ignore task-irrelevant distractors.Dynamical systems can account for behavioral and neural correlates in such tasks.

Behavioral correlates
A fundamental prediction arising from dynamical system models of task switching is the performance cost associated with switching tasks.In such models, the cost of switching arises from the time required to switch from the state of attention for one task to a target state of attention for another task.During this transition, the attentional state for the previous task (e.g.Task 1 in Fig. 1a-b) decays gradually, leading to proactive interference with the subsequent task (e.g.Task 2 in Figure 1a,b), which mimics 'task-set inertia' [1].Accordingly, increasing the interval between task cue and stimulus has been found to reduce switch costs, which can be accounted for by the additional time available for reaching the target state of attention [28].Another prediction pertains to the relationship between cognitive flexibility and stability: deeper attractors in the model create more robust task representations that are less susceptible to distractions but incur longer times to switch tasks [39,42].Therefore, these models highlight a potential trade-off between cognitive stability and flexibility [19,39,42,57].Some phenomena have been postulated to originate from inhibitory mechanisms that dynamical system models are well-equipped to simulate.For example, switching from a more difficult to an easier task has been paradoxically found to yield greater switch costs than vice versa [52,62].In a dynamical systems model, a more difficult task may require a greater attention, resulting in greater inhibition of the easier task (cf. Figure 1a).This enhanced inhibition impedes the switch to the easier task, providing a theoretical basis for such 'asymmetric' switch costs.
Using a large-scale task switching data set, Steyvers et al. [54] demonstrated that the dynamics of reaction times can be predicted by simple dynamical system models implementing the activation of the task-relevant representation and the concurrent inhibition of the taskirrelevant representation.Critically, they found that increased practice in task switching leads to reduced switch costs.Their model explained this improvement in terms of an increased asymptotic activation level of the representation for the relevant task, while the representation of the irrelevant task remained unaffected.Essentially, these results suggest that repeated practice shifts the final stable state of the attractor corresponding to the relevant task, enhancing its robustness while facilitating cognitive flexibility.This observation can explain observations that cognitive stability and flexibility must not always trade off one another [15,17].It depends on the mechanism that alters the dynamics of the system.
Dynamical system models also offer a framework to elucidate the dynamics underlying more abstract representations, such as for response strategies.In a study by Grahek et al. [20], participants were prompted to prioritize either fast or accurate responses.The authors observed that participants needed time to transition from one response strategy to another.Notably, in scenarios with frequent task switches, participants did not seem to fully transition into either strategy (e.g.responding very fast or very accurately).This phenomenon was interpreted through the lens of a dynamical system model, in which frequent task switches impede the system's ability to reach its final attractor state for either response strategy, resulting in participants functioning in an intermediate state (responding neither very fast nor very accurately).
Finally, computational studies addressing the stability-flexibility trade-off suggest that shallower attractors in dynamical models are more advantageous in environments with frequent task switching.Simulation studies reveal that task representations modeled with shallower attractors result in better performance in settings that demand frequent task transitions.Furthermore, the behavioral patterns of individuals performing in high-frequency task switching environments closely mirror those predicted by attractor models with shallower configurations, highlighting a bias toward cognitive flexibility as task switches become more likely [27,39,40,42].This aligns with empirical studies showing enhanced cognitive flexibility in individuals when the probability of task switching increases [33,34,37,41,51].

Neural correlates
The predictions derived from dynamical system models are closely tied to the interplay between cognitive flexibility and stability, on the one hand, and the neural dynamics underlying task representations, on the other hand.In light of dynamical systems, switching tasks entails a gradual transition between task representations.This suggests that task switches involve a gradual transformation of a neural representation from one task into another, making the representations for the two tasks more and more distinguishable (i.e.decodable) as time passes.Comporting with this prediction, a functional magnetic resonance imaging study demonstrated that task representations are more distinguishable from one another after repeating a task compared with switching tasks [43].Importantly, this study observed slower task switches if the previously task executed task was still decodable, implying that lingering activity of the previously executed task negatively impacted performance on task switches.
Dynamical system models also suggest multiple neural mechanisms that can play a role in shaping the landscape of task attractors, thereby modulating cognitive flexibility and stability.Intriguingly, most of these mechanisms reduce to the effect of the bifurcation parameter g in Equation 1, effectively influencing the balance between cognitive stability and flexibility.One such mechanism may be the stabilization of task representations in prefrontal cortex via dopamine.Greater levels of dopamine are hypothesized to increase the signal-to-noise ratio of neural firing in the cortical regions, effectively stabilizing neural representations of tasks [14,13,49,58].The stability-enhancing effect of dopamine in the cortex is complemented by its flexibility-enhancing effect in the striatum.Neural network models suggest that striatal dopamine potentiates afferent input (e.g. from the external task cue I) [4,16,24,44], enabling the 'gating' of task-relevant information into the cortex via striatal-thalamo-cortical projections [58].Aligned with this perspective, individuals with Parkinson's disease, marked by reduced striatal dopamine levels, show greater robustness against distractions [9,38].However, this comes at the cost of flexibility [8,10].Notably, the administration of dopaminergic medications appears to counteract this trend, reducing cognitive stability and enhancing cognitive flexibility [9,38].
Other neural mechanisms mimicking the effects of the bifurcation parameter include factors affecting the balance between excitatory and inhibitory activity, such as channel conductances for N-methyl-D-aspartate (NMDA) and gamma-aminobutyric acid (GABA), respectively.In the biophysically inspired attractor model by Ueltzhoeffer et al. [57], an increase in the slow, excitatory NMDA channels stabilizes states of high activity maintained by recurrent connections, leading to deeper task attractors, and thereby greater cognitive stability.Conversely, an increase in GABA channel conductance leads to an increase in global inhibition, thereby destabilizing high activity states, leading to shallower attractors and greater cognitive flexibility.However, as the authors note, the channel conductances are known to be directly influenced by dopaminergic modulation at the level of single-cell recordings [13,14,56], further highlighting the influence of dopamine on the dynamics of cognitive stability and flexibility.Altogether, the unifying perspective obtained from dynamical system theory suggests that the effects of different neural mechanisms can be summarized in terms of the same mathematical principles underlying pitchfork bifurcations.

Limitations
Although dynamical system models provide substantial insights into cognitive flexibility, they may require auxiliary mechanisms to capture other key phenomena.For example, even with ample task preparation time, individuals still exhibit 'residual' switch costs [45].Additionally, it is observed that returning to a previously abandoned task generates higher performance costs than switching to a new task [35].Furthermore, the costs associated with task switching can be affected by prior associations between stimuli and tasks [60].These and many other phenomena continue to challenge the explanatory scope of dynamical system models of cognitive flexibility and stability.

Conclusion
Dynamical systems offer an insightful theoretical framework for the psychological and neuroscientific study of cognitive flexibility and stability.By interpreting various models of cognitive flexibility through the mathematical constructs of dynamical systems, we can gain a deeper understanding of their temporal dynamics.This approach not only facilitates formal analyses but also uncovers unifying principles between different models of cognitive flexibility and stability, such as common effects resulting from parameter modifications.Additionally, when applied to models of human cognition, dynamical systems reveal the complex temporal dynamics inherent in both behavioral and neural aspects of cognitive flexibility and stability, thereby enriching our understanding of how the brain navigates both cognitive states in the service of goal-directed behavior.
(a) The dynamical systems model can be depicted as a recurrent neural network with two units, each representing the amount of attention allocated to one of two tasks.(b) The 2D state space of the model is defined by the amount of attention allocated to each task.The green line depicts a transition of attentional states from paying attention to Task 1 (red dot) to paying attention to Task 2 (blue dot) -introduced by cueing Task 2. The colored gradients indicate the potential energy of the state, and black arrows depict the potential energy landscape dictating changes from one state to another, as induced by the cue for Task 2 (cf.green arrow in (a)).The red dashed line indicates a 1D reduction of the state space, representing the relative attention paid to Task 1 versus Task 2. (c) The potential energy of the state is plotted as a function of the 1D state space.In the context of this model, cognitive flexibility is defined by the time needed to transition from one task to another (green line), whereas cognitive stability is defined as robustness to noise acting on the state (purple line).

Figure 2 Current
Figure 2