TL;DR
FlexiBrain is a resolution-agnostic, voxel-level encoding framework that allows deep learning models to ingest native fMRI data directly, bypassing time-consuming and destructive standardization pipelines. By defining patches in real-world physical units (millimeters and seconds) and leveraging an efficient Mamba-JEPA backbone, it preserves subject-specific anatomical details while outperforming state-of-the-art methods by up to 12 percentage points.
What Problem Does This Paper Address?
Large-scale deep learning in neuroimaging suffers from severe data heterogeneity. Functional MRI (fMRI) data collected across different scanners and clinical sites vary drastically in spatial resolution (e.g., voxel sizes ranging from 2mm to 4mm) and temporal sampling rates (from 720ms to over 3000ms).
To train standard deep learning models, researchers typically rely on rigid preprocessing pipelines that warp every subject's brain into a standardized template space (such as the MNI152 template). As illustrated in the paper's preprocessing breakdown, this traditional approach has two massive downsides: it is computationally expensive (taking hours of compute per subject), and it destroys fine-grained, subject-specific anatomical variations through interpolation and smoothing artifacts.
FlexiBrain addresses this bottleneck by shifting the burden of alignment from data preprocessing to model design, enabling direct ingestion of heterogeneous data in its native space.
Methods
FlexiBrain introduces a model-centric solution to handle native-space fMRI data through three core components:
- Dynamic Patch Resizing: Instead of defining patches by a fixed number of voxels, FlexiBrain defines them in real-world physical units (e.g., 12mm spatial cubes, 6-second temporal windows). It dynamically resizes a shared set of base embedding kernels using a geometric operator (the Moore-Penrose pseudo-inverse) to match the specific voxel size and sampling rate of the input scan. This ensures that each token represents a consistent physical receptive field across different datasets.
- Continuous Physical 3D Positional Encoding: Because background voxels are masked out—disrupting standard grid coordinates—FlexiBrain calculates the exact physical center of each valid patch in anatomical world space using the affine transformation matrix extracted from the NIfTI file headers.
- Mamba-JEPA Backbone: Tokenizing native fMRI at the voxel level yields ultra-long sequences (~4,000 tokens per subject). To avoid the quadratic complexity of standard Transformers, FlexiBrain uses a Mamba architecture (linear-time state-space model). It pairs this with a Joint Embedding Predictive Architecture (JEPA) to predict masked tokens in a semantic latent space rather than trying to reconstruct noisy raw voxels. A lightweight Mixture-of-Experts (MoE) module is appended to the context encoder to introduce structural asymmetry and prevent representation collapse.
Datasets
The authors evaluated FlexiBrain using several prominent multi-site neuroimaging datasets:
- Pre-training & Internal Evaluation: Combined data from the Autism Brain Imaging Data Exchange (ABIDE), the Alzheimer’s Disease Neuroimaging Initiative (ADNI), and the ADHD-200 Sample.
- External Evaluation: The Parkinson’s Progression Marker Initiative (PPMI) dataset was held out entirely during pre-training to serve as an out-of-distribution benchmark for zero-shot generalization.
Key Insights and Ideas
- Model Adaptation Over Data Alignment: Instead of forcing heterogeneous data to fit a rigid model input shape via hours of destructive preprocessing, the model's tokenization layer dynamically adapts its parameters to the physical reality of the data.
- Physical Units as a Universal Interface: Standardizing tokens by physical size (mm and seconds) ensures that a token represents the same anatomical and temporal receptive field across completely different scanner protocols.
- Latent Prediction Over Raw Reconstruction: fMRI data is notoriously noisy. Using a JEPA framework to predict features in latent space avoids wasting model capacity on high-frequency voxel noise and balances out loss variations caused by heterogeneous voxel grids.
- MoE as a Safeguard Against Collapse: In self-supervised latent prediction, models often suffer from representation collapse (mapping all inputs to a constant vector). Appending a token-adaptive MoE module introduces structural asymmetry that forces the model to learn content-dependent structures.
Key Results
- Downstream Performance: FlexiBrain consistently outperformed recent state-of-the-art fMRI foundation models (including SwiFT, Brain-JEPA, and NeuroSTORM) across five downstream diagnostic tasks. It achieved performance gains of up to 12 percentage points (e.g., 69.76% accuracy on ADHD-200 compared to SwiFT's 62.50%).
- Computational Efficiency: Operating in native space reduces preprocessing time from approximately 5 hours (required for non-linear template alignment) to just 3 minutes per subject.
- Hardware Footprint: Thanks to the Mamba backbone, FlexiBrain significantly reduced the resource footprint during training to 18.59 GFLOPs and 1.97 GB of memory, compared to a standard ViT baseline which demanded 28.24 GFLOPs and 8.29 GB of memory for the same sequence length.
Limitations and Future Work
- Scanner-Center Domain Shift: While FlexiBrain successfully handles resolution heterogeneity, a strict leave-one-scanner-center-out analysis showed performance degradation when a clinical site was completely absent from pre-training. True site harmonization remains an open challenge.
- Not Fully End-to-End: The framework still relies on minimal preprocessing (like motion correction and slice-timing correction) to ensure temporal consistency within a session. The authors note that extending the framework to raw, uncorrected acquisition data is an important next step.
- Scale of Pre-training: The current study validates the architecture on disease classification tasks across a few thousand subjects but has not yet been scaled up to a massive, population-level foundation model trained on tens of thousands of subjects.
Summary updated