[Paper Review] SwiFT: Swin 4D fMRI Transformer
SwiFT introduces a 4D Swin Transformer to learn end-to-end spatiotemporal representations directly from raw 4D fMRI data, enabling efficient prediction of sex, age, and cognitive intelligence across large datasets, with beneficial self-supervised pre-training and interpretable insights.
Modeling spatiotemporal brain dynamics from high-dimensional data, such as functional Magnetic Resonance Imaging (fMRI), is a formidable task in neuroscience. Existing approaches for fMRI analysis utilize hand-crafted features, but the process of feature extraction risks losing essential information in fMRI scans. To address this challenge, we present SwiFT (Swin 4D fMRI Transformer), a Swin Transformer architecture that can learn brain dynamics directly from fMRI volumes in a memory and computation-efficient manner. SwiFT achieves this by implementing a 4D window multi-head self-attention mechanism and absolute positional embeddings. We evaluate SwiFT using multiple large-scale resting-state fMRI datasets, including the Human Connectome Project (HCP), Adolescent Brain Cognitive Development (ABCD), and UK Biobank (UKB) datasets, to predict sex, age, and cognitive intelligence. Our experimental outcomes reveal that SwiFT consistently outperforms recent state-of-the-art models. Furthermore, by leveraging its end-to-end learning capability, we show that contrastive loss-based self-supervised pre-training of SwiFT can enhance performance on downstream tasks. Additionally, we employ an explainable AI method to identify the brain regions associated with sex classification. To our knowledge, SwiFT is the first Swin Transformer architecture to process dimensional spatiotemporal brain functional data in an end-to-end fashion. Our work holds substantial potential in facilitating scalable learning of functional brain imaging in neuroscience research by reducing the hurdles associated with applying Transformer models to high-dimensional fMRI.
Motivation & Objective
- Motivate end-to-end learning directly from high-dimensional 4D fMRI to better capture brain dynamics without ROI-based preprocessing.
- Develop SwiFT, a 4D Swin Transformer with memory- and computation-efficient local window attention for fMRI.
- Show that end-to-end SwiFT improves predictive performance on sex, age, and intelligence across large datasets (HCP, ABCD, UKB).
- Demonstrate the feasibility and benefits of contrastive self-supervised pre-training for downstream fMRI tasks.
- Provide interpretability analysis to identify brain regions contributing to predictions.
Proposed method
- Extend the Swin Transformer to 4D to operate on time and 3D spatial dimensions of fMRI volumes.
- Use 4D windowed self-attention (4D W-MSA) and 4D shifted window attention (4D SW-MSA) for efficient local interactions.
- Implement patch partitioning and patch merging across the three spatial dimensions while keeping the temporal dimension intact.
- Adopt absolute 4D positional embeddings added after each stage to encode spatial and temporal coordinates.
- Enable end-to-end learning with a final global-attention stage for full-token interactions.
- Employ two contrastive self-supervised pre-training objectives (instance contrastive loss and local-local temporal contrastive loss) to improve downstream performance.
- Perform weight-efficient training with a fixed 4D Swin Transformer backbone and a final MLP head for downstream tasks.

Experimental results
Research questions
- RQ1Can an end-to-end 4D Swin Transformer effectively learn spatiotemporal brain dynamics directly from raw fMRI data?
- RQ2Does SwiFT outperform ROI-based and two-step Transformer/CNN baselines on sex classification and age/intelligence prediction across large datasets?
- RQ3Can contrastive self-supervised pre-training improve downstream fMRI prediction tasks for SwiFT?
- RQ4What brain regions contribute most to sex classification according to interpretable attributions?
- RQ5How does SwiFT compare in efficiency (parameters, FLOPs, throughput) to existing 4D fMRI models like TFF?
Key findings
- SwiFT consistently outperformed recent baselines on sex classification and age/intelligence prediction across HCP, ABCD, and UKB datasets.
- Self-supervised pre-training with instance and local-local temporal contrastive losses can enhance downstream performance, with effects varying by dataset and task.
- Integrated gradient-based interpretation identifies brain regions aligned with known sex-differentiation literature (e.g., mPFC, PCC, precuneus) and varying regions across age groups.
- SwiFT is demonstrated to be more parameter- and compute-efficient than a global-attention Transformer baseline (TFF) while achieving better predictive performance.
- The model supports end-to-end learning from raw 4D fMRI data, reducing the need for ROI-based feature extraction and two-step learning pipelines.
- Longer input time sequences can improve performance for some tasks (e.g., intelligence in certain cohorts), but effects are task- and dataset-dependent.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.