Cognitive and behavioural flexibility: neural mechanisms and clinical considerations

Cognitive and behavioural flexibility permit the appropriate adjustment of thoughts and behaviours in response to changing environmental demands. Brain mechanisms enabling flexibility have been examined using non-invasive neuroimaging and behavioural approaches in humans alongside pharmacological and lesion studies in animals. This work has identified large-scale functional brain networks encompassing lateral and orbital frontoparietal, midcingulo-insular and frontostriatal regions that support flexibility across the lifespan. Flexibility can be compromised in early-life neurodevelopmental disorders, clinical conditions that emerge during adolescence and late-life dementias. We critically evaluate evidence for the enhancement of flexibility through cognitive training, physical activity and bilingual experience.

The year 2020 will be remembered as a time marked by an unprecedented need for flexibility. In response to the global COVID-19 pandemic, governments, institutions, businesses and individuals made necessary and creative adaptations to cope with an uncertain, rapidly evolving situation 1 . This public health and economic crisis necessitated a great degree of cognitive and behavioural flexibility on the part of individuals adapting to the novel situation with which they were confronted. Responses to the pandemic, ranging from denial and maintenance of the status quo to swift and decisive action to curtail the spread of the causative virus, provided a real-world example of why an optimal level of flexibility is adaptive.
Developmental and lifespan research suggests that flexibility promotes academic achievement, employment success 2 , successful transitioning to adulthood 3 and other optimal life outcomes. Likewise, flexibility in later life can mitigate the effects of ageing on cognitive decline 4 . Flexibility is typically thought to comprise both cognitive and behavioural components. 'Cognitive flexibility' is broadly defined as the mental ability to switch between thinking about two different concepts according to the context of a situation 5 . 'Behavioural flexibility' refers to the adaptive change of behaviour in response to changing environmental contingencies 6 . The constructs of cognitive flexibility and behavioural flexibility are thus closely intertwined. Since most laboratory tasks used to assess cognitive flexibility require behavioural outputs, they in effect measure aspects of both cognitive and behavioural flexibility. Likewise, it is hard to imagine a flexible behavioural response that is not associated with flexible cognition. The terms 'cognitive flexibility' and 'behavioural flexibility' are often used interchangeably in the neuroscience literature, and the differentiation in terminology is most likely attributable to the different disciplines (cognitive psychology and behavioural neuroscience, respectively) from which they arose.

Components of flexibility
Cognitive and behavioural flexibility fall under the broader category of executive functions, or processes necessary for the control of goal-directed behaviour 7 . Projects such as the Cognitive Atlas 8 that aim to systematically characterize psychological processes classify flexibility under executive and cognitive control. The question of whether different processes falling under the executive function umbrella can be considered unitary reflections of the same underlying mechanism 9 has been approached using latent variable analysis to examine the extent of unity or diversity of executive functions. In one influential account, executive functions are postulated to comprise three latent variables, described as mental set-shifting ('shifting'), information updating and monitoring in working memory ('updating') and inhibition of prepotent responses ('inhibition'), that are moderately correlated with one another, yet clearly separable 7 . This framework has helped address the task impurity problem -the issue that because executive functions necessarily manifest themselves by operating on other cognitive processes, any executive task strongly implicates other processes not directly relevant to the target executive function. When we use the term 'flexibility' , we mean to invoke the aspect of executive function that is typically associated with shifting.

Latent variable analysis
A statistical approach for identifying clusters based on a series of continuous variables or indicators. This type of analysis assumes that there are unobserved latent profiles that generate responses on indicator items.

Mental set-shifting
Also referred to as 'shifting', this refers to the ability to switch back and forth between multiple tasks.
Relatedly, a large and growing literature on flexibility comes from the study of working memory gating, or the process by which relevant contextual information is updated in working memory while distracting information is kept out 10 . Studies investigating neural mechanisms underlying flexibility in working memory are reviewed elsewhere 11,12 .
Box 1 describes two classic paradigms in cognitive and behavioural neuroscience that have historically been used to assess flexibility in human and animals. The Wisconsin Card Sorting Test (WCST) is a neuropsychological task developed for humans that measures the ability to infer rules to guide behaviour, create an attentional set based on abstract categories, and switch attention and adjust behaviour with changing task demands 13 . Performance on the WCST is strongly related to shifting (also referred to as 'attention switching' or 'task switching'), which involves the disengagement of an irrelevant task set and subsequent active engagement of a relevant task set 7 . Reversal learning tasks are often used to study behavioural flexibility in humans as well as rodents and non-human primates 14 . These paradigms assess the ability to respond adaptively in the face of changing stimulus-outcome or response-outcome contingencies 15 . What are referred to as 'switch trials' in cognitive flexibility studies are paralleled by 'reversals' in behavioural flexibility experiments. Both switches and reversals are points at which shifting from one task or mode of response to another is required. The first aim of this Review is to draw information from these and related neuroscience studies (Box 2) to summarize what is known regarding the brain systems and processes underlying cognitive and behavioural flexibility.
In the clinical realm, although diagnosis based on the fifth edition of the Diagnostic and Statistical Manual of Mental Disorders (DSM-V) is still the norm in psychiatry, there has been a push from the US National Institute of Mental Health to shift towards consideration of behaviour dimensionally -that is, along a continuum -rather than categorically. This research domain criteria (RDoC) approach recognizes that dimensions of behaviour can cut across traditional diagnostic categories and urges the integration of multiple levels of information from genomics to neural circuits to behaviour and self-report (for example, using questionnaires that are filled out by the participants themselves) to understand basic dimensions of functioning spanning the full range of human behaviour 16 . This framework may lead to a revised diagnostic nosology that is more firmly grounded in biology 17 . The 'cognitive systems' domain of the RDoC matrix includes constructs labelled 'cognitive control' and 'working memory' , which contain subconstructs (goal selection/performance monitoring and flexible updating) that are closely tied to the constructs of cognitive and behavioural flexibility. Consensus regarding which cognitive tasks best probe flexibility can potentially be built by adopting the RDoC framework, which itself is continuously undergoing refinement 18 .

Box 1 | Experimental paradigms used to assess cognitive and behavioural flexibility in humans and animals
The Wisconsin card Sorting Test (see the figure, part a) was first developed in 1948 to assess perseveration, abstract reasoning and set-shifting 142 . The test takes 20-30 minutes to administer as follows: four cards incorporating three stimulus parameters (colour, shape and number of objects) are presented to the participants, who are then asked to sort individual response cards according to different principles. Four different ways of classifying each card are possible, and participants must learn using feedback provided by the experimenter whether a given classification is correct or not. after the participant has correctly sorted several cards according to one learned rule, the experimenter changes the rule without letting the participant know that the rule has been changed. Individuals with frontal lobe damage and children younger than 4 years tend to persist in sorting cards according to previously learned rules and have difficulty flexibly switching to new sorting rules 143 . In reversal learning paradigms (see the figure, part b) animals form associations between two choices and their reward outcomes initially over a series of trials. after a successful learning period, the choice-outcome mapping is reversed. The ability of the animal to adapt and change behaviour after the first reversal is a measure of behavioural flexibility 144

RDoC matrix
The research domain criteria (RDoC) matrix is a tool to help implement the principles of RDoC in research studies.

www.nature.com/nrn
Cognitive and behavioural flexibility are compromised in clinical conditions affecting early life such as autism spectrum disorder (ASD) and attention-deficit/ hyperactivity disorder (ADHD); those that emerge in adolescence, including schizophrenia and mood disorders; and dementias with later-life onset. While many of these conditions share flexibility deficits, the heterogeneous nature, severity and patterns of co-morbid symptoms complicate efforts to develop treatment strategies for enhancing flexibility. The scope of this Review will span these clinical considerations with the goal of identifying common cognitive, pharmacological and neurobiological factors contributing to inflexibility transdiagonostically. Finally, we critically evaluate potential avenues for flexibility training and discuss future directions for translational neuroscience.
Neural substrates of flexibility Cognitive flexibility follows a protracted, inverted U-shaped developmental trajectory from early childhood through adolescence and adulthood, peaking between the second and third decades of life, and declining in late life 19 . Here we will summarize the role of lateral and orbital frontoparietal, midcingulo-insular and frontostriatal functional brain networks in supporting flexibility across the lifespan. The cognitive processes and neural properties contributing to the development of flexibility, its maturation in young adulthood and its decline with ageing will be delineated.

Cognitive flexibility in humans.
In studies of the neural basis of cognitive flexibility, participants perform taskswitching or set-shifting paradigms while their brain activity is monitored using functional MRI (fMRI) 20 . It is important to keep in mind that laboratory-based measures and neuropsychological tests have high construct validity but may not always converge with realworld flexible behaviours as indexed using self-report or informant-report questionnaires, which typically have greater ecological validity 21 . The Behaviour Rating Inventory of Executive Function (BRIEF) is an assessment available in versions for both children and adults that includes a measure of an individual's ability to shift, or make transitions, tolerate change, flexibly problemsolve, switch attention and change focus from one topic to another 22,23 . Adult participants complete the BRIEF as a self-report, and parents and teachers can complete this assessment to evaluate school-aged children. Test batteries that include assessments of flexibility in children and adults include the WCST, the Dimensional Change Card Sort 24 , the Delis-Kaplan Executive Function System (D-KEFS) 25 , NEPSY-II 26 and the Cambridge Neuropsychological Test Automated Battery Intra-Extra Dimensional Set Shift task 27 .
Cognitive flexibility is difficult to isolate, as it requires the confluence of several aspects of executive function 20,28 . Neurosynth is a tool for synthesizing the results of human neuroimaging studies to produce mappings between neural activation patterns and cognitive states using text mining and automated meta-analyses 29 . Entering the terms describing the latent variables comprising executive function into Neurosynth reveals that the brain maps associated with these interrelated cognitive constructs are highly overlapping 7 (FiG. 1a).
A large body of literature on human functional neuroimaging studies using task-switching and set-shifting paradigms points to a central role for the lateral frontoparietal network (L-FPN) and the midcingulo-insular network (M-CIN) in supporting executive function and cognitive flexibility 20,30 . The L-FPN is also referred to as the executive control network and includes lateral prefrontal cortices (PFCs; dorsolateral PFC (dlPFC), ventrolateral PFC and inferior frontal junction (IFJ)), the inferior parietal lobule (IPL), posterior inferior temporal lobes and portions of the midcingulate gyrus. The M-CIN is sometimes referred to as the salience network or the cingulo-opercular network, and includes bilateral anterior insulae (AI), the anterior midcingulate cortex and subcortical nodes, including the amygdala and thalamus 31 .
While whole-brain activation patterns reveal how effortful control and executive functions broadly engage these systems, approaches for estimating task-modulated network connectivity are beginning to reveal how specific experimental manipulations are associated with dynamic relationships among brain regions. For example, one study found that the IFJ is engaged during the updating of task representations, a core aspect of flexibility 32 . During a task requiring flexible selection of items based on different stimulus dimensions, participants initially directly engaged the IFJ, leading to recruitment of other L-FPN and M-CIN regions, including the dlPFC, IPL, anterior midcingulate cortex and AI via functional connections 33 . Considerable individual variability in functional network topography supporting cognitive flexibility was observed, and the strength of functional connectivity between selected brain regions was related to individual differences in task performance (FiG. 1b). This finding is in line with earlier work demonstrating domain-general task-switching activation in the IFJ 34 , a brain region that exhibits meta-analytic co-activation Box 2 | How is creativity related to flexibility?
Flexible thinking is a critical component of creativity, or the ability to think of new ideas or make new things. Flexibility and creativity have not historically been studied in tandem, despite the obvious parallels between the constructs. While cognitive flexibility is conceptualized as an aspect of executive function and is associated with a rich human neuroimaging literature, creativity has only recently become the topic of cognitive neuroscientific investigations. a query of researchers from academic societies focused on creativity (the Society for the Neuroscience of creativity and the Society for the Psychology of aesthetics, creativity, and the arts) yielded several cognitive constructs deemed relevant to creativity, including 'flexibility', 'cognitive control' and 'divergent thinking' 145 . a meta-analysis of neuroimaging studies of divergent thinking indicates that brain networks underlying creative idea generation are composed of lateral prefrontal, posterior parietal and anterior cingulate cortices, as well as the caudate 146 . a study examining neuroimaging predictors of creativity assessed with visual and verbal tests of divergent thinking, everyday creative behaviour and creative achievement revealed that greater creativity was broadly predicted by grey matter of the inferior frontal gyrus and inferior parietal lobule as well as white matter integrity of the basal ganglia 147 . These findings align with functional activation studies showing inferior frontal gyrus involvement in verbal creative problem-solving 148 . The overlap in lateral frontoparietal and striatal involvement for both flexibility and creativity points to potential shared neural substrates for these related constructs. Future work in creativity could thus benefit from closer integration with the literature on cognitive flexibility.

Construct validity
in psychology, the idea that a test is valid if it measures what it claims to measure or is designed to measure.

Divergent thinking
in the study of creativity, the type of thinking used in an open-ended task, such as coming up with multiple uses for a given object.

Ecological validity
in psychology, the idea that something measured with a laboratory test translates to performance in real-life settings.

Cognitive constructs
in psychology, cognitive constructs are terms used to described mental processes. Examples of cognitive constructs include 'attention', 'memory' and 'perception' . NaTure revIeWS | NEurosCiENCE and resting state functional connectivity with the AI, dlPFC and IPL 35 .
Behavioural flexibility in animals. Assessment of behavioural flexibility in marmoset monkeys reveals that animals with lateral PFC lesions are not impaired in reversal learning or in shifting behavioural responses to a previously rewarded alternative. These monkeys are, however, impaired with regard to extradimensional shifts. Monkeys with orbitofrontal cortex (OFC) lesions show the opposite behaviour: impairment in reversal learning but no deficits in extradimensional shifts. These findings have led to the proposal that the lateral PFC is necessary for shifting of responding between abstract perceptual dimensions, whereas the OFC and associated corticostriatal loops are necessary for shifting of responding between different stimuli with specific associations with reinforcement 36 . Similar findings have been observed in rodents engaging in reversal learning paradigms. OFC inactivation in rats impairs reversal learning owing to perseverance of previously learned choices 15 . Neurons in the mouse OFC respond saliently and transiently to rule switches during reversal learning 37 . Dorsomedial striatal inactivation impairs both reversal learning and strategy switching, resulting in an inability to maintain new choice patterns once they are selected. The dorsomedial striatum is thought to dynamically interact with multiple prefrontal subregions that generate new strategies to facilitate behavioural flexibility 38 .
For humans, reversal learning is much easier to perform than extradimensional shifts, but similar neuroanatomy to that seen in animals has been observed using fMRI 39   cognitive processes and brain network interactions underlying flexibility in the human brain. a | Three latent variables that constitute executive function are referred to as 'shifting (flexibility)', 'updating (working memory)' and 'inhibition' 7 . Automated meta-analyses of published functional neuroimaging studies can be conducted with Neurosynth, a Web-based platform that uses text mining to extract activation coordinates from studies reporting on a specific psychological term of interest and machine learning to estimate the likelihood that activation maps are associated with specific psychological terms, thus creating mapping between neural and cognitive states (see REF. 29 for detailed methods). Neurosynth reveals that brain imaging studies including the terms 'shifting', 'updating' and 'inhibition' report highly overlapping patterns of activation in lateral frontoparietal and midcingulo-insular brain regions, underscoring the difficulty of isolating the construct of flexibility from associated executive functions. a | Maps created by first, entering the terms 'shifting', 'updating' and 'inhibition' individually into Neurosynth; second, displaying the 'uniformity test' results to view z scores corresponding to the degree to which each voxel in the brain is consistently activated in studies that use each of the selected terms; third, downloading the resulting brain images (with thresholding at a false discovery rate of 0.01) in the form of NIfTi files; and fourth, displaying the brain images using the image viewer MRIcron with the following settings: 2.3 < z < 8 (scale); x = 45 (Montreal Neurological Institute (MNI) coordinate for sagittal slice), y = 19 (MNI coordinate for coronal slice) and z = 45 (MNI coordinate for axial slice). The uniformity test map depicts z scores from a one-way ANOVA testing whether the proportion of studies that report activation at a given voxel differs from the rate that would be expected if activations were uniformly distributed throughout grey matter. b | Brain regions supporting executive function and flexibility operate within the context of the broader networks shown in part a. During performance of a flexible item selection task, participants directly engage the inferior frontal junction (IFJ), which influences activity in other lateral frontoparietal and midcingulo-insular regions. ACC, anterior cingulate cortex; AG, angular gurus; AI, anterior insula; dlPFC, dorsolateral prefrontal cortex; IPL, inferior parietal lobule. Part b adapted with permission from REF. 33 , Massachusetts Institute of Technology.

Extradimensional shifts
in set-shifting tasks, an extradimensional shift is one in which the important aspect of a stimulus switches from one category to another (for example, in a discrimination task, when colour is no longer an informative aspect of the stimulus, and shape becomes the discriminating characteristic).

www.nature.com/nrn
Brain dynamics supporting flexibility. Brain dynamics underlie complex forms of cognition and behaviour, including flexibility. Recent work has examined timevarying or dynamic changes in functional coupling between brain regions 41-43 . Sliding window functional connectivity analyses can be used to quantify brain dynamic metrics, including 'dwell time' (the time spent in a particular brain state), 'frequency of occurrence' (the number of times a given brain state occurs) and 'transitions' (the number of times transitions between brain states are observed) (FiG. 2a,b). With use of this approach, it has been shown that certain patterns of whole-brain Fig. 2 | Brain dynamics underlying individual differences in flexibility. a | In sliding window dynamic functional connectivity analyses, time-varying patterns of connectivity between brain regions are quantified as follows. Whole-brain functional connectivity matrices computed for each window (for example, 45 seconds of functional MRI time-series data) are subjected to clustering, and each window is assigned to a 'brain state', here labelled 1, 2 and 3. b | Dynamic metrics, including frequency, dwell time and transitions between states, can then be computed on the basis of trajectories of brain state evolution over time 141 . c | Brain states are ordered from most frequently occurring on the left (state 1, characterized by weak correlations among brain regions) to least frequently occurring on the right (state 5, characterized by strong correlations among brain regions). Higher executive function performance measured outside the scanner is associated with greater episodes of more frequently occurring states and fewer episodes of less frequently occurring states. In the colour bar, hot colours (red) represent high correlation values and cool colours (blue) represent low correlation values. WCST, Wisconsin Card Sorting Test. Parts a, b and c adapted with permission from 44 , Elsevier.
dynamics are associated with elevated levels of cognitive flexibility. Individuals who score higher on the WCST exhibit more episodes of more frequently occurring brain states, and fewer episodes of less frequently occurring brain states that have previously been associated with low vigilance and arousal 44 (FiG. 2c). Dynamic patterns among specific networks have also been linked with flexible behaviours. Time-varying functional connectivity of the M-CIN predicts individual differences in cognitive flexibility 45 . Dynamics between the default mode or medial frontoparietal network (M-FPN) and the L-FPN have also been linked to cognitive flexibility 46 .
A study using hidden Markov models demonstrates that the proportion of time an individual spends in a brain state characterized by functional connectivity of M-FPN and L-FPN regions relates to individual differences in cognitive flexibility 47 . Multimodal investigations considering both anatomical connectivity and activation dynamics find that greater alignment between white matter networks and functional signals is associated with greater cognitive flexibility 48 .
The emerging links between brain dynamics and flexible behaviours in neurotypical adults 49 have set the stage for understanding how these processes are affected in development and ageing. Neural flexibility, or the frequency with which brain regions change allegiance between functional modules, has recently been shown to increase with age during the first 2 years of life 50 . At the other end of the lifespan, older adults performing well on a cognitive test battery were found to exhibit brain states characterized by global coherence, whereas those performing poorly exhibited greater frequency of switching between dynamic brain states 51 . Ease of transitions between brain states distinguishes younger from older individuals, and is further linked with executive function indexed by the D-KEFS. In younger adults, executive function ability is correlated with efficiency in brain dynamics of the M-CIN, whereas for older adults this ability is associated with efficiency in the M-FPN 52 . Brain regions in higher-order association cortices exhibit high levels of functional flexibility, with dissociable age-related changes observed in frontal and parietal regions across the lifespan 53 . Several recent studies have further shown how individual differences in task performance are related to patterns of dynamic brain organization 54,55 . Taken together, this emerging literature is in line with the notion that the ability of the brain to flexibly reconfigure itself in response to changing demands may underlie individual differences in flexible behaviours.
Brain variability and flexibility. Variability in neural signals, while initially conceptualized as noise 56 , has more recently been linked with cognitive capacity. Between childhood and mid-adulthood, brain signal variability increases with age, shows negative correlations with reaction time variability and positive correlations with accuracy 57 . Brain variability appears to increase during task performance compared with rest in younger and faster-performing adults, whereas older and slowerperforming adults exhibit less differentiation in brain variability across experimental conditions 58 . These findings build on work demonstrating that blood oxygen level-dependent (BOLD) variability is a better predictor of age than BOLD mean 59 . Across the age range from 6 to 85 years, BOLD signal variability decreases linearly across most of the brain, with the exception of the AI, a critical M-CIN node involved in flexibility, which shows the opposite pattern 60 (FiG. 3). In line with findings from functional activation studies, it has been shown a b High Age

Low
Performance  Fig. 3 | Quantifying brain signal variability. a | Mean squared successive difference is one approach for computing brain signal variability. Applied to neural time-series data, mean squared successive difference is calculated according to the equation shown. b | Regionally specific increases and decreases in brain signal variability across the lifespan may be associated with changes in behavioural performance. Brain signal variability decreases linearly across the lifespan in most brain regions, with the exception of the anterior insula, which exhibits linear age-related increases in variability. In early and late life, the speculation is that larger differences in variability between brain regions may lead to suboptimal behavioural performance. Optimal behavioural performance may be associated with a balance between high and low variability in different brain regions (black arrows) during midlife. Part b is adapted from REF. 60 , CC BY 4.0 (https:// creativecommons.org/licenses/by/4.0/).

Hidden Markov models
Statistical models in which the system being modelled is assumed to be a Markov process (where the probability of each event depends on the state in the previous event) with unobservable or hidden states.
www.nature.com/nrn that increased IFJ variability is linked to better performance on a cognitive flexibility task 61 . Older adults aged 59-73 years who exhibit upregulated brain signal variability show higher levels of task performance 62 . The suggestion is that higher variability might reflect a broader repertoire of metastable brain states and transitions between them to enable optimal responses 57 .

Flexibility in clinical conditions
Executive function impairments broadly, and flexibility impairments specifically, are observed across many forms of psychopathology and may serve as transdiagnostic intermediate phenotypes 63 . All of the DSM-V categories (with the possible exception of sleep-wake disorders) include clinical conditions in which domains of executive function are compromised; this raises the question of the extent to which the construct of flexibility has discriminative value. In several of the disorders in which flexibility deficits have been documented, these impairments can be observed even while performance on basic perceptual and motor tasks remains unaltered. Flexibility deficits are observed in neurodevelopmental conditions with early life onset, such as ASD and ADHD, as well as psychiatric conditions that emerge in adolescence, including mood disorders, obsessivecompulsive disorder (OCD) and schizophrenia. Late life onset dementias, including Parkinson disease and Alzheimer disease, are also marked by rigidity and cognitive inflexibility. The extent to which common and distinct neural mechanisms underlie the variety of flexibility deficits observed across the lifespan in these conditions will be explored in this section (TABlE 1).

Flexibility in developmental disorders. ASD and ADHD
are two prevalent, heterogeneous neurodevelopmental disorders typically diagnosed in the first 5 years of life. In children with ASD or ADHD, executive function and flexibility deficits are often observed in laboratory settings and in day-to-day activities 64,65 . Although children with ASD, ADHD or co-morbid ASD and ADHD may all exhibit flexibility deficits, the nature and severity of these issues can differ across and even within these disorders.
Early work in developmental psychopathology 66 and recent meta-analyses confirm broad executive dysfunction in ASD across domains 67 as well as more specific impairments in flexibility, typically assessed with the WCST 64,68 . Restricted and repetitive behaviours (RRBs), considered core deficits in ASD, can include stereotyped movements, insistence on sameness, and circumscribed or perseverative interests 69 . The severity of RRBs is associated with measures of cognitive inflexibility in ASD 70 . Studies of the neural circuitry underlying RRBs transdiagostically point to a critical role for frontostriatal systems in mediating these behaviours 71 . A recent review of neural mechanisms underlying cognitive and behavioural flexibility in autism additionally points to atypical patterns of L-FPN and M-CIN activation in response to task switching and set-shifting 72 .
While ASD is characterized by difficulty in flexibly adapting to changes in routines, children with ADHD have difficulty with attentional focus and exhibit high levels of variability in moment-to-moment behaviours 73 . Diagnostic criteria for ADHD include inattention, hyperactivity and impulsivity 69 , which can be thought of as manifestations of distractibility or too much flexibility. Still, the story is not as simple as 'impaired flexibility in ASD' versus 'heightened flexibility in ADHD' , as there is a very high degree of co-morbidity between these two disorders 74 such that the combination of impaired flexibility and inattention can manifest itself in the same individual. Some reports claim that executive dysfunction is more pervasive and more severe in ADHD than in ASD 75 , yet studies targeting flexibility document that children with ASD perform poorer on the WCST than do children with ADHD 76 . Age-related improvements in executive function are more clearly observed in ASD than in ADHD 77 . Even though not all children with a primary diagnosis of ASD exhibit executive dysfunction 78 , the vast majority of children with co-morbid ASD and ADHD do exhibit executive function impairments 65 .
Only a handful of neuroimaging studies have examined ASD and ADHD together. One found evidence for shared and distinct patterns of intrinsic functional connectivity centrality in children with these disorders 79 . Another reported no evidence for group differences in functional network connectivity across diagnostic groups 80 . Although it is hypothesized that the common behavioural manifestations of cognitive inflexibility across ASD and ADHD should be reflected in shared neural substrates, few assessments of brain circuitry supporting flexibility across these disorders have been conducted. Data-driven techniques are now being used to identify key dimensions of functioning that overlap across diagnostic categories and also present heterogeneously within diagnostic categories 81 . For example, transdiagnostic executive function subtypes have been identified with use of community detection algorithms, and children within the subtype characterized by inflexibility showed a failure to modulate parietal lobe activation in response to increasing executive task demands 82 . Other work examining ASD, ADHD and co-morbid ASD and ADHD using latent profile analysis also provides evidence for transdiagnostic executive function classes 65 . A study using magnetoencephalography found that during an intradimensional/ extradimensional set-shift task, children with ASD exhibited greater parietal activity than children with ADHD, and both groups showed sustained parietal activation with an absence of sequential progression of brain activation from parietal to frontal regions 83 . Further work is needed to understand the brain activation patterns and dynamics underlying reduced or heightened flexibility in these neurodevelopmental disorders, as well as the paradoxical combinations (for example, inflexibility alongside distractibility) that can sometimes be observed. This work might focus on how dynamics within specific brain networks might support different domains of executive function. For example, intrinsic dynamics of the M-CIN (but not the L-FPN) have been shown to relate to individual differences in distractibility in neurotypical adults 84 . Measurement issues complicate the assessment of flexibility deficits and their neural bases in ASD and ADHD, as different combinations of laboratory-based measures, neuropsychological tests and informant-report questionnaires have been used across studies 72 . It is important to note that well-documented inflexible everyday behaviours in ASD are not necessarily directly related to cognitive flexibility deficits assessed experimentally 85 . Standardized informant-report assessments specifically targeting flexible behaviours in autism have been developed, such as the Flexibility Scale, which reveals factors related to routines/rituals, transitions/change, special interests, social flexibility and generativity 86 . Still, these types of nuanced measure of flexibility are not yet routinely used in transdiagnostic assessment settings, leaving several open questions as to the specific profile of executive function and flexibility deficits that characterize neurodevelopmental disorders.

Flexibility in adolescence and midlife.
Adolescence is a critical developmental period marked by dramatic physical, social and emotional changes that require cognitive flexibility for successful navigation. Adolescence also coincides with a period of vulnerability and risk of the onset of psychopathologies, including anxiety, depression, OCD and schizophrenia. Brain circuitry supporting cognitive control is still undergoing development during adolescence 87 , in part owing to differential development of limbic and executive control systems 88 . These asymmetries are evident in studies demonstrating that adolescents learn faster from negative reward prediction errors than adults, and recruit the right AI to a greater degree during probabilistic reversal learning 89 .
Signs of mood disorders, including anxiety and depression, can develop during the adolescent years. Pathological anxiety involves excessive worry or the tendency to dwell on difficulties and perceive future problems as more likely than they are in reality, whereas depression involves rumination or passively focusing on distressing thoughts in response to sad mood and experiences 69 . Worry and rumination may reflect the same underlying construct of repetitive negative thinking, which is likely a product of inflexible thinking and difficulty engaging the L-FPN executive control systems in the service of emotion regulation 90 .
Another adolescent-onset disorder characterized by severe flexibility impairments is OCD. Flexibility deficits in OCD manifest themselves as maladaptive patterns of recurrent and persistent thoughts, urges and impulses that are intrusive, as well as compulsions, including repetitive behaviours that an individual feels driven to perform 69 . Neuroimaging investigations across OCD and ASD provide evidence that increased functional connectivity within frontostriatal circuitry relates to more severe symptoms of repetitive behaviour 91 . In OCD, reduced activation of the OFC and frontostriatal regions during cognitive flexibility task performance is regularly reported 92,93 .
Schizophrenia is another condition emerging during late adolescence that is associated with reduced cognitive flexibility, often accompanied by frontal lobe hypometabolism 94 . Individuals with schizophrenia perform worse than individuals with OCD on the WCST, suggesting the involvement of different subsystems within basal-corticofrontal circuits in these two disorders 95 . Just as in the general population, frontostriatal circuitry appears to be linked with variability of cognitive flexibility performance in schizophrenia 96 .
Flexibility in neurological disorders. While executive function and flexibility deficits are observed in normal ageing, these issues can be further exacerbated in neurological disorders that affect later life. Older adults exhibit reduced efficiency of lateral prefrontal control regions, and compensate for age-related declines in task-switching performance by relying on enhanced frontotemporal connectivity compared with younger adults 97 . The default-executive coupling hypothesis of ageing proposes that declining performance on executive control tasks and reduced flexibility in older adulthood are underpinned by inflexible coupling of the M-FPN and lateral prefrontal regions 98 . A recent metaanalysis of fMRI studies of executive function in ageing reveals that the IFJ is recruited to a different degree in younger versus older adults. Furthermore, decreased functional connectivity between the IFJ and other executive function-related brain regions is observed with increasing age 99 . Whole-brain computational models permit quantification of metastability and recalibration processes underlying changes in cognitive performance over the lifespan. Such models can help clarify how dedifferentiation observed at the network level, such as that Metastability A state of a dynamical system other than the state of least energy. in a non-linear system such as the brain, 'metastability' refers to a state in which signals fall outside their natural equilibrium state, but persist for an extended period of time.
www.nature.com/nrn proposed by the default-executive coupling hypothesis of ageing, can be seen as compensation for the decline of structural integrity in the ageing brain 100 .
One of the signs of dementia is heightened executive function impairment compared with that from normal ageing, including a deterioration of mental flexibility and the onset of cognitive rigidity. A burgeoning functional neuroimaging literature including task-switching and set-shifting tasks adapted from neuropsychological assessments (most notably the WCST) investigates cognitive flexibility deficits in ageing and dementia, confirming the critical role of PFC recruitment in maintaining these functions 101 . Flexibility deficits observed in Parkinson disease may result from dysfunction of frontostriatal loops resulting from dopamine depletion 102 . Across neurological disorders, different aspects of cognitive flexibility may be impaired. For example, frontoparietal changes affecting set-shifting ability characterize patients with amyotrophic lateral sclerosis, whereas frontostriatal changes affecting rule inference are seen in primary dystonia and Parkinson disease 103 .
Dysexecuitve syndrome, which involves impairment of working memory, cognitive flexibility and inhibitory control, is seen in progressive dementia syndrome due to Alzheimer disease. This syndrome is accompanied by frontoparietal hypometabolism as demonstrated by positron emission tomography 104 . Taken together, the literature on flexibility in ageing and dementia points to frontoparietal and frontostriatal dysfunction, as might be predicted from the human and animal research.
While we focus on maladaptive outcomes associated with flexibility deficits here, flexibility reductions can also be associated with adaptive or healthy traits, and the level of flexibility required can fluctuate depending on the context. Therefore, alterations in flexibility might in some cases represent normative adaptations to the perceived characteristics of the environment. In Parkinson disease, cognitive impairments such as slowed thinking and cognitive inflexibility parallel motor impairments 102 , suggesting that reduced flexibility might be an appropriate reaction to a world that is experienced as more stationary. Cognitive stability -the opposite of cognitive flexibility -can likewise be beneficial during tasks requiring focused attention and distractor inhibition 105 . Thus, reduced flexibility may paradoxically be optimal under specific conditions.

Drugs and training of flexibility
Animal studies have revealed how specific neurotransmitter systems underlie flexible cognition and behaviour. In humans, cognitive training paradigms and physical activity have been touted as means to bolster flexibility, and there is some initial evidence from studies of development and ageing that bilingualism may confer greater flexibility. This section will summarize what is known regarding the pharmacology of cognitive and behavioural flexibility, then critically review the research on cognitive flexibility enhancement and training.
Pharmacology supporting flexibility. Serotonin and striatal dopamine neurotransmitter systems have a modulatory role in reversal learning, as evidenced by human and animal lesion, stimulation and neuroimaging studies 106 . In humans, transient cerebral serotonin depletion affects processing of negative feedback during reversal learning 107 . l-DOPA withdrawal studies demonstrate that patients with Parkinson disease not receiving medication show inflexibility in the form of increased switch costs when switching between tasks 108 . Methylphenidate, a psychostimulant influencing dopamine and noradrenaline activity, has long been used to treat ADHD and other developmental disorders 109 . There is some evidence from studies of rhesus monkeys given therapeutic doses of methylphenidate that the drug can impair task-switching performance. This indicates that the improved ability to focus attention may come at the expense of hindering flexibility 110 . Taken together, these findings suggest that serotonergic and dopaminergic signalling are critically involved in flexible cognition and behaviour.
The striatal cholinergic systems also appear to play a role in behavioural flexibility. Proton magnetic resonance spectroscopy studies in humans during reversal learning show that lower levels of choline in the dorsal striatum are associated with a lower number of perseverative trials 111 . Studies of the contributions of the cholinergic system to flexibility are complicated, however, by the fact that many cholinergic neurons co-release glutamate or GABA along with acetylcholine 112 .
Interventions to improve flexibility. Computerized cognitive training, physical activity and specialized curricula have been described as potential interventions to improve flexibility in children, yet the evidence supporting the efficacy of these interventions is mixed. Successful programmes involve repeated practice and progressive increases in challenge to executive functions, and children who are more impaired initially benefit the most from cognitive training and physical activity interventions 2 . Generally, training in a specific aspect of executive function can produce short-term narrow transfer, but does not generalize to other aspects of executive function. For example, working memory training can improve working memory performance, but not inhibitory processing or other skills 113 . Implementing a gamebased flexibility training designed to increase motivation in children, one study found long-term transfer effects in untrained executive control tasks. The study authors also reported greater performance improvements in the game-based flexibility training group on reading comprehension, an effect that appeared only at the 6-week follow up. These findings suggest that the addition of game elements to executive control training tasks may result in enhanced complexity that facilitates transfer to academic abilities 114 .
Flexibility training in neurodevelopmental disorders has also produced mixed results. One computerized working memory and cognitive flexibility training designed for children with ASD did not result in differential improvement in a randomized controlled trial 115 . An executive function intervention known as Unstuck and On Target aims to address insistence on sameness, flexibility, goal setting and planning using a cognitive behavioural programme. This intervention has been Transfer effects Phenomena in which training or learning in one context applies to another.
shown to be effective for improving classroom behaviour, flexibility and problem-solving in children with ASD 116 .
Cognitive training has been used to combat age-related cognitive decline, and training-induced structural and functional brain changes in healthy older adults (60 years of age and older) have been demonstrated 117 . A task-switching study reported training-related improvements in task performance, but limited transfer to untrained similar flexibility tasks and no improvements for untrained domains of executive function after 1 year 118 .
Studies examining the effects of aerobic exercise or resistance training interventions without a cognitive component seem to suggest little or no executive function benefit, although exercise that is cognitively challenging, such as martial arts, can produce measurable benefits 119 . In adults of around 60 years of age and older, aerobic exercise interventions may contribute to salutary effects on cognition through prevention of volumetric decreases of hippocampal volume over time 120 . The small effects reported in studies of physical activity interventions on executive function stand in contrast to the fact that children with greater cardiovascular fitness perform better on executive function components, including information processing and control, visuospatial working memory and attention efficiency 121 . Likewise, individuals who are generally more physically active have better executive function than those who are more sedentary 122 .

Effects of bilingualism on flexibility.
More than 50% of the global population is bilingual, or able to use two languages with equal fluency. The concept of a 'bilingual advantage' suggests that individuals fluent in two languages may develop cognitive advantages, particularly within the executive function domain. Evidence supporting the bilingual advantage identifies inhibition and monitoring as potential mechanisms conferring enhanced executive control in individuals with diverse language experiences 123 . This model suggests that both languages in a bilingual individual's repertoire are always active to a degree, and there is a constant competition for selection. Lifelong experience of managing and resolving competition between languages imposes demands that require brain regions not typically used for language processing 124 . This bilingual experience reorganizes brain networks to create more effective mechanisms for executive control and results in cognitive benefits when non-linguistic processing draws on the same executive control networks 125 . As language switching involves the same frontal systems involved in executive control and inhibitory processes, it is thought that the bilingual experience results in general enhancement of these brain systems 123,126 .
Current research in bilingualism has produced mixed results, and there is no consensus regarding the relationship between bilingualism and cognitive advantages in the executive function domain. Some researchers report cognitive benefits in bilingual individuals 127 , while others fail to replicate these findings in typically developing children 128 and adults 129 . However, the bilingual advantage has been observed in children of lower socio-economic status 124,127 . Likewise, in individuals experiencing age-related cognitive decline, a 'cognitive reserve' has been observed whereby the bilingual brain is more resistant to neurodegeneration and dementia 123 . The observation that bilingual experience helps offset age-related losses in executive processes has led to the proposal that bilingualism may act as a neuroprotective factor against dementia by buffering against the decline in cognitive control abilities typically observed in later life 130,131 . Thus, the bilingual advantage may manifest itself under specific circumstances, but further research is needed on this topic.

Summary and future directions
The global COVID-19 pandemic highlighted the critical need for optimal levels of flexibility at the level of institutions and individuals. Neuroscience research has probed flexibility using paradigms that are capable of spanning both human and animal investigations. This research has demonstrated that cognitive and behavioural flexibility involve executive control processes that rely on the coordinated functioning among several large-scale frontoparietal and frontostriatal brain networks enacting salience detection, attention, inhibition, working memory and switching processes 20 . Understanding the typical development of these networks, their stabilization in adulthood and their potential for breakdown with ageing is the first step towards pinpointing effective strategies for addressing flexibility deficits in psychiatric and neurological disorders and enhancing flexibility across the lifespan. For example, the identification of unique brain profiles supporting various degrees of flexibility across clinical and neurotypical populations could aid in identifying interventions with the highest probability of success for a particular individual. Capturing mechanistic insights with the aid of neuroimaging will help to improve our current diagnostic nosology and move us towards achieving the goals of precision medicine.
Future directions include addressing issues of measurement to maximize ecological and construct validity in research on flexibility. It is important to acknowledge that highly reliable self-report or informant-report measures may better predict individual differences in real-life outcomes, whereas laboratory performance-based measures that are sensitive to within-person experimental manipulations can reveal processes underlying task performance 21 . Standardized, transdiagnostic assessments that are normed for targeted age ranges must be developed and universally adopted to permit characterization of common and unique aspects of flexibility that are affected across clinical conditions. Several self-report scales have been developed for use in adults, including the Cognitive Control and Flexibility Questionnaire 132 , the Cognitive Flexibility Scale 133 and the Psychological Flexibility Questionnaire 134 . Consistent use of questionnaires in future studies will provide a clearer picture of the clinical profile of flexibility deficits. Generally however, self-report/informant-report and behavioural measures are only weakly correlated, as behavioural measures index responses during structured situations, whereas self-report/informant-report queries how individuals behave in real-life situations 21 . Going forward, www.nature.com/nrn the challenge of how to bridge laboratory-based, objective behavioural measures of flexibility with real-world indices of flexible behaviour must be tackled. Recent approaches focus on measurement of 'hot' or emotionally salient flexibility 135,136 , and have also turned towards implicit rather than explicit flexibility performance measures 33 as possible bridges between real-world and laboratory performance.
Translational neuroscience research adopting the RDoC framework will likely continue to build on findings that interactions among the M-CIN, L-FPN and M-FPN are implicated as common neurobiological substrates for mental illness 28,137 . The emerging field of computational psychiatry that strives to use data-driven approaches and machine-learning to improve disease classification and predict treatment outcomes 138 will benefit by focusing on transdiagnostic constructs such as flexibility, with clear links to real-life outcomes. The success of these clinically oriented endeavours, however, hinges on progress in neuroinformatics efforts to construct biologically informed taxonomies of psychological processes 139 .
At present, there have been no interventional studies demonstrating the role of changing brain network dynamics in supporting successful training of flexibility. Following similar work providing evidence for dynamic reconfiguration of brain networks with working memory training 140 , future research should focus efforts towards delineating how effective cognitive and behavioural flexibility training alters brain dynamics. Studies of cognitive training generally provide limited support for far transfer of skills. Similarly, while the cumulative effects of exercise are clearly beneficial for the brain and cognition, more research is needed to determine the type and dosage of physical activity intervention that is most suited to enhance executive function and flexibility. If bilingualism can confer a flexibility advantage in some instances, then encouraging bilingualism might be a 'natural intervention' strategy to improve flexibility. The bolstering of flexibility that may be conferred by bilingualism provides an added incentive to promote the learning of multiple languages from a young age. The next frontier of flexibility research will likely involve collaborations among clinical psychologists, medical professionals, neuroscientists, engineers, computer scientists and educators.
Published online 3 February 2021