FlexiBrain: Resolution-Agnostic Voxel-Level Encoding for Native fMRI

Mo Wang, Wenhao Ye, Junfeng Xia, Minghao Xu, Hongkai Wen, Quanying LiuarXiv 2026

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.

Fig. 1: fMRI preprocessing. Native fMRI is rapid and retains subject-specific anatomical information. However, it presents a challenge for deep learning due to its highly diverse resolution and non-aligned spatial coordinates. Template fMRI re- quires resource-intensive registration to align the image to a standard template brain, often consuming hours per subject. This eliminates individual differences, resulting in a unified and standardized resolution. ROI-based fMRI is derived from the registered Template fMRI using brain parcellation. It is reduced to a 2D representation (channels × time), summarizing activity across defined regions of interest.

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:

  1. 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.
  2. 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.
  3. 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.
Fig. 2: FlexiBrain Pipeline. (a) FlexiBrain accepts Native fMRI with heterogeneous resolution from diverse datasets. To achieve resolution-agnosticism, the foundational spatial patch size (millimeters) and temporal patch size (seconds) are defined in real- world physical units. FlexiBrain uses a dynamic patch resizing to accommodate the variable number of voxels (due to differing resolutions) within a fixed physical patch size. (b) The physical patches with position embeddings in real-world coordinate sys- tem are sampled to create target and context patches for a self-supervised approach. The framework employs a novel Mamba-JEPA that is specifically designed to avoid background input and utilizes the Mixture-of-Experts module to mitigate representa- tion 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

BibTeX
@misc{wang2026flexibrain,
  author = {Mo Wang and Wenhao Ye and Junfeng Xia and Minghao Xu and Hongkai Wen and Quanying Liu},
  title = {{FlexiBrain: Resolution-Agnostic Voxel-Level Encoding for Native fMRI}},
  year = {2026},
  eprint = {2606.11500},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.11500},
}
Figure