Probabilistic Prediction of Neural Dynamics via Autoregressive Flow Matching
Authors: Nicole Rogalla, Yuzhen Qin, Mario Senden, Ahmed El-Gazzar, Marcel van Gerven
Organizations: Department of Machine Learning and Neural Computing, Donders Institute for Brain, Cognition and Behaviour, Radboud University, Nijmegen, the Netherlands · Department of Cognitive Neuroscience, Maastricht University, Maastricht, the Netherlands · Maastricht Brain Imaging Center, Maastricht University, Maastricht, the Netherlands
Forecasting neural activity in response to naturalistic stimuli remains a key challenge for understanding brain dynamics and enabling downstream neurotechnological applications. Here, we introduce a generative forecasting framework for modeling neural dynamics based on autoregressive flow matching (AFM). Building on recent advances in transport-based generative modeling, our approach probabilistically predicts neural responses at scale from multimodal sensory input. Specifically, we learn the conditional distribution of future neural activity given past neural dynamics and concurrent sensory input, explicitly modeling neural activity as a temporally evolving process in which future states depend on recent neural history. We evaluate our framework on the Algonauts project 2025 challenge functional magnetic resonance imaging dataset using subject-specific models. AFM significantly outperforms both a non-autoregressive flow-matching baseline and the official challenge general linear model baseline in predicting short-term parcel-wise blood oxygenation level-dependent (BOLD) activity, demonstrating improved generalization and widespread cortical prediction performance. Ablation analyses show that access to past BOLD dynamics is a dominant driver of performance, while autoregressive factorization yields consistent, modest gains under short-horizon, context-rich conditions. Together, these findings position autoregressive flow-based generative modeling as an effective approach for short-term probabilistic forecasting of neural dynamics with promising applications in closed-loop neurotechnology.
Figures & tables
Figure 1: Autoregressive flow matching framework. Training aims to construct a probability path between a base distribution p0 and the target distribution p1 . The path is learned by regressing a neural network νθ which processes a sample from the probability path yts at flow step s , a context vector ht encoding both past BOLD images and stimulus features in a context window of length w , the stimulus feature ct , against the target conditional velocity field μ . Predictions are generated by sampling from p0 and integrating νθ with an ODE solver until s=1 . Figure adapted from El-Gazzar and van Gerven (2025a) .
Train r∗
Test r∗
Framework
mean
sub-01
sub-02
sub-03
sub-05
mean
sub-01
sub-02
sub-03
sub-05
GLM (Algonauts project 2025 challenge baseline)
0.320
0.330
0.331
0.312
0.309
0.260
0.242
0.275
0.267
0.256
SFM
0.577
0.597
0.546
0.584
0.606
0.423
0.402
0.405
0.447
0.438
AFM
0.498
0.480
0.437
0.541
0.532
0.465
0.449
0.428
0.493
0.488
Table 1: Performance comparison of AFM to baselines (SFM and GLM). Noise-ceiling adjusted Pearson’s correlation scores ( r∗ ) per subject for GLM baseline and FM optimized individual models. Train correlations are based on season 1, test correlations are based on season 6 of the TV show Friends . Values are rounded to three decimals. Highest values per column are highlighted in bold. All comparisons between frameworks significant given block-permutation test (10,000 repetitions, p < 0.05).
Figure 2: Flatmap of mean prediction performance of AFM. A) Flatmap of parcel-wise Pearson’s correlation coefficients ( r ) between predicted and observed fMRI responses averaged across subjects displayed on the FreeSurfer fsaverage brain. B) Flatmap of parcel-wise performance difference between (1) GLM and AFM and (2) SFM and AFM. Errorbar shared for difference plots. Insignificant parcels are depicted in grey (block-permutation test; 10,000 repetitions; p<0.05 , FDR-corrected across parcels). Numbers in parentheses indicate the count of significant parcels out of the total 1,000.
Figure 3: Prediction performance of optimized individual AFM models with GRU encoder across Yeo et al. (2011) ’s seven brain networks. A) Noise-level-adjusted correlation test scores ( r∗ ) averaged over parcels within each network. Error bars indicate variability across subjects. All results significant (block-permutation test, 10,000 repetitions, p<0.001 , Bonferroni correction). B) Relative performance gains ( Δr=rAFM∗−rB∗ ) of AFM over baseline frameworks (GLM, SFM). Asterisks denote significance levels of differences given a block-permutation test (10,000 repetitions, *: p<0.05 , **: p<0.001 , ***: p<0.001 , ****: p<0.0001 , ns: not significant; Bonferroni correction). Abbreviations: V: visual, SM: somatomotor, DA: dorsal attention, SV: salience / ventral attention, L: limbic, FP: frontoparietal, D: default. Results rounded to three decimals.
CRPS
mean
sub-01
sub-02
sub-03
sub-05
SFM
0.370
0.368
0.361
0.378
0.374
AFM
0.369
0.366
0.359
0.377
0.373
Table 2: Uncertainty quantification of AFM compared to baseline SFM. Continuous ranked probability score (CRPS) per framework on test set predictions. Values are rounded to three decimals. Best values per column are highlighted in bold.
Figure 4: Ablation analyses of A) context window length and B) prediction window length for AFM and SFM on subject 1. Noise-ceiling adjusted correlation ( r∗ ) shown for frameworks evaluated in increments of 5 (0-50s for context: 0-25 s for prediction). Markers indicate observed values.
mean
sub-01
sub-02
sub-03
sub-05
AFM (BOLD + stimulus)
0.465
0.449
0.428
0.493
0.488
AFM (stimulus only)
0.284
0.274
0.284
0.298
0.279
SFM (BOLD + stimulus)
0.423
0.402
0.405
0.447
0.438
SFM (stimulus only)
0.162
0.165
0.161
0.181
0.141
Table 3: Performance of FM models trained using both past stimulus and BOLD dynamics compared to FM models given only stimulus history. Noise-ceiling adjusted Pearson’s correlation scores ( r∗ ) per subject. Test correlations are based on season 6 of the TV show Friends . Values are rounded to three decimals.
Flow matching and diffusion models enable conditional generation across domains ranging from images to proteins, with recent extensions to out-of-distribution contexts. Yet generative models of neural time series have largely remained restricted to categorical conditioning, precluding compositional and zero-shot generalization. In this work, we propose a per-timestep conditioned diffusion transformer for generating realistic fMRI brain dynamics during unseen cognitive tasks by injecting both compositional language and optional spatial priors in-context. Such zero-shot generation could enable counterfactual neuroscience by supporting in-silico design and evaluation of novel cognitive experiments before empirical validation. Leveraging this model, we evaluate across hundreds of held-out task conditions and characterize predictive performance in relation to the training manifold. From language alone, the model recovers region-specific recruitment across tasks and held-out spatial activation patterns. Spatial priors, when available, complement the text pathway by anchoring generation in regions of task space where language alone degrades, while retaining the compositional structure needed for counterfactual task specification. To our knowledge this is the first generative model of whole-cortex fMRI dynamics for unseen cognitive tasks, advancing counterfactual neuroscience and data-driven experimental design.
Sam Gijsen, Michał Łukomski, Marc-André Schulz +1
Hertie Institute for AI in Brain Health, University of Tübingen, Germany · Tübingen AI Center, University of Tübingen, Germany · Charité – Universitätsmedizin Berlin, Department of Psychiatry and Psychotherapy, Germany +1
Brain activity unfolds as coordinated patterns across regions over time, and modeling these dynamics is a central goal in computational neuroscience. Because activity is distributed over connected brain regions, it is naturally represented on a graph whose nodes are brain regions or recording electrodes and whose edges capture relationships between these nodes, with message-passing modeling regional communication. However, standard message-passing networks place every node in a single shared feature space and typically aggregate messages from neighbors by scalar summation, which does not align with neurobiological evidence of brain communication. In order to model the heterogeneous nature of the brain, we introduce BrainDyn, a graph ordinary differential equation (ODE) network built on a cellular sheaf with dynamic restriction maps, recomputed from the forecasting context window rather than fixed once, mediating region-to-region communication through learned linear transformations that drive the time evolution of neural activity. We evaluate BrainDyn on resting-state fMRI, EEG, and simulated activity from the NEST simulator. Across these modalities, we test multi-region forecasting and autoregressive generation of brain transients, and, using NEST, prediction of altered transients following controlled perturbations. BrainDyn outperforms competing models across modalities, while analysis of the learned features shows that they are expressive, interpretable, and biologically aligned.
Siddharth Viswanath, Panayiotis Ketonis, Cassidy All +10
Yale University · Boise State University · University of Wisconsin–Madison
Forecasting time-varying functional connectivity from electroencephalography (EEG) requires modeling both history-dependent trends and structured variability across channels. Conditional flow matching provides a framework for distributional forecasting, yet it remains unclear whether graph-informed source distributions offer practical advantages over isotropic noise and strong deterministic predictors. We introduce a graph-structured residual flow framework that separates conditional mean prediction from stochastic residual transport. A history-only predictor estimates the future connectivity graph, while a graph Gaussian source encodes dependencies derived from past connectivity through a Laplacian-based covariance. A conditional velocity field transports source samples to future graph residuals, with transport time explicitly distinguished from physical EEG time. Our study identifies the conditions and controls needed to distinguish useful residual transport from improvements attributable to deterministic prediction, learned representations, and sampling effects.
Faculty of Information Science and Technology, Hokkaido University, Japan · SANKEN, The University of Osaka, Japan · Department of Computer Science, University of Illinois Urbana-Champaign, USA +1