Article

https://doi.org/10.1038/s41467-024-46511-5

A multi-demand operating system
underlying diverse cognitive tasks
Received: 21 July 2022

Weidong Cai

1,2, Jalil Taghia3 & Vinod Menon

1,2,4

Accepted: 28 February 2024

1234567890():,;

1234567890():,;

Check for updates

The existence of a multiple-demand cortical system with an adaptive, domaingeneral, role in cognition has been proposed, but the underlying dynamic
mechanisms and their links to cognitive control abilities are poorly understood. Here we use a probabilistic generative Bayesian model of brain circuit
dynamics to determine dynamic brain states across multiple cognitive
domains, independent datasets, and participant groups, including task fMRI
data from Human Connectome Project, Dual Mechanisms of Cognitive Control
study and a neurodevelopment study. We discover a shared brain state acrossseven distinct cognitive tasks and found that the dynamics of this shared brain
state predicted cognitive control abilities in each task. Our ﬁndings reveal the
ﬂexible engagement of dynamic brain processes across multiple cognitive
domains and participant groups, and uncover the generative mechanisms
underlying the functioning of a domain-general cognitive operating system.
Our computational framework opens promising avenues for probing neurocognitive function and dysfunction.

The human brain is a ﬂexible, yet stable, system that allows rapid andadaptive allocation of cognitive resources to meet moment-bymoment changes in task demands1–7. A converging body of evidence
now points to a core set of distributed brain areas that are consistently
engaged during diverse cognitive tasks8–15. This commonality naturally
raises the critical and challenging question of how the same brain areas
might underlie cognition across multiple task domains16. Addressing
this question has the potential to uncover mechanisms underlying a
multiple-demand, domain-general, functional system underlying cognition and identify transdiagnostic features of cognitive dysfunction in
psychiatric and neurological disorders17. Here we use a state space
hidden Markov model (HMM) to address this challenge. We identify
common brain states that are dynamically engaged across seven different cognitive paradigms, across multiple participant cohorts, anddemonstrate their behavioral relevance.
Surprisingly, a wide range of cognitive tasks have been found toelicit a common pattern of frontal and parietal network activity18,
leading to the proposal that a common multiple-demand system may
play an adaptive, domain-general, role to achieve task goals16. Evidence
for the involvement of a network of frontal-parietal cortical regionsthat are commonly activated across tasks has emerged from a wide
range of electrophysiological and fMRI studies19,20. However, theshared mechanisms by which such a multiple-demand system contributes to cognition across a broad range of tasks is not known asprevious studies have primarily focused on identiﬁcation of brain areascommonly activated across tasks and have lacked the quantitative
rigor needed to link dynamic brain circuits across tasks. Crucially,
activation of common brain areas does not necessarily imply engagement of a shared underlying mechanism by which the putative
multiple-demand system operates across cognitive domains. An
alternative hypothesis is that despite engagement of similar brain
regions no common generative mechanisms are engaged across tasks.
Identiﬁcation of a common generative mechanism would provide
strong evidence for a domain-general cognitive operating system.
Uncovering general dynamical mechanisms that contribute tomultiple cognitive tasks independently in a quantitatively rigorous
manner is challenging because of the lack of computational models forcharacterizing shared processes across tasks that vary along multiple
cognitive dimensions and behavioral contingencies, as well as dataacquisition protocols and participant cohorts. A critical issue here is1

Department of Psychiatry & Behavioral Sciences, Stanford University School of Medicine, Stanford, CA, USA. 2Wu Tsai Neuroscience Institute, Stanford
University, Stanford, CA, USA. 3Department of Information Technology, Uppsala University, Uppsala, Sweden. 4Department of Neurology & Neurologicale-mail: wdcai@stanford.edu; menon@stanford.edu
Sciences, Stanford University School of Medicine, Stanford, CA, USA.

Nature Communications | (2024)15:21851

Articlethat uncovering the operation of such a multiple-demand system
requires analysis of latent dynamical processes that underlie different
cognitive tasks.
State space models that capture dynamic changes in coactivation
patterns across brain regions involved in cognitive control offer a
powerful tool in this regard. Latent space models are now being widely
explored as promising tools for analyzing rich patterns of electrophysiological activity across diverse neural systems and behaviors, as
they do not depend on known relationships between neural activity
and external experimental variables21,22. Latent state models characterize patterns of covariation across a neuronal population to reveal
its internal state22. These models have proven useful for visualizing
population-level neural activity, relating activity to behavior, andinterrogating the dynamic mechanisms that mediate population-levelcomputations22–26. Moreover, comparisons of large-scale neural activity across participants and different experimental tasks is challenging
without models and rigorous computational methods for linking
neural processes across two or more datasets. State space algorithms
that probe a shared space where they can be directly compared, have
proven to be valuable for comparing high-dimensional neural activities
across times, subsets of neurons, and individuals27. Our models are
tailored to achieve similar goals with human fMRI data.
Analogous to recent neurophysiological investigations, we use alatent space HMM which models covariation in fMRI activity with a
Bayesian switching dynamical systems state space (BSDS) algorithm28.
Speciﬁcally, brain states are characterized by a unique pattern oftime-varying activation and functional connectivity linking regions ofinterest28. Importantly, these brain states do not occur at random,they are temporally correlated in a Markovian sense—the brain state ata given time depends on the state in the previous time instance. Different from conventional approaches based on external experimental
variables, at each time point, a brain state i occurs with a probabilityp(i) that ﬂuctuates over time, and a transition probability A(i,j) of
transitioning from state i to state j. BSDS implements an unsupervised
learning algorithm to determine brain states, their probability ofoccurrence at each time point, transition probability, and the mean
activation and functional connectivity. Moreover, unlike conventional
methods, BSDS does not directly compute time-varying activationand functional connectivity using arbitrary moving windows or
impose temporal boundary associated with predeﬁned task conditions. Instead, BSDS learns latent representations and states in a
uniﬁed framework by optimization of single objective function withina Bayesian framework. Our generative model thus allowed us toinfer time-varying activation and functional connectivity associatedwith each brain state with minimal assumptions. Importantly, thegenerative model implemented by BSDS provides posterior probability distributions of model parameters from one cognitive task
which can be used as priors for estimating model parameters fromother tasks, thereby facilitating analysis of a domain-general functional multiple-demand systems across cognitive domains and participant cohorts.
The overarching aim of our study was to characterize sharedlatent brain mechanisms associated with a multiple-demand cognitive
operating system across a wide range of cognitive tasks, and determine their association with individual differences in cognitive control
abilities. To accomplish this, we characterized the Markovian properties of shared brain states by examining the probability of brain state
occurrence, their transition probabilities, and associated activationand connectivity features in seven widely used cognitive task paradigms. We identiﬁed brain states in each task and examined theircorrespondence with brain states in a task canonical n-back working
memory reference task28. Using the n-back working memory as areference task, we asked whether task-optimal latent brain states that
occur during the high cognitive load condition in the n-back task arealso engaged during each of the other seven cognitive tasks. Our

Nature Communications | (2024)15:2185

https://doi.org/10.1038/s41467-024-46511-5

choice of the working memory task was motivated both by the fact that
it is widely used to probe cognitive function and dysfunction29,30, andby our identiﬁcation of optimal and non-optimal brain states associated with cognitive performance and decision-making28. Whether alatent brain state in an independent task matches an optimal working
memory task brain state was determined by how close they were in
their latent space parameters (Fig. 1).
Our ﬁrst major goal was to characterize brain states in an independent set of four cognitive control tasks acquired as part of the Dual
Mechanism of Cognitive Control (DMCC) study31. The DMCC study
includes the AX continuous performance task (AxCPT), cued task
switching task (CuedTS), Sternberg working memory task (Sternberg)
and Stroop interference task (Stroop). All four cognitive tasks havebeen widely used to examine different aspects of cognitive control32–34.
We hypothesized that our approach would uncover a common brain
state across the four cognitive control tasks, thereby elucidating ashared circuit mechanism underlying the multiple-demand system inan adult cohort.
Crucially, we investigated whether brain states identiﬁed by ourmodel in each of the four cognitive control tasks are behaviorally
relevant. We assessed brain-behavior relations in relation to occurrence rates of brain states engaged during task performance. We theninvestigated whether the occurrence of the shared brain states acrosscognitive task domains was preferentially linked to task performance.
Extending our previous ﬁnding that the inability to engage such a state
was associated with poor performance in the working memory task28,
we hypothesized that occurrence of the shared brain state underlying
the multiple-demand system would be behaviorally relevant across thefour cognitive control tasks.
Our third major goal was to investigate whether occurrence of theshared brain state is also developmentally relevant, and whether its
occurrence could predict attention deﬁcits characteristic of childhood
Attention Deﬁcit/Hyperactivity Disorder (ADHD), a neurodevelopmental disorder characterized by prominent deﬁcits in cognitive
control35,36. We examined whether the same generative model could be
used to investigate latent brain states in typically developing children
and children with ADHD performing a stop-signal task (SST), a standard paradigm for probing impulsivity and response inhibition37. We
hypothesized that difﬁculty in engaging the shared latent brain state
would predict cognitive control deﬁcits and severity of inattention
symptoms in children.
Finally, to investigate the broader application of our model
beyond canonical cognitive control and working memory tasks, weinvestigated a relational processing (RP) fMRI task from the HCP38.
Because the RP and n-back working memory tasks were performed in
the same individuals, this allowed us to determine whether individuals
have similar brain state features across tasks. We hypothesized that
individuals would show similar latent brain state features across cognitive tasks, reﬂecting intra-individual stability of features in themultiple-demand cognitive system.
Our study builds on previous research using a putative multipledemand system identiﬁed using a large sample from the Human
Connectome Project (HCP)28. Replicability is a major challenge inneuroscience and a key goal here is to investigate the same brain
regions, encompassing key nodes of the salience, default-mode, andlateral frontoparietal networks, which are consistently activated acrossvarious cognitive tasks30,39,40. Using reference generative models
associated with a canonical working memory task, we then examine
whether latent brain states from the reference task also play a role in
the underlying cognitive processes of diverse tasks. We uncover ashared optimal dynamic brain state underlying a broad range of cognitive domains, tasks, across multiple participant cohorts and dataacquisition protocols. Findings provide critical insights into the
dynamical circuit mechanisms by which a common multiple-demandsystem contributes to a wide range of cognitive functions.
2Articlehttps://doi.org/10.1038/s41467-024-46511-5

Results

resolution, with sub-2-second sampling rates ranging from 0.49 to
1.2 s. This allowed us to capture rich temporal dynamics in fMRI data ineach task and determine shared underlying latent structures and relatethem to cognitive task performance.
In a previous study using an n-back working memory task with 122
participants from the HCP, we uncovered an optimal brain state for

Our analysis strategy and data analysis pipeline are shown in Fig. 1 andSupplementary Fig. 1 (see also Methods for additional details). We
leveraged a total of seven different experiments across a wide range ofcognitive domains (Supplementary Table S1). An important feature of
all fMRI datasets was that they were acquired at high temporal

Nature Communications | (2024)15:21853

Articlehttps://doi.org/10.1038/s41467-024-46511-5

Fig. 1 | Overview of data analysis strategy and pipeline. We applied a Bayesian
switching dynamic systems (BSDS) to time series extracted from brain regions
constituting a multiple-demand system involved in cognitive control. We investigated latent brain states across seven different cognitive tasks and four different
datasets. First, to demonstrate a shared latent brain state across cognitive domains,
we matched task-speciﬁc latent brain states with the task-optimal latent brain state
SHWM associated with high-load working memory task condition. Two different
state matching algorithms demonstrated convergent results. Second, the relationship between the shared latent brain state and cognitive performance in eachtask was investigated using both multivariate canonical correlation and univariate
correlation analysis. Third, we examined the shared latent brain state and its relation to clinical measures of inattention in a developmental cohort. Fourth, weevaluated similarity of latent brain states within individuals across cognitive tasks.
WM n-back working memory task, AxCPT Ax continuous performance task, CuedTS
Cued task switching task, Stern Sternberg working memory task, Stroop Stroop
interference task, SST Stop-signal task, RP Relation processing task. The regression
estimate is presented with 95% conﬁdence interval (shaded area).

high load cognitive control (SHWM) which occurs preferentially during
the 2-back, high-load, working memory task condition, over during the
low-load and ﬁxation task conditions28. We chose this task because then-back task, and in particular the 2-back condition, requires sustained
engagement of attention and cognitive control resources for achieving
good task performance. We therefore used n-back task states as atemplate for analysis of shared latent states across tasks. The latent
brain state was deﬁned by unique patterns of activity and functional
connectivity between key nodes of the salience, central executive, anddefault mode networks (SN, CEN and DMN, respectively), three largescale cingulo-opercular and frontoparietal neurocognitive networks
whose dynamic interactions play an essential role in cognition28,41–43.
The ROIs included bilateral anterior insula (AI), middle frontal gyrus(MFG), frontal eye ﬁeld (FEF), intraparietal sulcus (IPS) and dorsomedial prefrontal cortex (DMPFC), ventromedial prefrontal cortex(VMPFC) and posterior cingulate cortex (PCC).
State SHWM was determined to be an “optimal latent brain state”
because (1) it had higher occupancy rate in the 2-back, compared to the
0-back, task condition, where occupancy rate refers to a measure forhow often a latent brain state occurs during a period of time, (2) it had
higher occupancy rate than other latent brain states in the 2-back task
condition, and (3) its occupancy rate predicted behavioral
performance28. Based on these observations, we used the SHWM as areference state (Supplementary Fig. S2) and identiﬁed brain states ineach of the other six cognitive tasks whose spatiotemporal features
best matched SHWM. In other words, in each of the other six tasks X, we
identiﬁed state SHX which was matched to SHWM, the optimal state forthe 2-back working memory task. Importantly, we then determined
whether the likelihood of engaging such “matched optimal” states
predicted cognitive control abilities, including individual differences
in task-speciﬁc measures of cognitive task performance and clinicalsymptoms associated with cognitive control deﬁcits.

back tasks. State temporal closeness measures the similarity of twolatent brain states’ temporal proﬁles (i.e., posterior probability of brain
states along time) in the same dataset (see details in methods),
whereas state space closeness measures the similarity of two latent
brain states’ space feature proﬁles (i.e., mean and covariance). High
temporal correlation and high space closeness indicates better
matching of states. Both algorithms identiﬁed a single unique state
SHAxCPT with the highest state-space closeness (c = 1.2, p = 0.005) andthe highest temporal closeness (r = 0.83, p = 0.004, Pearson’s correlation) with SHWM (Fig. 2). Detailed results from statistical analysis ofstate matching procedures across tasks are described in Supplementary Information (Supplementary Results and Supplementary
Table S13). These results identify SHAxCPT as a brain state matching
SHWM, the task-optimal reference engaged during working memory.
CCA We used CCA to investigate multivariate relations between
brain states and behavioral measures on the AxCPT. We found a signiﬁcant canonical correlation between occupancy rates of brain states
and behavioral performance (r = 0.51, p < 0.001, Pearson’s correlation,
Fig. 3a). The occupancy rate of SHAxCPT had the highest positive weightin the brain component and, correspondingly, AY RT had the highest
positive weights and BX RT had the most negative weight in the
behavioral component, suggesting that increased occupancy rate of
SHAxCPT is associated with better task performance (Fig. 3a, Supplementary Table S3). Predictive modeling using CCA showed that predicted canonical brain state measures and predicted canonicalbehavioral measures were signiﬁcantly correlated (r = 0.31, p = 0.02,
Pearson’s correlation).
Univariate analysis We then examined the relation between
SHAxCPT and a single index of cognitive control in the AxCPT task. We
used a normalized measure of the difference between RTs to “AY” and“BX” trials, a composite measure of proactive and reactive cognitive
control processes associated with the AxCPT task44,45. We found thatthe occupancy rate of SHAxCPT was signiﬁcantly correlated withproactive cognitive control (r = 0.34, p = 0.02, Pearson’s correlation,
Fig. 3e). No other state had statistically signiﬁcant and positive contribution to cognitive control (Supplementary Table S10). This result
demonstrates that greater engagement of SHAxCPT is associated with
better cognitive control.

DMCC tasks: AxCPT
We conducted a parallel set of analyses on four different cognitive
control tasks from the DMCC study, including the AxCPT, CuedTS,
Sternberg, and Stroop tasks31.
The AxCPT is widely used to investigate cognitive control
mechanisms associated with proactive and reactive control32. In thistask, participants are presented with the letters A or B followed byletters X or Y (or not “X”), comprising AX, AY, BX, and BY pairs. They
are asked to respond to the probe (“X”) only if it followed the contextual cue (“A”). Participants were to make another response to othercue–probe sequences (“A” then “Y,” “B” then “X,” or “B” then “Y”), eachoccurring with much lower probability than the target pair (“AX”).
Analysis of behavioral performance revealed that RTs were signiﬁcantly longer in the AY than AX trials (t49 = 17.44, p < 0.001, Cohen’sd = 4.933, two-tailed paired t-test; Supplementary Table S2) and in the
BX than BY trials (t49 = 8.02, Cohen’s d = 2.268, p < 0.001, two-tailed
paired t-test; Supplementary Table S2). Longer RT in AY and shorter RT
in BX are associated with better proactive and reactive control,
respectively44,45.
BSDS uncovered six latent brain states in the AxCPT task (Supplementary Fig. S3a). Next, we used two different algorithms todetermine the correspondence between states in the AxCPT and n-

Nature Communications | (2024)15:2185

DMCC tasks: CuedTS
The CuedTS paradigm is widely used to investigate cognitive control in
response to changing task rules46,47. Participants performed a letterdigit task in which they were cued to respond to either the letter or
number in target stimuli which consisted of a letter-digit pair (e.g., “D3”, or “1 A”). Based on the cue, participants had to either categorize theletter as a vowel or consonant, or categorize the digit as even or odd
depending on the cue. In incongruent trials, the two stimuli activatedcompeting cue-dependent responses (e.g., “A 3”) whereas in congruent trials, the response was cue-independent (e.g., “A 2”). Analysis
of behavioral data revealed that RT on congruent trials was signiﬁcantly shorter than on incongruent trials (t49 = 3.2, p = 0.002,
Cohen’s d = 0.533, two-tailed paired t-test; Supplementary Table S2).
Shorter RTs in incongruent trials and lower RT differences between
congruent and incongruent trials are associated with better cognitive
control ability in this task46,48.
4

Articlehttps://doi.org/10.1038/s41467-024-46511-5

Fig. 2 | Shared latent brain state across four different dual mode of cognitive
control (DMCC) tasks. BSDS uncovered 6 dynamic brain states in the AxCPT(N = 50). SHAxCPT showed (a) the highest state space closeness (c = 1.2) and (b)highest state temporal closeness (r = 0.83) with SHWM. BSDS uncovered 6 dynamic
brain states in the CuedTS task. SHCuedTS showed (a) the highest state space closeness (c = 0.88) and (b) the highest state temporal closeness (r = 0.72) with SHWM.
BSDS uncovered 4 dynamic brain states in the Sternberg working memory task.

SHStern showed (a) the highest state space closeness (c = 0.86) and (b) highest state
temporal closeness (r = 0.7) with SHWM. BSDS uncovered 5 dynamic brain state in
the Stroop task. SHStroop showed (a) the highest state space closeness (c = 1) and (b)the highest state temporal closeness (r = 0.82) with SHWM. SHWM refers to the highload dynamic brain state in the n-back working memory task. In each task, the best
matched four latent states are illustrated here. Color bars are the scales for state
space closeness and state temporal closeness.

BSDS uncovered six latent brain states in the CuedTS (Supplementary Fig. S3b). Using the two different state matching algorithms,
we again identiﬁed a single unique SHCuedTS with the highest state
space closeness (c = 0.88, p = 0.03) and the highest state temporalcloseness (r = 0.72, p = 0.02, Pearson’s correlation) with SHWM (Fig. 2).
Detailed results from statistical analysis of state matching procedures
across tasks are described in Supplementary Information (Supplementary Results and Supplementary Table S13). These results identify
SHCuedTS as a brain state matching SHWM, the task-optimal stateengaged during working memory.
CCA We ﬁrst used CCA to investigate multivariate relations
between brain state and behavioral measures in the CuedTS task. We
found a signiﬁcant canonical correlation between occupancy rate ofbrain states and behavioral performance (r = 0.59, p < 0.001, Pearson’s
correlation, Fig. 3b). The occupancy rate of SHCuedTS had the highest
positive weight in the brain component and, correspondingly, incongruent RT had negative weights, suggesting that the increased occupancy rate of SHCuedTS is associated with better task performance(Fig. 3b, Supplementary Table S3). Predictive CCA showed that thepredicted canonical brain state measures and predicted canonicalbehavioral measures were signiﬁcantly correlated (r = 0.35, p = 0.01,
Pearson’s correlation).
Univariate analysis We then examined the relation between
SHCuedTS and a single index of cognitive control. We used RT differences between congruent and incongruent trials to measure the taskrule congruency effect46,48, in which larger values indicate higher levelsof cognitive control. We found that the occupancy rate of SHCuedTS was
marginally signiﬁcantly correlated with cognitive control (r = 0.28,
p = 0.05, Pearson’s correlation, Fig. 3f). No other state had a statisticallysigniﬁcant and positive contribution to cognitive control(Supplementary Table S10). This result demonstrates that greater
engagement of SHCuedTS is associated with better conﬂict resolution.

Nature Communications | (2024)15:2185

DMCC tasks: Sternberg
The Sternberg task is widely used for probing maintenance andmanipulation of information in working memory49–51. In this task,
participants determine whether a probe matches a list of stimuli presented previously. High and low load conditions differ in the numberof stimuli that need to be maintained in working memory. Participants
showed signiﬁcantly lower cognitive control in the high, compared to
the low, load condition (t49 = 2.69, p = 0.01, Cohen’s d = 0.761, twotailed paired t-test; Supplementary Table S2). Higher accuracy andshorter RT on high load trials are associated with better working
memory capacity49–51.
BSDS uncovered four latent brain states in the Sternberg task
(Supplementary Fig. S3c). Using two different state matching algorithms, we identiﬁed a single unique SHStern with the highest state
space closeness (c = 0.86, p = 0.04) and the highest state temporalcloseness (r = 0.7, p = 0.03, Pearson’s correlation) with SHWM (Fig. 2).
Detailed results from statistical analysis of state matching procedures
across tasks are described in Supplementary Information (Supplementary Results and Supplementary Table S13). These results identify
SHStern as a brain state matching SHWM, the task-optimal state engaged
during working memory.
CCA We ﬁrst used CCA to investigate multivariate relations
between brain state and behavioral measures in the Sternberg task. We
found a signiﬁcant canonical correlation between occupancy rates ofbrain states and behavioral performance measures (r = 0.65, p < 0.001,
Pearson’s correlation, Fig. 3c). The occupancy rate of SHStern had thehigh positive weights in the brain component, suggesting increased5Articlehttps://doi.org/10.1038/s41467-024-46511-5

Fig. 3 | Latent brain states are associated with task performance in all four dual
mode of cognitive control (DMCC) tasks. Multivariate CCA revealed signiﬁcantcorrelations between occupancy rates of latent brain states and behavioral variables in all the DMCC tasks, including (a) AxCPT, (b) CuedTS, (c) Sternberg and (d)Stroop (N = 50). In each task, the component in which linear combination of
behavioral variables that best represents general cognitive control was selected toinvestigate the relationship between latent brain state and behavioral performance.
Weights of canonical components in each task are presented next to the axes andsummarized in Supplementary Table S3. Univariate Pearson’s correlation revealed
signiﬁcant correlation between occupancy rate of the multiple-demand brain state(e.g., SHAxCPT) and cognitive control index in all the DMCC tasks, including (e)AxCPT, (f) CuedTS, (g) Sternberg task, and (h) Stroop. SHAxCPT, SHCuedTS, SHStern
and SHStroop refers to the dynamic brain state that matches to SHWM in the AxCPT,
CuedTS, Sternberg and Stroop tasks, respectively. AxCPT Ax Continuous performance task, CuedTS Cued task switching task, ACC Accuracy, RT Reaction time, LL
Low load, HL High load, Con Congruent; Incon Incongruent, OR Occupancy rate.
The regression estimate is presented with 95% conﬁdence interval (shaded area).
Source data are provided as a Source data ﬁle. P values were not adjusted for
multiple comparisons.

occupancy rate of SHStern is associated with better performance(Fig. 3c, Supplementary Table S3). Predictive CCA showed that thepredicted canonical brain state measures and predicted canonicalbehavioral measures were signiﬁcantly correlated (r = 0.41, p = 0.004,
Pearson’s correlation).
Univariate analysis We then examined the relation between
SHStern and a single index of cognitive control in the Sternberg task. We
used an efﬁciency score (Accuracy/RT) to assess working memory
function and create a standardized index of cognitive control49–51. We
found that the occupancy rate of SHStern was correlated with cognitive
control (r = 0.35, p = 0.01, Pearson’s correlation, Fig. 3g). No other state
had a statistically signiﬁcant and positive contribution to cognitive
control (Supplementary Table S10). This result demonstrates that
greater engagement of SHStern is associated with better cognitive
control in maintaining task-relevant information in working memory.

(r = 0.82, p = 0.008, Pearson’s correlation) with SHWM (Fig. 2). Detailed
results from statistical analysis of state matching procedures acrosstasks are described in Supplementary Information (Supplementary
Results and Supplementary Table S13). These results identify SHStroop
as a brain state matching SHWM, the task-optimal state engaged during
working memory.
CCA We ﬁrst used CCA to investigate multivariate relations
between brain state and behavioral measures in the Stroop task. We
found a signiﬁcant canonical correlation between occupancy of brain
states and behavioral performance measures (r = 0.59, p < 0.001,
Pearson’s correlation, Fig. 3d). Importantly, occupancy rate of SHStroop
had high positive weight in the brain component and, correspondingly, Incongruent RT had negative weight, suggesting increased
occupancy rate of SHStroop associated with faster response in incongruent trials (Fig. 3d, Supplementary Table S3). Predictive CCA showedthat the predicted canonical brain state measures and predicted
canonical behavioral measures were signiﬁcantly correlated (r = 0.41,
p = 0.004, Pearson’s correlation).
Univariate analysis We then examined the relation between
SHStroop and a single index of cognitive control in the Stroop task.
Cognitive control was indexed using the difference in RT between
congruent and incongruent trials as it is widely used to quantify individuals’ ability to resolve conﬂict and identify its neural basis34,52,53. We
found that the occupancy rate of SHStroop was signiﬁcantly correlatedwith cognitive control (r = 0.33, p = 0.02, Pearson’s correlation, Fig. 3h).
No other state had a statistically signiﬁcant and positive contribution
to cognitive control (Supplementary Table S10). This result demonstrates greater engagement of SHStroop is associated with better cognitive control during the Stroop.
Together, these results demonstrate that latent brain states thatare well matched to a shared SHWM state in the 2-back working memory task, can be identiﬁed in four different cognitive control tasks in

DMCC tasks: Stroop
The Stroop is a classic paradigm used to investigate inhibitory control
and response conﬂict34. This task requires participants to speak out thefont color in which a word is presented. The task involves congruent andincongruent trials, in which the word and the font color of the word areeither the same or different, respectively. Analysis of behavioral data
revealed that RTs were signiﬁcantly lower in the incongruent, compared
to congruent, trials reﬂecting greater cognitive control demands in theincongruent condition (t49 = 13.76, p < 0.001, Cohen’s d = 3.892, twotailed paired t-test; Supplementary Table S2). Shorter RTs in incongruent trials and lower RT differences between congruent and incongruent trials are associated with better cognitive control in this task.
BSDS uncovered ﬁve latent brain states in the Stroop task (Supplementary Fig. S3d). Using two different state matching algorithms,
we identiﬁed a single unique SHStroop with the highest state spacecloseness (c = 1, p = 0.005) and the highest state temporal closeness

Nature Communications | (2024)15:2185

6

Articlehttps://doi.org/10.1038/s41467-024-46511-5

the DMCC and that their temporal properties are related to cognitive
control in each task (summarized in Supplementary Table S8).

Stop-signal task (SST)
We used Stop-signal task (SST) data from a cohort of 45 typicallydeveloping children and children with ADHD (9–12 years old) acquired
at Stanford University. The SST is widely used to probe inhibitory
control and its underlying neural mechanism8,54–56. Participants wereasked to make motor responses to frequent Go signals. Occasionally, aGo signal was followed by a Stop signal, which required participants towithhold the prepotent Go response. Participants achieved a highaccuracy on Go trials (94 ± 5%) and near 50% accuracy on Stop trials(51 ± 6%) (Supplementary Table S4). Importantly, the stop-signal
reaction time (SSRT) estimated from the Race model quantiﬁes one’s
stopping speed37,57. Shorter SSRTs are associated with better inhibitory
control.
BSDS uncovered four latent brain states in the SST (Supplementary Fig. S4). Using two different state matching algorithms, we again
identiﬁed a single unique SHSST with the highest state space closeness(c = 1.4, p = 0.005) and the highest state temporal closeness (r = 0.77,
p = 0.008, Pearson’s correlation) with the SHWM (Fig. 4). Detailed
results from statistical analysis of state matching procedures acrosstasks are described in Supplementary Information (Supplementary
Results and Supplementary Table S13). These results identify SHSST as abrain state matching SHWM, the task-optimal state engaged during
working memory.
CCA We ﬁrst used CCA to investigate multivariate relations between
brain state and behavioral measures in the SST. We found a signiﬁcantcanonical correlation between occupancy rates of brain states andbehavioral performance measures (r = 0.61, p < 0.001, Pearson’s correlation, Fig. 5a). The occupancy rate of SHSST had high positive weight inthe brain component and, correspondingly, Stop Accuracy had highpositive weight, suggesting increased occupancy rate of SHSST is associated with better performance (Fig. 5a, Supplementary Table S5). Predictive CCA showed that the predicted canonical brain state measuresand predicted canonical behavioral measures were signiﬁcantly correlated (r = 0.43, p = 0.004, Pearson’s correlation).
Univariate analysis We then examined the relation between SHSST
and a single index of cognitive control in the SST. Cognitive control on
the SST was indexed using the SSRT37,57. To facilitate comparison withall other tasks in this study, we used 1/SSRT so that larger values
indicate better cognitive control. The occupancy rate of SHSST was
signiﬁcantly correlated with this index of cognitive control (r = 0.34,
p = 0.02, Pearson’s correlation) (Fig. 5b). No other state had a statistically signiﬁcant and positive contribution to cognitive control (Supplementary Table S10). This result demonstrates that greater
engagement of SHSST is associated with faster stopping.
To investigate links with clinically relevant measures associatedwith ADHD, we investigated the relationship between the posterior
probability of the matched state SHSST and severity of inattention
symptoms. We found that the posterior probability of SHSST was signiﬁcantly correlated with the inattention score (r = 0.38, p = 0.01,
Pearson’s correlation, Fig. 5c). No other state had a statistically signiﬁcant and positive contribution to the inattention score (Supplementary Table S11). This result demonstrates that greater engagementof SHSST is associated with less severe inattention symptoms.

Leave one ROI out analysis reveals key role of MFG acrosscognitive tasks
To quantify the impact of each brain region on the similarity between
SHWM and SHX, where X represents all other tasks, we conducted aleave one ROI out analysis. Speciﬁcally, we computed the change(delta) in the Kullback–Leibler divergence across model parameters
between states SHWM and SHX before and after removing each brain
region’s latent state features. 1/delta was used to quantify the effect ofNature Communications | (2024)15:2185

Fig. 4 | Shared latent brain states in the stop signal task (SST). a BSDS uncovered
4 dynamic brain states (N = 45). SHSST showed the highest state space closeness(r = 1.4). b SHSST also showed the highest state temporal closeness (c = 0.77) with
SHWM. SHWM refers to the high-load dynamic brain state in the n-back working
memory task. SHSST refers to the dynamic brain state that matches to SHWM in the
SST. Color bars are the scales for state space closeness and state temporalcloseness.

the virtual lesion on state similarity. We found that the MFG, encompassing the dorsolateral prefrontal cortex, has the highest impact onstate similarity across the AxCPT, CuedTS, Sternberg, Stroop, and SST
tasks (Supplementary Fig. S5). This result suggests that the MFG is a
critical brain region underlying the shared high-load brain state acrossmultiple cognitive tasks.

Relational processing (RP) task from the human connectome
project
Finally, we investigated the relational processing (RP) task to further
characterize generalizability beyond the standard cognitive control
and working memory tasks investigated above. BSDS was used to
identify latent brain states in two different sessions (Sessions 1 and 2),each lasting 3 min, and to determine replicability of our ﬁndings. In the7Articlehttps://doi.org/10.1038/s41467-024-46511-5

Fig. 5 | Latent brain states are associated with task performance and inattention symptoms in the stop signal task (SST). a Multivariate CCA revealed signiﬁcant canonical correlations between occupancy rates of latent brain states andbehavioral variables in SST (N = 45). The component in which linear combination of
behavioral variables that best represents general cognitive control was selected toinvestigate the relationship between latent brain state and behavioral performance.
Weights of canonical components in each task was summarized in Supplementary
Table S5. b Univariate Pearson’s correlation analysis revealed that OR of SHSST issigniﬁcantly correlated with cognitive control index in the SST. c OR of SHSST issigniﬁcantly correlated with inattention scores from the SWAN. SHSST refers to the
dynamic brain state that matches to SHWM in the SST. ACC Accuracy, RT Reaction
Time, US Unsuccessful Stopping, SSD Stop Signal Delay, SSRT Stop Signal Reaction
Time, SWAN Strengths and Weaknesses of ADHD-symptoms and Normal-behavior
rating scale, OR Occupancy rate. The regression estimate is presented with 95%
conﬁdence interval (shaded area). Source data are provided as a Source data ﬁle.

relational task condition, participants were asked to judge whether
two pairs of objects differed along the same dimension. In the control
condition, participants were asked to decide whether an object matched top objects on a pre-speciﬁed dimension. We used an efﬁciency
score (Accuracy/RT) to quantify performance and standardize it togenerate a composite measure of cognitive control (see Methods fordetails). In both sessions 1 and 2, participants showed lower performance during relational processing than the matching control task
(session 1: t89 = 16.71, p < 0.001, Cohen’s d = 3.523, two-tailed paired ttest; session 2: t89 = 14.8, p < 0.001, Cohen’s d = 3.121, two-tailed paired
t-test; Supplementary Table S6), suggesting that the relation processing task is more cognitively demanding.
In Session 1 of the RP task, BSDS uncovered four latent brain
states (Supplementary Fig. S6). State matching analysis identiﬁed
a single unique SHRP1 with the highest state space closeness(c = 13, p = 0.005) and the highest state temporal closeness(r = 0.97, p = 0.004, Pearson’s correlation) with SHWM in Session 1(Fig. 6). These ﬁndings were replicated in Session 2 data. Again,
BSDS revealed four latent brain states, with a single unique matched state SHRP2 that had the highest state space closeness(c = 7.73, p = 0.005) and the highest state temporal closeness(r = 0.95, p = 0.004, Pearson’s correlation) with SHWM (Fig. 6).
Detailed results from statistical analysis of state matching procedures across tasks are described in Supplementary Information(Supplementary Results and Supplementary Table S13). These
results identify SHRP1 and SHRP2 as brain states matching SHWM,
the task-optimal state engaged during working memory.
CCA We ﬁrst examined multivariate patterns of the canonicalcomponent that best represents general cognitive control and thepattern of the canonical component in the latent brain state. We founda signiﬁcant canonical correlation between latent brain states andbehavioral performance (session 1: r = 0.35, p < 0.001, Pearson’s correlation, Fig. 7a, session 1: r = 0.44, p < 0.001, Pearson’s correlation,
Fig. 7b). Importantly, the occupancy rate of SHRP had high positive
weights in the brain component in both sessions and, correspondingly,
accuracy had positive weights, suggesting increased occupancy rate of
SHRP is associated with better task performance (Fig. 7, Supplementary
Table S7). Predictive CCA showed that the predicted canonical brain
state measures and predicted canonical behavioral measures in Session 2, but not Session 1, were signiﬁcantly correlated (r = 0.31,
p = 0.004, Pearson’s correlation).

Univariate analysis We then examined the relation between SHRP
and a single index of cognitive control in the relational processing task.
Cognitive control on the task was indexed using task efﬁciency(Accuracy/RT). In Session 1, we found that the occupancy rate of SHRP1
was signiﬁcantly correlated with cognitive control (r = 0.28, p = 0.009,
Pearson’s correlation). This ﬁnding was replicated in Session 2 (r = 0.32,
p = 0.002, Pearson’s correlation). No other state had a statisticallysigniﬁcant and positive contribution to cognitive control (Supplementary Table S10). These results demonstrate that greater engagement of SHRP is associated with better cognitive performance in therelational processing task, and furthermore, that this relation isreproducible.

Nature Communications | (2024)15:2185

Shared brain state for cognition within individuals
Taking advantage of the HCP within-subjects design in which, therelational processing (RP) and the n-back working memory tasks wereboth performed by the same individuals, we then determined whether
the temporal properties of the shared optimal brain state was reliable
across participants. Speciﬁcally, we examined the relation between theoccupancy rates associated with latent states SHRP and SHWM. We
found a signiﬁcant correlation in both Session 1 (r = 0.43, p < 0.001,
Pearson’s correlation; Supplementary Fig. S7a) and Session 2 (r = 0.24,
p = 0.02, Pearson’s correlation; Supplementary Fig. S7b).
These results provide evidence for similarities in intra-individual
latent state across distinct cognitive tasks.

Model-based brain states vs. conventional activation and connectivity analyses
We conducted additional analyses examining the similarity of activation/deactivation and connectivity proﬁles determined by our BSDS
brain-state model, and contrasted this with similarity measures fromconventional general linear regression analyses (Supplementary Methods and Supplementary Fig. S8). In each of the seven cognitive tasks, wefound that our BSDS model performed better at capturing common
brain states across tasks than conventional general linear model-based
activation and connectivity proﬁles (Supplementary Fig. S9).

Robustness of state matching with respect to sample size in the
n-back task

To examine the robustness of our ﬁndings with respect to the sample
size used in generating the reference optimal latent brain state SHWM,

8

Articlehttps://doi.org/10.1038/s41467-024-46511-5

Fig. 6 | Shared latent brain states in the Relational Processing (RP) task. BSDS
uncovered 4 dynamic brain states in both Sessions 1 and 2 (N = 90). SHRP1 has (a) the
highest state space closeness (c = 13) and (b) the highest state temporal closeness(r = 0.97) with SHWM in Session 1. SHRP2 has (a) the highest state space closeness(c = 7.7) and (b) the highest state temporal closeness (r = 0.95) with SHWM in Session

2. SHWM refers to the high-load dynamic brain state in the n-back task. SHRP1 andSHRP2 refers to the dynamic brain states that matches to SHWM in the Relational task
sessions 1 and 2, respectively. Color bars are the scales for state space closeness andstate temporal closeness.

we leveraged a larger sample (N = 415 participants) from the HCP nback working memory task and repeated that analysis to identify the
optimal latent brain state SHWM415 in the larger sample. In each cognitive task, we found that the state that best matched to SHWM415 was
the same state that matched SHWM (Supplementary Results and Supplementary Figs. S10–S13).

brain state was behaviorally signiﬁcant. We found that, in each cognitive task, the state that best matched SHMETA predicted task performance (Supplementary Results and Supplementary Figs. S18–S24).

Robustness of state matching with respect to reference tasks
To examine the robustness of our ﬁndings with respect to the choice ofthe reference tasks, we examined state matching using the HCP relational processing and SST tasks as reference tasks. In each cognitivetask, we found that the state best matched to the optimal brain state
was the same state that matched SHWM (Supplementary Results andSupplementary Figs. S14–S17).

Robustness of the main ﬁndings with respect to ROI selection

To examine the robustness of our ﬁndings with respect to the selectionof ROIs, we used NeuroSynth to create a new set of ROIs based onmeta-analysis of working memory and repeated the analyses to identify the optimal latent brain state in the HCP n-back task and labeled
the optimal state as SHMETA. We then used BSDS and state-matchingalgorithms to determine the optimal brain state which matched
SHMETA in each cognitive task and determined whether the matched
Nature Communications | (2024)15:2185

Discussion
We used a probabilistic dynamical systems model to investigate
fundamental circuit mechanisms underlying the functioning of amultiple-demand system across multiple cognitive domains. Our
computational modeling revealed a shared dynamic latent brain stateengaged across diverse experiments and four data cohorts that havebeen widely used to investigate human cognition. Importantly,
despite signiﬁcant differences in experimental paradigms, dataacquisition protocols, and participant cohorts, the temporal properties of brain states predicted cognitive task performance in each of
the tasks. Moreover, the occurrence rates of the shared latent statealso predicted behavioral performance. Furthermore, weak engagement of the shared brain state was related to inattention symptoms,suggesting that our generative model is also relevant for investigations of psychopathology. Together, our ﬁndings uncover a general
dynamic brain state that is preferentially engaged during cognition,and demonstrates that functional circuits associated with themultiple-demand system can adaptively contribute to a wide range ofcognitive functions16.
9Articlehttps://doi.org/10.1038/s41467-024-46511-5

Fig. 7 | Latent brain states are associated with task performance in the Relational Processing (RP) task. Multivariate CCA revealed signiﬁcant correlations
between occupancy rates of latent brain states and behavioral variables in the HCP
RP task session 1 (a) and 2 (b) (N = 90). In each task, the component in which linear
combinations of behavioral variables that best represents general cognitive control
was selected to investigate the relationship between latent brain state and behavioral performance. Weights of canonical components in each task are summarizedin Supplementary Table S7. Univariate Pearson’s correlation analysis revealed that

OR of SHSST is signiﬁcantly correlated with cognitive control index in the HCP RP
session 1 (c) and 2 (d). SHRP1 and SHRP2 refers to the dynamic brain states thatmatches to SHWM in the Relational task session 1 and 2, respectively. HCP Human
Connectome Project, RP Relational Processing, MC Matching Control, ACC Accuracy, RT Reaction Time, OR Occupancy rate. The regression estimate is presented
with 95% conﬁdence interval (shaded area). Source data are provided as a Source
data ﬁle. P values were not adjusted for multiple comparisons.

The ﬁrst major goal of our study was to determine whether ashared brain state is engaged across a broad range of cognitive tasks
within a common multiple-demand system. Meta-analyses of functional neuroimaging studies involving diverse cognitive tasks havereported the involvement of a common set of brain regions including
insular, prefrontal, parietal and cingulate cortices30,39,58,59. A fundamental yet unaddressed question is whether common brain states areengaged across cognitive task domains. This question is especiallychallenging because cognitive tasks differ along many dimensions,they activate similar brain areas—identifying commonly activated brain
areas does little to capture the underlying functional circuitry involvedin these tasks. We used a machine learning algorithm to address thischallenge.
A key aspect of our BSDS model is the identiﬁcation of brain states
based on joint modeling of activation and co-activation patterns28.
Such models have the advantage that they do not depend on known
relationships between neural activity and external experimental
variables21,22. Our state space models jointly capture time-varying
changes in activation and connectivity patterns across brain regions
involved in cognitive control and, moreover, provide a rigorous
computational approach for linking neural processes across two or
more datasets. A key point to note here is that brain states inferred byour model reﬂect factors which can be explicitly modeled, such as
experimentally-deﬁned task conditions, as well as unobserved mental
processes, such as a momentary lapse in attention, changes in motivation, alertness and fatigue which inﬂuence brain states60–64.

Crucially, generative model parameters derived by BSDS allowed
us to map brain states across cognitive tasks and use state space
dynamic measures for capturing shared features. In a previous study,
we discovered an optimal brain state SHWM associated with high-loadcognitive demands during working memory28 and this served as areference state for the present study. Crucially, we found that, in eachof the seven other cognitive tasks, there was a shared brain state that
had a highly similar proﬁle as SHWM, the optimal state in the working
memory task.
Notably, correspondence between brain states across cognitive
tasks was examined using two different analytic measures which yielded convergent ﬁndings (Fig. 1). The ﬁrst approach was based on KLdivergence of multivariate latent variables independently derived fromeach task. In this formalism, alignment of brain states is captured by
low KL-divergence between model parameters, including regional
activation and inter-regional functional connectivity. Low KLdivergence reﬂects similar multivariate patterns of latent variables,
indicating a strong match in brain states identiﬁed from the working
memory task on the one hand, and each of the other tasks on the other.
A second, and much more challenging approach, was based onusing generative aspects of the BSDS model. In this approach, model
parameters associated with the reference state SHWM, the optimal nback working memory task, were used as priors to estimate the posterior probabilities of SHWM in each of the seven other cognitive tasks.
Alignment of latent brain states was captured by a high correlation
between temporal evolution of the brain states derived by applying

Nature Communications | (2024)15:2185

10

Article
BSDS independently or using model parameters associated with SHWM
from the working memory task. Remarkably, in each task, we foundthat brain states with high temporal correlation precisely matched thestates derived using KL-divergence: the brain state that had the lowest
KL-divergence also showed the highest temporal correlation. It is further noteworthy that our approach was able to detect a shared latentstate in cognitive tasks that used block fMRI designs, but also in thecase of ﬁve tasks that used fast event-related fMRI designs where thetemporal evolution of brain states is much more complex and cannot
be accurately estimated by conventional approaches.
In each of the seven cognitive tasks, BSDS captured common
brain states better than conventional general linear models (Supplementary Fig. S9). While this common brain state is characterized by ahigh level of similarity in co-activation and functional connectivity
patterns, each task has its own unique ﬁngerprint. Identiﬁcation of thecommon brain state across different cognitive tasks demonstrates thatsimilar brain circuity is engaged when cognitive demands are high,regardless of the details of task context. Contrarily, when cognitive
control is not needed, the multivariate pattern of activation and connectivity deviates from that in the shared high cognitive-load brain
state. Moreover, these brain states ﬂuctuate over time and are characterized by distinct task- and state-speciﬁc state transition
probabilities.
The second major goal of our study was to investigate the behavioral relevance of brain states in each of the seven cognitive tasks. We
tested the hypothesis that engagement of the shared latent state
would be associated with better cognitive performance, and further
isolate task-optimal brain states from non-optimal or task-irrelevant
brain states. We examined the relationship between occurrence oflatent brain state and behavioral performance using both multivariate
and univariate approaches. Canonical correlation analysis revealed
multivariate relations between brain states and behavioral measures ineach of the seven cognitive tasks. Thus, the temporal pattern ofdynamic ﬂuctuations of brain states is highly behaviorally relevant.
Additionally, temporal properties of the shared brain state predicted performance in each of the seven tasks, highlighting the behavioral relevance of the shared brain state identiﬁed in the present
study. Speciﬁcally, in each task, the occupancy rate of the shared brain
state that matched SHWM, the optimal state in the n-back working
memory task28, was signiﬁcantly correlated with behavioral measuresassociated with cognitive control capacity speciﬁc to each task.
Each of the four DMCC tasks taps into a different aspect of cognitive control. The AxCPT is a widely used paradigm for probing dual
mechanisms of proactive and reactive control32. We assessed proactive
and reactive control by contrasting the “AY” and “BX” task conditions,as longer RT in “AY” is associated with implementation of proactive
control and shorter RT in “BX” is associated with good reactive
control44,45. A larger difference between “AY” and “BX” indicatesgreater proactive and reactive control. CCA revealed an association
between brain state and behavioral measures. Aligned with CCA weightpatterns, univariate analysis revealed that higher occupancy of theshared latent state SHAxCPT was correlated with greater proactive andreactive control. Our ﬁndings suggest that optimal engagement of theshared latent state facilitates implementation of dual control
processes.
The CuedTS allows investigation of cognitive control associatedwith response based on previously cued task rules46,48. This task has
long been recognized as a critical paradigm to assess a core component of cognitive control—the ability to dynamically update task
representations and conﬁgure attention and action systems for processing the upcoming target31. Incongruent trial conditions requireparticipants to make cue-dependent decisions, whereas in congruent
trials a response can be made independent of the cue. Good performance on incongruent trials relies on actively maintaining taskrelevant stimulus-response association and inhibiting task-irrelevant

Nature Communications | (2024)15:2185

https://doi.org/10.1038/s41467-024-46511-5

stimulus-response association. CCA revealed the association between
the high positive weight of SHCuedTS and the positive weight ofIncongruent Accuracy and negative weight of Incongruent RT. Alignedwith CCA weight patterns, higher occupancy rate of the shared latentstate SHCuedTS was associated with greater cognitive control index (orreduced congruency effect). Our ﬁndings suggest that engagement of
the shared latent brain state facilitates task preparation.
The Sternberg working memory task is a delayed match to sample
paradigm, in which participants are presented with a set of stimuli tobe remembered and then asked to judge whether a probe matches
stimuli presented during the encoding phase49,51. The high load condition is particularly cognitively challenging because it requires participants to encode and maintain in memory a long list of stimuli (up to
eight words). A composite measure based on both accuracy andreaction time during the high load condition was used to index cognitive control. CCA revealed an association between brain state andbehavioral measures. Aligned with CCA weight patterns, we found apositive correlation between occupancy rate of the shared latent brain
state SHStern and cognitive control, suggesting that the ability toengage SHStern predicts individual differences in cognitive control
ability.
Finally, the Stroop task is a classic probe of conﬂict resolution andresponse inhibition52. CCA revealed an association between brain stateand behavioral measures. Aligned with CCA weight patterns, occupancy rates of the shared brain state SHStroop were associated with theStroop effect, suggesting that engagement of this state facilitates
resolution of stimulus-response conﬂict.
In the SST, participants are required to withhold prepotent
responses when presented with an infrequent stop signal. We applied
the Race Model37 to compute SSRT, which provides a neurophysiologically validated estimate of stopping speed65. SSRT is a canonicalmeasure of inhibitory control, and a core component of cognitive
control. CCA revealed an association between brain state and behavioral measures. Aligned with CCA weight patterns, we found that theoccupancy rate of SHSST was correlated with SSRT, suggesting that theability to engage SHSST predicts individual differences in inhibitory
control ability.
In the RP task, participants are required to ﬁrst identify thedimensions along which stimuli differ in top and bottom rows of stimuli, and then determine whether the dimensions are the same or not.
In comparison to the baseline matching control condition, in which
participants determine which stimulus matches the target in a deﬁned
condition, the RP task requires extraction of abstract information fromconcrete external stimuli and maintenance of novel representations inworking memory for decision-making based on task rules retrieved
from long-term memory66. This task requires high-order cognitive
control processes associated with establishing and switching task sets.
CCA again revealed a multivariate relation between brain states andbehavioral measures, and this relationship was further replicatd by
univariate analysis. Critically, these ﬁndings were also replicated inacross two different sessions, demonstrating the robustness andreproducibility of a task-optimal brain state during relational
processing.
Our ﬁndings demonstrate that engagement of a shared taskgeneral dynamic brain state predicts cognitive performance acrossdiverse cognitive tasks. While each task differs in the speciﬁc cognitive
processes engaged over time, they all require access to a core set ofneural resources to meet increased cognitive challenges30,58,67. Ourﬁndings contribute to the understanding of the functioning of amultiple-demand system that was proposed based on a common set ofbrain regions activated during various cognitive tasks16. The existenceof a common underlying latent process governing this system waspreviously unknown. Our ﬁndings shed light on this critical issue andreveal a common brain state that is activated across diverse cognitive
control tasks, and its dynamic properties predict task performance11Articleregardless of task context. More generally, isolating task-optimal brain
states from non-optimal or task-irrelevant brain states associated withcognitive performance provides information about dynamic neurocognitive processes engaged by a shared multiple-demand frontoparietal cortical system.
The third major goal of our study was to investigate generalizability of the multiple-demand system and shared brain states to adevelopmental cohort. We further sought to determine relevance toinattention symptoms associated with ADHD, aprevalent neurodevelopmental disorder characterized by deﬁcits in cognitive control35,36,68–70. Brain imaging studies have linked the disorderwith abnormalities in activation and connectivity of frontoparietal
cortical regions71–77. However, it is not known whether brain statemodels associated with a multiple-demand frontoparietal systemderived from healthy adults are generalizable to children, and whether
the temporal properties of a shared task-related brain state also predict cognitive deﬁcits and clinical symptoms associated with ADHD. To
address this, we used a stop signal task, a classic behavioral paradigm
that has been widely used to investigate inhibitory control37, toinvestigate individual differences in children’s inhibitory control
ability78, as well as inattention, a hallmark of cognitive deﬁcits in children with ADHD79.
Our analysis revealed three key ﬁndings. First, our computationalmodel showed that brain states are generalizable from adults to children. Our prior research on the developmental maturation of response
inhibition in the stop signal task demonstrated that the extent to whichchildren engage an adult-like template of multivariate brain activation
patterns predicts their behavioral performance8. Building on theseﬁndings, we show here that the shared latent brain state present in
adults across a wide range of cognitive control tasks is also present inchildren during the stop signal task. This suggests that children engage
a shared dynamic process, not just similar brain activation patterns8.
Second, we found a signiﬁcant relation between SSRT, the modelbased estimation of stopping speed, and the occupancy rate of SHSST,
suggesting that weaker engagement of the shared latent state is related to weaker inhibitory control in children. Third, we found that lower
occurrence of the task-optimal shared state was also related to theclinical symptoms of inattention. The identiﬁcation of a shared latent
brain state between children and adults provides a valuable template
and analytic model for probing aberrant brain circuit dynamics
underlying cognitive control and attentional deﬁcits within the framework of a core multiple-demand system.
Each brain state is characterized by a distinct pattern of multivariate activity and inter-regional connectivity28. To determine theunique contributions of each brain region to the matched latent statesfrom each task, we conducted a leave-one-ROI-out analyses andexamined multivariate features of each brain region in relation to its
impact on the similarity between SHWM and SH from each task. Strikingly, multivariate features from the dorsolateral prefrontal cortex, inleft and right MFG, exhibited the greatest similarity between SHWM and
SH in other cognitive control tasks. The dorsolateral prefrontal cortex
is a crucial region underlying executive control functions in bothhuman13,16,39,80 and non-human primates81–83. Furthermore, metaanalytic research of neuroimaging studies has found that the dorsolateral prefrontal cortex is a commonly activated region in a variety ofdifferent cognitive and attentional control tasks30,39,58,84, and is thought
to be a subserve domain-general cognitive functions. Here, our ﬁndings reveal a central role for the dorsolateral prefrontal cortex inoperation of the multiple-demand system not only during working
memory, but also in the shared state engaged during a wide range oftasks that require cognitive control.
Although the relational processing (RP) task encompasses more
complex cognitive operations beyond those employed by the canonical cognitive control task, BSDS still identiﬁed a shared latent statethat matches the optimal latent brain state in the n-back working

Nature Communications | (2024)15:2185

https://doi.org/10.1038/s41467-024-46511-5

memory task. Given that SHWM is a task-general dynamic brain state
underlying cognition, an interesting question is whether engaging
SHWM during cognitive and attentional control tasks represents an
individual’s unique latent dynamic neurobiological proﬁle. To probe
this question, we examined the occupancy rate of SHWM during then-back working memory task, and the occupancy rate of SHRP during
the relational processing task, from the same group of participants.
Indeed, there was signiﬁcant positive correlation between SHwm and
SHRP across participants. This suggests that an individual who is more
likely to engage SHWM during a working memory task is also more
likely to engage this shared brain state during other cognitive andattentional control tasks. Furthermore, by replicating this ﬁnding in
two sessions of the RP task, we demonstrated the robustness of thisﬁnding. These results reveal a shared latent brain state across cognitive
tasks within an individual, and suggest the potential for identifying
individualized measures arising from dynamic brain processes acrossmultiple cognitive tasks.
While our study presents critical insights into the dynamics ofcognitive control and attention across seven different tasks, there arelimitations warrant consideration and suggest avenues for future work.
First, the task fMRI data primarily came from the Human Connectome
and the Dual Mechanisms of Cognitive Control projects, generalizability to other datasets and populations needs to be examined.
Second, our choice of Automatic Relevance Determination priors forhigh-dimensional variable selection was motivated by computational
tractability and prior validation28 and by their broader use in themodern machine learning literature85–87. Nevertheless, it is importantto acknowledge that the selection of priors and model inference inBayesian modeling remains an area of active debate within the ﬁeld.
Alternative approaches, such as spike-and-slab priors87,88, may offer
valuable insights and should be considered in future investigations.
Third, our methodology was rigorously validated in previous research,
including simulations and optogenetic stimulation, underscoring its
reliability28. However, the neuroscience community has yet to reach aconsensus regarding ideal biophysically realistic models for validating
causal circuit dynamics. Future investigations should further validate
state space models, such as ours, against a broader spectrum ofbiophysically-realistic simulations, extending beyond the scope of
those explored in our prior work28.
Human cognition relies on dynamic brain mechanisms for
implementing adaptive cognitive functions. Our study reveals latent
brain mechanisms underlying the operation of a multiple-demandsystem across a wide range of cognitive task domains, and help shedlight on a major unsolved problem in cognitive neuroscience. Ourﬁndings provide critical insights into dynamic brain mechanisms
underlying human cognition, and our generative hidden Markov
model-based computational framework opens promising avenues forprobing neurocognitive function, as well as their disruptions in psychiatric and neurological disorders.

Methods
Ethics statement
Data acquisition for the Dual Mechanisms of Cognitive Control(DMCC) was approved by the Institutional Review Board of The
Washington University in St. Louis. Data acquisition for the stop-signal
task (SST) was approved by the Institutional Review Board of Stanford
University. Data acquisition for the Human Connectome Project (HCP)
was approved by the Institutional Review Board of The Washington
University in St. Louis. Informed consent was obtained from all theparticipants or their legal guardians.

Bayesian switching dynamical systems (BSDS) model
Bayesian switching dynamical systems (BSDS) is a powerful state-space
generative model for uncovering latent brain state dynamics that may
not necessarily be time-locked to experimental task conditions28,41,89,90.
12

Article
BSDS identiﬁes brain states and their dynamic spatiotemporal properties in an optimal latent subspace. These properties allowed us to
identify shared brain states across multiple cognitive tasks. In eachtask, the initial value for the number of possible latent brain states was
set as 15. BSDS uses an Automatic Relevance Determination algorithm
which regularizes the solution space and effectively prunes away
redundant or superﬂuous features28,91 Details of the method aredescribed in our previous study28 and in the Supplementary Method.

BSDS analysis with priors
BSDS can be used to model latent brain states in new data using priors
from model parameters from previously trained data. The BSDS model
contains two sets of latent variables: global and local. Global latentvariables are not a function of data instance (all variables in Equations
1–2 that are not a function of time). Local latent variables in BSDS on
the other hand are a function of time and data sample. The maindifference between these two variables is that the global variables canbe transferred from one data to another. The local variables, however,need to be learned again for new data.
When using an existing BSDS model to ﬁt the new data and estimate posterior probability of the states (latent state variables) in the
new data, the global variables are directly transformed from theexisting BSDS model and the local variables are learned using the newdata given the global variables. In practice, only a single iteration of
BSDS would sufﬁce to learn the local latent variables for the new data.

https://doi.org/10.1038/s41467-024-46511-5

state space closeness, TPP(SHAxCPT)AxCPT and TPP(SHWM)AxCPT shouldhave the highest state temporal closeness.
This process was repeated for each of the seven cognitive tasks to
identify states that best matched SHWM in each task.
Statistical signiﬁcance of space closeness We used permutation
testing in which space closeness was computed across two randomly
drawn states from the n-back working memory task and the cognitive
control task (e.g., AxCPT). The two states were selected from the sameor different tasks, which is a random process. This permutation was
repeated 100 times to generate a distribution of space closeness fromwhich the signiﬁcance (p value) of the space closeness between SHWM
and SH of another task, e.g., SHAxCPT, was computed. The permutation
was performed only 100 times because of the limited number for
random combination of states and preclude inﬂation of p values.
Statistical signiﬁcance of temporal closeness We used the same
permutation procedure as described above to compute temporalcloseness between two randomly selected brain states. The permutation was repeated from 100 times to generate a distribution of temporal closeness from which the p value of the temporal closenessbetween SHWM and SH of another task, e.g., SHAxCPT, are computed.

Temporal and spatial metrics of dynamic brain states
Measures extracted from BSDS include occupancy rate and temporal
evolution of latent brain state, and mean and covariance of states.

Leave one ROI out analysis on state space closeness
BSDS state matching
We developed two metrics to determine how well brain states are matched across tasks: state space closeness and state temporal closeness.
State space closeness Each brain state was deﬁned by multivariate
features in optimized latent space, activation level and covariance. Let
S1WM to S4WM denote dynamic brain states obtained by applying BSDS
to the HCP n-back task. We showed identiﬁed state S1WM which
dominated the 2-back high-load (SH) condition and predicted performance and decision-making process in the 2-back trials28. To simplify
state names, without loss of generalization, we relabel S1WM as SHWM.
Now let S1AxCPT to SNAxCPT denote dynamic brain states obtained byapplying BSDS to the AxCPT task. Each brain state is represented by aGaussian distribution with mean and covariance associated with multivariate features in the latent brain state. The state space closeness(denoted as c) is computed by one divided by the Kullback–Leibler
divergence (KLD) between two states’ Gaussian distributions. Higher
closeness or smaller KLD indicates that the two states are more similarin their multivariate features. If S1AxCPT has the highest state spacecloseness with SHWM among all the states obtained in the AxCPT task,
S1AxCPT is considered a state matching SHWM and relabeled as SHAxCPT.
State temporal closeness Given the latent state model, ROI timeseries can, in turn, be represented as posterior probability time courses of estimated brain states. To conﬁrm that SHAxCPT is a state
matching SHWM, we further examined whether SHWM and SHAxCPT have
similar temporal evolutions if two different latent state models are ﬁt
to the same data. Let S1AxCPT to SNAxCPT denote dynamic brain statesobtained by applying BSDS to the AxCPT task. BSDS estimates temporal posterior probability (TPP) of each brain state at each time pointin the AxCPT task. TPP(S1AxCPT)AxCPT to TPP(SNAxCPT)AxCPT denote
temporal posterior probability of S1AxCPT to SNAxCPT in the AxCPT task.
We then applied global model parameters associated with SHWM,
S2WM, S3WM, and S4WM from the HCP WM task to the AxCPT task tocompute temporal posterior probability of latent brain state of the
HCP WM task in the AxCPT task. Let TPP(SHWM)AxCPT denote temporal
posterior probability of SHWM in the HCP AxCPT task. State temporalcloseness (denoted as r) is measured by the Pearson’s correlation
between each pair of temporal posterior probabilities in the TPPs fromtwo task. We hypothesize that, if SHAxCPT and SHWM have the highest

Nature Communications | (2024)15:2185

To evaluate the critical contribution of each brain region to the similarity of brain states between tasks, we conducted a leave one ROI out
analysis. Each time, we removed all the features from one ROI in thestate space in SHWM and SHX from another task X (e.g., SHAxCPT) andcomputed the change (delta) of the KLD before and after removing the
ROI. Then, the impact of the lesion on the state similarity was quantiﬁed using 1/delta. We repeated the procedure for all the ROIs in eachtask. The larger with 1/delta value, the greater contribution the ROI has
on the similarity between brain states. Statistical signiﬁcance estimation is described in Supplementary Methods.

Human fMRI datasets: HCP dataset
N-back working memory task We used the high-load dynamic brain
state from the HCP N-back task identiﬁed from our previous study38, as
the reference state for all other cognitive tasks in the present study.
The same sample (122 individuals) from the previous study was used in
the current study.
Relational processing (RP) task We selected 90 individuals fromthe 122 who had also participated in the n-back study38. The following
criteria were used: (1) complete behavioral and brain imaging data in
two different acquisition sessions; (2) range of head motion in anytranslational and rotational direction less than 1 voxel; (3) averagescan-to-scan head motion less than 0.25 mm.
Task details are described in Supplementary Methods and Supplementary Fig. 1.

Human fMRI datasets: DMCC dataset
We used the Dual Mechanism of Cognitive Control (DMCC) dataset31
which contains four different task paradigms for probing cognitive
control: (1) AX continued performance task (AxCPT), (2) Cued task
switching task (CuedTS), (3) Sternberg working memory task (Sternberg) and (4) Stroop interference task (Stroop). We used data from 50
individuals (19–42 years old, 31 F/19 M) out of a total of 89 participantsin the DMCC dataset based on the following criteria: (1) complete
behavioral and brain imaging data; (2) range of head motion in anytranslational and rotational direction was less than 1 voxel in all thetasks; (3) average scan-to-scan head motion was less than 0.25 mm inall the tasks.

13

Article
Task details are described in Supplementary Methods and Supplementary Fig. 1. Additional details can be found in online descriptions of the DMCC31,92.

https://doi.org/10.1038/s41467-024-46511-5

to reduce head-motion-related artifacts and resulting time series was
further linearly detrended and normalized.

Relation between brain states and behavioral performance
Human fMRI datasets: Stanford dataset

Details are described in Supplementary Methods.

To characterize the relation between brain states and behavioral performance in different tasks, we ﬁrst used multivariate canonical correlation analysis (CCA) to investigate multivariate relations between
brain state and cognitive performance measures in each task95,96. The
robustness of the CCA model was also tested using a predictive modelwith leave-one-out cross validation. Details of the CCA variable setting
and prediction analyses are described in Supplementary Methods. We
then used Pearson’s correlation (two-tailed) to investigate the link
between the occupancy rate of the shared multiple-demand state andtask-speciﬁc measures of cognitive control abilities (Supplementary
Table S9).

fMRI acquisition

Relation between brain states and clinical symptoms

DMCC Functional scans were acquired on a 3 T Siemens Prisma with a
32-channel head coil, without in-plane acceleration (iPat = none).
CMRR multiband sequences were used, TR = 1200 ms, TE = 33 ms, ﬂip
angle = 45°, in-plan resolution = 2.4 mm and multiband factor = 4.
SST fMRI data were acquired on a 3 T GE Signa scanner using a 32
channel head coil at the Richard M Lucas Center for Imaging at Stanford. Functional images of 42 axial slices were acquired using themultiband gradient-echo planar imaging with the following parameters: TR = 490 ms; TE = 30 ms; ﬂip angle = 45°, in-plane resolution = 3 mm and multiband factor = 6.
HCP fMRI data were acquired using a multiband, gradient-echo
planar imaging with the following parameters: TR = 720 ms, TE = 33.1 ms,
ﬂip angle = 52°; in-plane resolution = 2 mm and multiband factor = 8.

To characterize the relation between the shared multiple-demandbrain state and attentional deﬁcits, we used Pearson’s correlation (twotailed) to examine the relation between occupancy rate of SHSST andthe severity of inattention symptoms in children assessed using the
SWAN rating scale.

Stop-signal task (SST) Forty-ﬁve children with ADHD or TD children(9–12 years old, 22 F/23 M) completed the SST task during MRI scanning. Task details are described in Supplementary Methods and Supplementary Fig. 1.
Clinical symptoms of Inattention were assessed using theStrengths and Weaknesses of ADHD-symptoms and Normal-behavior(SWAN) rating scale93.

Task performance statistical test

Reporting summary
Further information on research design is available in the Nature
Portfolio Reporting Summary linked to this article.

Data availability
All original data reported in this study are publicly available on
Zenodo: https://zenodo.org/records/10702914. Source data are provided with this paper.

fMRI preprocessing
For the four DMCC tasks and the HCP n-back and RP tasks, we downloaded minimally preprocessed fMRI data. DMCC data was preprocessed using fMRIPrep pipeline31, including head motion correction,correction of susceptibility-derived distortion, slice-timing correction,
registration and normalization. HCP data was preprocessed using
fMRIVolume pipeline94, including correction of gradient-nonlinearityinduced distortion, realignment for motion correction, registration, andnormalization in 2 mm MNI space. Details of the preprocessing steps in
DMCC and HCP datasets are described in previous studies31,94. We
applied spatial smoothing with a Gaussian kernel of 6 mm FWHM in theminimally preprocessed DMCC and HCP data to improve signal-tonoise ratio as well as anatomical correspondence between individuals28.
For the SST, fMRI data were preprocessed using SPM12, including
realignment, slice-timing correction, co-registration, normalizationand smoothing8.
The same smoothing parameters were used in the HCP, DMCC
and SST datasets.

Region of interest (ROI) and time series
Load-dependent ROIs were determined using the HCP n-back task on
the contrast of interest: 2-back versus 0-back, including 9 load-positive(2-back > 0-back) ROIs: bilateral anterior insula (AI), bilateral middle
frontal gyrus (MFG), bilateral frontal eye ﬁeld (FEF), bilateral intraparietal sulcus (IPS) and dorsomedial prefrontal cortex (DMPFC), and 2
load-negative (2-back <0-back) ROIs: ventromedial prefrontal cortex(VMPFC) and posterior cingulate cortex (PCC)28 (Supplementary
Fig. S2a). Each ROI was a 6-mm radius sphere centered at the corresponding peak voxel. See Supplementary Table S12 for MNI coordinates of the ROIs.
Time series of the 1st eigenvalue was extracted using Marsbar(https://marsbar-toolbox.github.io/) from each ROI per subject in eachdataset. A multiple linear regression approach with 6 realignment
parameters (3 translations and 3 rotations) was applied to time series

Nature Communications | (2024)15:2185

Code availability
Functional MRI data preprocessing and statistical analyses were performed on the SPM12 and FSL 6, and Matlab 2020. BSDS and State
Matching Code can be accessed at Github (https://github.com/scsnl/
Cai_Multiple_Demand_System_2023) and Zenodo (https://doi.org/10.
5281/zenodo.10660076)97.

References
1.

2.

3.

4.
5.

6.

7.

8.

Braun, U. et al. Dynamic reconﬁguration of frontal brain networks
during executive cognition in humans. Proc. Natl. Acad. Sci. USA
112, 11678–11683 (2015).
Bressler, S. L. & Menon, V. Large-scale brain networks in cognition:
emerging methods and principles. Trends Cogn. Sci. 14,
277–290 (2010).
Kitzbichler, M. G., Henson, R. N., Smith, M. L., Nathan, P. J. & Bullmore, E. T. Cognitive effort drives workspace conﬁguration ofhuman brain functional networks. J. Neurosci. Off. J. Soc. Neurosci.
31, 8259–8270 (2011).
Menon, V. Large-scale functional brain organization. In: Brain
Mapping: An Encyclopedic Reference (Academic Press, 2015).
Shine, J. M. et al. The dynamics of functional brain networks: integrated network states during cognitive task performance. Neuron
92, 544–554 (2016).
Spadone, S. et al. Dynamic reorganization of human resting-state
networks during visuospatial attention. Proc. Natl. Acad. Sci. USA
112, 8112–8117 (2015).
Vatansever, D., Menon, D. K., Manktelow, A. E., Sahakian, B. J. &Stamatakis, E. A. Default mode dynamics for global functional
integration. J. Neurosci. Off. J. Soc. Neurosci. 35,
15254–15262 (2015).
Cai, W. et al. Hyperdirect insula-basal-ganglia pathway and adultlike maturity of global brain responses predict inhibitory control inchildren. Nat. Commun. 10, 4798 (2019).
14

Article
9.

Crittenden, B. M., Mitchell, D. J. & Duncan, J. Task encoding acrossthe multiple demand cortex is consistent with a frontoparietal andCingulo-Opercular dual networks distinction. J. Neurosci. 36,
6388–6388 (2017).
10. Cole, M. W., Bassett, D. S., Power, J. D., Braver, T. S. & Petersen, S. E.
Intrinsic and task-evoked network architectures of the human brain.
Neuron 83, 238–251 (2014).
11. Cole, M. W., Ito, T., Bassett, D. S. & Schultz, D. H. Activity ﬂow overresting-state networks shapes cognitive task activations. Nat. Neurosci. 19, 1718–1726 (2016).
12. Dosenbach, N. U. et al. A core system for the implementation of task
sets. Neuron 50, 799–812 (2006).
13. Dosenbach, N. U. et al. Distinct brain networks for adaptive andstable task control in humans. Proc. Natl. Acad. Sci. USA 104,
11073–11078 (2007).
14. Leung, H. C. & Cai, W. Common and differential ventrolateral prefrontal activity during inhibition of hand and eye movements. J.
Neurosci. Off. J. Soc. Neurosci. 27, 9893–9900 (2007).
15. McNab, F. et al. Common and unique components of inhibition andworking memory: an fMRI, within-subjects investigation. Neuropsychologia 46, 2668–2682 (2008).
16. Duncan, J. The multiple-demand (MD) system of the primate brain:mental programs for intelligent behaviour. Trends Cogn. Sci. 14,
172–179 (2010).
17. Menon, V. Brain networks and cognitive impairment in psychiatricdisorders. World Psychiatry 19, 309–310 (2020).
18. Menon, V. & D’Esposito, M. The role of PFC networks in cognitive
control and executive function. Neuropsychopharmacology 47,
90–103 (2022).
19. Duncan, J. The structure of cognition: attentional episodes in mind
and brain. Neuron 80, 35–50 (2013).
20. Duncan, J. & Miller, E. K. Adaptive neural coding in frontal andparietal cortex. In: Principles of frontal lobe function (eds Stuss, D.
T., Knight, R. T.) (Oxford University Press, 2013).
21. Pei, F. et al. Neural Latents Benchmark ‘21: Evaluating latent variable
models of neural population activity. Arxiv (2022).
22. Vyas, S., Golub, M. D., Sussillo, D. & Shenoy, K. V. Computation
through neural population dynamics. Annu. Rev. Neurosci. 43,
249–275 (2020).
23. Cunningham, J. P. & Yu, B. M. Dimensionality reduction for largescale neural recordings. Nat. Neurosci. 17, 1500–1509 (2014).
24. Hurwitz, C., Kudryashova, N., Onken, A. & Hennig, M. H. Building
population models for large-scale neural recordings: Opportunities
and pitfalls. Curr. Opin. Neurobiol. 70, 64–73 (2021).
25. Keeley, S. L., Zoltowski, D. M., Aoi, M. C. & Pillow, J. W. Modelingstatistical dependencies in multi-region spike train data. Curr. Opin.
Neurobiol. 65, 194–202 (2020).
26. Pandarinath, C. et al. Latent factors and dynamics in motor cortex
and their application to brain-machine interfaces. J. Neurosci. 38,
9390–9401 (2018).
27. Dabagia, M., Kording, K. P. & Dyer, E. L. Comparing highdimensional neural recordings by aligning their low-dimensional
latent representations. arXiv:2205.08413v1 (2022).
28. Taghia, J. et al. Uncovering hidden brain state dynamics that regulate performance and decision-making during cognition. Nat.
Commun. 9, 2505 (2018).
29. Kane, M. J., Conway, A. R. A., Miura, T. K. & Colﬂesh, G. J. H. Working
memory, attention control, and the N-back task: a question of construct validity. J. Exp. Psychol. Learn Mem. Cogn. 33, 615–622 (2007).
30. Owen, A. M., McMillan, K. M., Laird, A. R. & Bullmore, E. N-backworking memory paradigm: a meta-analysis of normative functional
neuroimaging studies. Hum. Brain Mapp. 25, 46–59 (2005).
31. Braver, T. S., Kizhner, A., Tang, R., Freund, M. C. & Etzel, J. A. The
dual mechanisms of cognitive control (DMCC) project. J. Cogn.
Neurosci. 33, 1990–2015 (2021).

Nature Communications | (2024)15:2185

https://doi.org/10.1038/s41467-024-46511-5
32. Braver, T. S. The variable nature of cognitive control: a dual
mechanisms framework. Trends Cogn. Sci. 16, 106–113 (2012).
33. Bunge, S. A., Ochsner, K. N., Desmond, J. E., Glover, G. H. & Gabrieli,
J. D. Prefrontal regions involved in keeping information in and out ofmind. Brain J. Neurol. 124, 2074–2086 (2001).
34. Carter, C. S. & van Veen, V. Anterior cingulate cortex and conﬂict
detection: an update of theory and data. Cogn. Affect Behav. Neurosci. 7, 367–379 (2007).
35. Barkley, R. A. Behavioral inhibition, sustained attention, andexecutive functions: constructing a unifying theory of ADHD. Psychol. Bull. 121, 65–94 (1997).
36. Hinshaw, S. P. Attention deﬁcit hyperactivity disorder (ADHD):
controversy, developmental mechanisms, and multiple levels ofanalysis. Annu. Rev. Clin. Psychol. 14, 291–316 (2018).
37. Logan, G. D. & Cowan, W. B. On the ability to inhibit thought andaction—a theory of an act of control. Psychol. Rev. 91,
295–327 (1984).
38. Van Essen, D. C. et al. The human connectome project: a dataacquisition perspective. NeuroImage 62, 2222–2231 (2012).
39. Cai, W., Ryali, S., Chen, T., Li, C. S. & Menon, V. Dissociable rolesof right inferior frontal cortex and anterior insula in inhibitory
control: evidence from intrinsic and task-related functional parcellation, connectivity, and response proﬁle analyses acrossmultiple datasets. J. Neurosci. Off. J. Soc. Neurosci. 34,
14652–14667 (2014).
40. Nee, D. E. et al. A meta-analysis of executive components ofworking memory. Cereb. Cortex 23, 264–282 (2013).
41. Cai, W. et al. Latent brain state dynamics distinguish behavioral
variability, impaired decision-making, and inattention. Mol. Psychiatry 26, 4944–4957 (2021).
42. Menon, V. & Uddin, L. Q. Saliency, switching, attention and control:a network model of insula function. Brain Struct. Funct. 214,655–667 (2010).
43. Sridharan, D., Levitin, D. J. & Menon, V. A critical role for the rightfronto-insular cortex in switching between central-executive anddefault-mode networks. Proc. Natl. Acad. Sci. USA 105,
12569–12574 (2008).
44. Braver, T. S., Paxton, J. L., Locke, H. S. & Barch, D. M. Flexible neuralmechanisms of cognitive control within human prefrontal cortex.
Proc. Natl. Acad. Sci. USA 106, 7351–7356 (2009).
45. Chatham, C. H., Frank, M. J. & Munakata, Y. Pupillometric andbehavioral markers of a developmental shift in the temporal
dynamics of cognitive control. Proc. Natl. Acad. Sci. USA 106,5529–5533 (2009).
46. Meiran, N. & Kessler, Y. The task rule congruency effect in task
switching reﬂects activated long-term memory. J. Exp. Psychol.
Hum. Percept. Perform. 34, 137–157 (2008).
47. Vandierendonck, A., Liefooghe, B. & Verbruggen, F. Task switching:interplay of reconﬁguration and interference control. Psychol. Bull.
136, 601–626 (2010).
48. Bugg, J. M. & Braver, T. S. Proactive control of irrelevant task rules
during cued task switching. Psychol. Res. 80, 860–876 (2016).
49. Awh, E. & Jonides, J. Overlapping mechanisms of attention andspatial working memory. Trends Cogn. Sci. 5, 119–126 (2001).
50. Cai, W. et al. Dopaminergic medication normalizes aberrant cognitive control circuit signaling in Parkinson’s disease. Brain J. Neurol.
145, 4042–4055 (2022).
51. Oberauer, K. Removing irrelevant information from working memory: a cognitive aging study with the modiﬁed Sternberg task. J.
Exp. Psychol. Learn 27, 948–957 (2001).
52. MacLeod, C. M. Half a century of research on the Stroop effect: an
integrative review. Psychol. Bull. 109, 163–203 (1991).
53. Barch, D. M. et al. Anterior cingulate cortex and response conﬂict:
effects of response modality and processing domain. Cereb. Cortex
11, 837–848 (2001).
15

Article
54. Aron, A. R., Fletcher, P. C., Bullmore, E. T., Sahakian, B. J. & Robbins,
T. W. Stop-signal inhibition disrupted by damage to right inferior
frontal gyrus in humans. Nat. Neurosci. 6, 115–116 (2003).
55. Chen, W. et al. Prefrontal-subthalamic hyperdirect pathway modulates movement inhibition in humans. Neuron 106, 579–588.e573(2020).
56. Li, C. S., Huang, C., Constable, R. T. & Sinha, R. Imaging response
inhibition in a stop-signal task: neural correlates independent ofsignal monitoring and post-response processing. J. Neurosci. Off. J.
Soc. Neurosci. 26, 186–192 (2006).
57. Verbruggen, F. & Logan, G. D. Models of response inhibition in thestop-signal and stop-change paradigms. Neurosci. Biobehav. Rev.
33, 647–661 (2009).
58. Levy, B. J. & Wagner, A. D. Cognitive control and right ventrolateralprefrontal cortex: reﬂexive reorienting, motor inhibition, and action
updating. Ann. N. Y. Acad. Sci. 1224, 40–62 (2011).
59. Wager, T. D. et al. Common and unique components of response
inhibition revealed by fMRI. NeuroImage 27, 323–340 (2005).
60. Keller, C. J. et al. Induction and quantiﬁcation of excitability changes in human cortical networks. J. Neurosci. Off. J. Soc. Neurosci.
38, 5384–5398 (2018).
61. Korzeniewska, A., et al. Changes in human brain dynamics during
behavioral priming and repetition suppression. Prog. Neurobiol.
189, 101788 (2020).
62. Gergelyﬁ, M., Jacob, B., Olivier, E. & Zenon, A. Dissociation between
mental fatigue and motivational state during prolonged mental
activity. Front. Behav. Neurosci. 9, 176 (2015).
63. Tang, Y. Y. et al. Short-term meditation training improves attention
and self-regulation. Proc. Natl. Acad. Sci. USA 104,
17152–17156 (2007).
64. Wascher, E. et al. Frontal theta activity reﬂects distinct aspects ofmental fatigue. Biol. Psychol. 96, 57–65 (2014).
65. Hanes, D. P., Patterson, W. F. 2nd & Schall, J. D. Role of frontal eye
ﬁelds in countermanding saccades: visual, movement, and ﬁxation
activity. J. Neurophysiol. 79, 817–834 (1998).
66. Christoff, K., Ream, J. M., Geddes, L. P. & Gabrieli, J. D. Evaluating
self-generated information: anterior prefrontal contributions tohuman cognition. Behav. Neurosci. 117, 1161–1168 (2003).
67. Laird, A. R. et al. A comparison of label-based review and ALE metaanalysis in the Stroop task. Hum. Brain Mapp. 25, 6–21 (2005).
68. Castellanos, F. X. & Tannock, R. Neuroscience of attention-deﬁcit/
hyperactivity disorder: the search for endophenotypes. Nat. Rev.
Neurosci. 3, 617–628 (2002).
69. Nigg, J. T. et al. Executive functions and ADHD in adults: evidence
for selective effects on ADHD symptom domains. J. Abnorm Psychol. 114, 706–717 (2005).
70. Polanczyk, G., de Lima, M. S., Horta, B. L., Biederman, J. & Rohde, L.
A. The worldwide prevalence of ADHD: a systematic review andmetaregression analysis. Am. J. Psychiatry 164, 942–948 (2007).
71. Cai W, Grifﬁths K, Korgaonkar M.S., Williams L. M. & Menon V.
Inhibition-related modulation of salience and frontoparietal networks predicts cognitive control ability and inattention symptoms
in children with ADHD. Mol Psychiatry, 26, 4016–4025 (2021).
72. Castellanos, F. X. et al. Cingulate-precuneus interactions: a new
locus of dysfunction in adult attention-deﬁcit/hyperactivity disorder. Biol. Psychiatry 63, 332–337 (2008).
73. Cortese, S. et al. Toward systems neuroscience of ADHD: a metaanalysis of 55 fMRI studies. Am. J. Psychiatry 169, 1038–1055(2012).
74. Dickstein, S. G., Bannon, K., Castellanos, F. X. & Milham, M. P. The
neural correlates of attention deﬁcit hyperactivity disorder: an ALE
meta-analysis. J. Child Psychol. Psychiatry 47, 1051–1062 (2006).
75. Fair, D. A. et al. Atypical default network connectivity in youth withattention-deﬁcit/hyperactivity disorder. Biol. Psychiatry 68,
1084–1091 (2010).

Nature Communications | (2024)15:2185

https://doi.org/10.1038/s41467-024-46511-5
76. Cai, W., Chen, T., Szegletes, L., Supekar, K. & Menon, V. Aberrant
time-varying cross-network interactions in children with attentiondeﬁcit/hyperactivity disorder and the relation to attention deﬁcits.
Biol. Psychiatry Cogn. Neurosci. Neuroimaging 3, 263–273 (2018).
77. Rosenberg, M. D. et al. A neuromarker of sustained attention fromwhole-brain functional connectivity. Nat. Neurosci. 19,
165–171 (2016).
78. Williams, B. R., Ponesse, J. S., Schachar, R. J., Logan, G. D. & Tannock, R. Development of inhibitory control across the life span. Dev.
Psychol. 35, 205–213 (1999).
79. Willcutt, E. G., Doyle, A. E., Nigg, J. T., Faraone, S. V. & Pennington, B.
F. Validity of the executive function theory of attention-deﬁcit/
hyperactivity disorder: a meta-analytic review. Biol. Psychiatry 57,
1336–1346 (2005).
80. D’Esposito, M. & Postle, B. R. The cognitive neuroscience of working
memory. Annu. Rev. Psychol. 66, 115–142 (2015).
81. Funahashi, S., Bruce, C. J. & Goldman-Rakic, P. S. Mnemonic codingof visual space in the monkey’s dorsolateral prefrontal cortex. J.
Neurophysiol. 61, 331–349 (1989).
82. Fuster, J. M. & Alexander, G. E. Neuron activity related to short-term
memory. Science 173, 652–654 (1971).
83. Goldman-Rakic, P. S. Cellular basis of working memory. Neuron 14,
477–485 (1995).
84. Daniel, T. A., Katz, J. S. & Robinson, J. L. Delayed match-to-sample inworking memory: a BrainMap meta-analysis. Biol. Psychol. 120,
10–20 (2016).
85. Bishop, C. M. Pattern Recognition and Machine Learning(Springer, 2006).
86. Leijon, A. Bayesian Learning of Gaussian Mixtures: Variational“Over-pruning”. KTH-Sch. Elect. Eng. (2013).
87. Murphy, K. P. Probabilistic Machine Learning: Advanced Topics (MITPress, 2023).
88. Dance, H. & Paige, B. Fast and scalable spike and slab variableselection in high-dimensional Gaussian processes. Pract. Mach.
Learn. Res. 151, 7976–8002 (2022).
89. Cai, W. D., Mizuno, Y., Tomoda, A. & Menon, V. Bayesian dynamicalsystem analysis of the effects of methylphenidate in children withattention-deﬁcit/hyperactivity disorder: a randomized trial. Neuropsychopharmacology 48, 1690–1698 (2023).
90. Lee, B. et al. Latent brain state dynamics and cognitive ﬂexibility inolder adults. Prog. Neurobiol. 208, 102180 (2022).
91. Neal, R. M. Bayesian Learning for Neural Networks (Springer-Verlag, 1996).
92. Etzel J. et al. The Dual Mechanisms of Cognitive Control dataset, atheoretically-guided within-subject task fMRI battery. ScientiﬁcData, 9, 114. (2022).
93. Swanson, J. M. et al. Categorical and dimensional deﬁnitions andevaluations of symptoms of ADHD: history of the SNAP and the
SWAN rating scales. Int. J. Educ. Psychol. Assess. 10, 51–70 (2012).
94. Glasser, M. F. et al. The minimal preprocessing pipelines for the
Human Connectome Project. NeuroImage 80, 105–124 (2013).
95. Hotelling, H. Relations between two sets of variables. Biometrika 28,
321–377 (1936).
96. Smith, S. M. et al. A positive-negative mode of population covariation links brain connectivity, demographics and behavior. Nat.
Neurosci. 18, 1565–1567 (2015).
97. Cai, W., Taghia, J., Menon, V. A multi-demand operating system
underlying diverse cognitive tasks (Code). Zenodo (105281/
zenodo10660076) (2024).

Acknowledgements
This research was supported by The Knut and Alice Wallenberg Foundation KAW2014.0392 (J.T.), BBRF Young Investigator Grant (W.C.),
National Institutes of Health MH105625 (W.C.), MH124816 (W.C.),
EB022907 (V.M.), NS086085 (V.M.), and MH121069 (V.M.). We thank Drs.

16

Article
Todd Braver and Jo Etzel for sharing the DMCC dataset and for useful
discussions. We thank Drs. Emily B. Fox, Scott W. Linderman, Srikanth
Ryali, Byeongwook Lee and Percy Mistry for their valuable feedback on
the manuscript.

https://doi.org/10.1038/s41467-024-46511-5
Reprints and permissions information is available at
http://www.nature.com/reprints
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional afﬁliations.

Author contributions
Conceptualization: W.C. and V.M.; Methodology: J.T., W.C., and V.M.;
Investigation: W.C. and J.T., Writing: W.C. and V.M.; Review & Editing:W.C., J.T., and V.M.

Competing interests
The authors declare no competing interests.

Additional information
Supplementary information The online version contains
supplementary material available athttps://doi.org/10.1038/s41467-024-46511-5.
Correspondence and requests for materials should be addressed to
Weidong Cai or Vinod Menon.

Open Access This article is licensed under a Creative Commons
Attribution 4.0 International License, which permits use, sharing,
adaptation, distribution and reproduction in any medium or format, aslong as you give appropriate credit to the original author(s) and thesource, provide a link to the Creative Commons licence, and indicate ifchanges were made. The images or other third party material in thisarticle are included in the article’s Creative Commons licence, unlessindicated otherwise in a credit line to the material. If material is notincluded in the article’s Creative Commons licence and your intended
use is not permitted by statutory regulation or exceeds the permitteduse, you will need to obtain permission directly from the copyrightholder. To view a copy of this licence, visit http://creativecommons.org/
licenses/by/4.0/.
© The Author(s) 2024

Peer review information Nature Communications thanks Brendan
Depue, Robert Whelan and the other, anonymous, reviewer(s) for theircontribution to the peer review of this work.

Nature Communications | (2024)15:2185

17