Papers › SwiFT: Swin 4D fMRI Transformer

SwiFT: Swin 4D fMRI Transformer

12 Jul 2023NeurIPS 2023 11arXiv:2307.05916archive 2025-07-28

Peter Yongho Kim, Junbeom Kwon, Sunghwan Joo, Sangyoon Bae, DongGyu Lee, Yoonho Jung, Shinjae Yoo, Jiook Cha, Taesup Moon

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.

PaperPDFConference PDFCodeCode Syntology ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 42 code samples harvested from 5 repositories linked to this paper: 25 ran (of which 4 constructed an object rather than computing a result; 16 with no instrument failure: 0 honoured, 0 violated, 16 with no contract checked; 9 where Syntology's instrument failed) · 17 unverified. Where Syntology's instrument failed: 7 where our contract draft was wrong; 2 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 12 samples from 1 repository, 8 ran (4 with no instrument failure; 4 where Syntology's instrument failed); found in paper text by Syntology: 30 samples from 4 repositories, 17 ran (12 with no instrument failure; 5 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 1 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-26 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 3 of the 25 samples that ran have no recorded date.

transconnectome/swift officialmentioned in papermentioned on GitHubpytorchSyntology: 12 samples, 8 ran (4 instrument-failed) · 4 unverified report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

42 samples harvested: 25 ran (of which 4 constructed an object rather than computing a result; 16 with no instrument failure: 0 honoured, 0 violated, 16 with no contract checked; 9 where Syntology's instrument failed) · 17 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

7ran · our draft was wrong
2ran; the contract check could not run
16ran
17unverified

Licence: 16 of the 42 samples are pointer only, meaning Syntology does not serve that copy's text. For 9 of them, this paper's copy is under a permissive licence and cleared, but the stored copy of the same code that Syntology serves is not; the licence label's tooltip gives Syntology's recorded reason. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 5 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 1 sample that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

transconnectome/swift official repository 12 samples, 8 ran (4 instrument-failed) · 4 unverified
window_partition in 377 papers
census: 13 implementations from 17 papers, 5 distinct outputs across 3 buckets, one shared input per bucket
project/module/models/swin4d_transformer_ver7.py ran · our draft was wrong Apache-2.0 (permissive) · e0d194741047c322 · report fixture: signature x:Tensor/6/float, window_size:list/1/int · returned Tensor · level recorded, date not recorded
PatchEmbed in 123 papers
census: 9 implementations from 9 papers, 6 distinct outputs on one shared input
project/module/models/swin4d_transformer_ver7.py ran Apache-2.0 (permissive) · 6c813e3ad36d54c6 · report fixture: returned PatchEmbed · level recorded 2026-09-22
PatchMergingV2 project/module/models/swin4d_transformer_ver7.py ran Apache-2.0 (permissive) · 328b4af4918629c8 · report fixture: returned PatchMergingV2 · level recorded 2026-09-22
PositionalEmbedding in 43 papers
census: 6 implementations from 6 papers, 4 distinct outputs across 3 buckets, one shared input per bucket
project/module/models/swin4d_transformer_ver7.py ran Apache-2.0 (permissive) · 68b986bf66c51ea9 · report fixture: returned PositionalEmbedding · level recorded 2026-09-22
WindowAttention4D project/module/models/swin4d_transformer_ver7.py ran Apache-2.0 (permissive) · b560de9c9e1dc9dc · report fixture: returned WindowAttention4D · level recorded 2026-09-22
compute_mask in 19 papers project/module/models/swin4d_transformer_ver7.py ran · our draft was wrong Apache-2.0 (permissive) · 961af72c78cb1191 · report fixture: signature dims:tuple/1/int, window_size:tuple/1/int, shift_size:tuple/1/int, device:device/0/? · returned Tensor · level recorded 2026-09-22
get_window_size in 21 papers project/module/models/swin4d_transformer_ver7.py ran; the contract check could not run (RAISES) · metamorphic tier: well formed Apache-2.0 (permissive) · 34484ba7deb03520 · report fixture: signature x_size:tuple/1/int, window_size:tuple/1/int, shift_size:tuple/1/int · returned tuple · level recorded, date not recorded
window_reverse in 296 papers project/module/models/swin4d_transformer_ver7.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant Apache-2.0 (permissive) · 277cca9a3532b997 · report fixture: signature windows:Tensor/6/float, window_size:list/1/int, dims:tuple/1/int · returned Tensor · level recorded, date not recorded
BasicLayer in 56 papers project/module/models/swin4d_transformer_ver7.py unverified Apache-2.0 (permissive) · 64670e8bbebf37ee · report
BasicLayer_FullAttention project/module/models/swin4d_transformer_ver7.py unverified Apache-2.0 (permissive) · 82954f2e594f9808 · report
SwinTransformer4D project/module/models/swin4d_transformer_ver7.py unverified Apache-2.0 (permissive) · 282c605afc9a9df9 · report
SwinTransformerBlock4D project/module/models/swin4d_transformer_ver7.py unverified Apache-2.0 (permissive) · 32ee991678bfe389 · report
Wayfear/BrainNetworkTransformer found in paper text by Syntology 10 samples, 7 ran (0 instrument-failed) · 3 unverified
get_param_group_no_wd source/components/optimizer.py ran MIT (permissive) here; the stored copy is pointer only · b93d89b36f5d3776 · report fixture: signature model:callable/0/?, match_rule:NoneType/0/?, except_rule:NoneType/0/? · returned tuple · level recorded 2026-09-24
init_dataloader source/dataset/dataloader.py ran MIT (permissive) here; the stored copy is pointer only · 14b27b9a81d9c709 · report fixture: signature cfg:DictConfig/0/?, final_timeseires:Tensor/3/float, final_pearson:Tensor/2/float, labels:Tensor/1/int · returned list · level recorded 2026-09-24
logger_factory source/components/logger.py ran MIT (permissive) here; the stored copy is pointer only · 0b3026b607b39b17 · report fixture: signature config:DictConfig/0/? · returned RootLogger · level recorded 2026-09-24
lr_scheduler_factory source/components/lr_scheduler.py ran MIT (permissive) · 6d0049b1f197cbe2 · report fixture: signature lr_configs:list/1/DictConfig, cfg:DictConfig/0/? · returned list · level recorded 2026-09-24
optimizer_factory source/components/optimizer.py ran MIT (permissive) · be45113508613473 · report fixture: signature model:callable/0/?, optimizer_config:DictConfig/0/? · returned SGD · level recorded 2026-09-24
optimizers_factory source/components/optimizer.py ran MIT (permissive) · fd96023efb6b2b49 · report fixture: signature model:callable/0/?, optimizer_configs:list/1/DictConfig · returned list · level recorded 2026-09-24
set_file_handler source/components/logger.py ran MIT (permissive) here; the stored copy is pointer only · b16e48b96d32841d · report fixture: signature log_file_path:PosixPath/0/? · returned RootLogger · level recorded 2026-09-24
init_stratified_dataloader source/dataset/dataloader.py unverified MIT (permissive) here; the stored copy is pointer only · cd853ca321de5189 · report
load_abcd_data source/dataset/abcd.py unverified MIT (permissive) · b660db87ab516861 · report
load_abide_data source/dataset/abide.py unverified MIT (permissive) here; the stored copy is pointer only · a179c3e7ac1bdec0 · report
GonyRosenman/TFF found in paper text by Syntology 7 samples, 0 ran · 7 unverified
BaseModel in 92 papers model.py unverified no licence file found · pointer only · 7c145bb8dd7de3e8 · report
BottleNeck_in model.py unverified no licence file found · pointer only · 0f08ae993a0c2db4 · report
BottleNeck_out model.py unverified no licence file found · pointer only · fcbcaa008dd46021 · report
Decoder in 210 papers model.py unverified no licence file found · pointer only · c921c50ee314871e · report
Encoder in 278 papers model.py unverified no licence file found · pointer only · 7b86cf23e6c30cc6 · report
Encoder_Transformer_Decoder model.py unverified no licence file found · pointer only · 453a114ddaa22943 · report
Transformer_Block model.py unverified no licence file found · pointer only · 524f03b0d35aaa91 · report
Project-MONAI/MONAI found in paper text by Syntology 9 samples, 9 ran (5 instrument-failed) · 0 unverified
register_vcs_handler in 31 papers monai/_version.py ran · our draft was wrong Apache-2.0 (permissive) · c55cafde08716f01 · report fixture: signature vcs:str/0/str, method:str/0/str · returned function · level recorded 2026-09-26
run_command in 61 papers monai/_version.py ran Apache-2.0 (permissive) · dbb37355631dabcf · report fixture: signature commands:list/1/str, args:list/1/str, cwd:NoneType/0/?, verbose:bool/0/bool, hide_stderr:bool/0/bool, env:NoneType/0/? · returned tuple · level recorded 2026-09-26
sigmoid_focal_loss in 122 papers
census: 3 implementations from 9 papers, 2 distinct outputs across 2 buckets, one shared input per bucket
monai/losses/focal_loss.py ran Apache-2.0 (permissive) · 0a9007867090337a · report fixture: signature input:Tensor/2/float, target:Tensor/2/float, gamma:float/0/float, alpha:Tensor/1/float · returned Tensor · level recorded 2026-09-24
soft_dilate monai/losses/cldice.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) here; the stored copy is pointer only · edd33c56dd0421f0 · report fixture: signature img:Tensor/4/float · returned Tensor · level recorded 2026-09-26
soft_erode monai/losses/cldice.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) here; the stored copy is pointer only · ebb4c26db0d1a569 · report fixture: signature img:Tensor/4/float · returned Tensor · level recorded 2026-09-26
soft_open monai/losses/cldice.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) here; the stored copy is pointer only · 302a88a3b3b24caf · report fixture: signature img:Tensor/4/float · returned Tensor · level recorded 2026-09-26
softmax_focal_loss monai/losses/focal_loss.py ran Apache-2.0 (permissive) · cf84889126420b19 · report fixture: signature input:Tensor/2/float, target:Tensor/2/float, gamma:float/0/float, alpha:Tensor/1/float · returned Tensor · level recorded 2026-09-24
spatial_gradient monai/losses/deform.py ran fingerprinted Apache-2.0 (permissive) · d7c2de9a1750ea2b · report fixture: signature x:Tensor/4/float, dim:int/0/int · returned Tensor · level recorded 2026-09-24
versions_from_parentdir in 31 papers monai/_version.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 5032e3b81c0fffb3 · report fixture: signature parentdir_prefix:str/0/str, root:str/0/str, verbose:bool/0/bool · returned dict · level recorded 2026-09-26
DAVEISHAN/TCLR found in paper text by Syntology 4 samples, 1 ran (0 instrument-failed) · 3 unverified
SpatioTemporalConv tclr_pretraining/r3d_prp.py ran · metamorphic tier: invariant MIT (permissive) · 2c09aa35ea6cf969 · report fixture: signature x:Tensor/5/float · returned Tensor · level recorded 2026-09-22
R3DNet tclr_pretraining/r3d_prp.py unverified MIT (permissive) · 8d8eac234638f60f · report
SpatioTemporalResBlock tclr_pretraining/r3d_prp.py unverified MIT (permissive) · 065d6753334a893e · report
SpatioTemporalResLayer tclr_pretraining/r3d_prp.py unverified MIT (permissive) · dae33da258ab777e · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it. Siblings are assemblies lifted from this paper in the same batch for the same method: alternative readings kept side by side; none replaces or supersedes another.

3 assemblies on this paper: 3 harvested, 0 generated, listed in 1 groups (siblings lifted in one batch form one group).

3 sibling assemblies for SwiFT (harvested), lifted in the same batch on 2026-09-09: alternative readings kept side by side; none replaces or supersedes another.

harvested Assembly for SwiFT (graph method: SwiFT). 12 bricks; individually on a fixture: 8 ran (of which 4 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 4 where Syntology's instrument failed) · 4 unverified. The assembly has not been run end-to-end.

one of 3 siblings

  1. SwinTransformer4D entry · level 0 · unverified · 282c605afc9a9df9
  2. BasicLayer model · level 0 · unverified · 64670e8bbebf37ee
  3. BasicLayer_FullAttention model · level 0 · unverified · 82954f2e594f9808
  4. PatchEmbed helper · level 1 · ran · 6c813e3ad36d54c6
  5. PositionalEmbedding model · level 1 · ran · 68b986bf66c51ea9
  6. SwinTransformerBlock4D model · level 0 · unverified · 32ee991678bfe389
  7. compute_mask helper · level 1 · ran · our draft was wrong · 961af72c78cb1191
  8. get_window_size helper · level 1 · ran; the contract check could not run (RAISES) · 34484ba7deb03520
  9. WindowAttention4D model · level 1 · ran · b560de9c9e1dc9dc
  10. window_partition helper · level 2 · ran · our draft was wrong · e0d194741047c322
  11. window_reverse helper · level 1 · ran; the contract check could not run (RAISES) · 277cca9a3532b997
  12. PatchMergingV2 model · level 1 · ran · 328b4af4918629c8

harvested Assembly for SwiFT (graph method: SwiFT). 4 bricks; individually on a fixture: 1 ran (of which 0 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 0 violated, 1 with no contract checked; 0 where Syntology's instrument failed) · 3 unverified. The assembly has not been run end-to-end.

one of 3 siblings

  1. R3DNet entry · level 0 · unverified · 8d8eac234638f60f
  2. SpatioTemporalConv model · level 1 · ran · 2c09aa35ea6cf969
  3. SpatioTemporalResBlock model · level 0 · unverified · 065d6753334a893e
  4. SpatioTemporalResLayer model · level 0 · unverified · dae33da258ab777e

harvested Assembly for SwiFT (graph method: SwiFT). 7 bricks; individually on a fixture: 0 ran · 7 unverified. The assembly has not been run end-to-end.

one of 3 siblings

  1. Encoder_Transformer_Decoder entry · level 0 · unverified · 453a114ddaa22943
  2. BaseModel helper · level 0 · unverified · 7c145bb8dd7de3e8
  3. BottleNeck_in helper · level 0 · unverified · 0f08ae993a0c2db4
  4. BottleNeck_out helper · level 0 · unverified · fcbcaa008dd46021
  5. Decoder model · level 0 · unverified · c921c50ee314871e
  6. Encoder model · level 0 · unverified · 7b86cf23e6c30cc6
  7. Transformer_Block helper · level 0 · unverified · 524f03b0d35aaa91

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2307.05916") returns these assemblies with each brick's role and wiring (how to connect).

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxStochastic DepthSwin TransformerTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections