Functional connectivity-based attractor dynamics of the human brain in rest, task, and disease
Figures
Functional connectivity-based attractor neural networks as models of macro-scale brain dynamics.
(A) Free-energy-minimizing artificial neural networks (Spisak and Friston, 2025) are a form of recurrent stochastic artificial neural networks that, similarly to classical Hopfield networks (Hopfield, 1982; Koiran, 1994), can serve as content-addressable (‘associative’) memory systems. More generally, through the learning rule emerging from local free-energy minimization, the weights of these networks will encode a global internal model of the external world. The priors of this internal generative model are represented by the attractor states of the network that, as a special consequence of free-energy minimization, will tend to be orthogonal to each other. During stochastic inference (local free-energy minimization), the network samples from the posterior that combines these priors with the previous brain substates (also encompassing incoming stimuli), akin to Markov chain Monte Carlo (MCMC) sampling. (B) In accordance with this theoretical framework, we consider regions of the brain as nodes of a free-energy-minimizing artificial neural network. Instead of initializing the network with the structural wiring of the brain or training it to solve specific tasks, we set its weights empirically, using information about the interregional ‘activity flow’ across regions, as estimated via functional brain connectivity. Applying the inference rule of our framework - which displays strong analogies with the relaxation rule of Hopfield networks and the activity flow principle that links activity to connectivity in brain networks - results in a generative computational model of macro-scale brain dynamics that we term a functional connectivity-based (stochastic) attractor neural network (fcANN). (C) The proposed computational framework assigns a free energy level, a probability density and a ‘trajectory of least action’ towards an attractor state to any brain activation pattern and predicts changes of the corresponding dynamics in response to alterations in activity and/or connectivity. The theoretical framework underlying the fcANNs - based on the assumption that the brain operates as a free energy minimizing attractor network - draws formal links between attractor dynamics and multi-level Bayesian active inference.
Attractor states and state-space dynamics of connectome-based Hopfield networks.
(A) Leading eigenvectors of the empirical coupling matrix (upper in each pair) closely match functional connectivity-based attractor network (fcANN) attractor states (lower in each pair). Numbers under each pair report Pearson correlation and two-sided p-values based on 1000 surrogate data realizations, generated by phase-randomizing the true time series and recomputing the connectivity matrix. For the comprehensive results of the eigenvector-attractor alignment analysis (including a supplementary analysis on weight similarity to the analogous Kanter-Sompolinsky projector network) see Figure 2—figure supplement 2. (B) Example matches from a single permutation of the permutation-based null distribution. For each symmetry-preserving permutation of , we recomputed the corresponding eigenvectors and attractors and re-matched them. The maps are visibly mismatched and correlations are near zero, illustrating the null against which the empirical correlations in panel A are evaluated. (C) Left panel: Free-energy-minimizing attractor networks have been shown to establish approximately orthogonal attractor states (right), even when presented with correlated patterns (left, adapted from Spisak and Friston, 2025). fcANN analysis reveals that the brain also exhibits approximately orthogonal attractors. On all three polar plots, pairwise angles between attractor states are shown. Angles concentrating around 90° in the empirical fcANN are consistent with predictions of free-energy-minimizing (Kanter-Sompolinsky-like) networks. (Note, however, that in high-dimensional spaces, random vectors would also tend to be approximately orthogonal.) (D) The fcANN of study 1 seeded with real activation maps (gray dots) of an example participant. All activation maps converge to one of the four attractor states during the deterministic relaxation procedure (without noise), and the system reaches equilibrium. Trajectories are colored by attractor state. (E) Illustration of the stochastic relaxation procedure in the same fcANN model, seeded from a single starting point (activation pattern). With stochastic relaxation, the system no longer converges to an attractor state, but instead traverses the state space in a way restricted by the topology of the connectome and the ‘gravitational pull’ of the attractor states. The shade of the trajectory changes with increasing number of iterations. The trajectory is smoothed with a moving average over 10 iterations for visualization purposes. (F) Real resting state fMRI data of an example participant from study 1, plotted on the fcANN projection. The shade of the trajectory changes with an increasing number of iterations. The trajectory is smoothed with a moving average over 10 iterations for visualization purposes. (G) Consistent with theoretical expectations, we observed that increasing the inverse temperature parameter led to an increasing number of attractor states, emerging in a nested fashion (i.e. the basin of a new attractor state is fully contained within the basin of a previous one). When contrasting the functional connectome-based attractor neural network (ANN) with a null model based on symmetry-retaining permuted variations of the connectome (NM2), we found that the topology of the original (unpermuted) functional brain connectome makes it significantly better suited to function as an attractor network than the permuted null model. The table contains the median number of iterations until convergence for the original and permuted connectomes for different temperature parameters and the p-value derived from a one-sided Wilcoxon signed-rank test (i.e. a non-parametric paired test) comparing the iteration values for each random null instance (1000 pairs) to the iteration number observed with the original matrix and the same random input; with the null hypothesis that the empirical connectome converges in fewer iterations. than the permuted connectome. (H) We optimized the noise parameter of the stochastic relaxation procedure for eight different values over a logarithmic range between and 1 and contrasted the similarity (Wasserstein distance) between the 122-dimensional distribution of the empirical and the fcANN-generated data against null data generated from a covariance-matched multivariate normal distribution (1000 surrogates). We found that the fcANN reached multistability with and provided the most accurate reconstruction of the real data with , as compared with its accuracy in retaining the null data, suggesting that the fcANN model is capable of capturing non-Gaussian conditionals in the data. Glass’s Delta quantifies the distance from the null mean, expressed in units of null standard deviation.
Parameter sweep of functional connectivity-based attractor network (fcANN) parameters threshold and beta.
The number of attractor states is color-coded. See supplemental_material.ipynb for details.
Eigenstructure and projector tests of the functional connectivity-based attractor network (fcANN).
(A) Eigenvalue spectra of the empirical coupling matrix J (left) and null model 1 (coupling matrix based on phase-randomized timeseries data, recalculated for each permutation) (right). (B) Eigenvector-attractor alignment calculated from the empirical (left) and phase-randomized data (right). Attractors were obtained by deterministic relaxation from random initial states (with collapsing sign-duplicates); alignment is the absolute cosine between collapsed attractor vectors and the top eigenvectors of J. (C) Weight correspondence between J and its Kanter-Sompolinsky (K-S) analog. From the measured attractors, we formed Σ (columns are attractors) and C=ΣᵀΣ/N, then computed the pseudo-inverse projector . Similarity was quantified as the cosine between the off-diagonal elements of J and . The gray histogram shows the null distribution from null model 2 (symmetry-preserving permutations of J, but see Source notebook for similar results with null model 1, i.e., phase-randomized timeseries data); for each of the 1000 permutations we recomputed the own attractors of the surrogate network and . The red dashed line marks the empirical value; the one-sided p-value is the fraction of null cosines ≥ the empirical cosine. The empirical network shows stronger eigenvector–attractor alignment and substantially higher J↔J_KS off-diagonal correspondence than the null, consistent with approximate K-S projector behavior.
Schematic representation of the functional connectivity-based attractor network (fcANN) projection.
The fcANN projection is a 2-dimensional visualization of the fcANN dynamics, based on the first two principal components (PCs) of the states sampled from the stochastic relaxation procedure. The first two PCs yield a clear separation of the attractor states, with the two symmetric pairs of attractor states located at the extremes of the first and second PC. To map the attractors’ basins on the space spanned by the first two PCs, we obtained the attractor state of each point visited during the stochastic relaxation and fit a multinomial logistic regression model to predict the attractor state from the first two PCs. The resulting model accurately predicted attractor states of arbitrary brain activity patterns, achieving a cross-validated accuracy of 96.5% (permutation-based p<0.001). The attractor basins were visualized by using the decision boundaries obtained from this model. We propose the 2-dimensional fcANN projection as a simplified visual representation of brain dynamics and use it as a basis for all subsequent analyses in this work.
Functional connectivity-based attractor network s (fcANNs) initialized with the empirical connectome have better convergence properties than permutation-based null models.
We investigated the convergence properties of functional connectome-based attractor neural networks (ANNs) in study 1 by contrasting the number of iterations until reaching convergence to a permutation-based null model. In more detail, the null model was constructed by randomly permuting the upper triangle of the original connectome and filling up the lower triangle to get a symmetric network (symmetry of the weight matrix is a general requirement for convergence). This procedure was repeated 1000 times. In each repetition, we initialized both the original and the permuted fcANN with the same random input and counted the number of iterations until convergence. Each point on the plot shows an iteration number; the lines connect iteration numbers corresponding to the original and permuted matrices initialized with the same input. Statistical significance of the faster convergence in the empirical connectome was assessed via a one-sided Wilcoxon signed-rank test (i.e. a non-parametric paired test) on the paired iteration values (1000 pairs), with the null hypothesis that the empirical connectome converges in fewer iterations than the permuted connectome. The whole procedure was repeated with β = 0.3, 0.35, 0.4, 0.5, and 0.6 (providing 2–8 attractor states). See convergence-analysis.ipynb for details.
Connectome-based attractor networks reconstruct characteristics of real resting-state brain activity.
(A) The four attractor states of the functional connectivity-based attractor network (fcANN) model from study 1 reflect brain activation patterns with high neuroscientific relevance, representing sub-systems previously associated with ‘internal context’ (blue), ‘external context’ (yellow), ‘action’ (red), and ‘perception’ (green) (Golland et al., 2008; Cioli et al., 2014; Chen et al., 2018; Fuster, 2004; Margulies et al., 2016; Dosenbach et al., 2025). (B) The attractor states show excellent replicability in two external datasets (study 2 and 3, overall mean correlation 0.93). (C) The first two principal components (PCs) of the fcANN state space (the ‘fcANN projection’) explain significantly more variance (two-sided percentile bootstrap p<0.0001 on , 100 resamples) in the real resting-state fMRI data than principal components derived from the real resting-state data itself and generalizes better (two-sided percentile bootstrap p<0.0001) to out-of-sample data (study 2). Error bars denote 99% percentile bootstrapped confidence intervals (100 resamples). (D) The fcANN analysis reliably predicts various characteristics of real resting-state fMRI data, such as the fraction of time spent on the basis of the four attractors (first column, p=0.007, contrasted to the multivariate normal null model NM3), the distribution of the data on the fcANN-projection (second column, p<0.001, contrasted to the multivariate normal null model NM3) and the temporal autocorrelation structure of the real data (third column, p<0.001, contrasted to a null model based on permuting time frames). The latter analysis was based on flow maps of the mean trajectories (i.e. the characteristic timeframe-to-timeframe transition direction) in fcANN-generated data, as compared to a shuffled null model representing zero temporal autocorrelation. For more details, see Methods. Furthermore, we demonstrate that - in line with the theoretical expectations - fcANNs ‘leak’ their weights during stochastic inference (rightmost column): the time series resulting from the stochastic relaxation procedure mirror the covariance structure of the functional connectome the fcANN model was initialized with. While the ‘self-reconstruction’ property in itself does not strengthen the face validity of the approach (no unknown information is reconstructed), it is a strong indicator of the model’s construct validity; i.e., that systems that behave like the proposed model inevitably ‘leak’ their weights into the activity time series.
Robustness of the functional connectivity-based attractor network (fcANN) weights to noise.
We set the temperature of the fcANN so that two attractor states emerge and iteratively add noise to the connectome. To account for the change in dynamics, we adjust the temperature (beta) of the noisy fcANN so that exactly two states emerge. We then highlight the decrease in nodal strength of the noisy connectome (the fcANN weights) as a reference metric vs the correlation of the attractor states that emerge from the noisy connectome. See supplemental_material.ipynb for details.
Statistical inference of the functional connectivity-based attractor network (fcANN) state occupancy prediction with different null models.
(A) Results with a spatial autocorrelation-preserving null model for the empirical activity patterns. See null_models.ipynb for more details. (B) Results where simulated samples are randomly sampled from a multivariate normal distribution, with the functional connectome as the covariance matrix, and compared to the fcANN performance. See supplemental_material.ipynb for details.
Explained variance in state energy by first two principal components.
See supplemental_material.ipynb for details.
Cross-validation classification accuracy of the functional connectivity-based attractor network (fcANN), when predicting the attractor state from state activation.
The boxplot showing median (center line), interquartile range (box), and 1.5×IQR whiskers; the point denotes an outlier. See supplemental_material.ipynb for details.
Functional connectivity-based attractor networks reconstruct real task-based brain activity.
(A) Functional MRI time frames during pain stimulation from study 4 (second functional connectivity-based attractor network fcANN projection plot) and self-regulation (third and fourth) are distributed differently on the fcANN projection than brain substates during rest (first projection, permutation test, p<0.001 for all). Energies, as defined by the Hopfield model, are also significantly different between rest and the pain conditions (permutation test, p<0.001), with higher energies during pain stimulation. Triangles denote participant-level mean activations in the various blocks (corrected for hemodynamics). Small circle plots show the directions of the change for each individual (points) as well as the mean direction across participants (arrow), as compared to the reference state (downregulation for the last circle plot, rest for all other circle plots). (B) Flow analysis (difference in the average timeframe-to-timeframe transition direction) reveals a nonlinear difference in brain dynamics during pain and rest (left). When introducing a weak pain-related signal in the fcANN model during stochastic relaxation, it accurately reproduces these nonlinear flow differences (right). (C) Simulating activity in the Nucleus Accumbens (NAc) (the region showing significant activity differences in Woo et al., 2015) reconstructs the observed nonlinear flow difference between up- and downregulation (left). (D) Schematic representation of brain dynamics during pain and its up- and downregulation, visualized on the fcANN projection. In the proposed framework, pain does not simply elicit a direct response in certain regions, but instead, shifts spontaneous brain dynamics towards the ‘action’ attractor, converging to a characteristic ‘ghost attractor’ of pain. Down-regulation by NAc activation exerts force towards the attractor of internal context, leading to the brain less frequent ‘visiting’ pain-associated states. (E) Visualizing meta-analytic activation maps (see Figure 4—source data 1 for details) on the fcANN projection captures intimate relations between the corresponding tasks and (F) serves as a basis for a fcANN-based theoretical interpretative framework for spontaneous and task-based brain dynamics. In the proposed framework, task-based activity is not a mere response to external stimuli in certain brain locations but a perturbation of the brain’s characteristic dynamic trajectories, constrained by the underlying functional connectivity. From this perspective, ‘activity maps’ from conventional task-based fMRI analyses capture time-averaged differences in these whole brain dynamics.
-
Figure 4—source data 1
Source data detailing the search terms used, and the number of studies included in the meta-analysis, as well as the total number of reported activations, and the maximal Z-statistic.
- https://cdn.elifesciences.org/articles/98725/elife-98725-fig4-data1-v1.docx
Functional connectivity-based attractor network (FcANN) can reconstruct the pain ‘ghost attractor.’.
Signal-to-noise values range from 0.003 to 0.009. Asterisk denotes the location of the simulated ‘ghost attractor.’ P-values are based on permutation testing, by randomly changing the conditions on a per-participant basis. See main_analyses.ipynb for more details.
Functional connectivity-based attractor network (fcANN) can reconstruct the changes in brain dynamics caused by the voluntary downregulation of pain (as contrasted to upregulation).
Signal-to-noise values range from 0.001 to 0.005. P-values are based on permutation testing, by randomly changing the conditions on a per-participant basis. See main_analyses.ipynb for more details.
Connectome-based Hopfield analysis of autism spectrum disorder.
(A) The distribution of time frames on the functional connectivity-based attractor network (fcANN) projection separately for ASD patients and typically developing control (TDC) participants. (B) We quantified attractor state activations in the Autism Brain Imaging Data Exchange datasets (study 7) as the individual-level mean activation of all time frames belonging to the same attractor state. This analysis captured alterations similar to those previously associated with ASD-related perceptual atypicalities (visual, auditory, and somatosensory cortices) as well as atypical integration of information about the ‘self’ and the ‘other’ (default mode network regions). All results are corrected for multiple comparisons across brain regions and attractor states (122×4 comparisons) with Bonferroni correction. See Table 3 and Figure 5—source data 1 for detailed results. (C) The comparison of data generated by fcANNs initialized with ASD and TDC connectomes, respectively, revealed a characteristic pattern of differences in the system’s dynamics, with increased pull towards (and potentially a higher separation between) the action and perception attractors and a lower tendency of trajectories going towards the internal and external attractors. Abbreviations: MCC: middle cingulate cortex, ACC: anterior cingulate cortex, pg: perigenual, PFC: prefrontal cortex, dm: dorsomedial, dl: dorsolateral, STG: superior temporal gyrus, ITG: inferior temporal gyrus, Caud/Acc: caudate-accumbens, SM: sensorimotor, V1: primary visual, A1: primary auditory, SMA: supplementary motor cortex, ASD: autism spectrum disorder, TDC: typically developing control.
-
Figure 5—source data 1
All significant differences of the mean state activation analysis on the ABIDE dataset; label denotes the region in the BASC122 atlas.
See supplemental_material.ipynb in the analysis source code for details.
- https://cdn.elifesciences.org/articles/98725/elife-98725-fig5-data1-v1.csv
Tables
Null models applied in the present study.
| Short name | Brief description | Invariant to | Destroys |
|---|---|---|---|
| NM1 Temporal phase randomization | Phase-randomize time series data independently for each region; recalculate connectivity. | Time-series power spectrum and autocorrelation | Conditional dependencies across regions |
| NM2 Symmetry-preserving matrix permutation | Shuffle off-diagonal entries of while keeping symmetry | Weight distribution and symmetry | Topological structure, clusteredness |
| NM3 Covariance-matched Gaussian | Draw time frames from a multivariate normal with covariance equal to the functional connectome’s covariance | Gaussian conditionals | Nonlinear and non-Gaussian conditionals, temporal autocorrelation |
| NM4 Temporal order permutation | Randomly permute time-frame order within runs; used for flow analyses | Spatial autocorrelation | Temporal autocorrelation |
| NM5 Condition shuffling | Permute condition labels, either within participant (e.g. pain vs. rest; up- vs. down-regulation) or between participant (shuffle patient vs. control labels) | Marginal distributions and overall data structure | Condition-specific associations and effects |
Research questions, methodological approaches, and the corresponding null models.
| Research question | Methodological approach | Null model |
|---|---|---|
| Q1. Is the brain an approximate K-S projector ANN (FEP-ANN prediction)? | Compare eigenvectors of the coupling matrix with attractor states | NM1-2 |
| Q2. Is the functional connectome well-suited to function as an attractor network? | Measure iterations to convergence in deterministic relaxation | NM2 |
| Q3. What are the optimal parameters for the fcANN model? | We fix β = 0.04 (four attractor states) for simplicity. We perform a rough optimization of the noise parameter in stochastic relaxation to match empirical data distribution. | NM3 |
| Q4. Do fcANNs display biological plausible attractor states? | Identify attractor states, report basin sizes, and assess spatial patterns with different inverse temperature parameters and noise levels | Qualitative |
| Q5. Can fcANNs reproduce the characteristics of resting-state brain activity? | Compare stochastic dynamics (state occupancy, distribution, temporal trajectory) with empirical resting state data | NM3-4 |
| Q6. Can resting-state fMRI-based fcANNs predict large-scale brain dynamics elicited by tasks or stimuli? | Contrast pain vs. rest dynamics with data generated by fcANNs and pain-associated control signal | NM5 |
| Q7. Can resting-state fMRI-based fcANNs predict altered brain dynamics in clinical populations? | Contrast autism spectrum disorder patients vs. typically developing control participants’ observed brain dynamics with data generated by fcANNs initialized with the respective functional connectomes | NM5 |
The top ten largest changes in average attractor-state activity between autistic and control individuals.
Mean attractor-state activity changes are presented in the order of their absolute effect size. Reported effect sizes are mean attractor activation differences. Note that activation time series were standard scaled independently for each region, so effect size can be interpreted as showing the differences as a proportion of regional variability. All p-values are based on permutation tests (shuffling the group assignment) and corrected for multiple comparisons (via Bonferroni’s correction). For a comprehensive list of significant findings, see Figure 5—source data 1.
| Region | Attractor | Effect size | p-value |
|---|---|---|---|
| Primary auditory cortex | Perception | –0.126 | <0.0001 |
| Middle cingulate cortex | Action | 0.109 | <0.0001 |
| Cerebellum lobule VIIb (medial part) | Internal context | 0.104 | <0.0001 |
| Mediolateral sensorimotor cortex | Perception | –0.099 | 0.00976 |
| Precuneus | Action | 0.098 | <0.0001 |
| Middle superior temporal gyrus | Perception | –0.098 | <0.0001 |
| Frontal eye field | Perception | –0.095 | <0.0001 |
| Dorsolateral sensorimotor cortex | Perception | –0.094 | 0.00976 |
| Posterior cingulate cortex | Action | 0.092 | <0.0001 |
| Dorsolateral prefrontal cortex | External context | –0.092 | <0.0001 |
Datasets and studies.
The table includes details about the study modality, analysis aims, sample size used for analyses, mean age, gender ratio, and references.
| Study | Modality | Analysis | n | Age (mean ±sd) | % Female | References |
|---|---|---|---|---|---|---|
| Study 1 | Resting state | Discovery | 41 | 26.1±3.9 | 37% | Spisak et al., 2020 |
| Study 2 | Resting state | Replication | 48 | 24.9±3.5 | 54% | Spisak et al., 2020 |
| Study 3 | Resting state | Replication | 29 | 24.8±3.1 | 53% | Spisak et al., 2020 |
| Study 4 | Task-based | Pain self-regulation | 33 | 27.9±9.0 | 66% | Woo et al., 2015 |
| Study 5 (Meta-analysis) | Task-based | IPD meta-analysis pain map | n=603 (20 studies) | 26.3±5.9 | 39% | Zunhammer et al., 2021 |
| Study 6 (Neurosynth) | Task-based | Coordinate-based meta-analyses | 14,371 studies in total | N/A | N/A | Yarkoni et al., 2011 |
| Study 7 (ABIDE, NYU sample) | Resting state | Autism Spectrum Disorder | ASD: 98; NC: 74 | 15.3±6.6 | 20.9% | di Martino et al., 2014 |
MRI acquisition parameters.
TR: repetition time; TE: echo time; FA: flip angle; FOV: field of view; EPI: echo-planar imaging; SPGR: spoiled gradient recall; SENSE/GRAPPA/ASSET: parallel imaging factors. Studies 5–7 are meta-analyses or multi-center studies with varying data. Sequence parameters for these studies are available in the respective publications.
| Parameter | Study 1 | Study 2 | Study 3 | Study 4 |
|---|---|---|---|---|
| Scanner/head coil | Philips Achieva X 3T; 32-ch | Siemens Magnetom Skyra 3T; 32-ch | GE Discovery MR750w 3T; 20-ch | Philips Achieva TX 3T; head coil per site |
| Anatomical sequence | T1 MPRAGE | T1 MPRAGE | T1 3D IR-FSPGR | T1 SPGR (high-resolution) |
| Anatomical TR/TE | 8500 ms/3.9 ms | 2300 ms/2.07 ms | 5.3 ms/2.1 ms | -/- |
| Anatomical resolution/FOV | 1×1×1 mm³; 256×256×220 mm³ | 1×1×1 mm³; 256×256×192 mm³ | 1×1×1 mm³; 256×256×172 | - |
| Resting-state EPI TR/TE/FA | 2500 ms/35 ms/90° | 2520 ms/35 ms/90° | 2500 ms/27 ms/81° | 2000 ms/20 ms/ - |
| Phase enc. | COL | A>>P | A>>P | - |
| FOV (voxels×slices) | 240×240×132; 40 slices | 230×230×132; 38 slices | 96×96×44; 44 slices | 64×64; 42 slices |
| Slice thickness/gap/order | 3 mm/0.3 mm/interleaved | 3 mm/0.48 mm/interleaved | 3 mm/0 mm/interleaved | 3 mm / - / interleaved |
| Acceleration/fat suppression | SENSE 3×/SPIR | GRAPPA 2×/Fat sat. | ASSET 2×/Fat sat. | SENSE 1.5×/- |
| Volumes/dummies/scan time | 200/5 / 8 min 37 s | 290/5 / 12 min 11 s | 240/0 / 10 min | -/-/- |