Three spectral ViTs trained from scratch on 100 subjects each, reconstructed from withheld ADNI data (see demo.ipynb).
- Spectral tokens. An image is tokenized into coefficients of a fixed basis instead of spatial patches: each token is one spectral mode, and the sequence length is chosen rather than implied by resolution.
- Example bases. Empirical (principal components), harmonic (cosine and Fourier) and graphical (graph Laplacian eigenvectors). Any ordered basis may be admitted, with learned rank weights and positional embeddings by mode.
- Limited data. At the smallest training sizes the spectral ViT leads on brain MRI sex (IXI), age (HCP-Aging) and neurostimulation response, all six MedMNIST3D cohorts, MNIST, aligned faces (LFW), simulated patterns and ModelNet40 shapes; a block extension leads or matches patch tokens on CIFAR-10 and CIFAR-100.
The spectral ViT against a spatial ViT: the two differ only in the projection, which is fixed for spectral tokens. Tinted cells carry learned weights.
Scripts read their data locations from the environment (see paths.py); results are written to results/.
export SPECTRALVIT_DATA=/path/to/data # datasets and caches (default: data/ in this repository)
export SPECTRALVIT_RAW=/path/to/bids # original cohorts in BIDS layout (default: $SPECTRALVIT_DATA/raw)
export ADNI_ROOT=/path/to/ADNI3 # demo.ipynb only: ADNI3 in BIDS layout
export ADNI_WORK=/path/to/derivatives/ADNI # demo.ipynb only: registered volumes, SynthSeg outputs, figure
MNIST, CIFAR-10 and CIFAR-100, LFW, MedMNIST3D, ModelNet40 and IXI are public. HCP-Aging and ADNI require their data use agreements. The neurostimulation cohort is protected clinical data and is not released.
git clone https://github.com/agr78/SpectralViT.git
cd SpectralViT
conda env create -f spectralViT.yml
conda activate spectralViT
Alternatively, pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu128.
Each experiment has a sweep script that trains every model by training-set size and a builder that turns its results into the paper's table or figure.
If this code is used, please cite the following:
arXiv:2605.12026: A. G. Roberts et al., Spectral Vision Transformer for Efficient Tokenization with Limited Data, 2026.
@article{roberts2026spectralViT,
title={Spectral Vision Transformer for Efficient Tokenization with Limited Data},
author={Alexandra G. Roberts and Maneesh John and Jinwei Zhang and Dominick Romano and Mert {\c{S}}i{\c{s}}man and Ki Sueng Choi and Heejong Kim and Mert R. Sabuncu and Thanh D. Nguyen and Alexey V. Dimov and Pascal Spincemaille and Brian H. Kopell and Yi Wang},
year={2026},
eprint={2605.12026},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2605.12026},
}Please direct questions to Alexandra G. Roberts at agr78@cornell.edu.

