NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Dual-Domain Vision Transformer with Spectral Positional Bias

Abdulaziz Alshamsi, Abdulla Alghfeli, Chenghua Lin, Hujun YinNeurIPS 2026

TL;DR

Vision Transformers are naturally "space-blind," and teaching them where image patches live usually requires clunky spatial lookup tables that break down when image resolutions change. This paper flips positional encoding into the frequency domain using Fourier coefficients—shrinking the parameter cost by $3.25\times$ and allowing mathematically exact transfers across resolutions without ad-hoc smoothing. Paired with a parallel, self-gating hybrid architecture, the network organically discovers the exact coarse-to-fine processing schedule that engineers previously had to hand-code.

What Problem Does This Paper Address?

To a standard Vision Transformer (ViT), an image is just an unordered bag of patches; shuffle them like puzzle pieces, and pure self-attention won’t notice. To inject geometry, popular models like Swin use spatial relative-position tables—storing a learned scalar for every possible pixel-patch displacement.

While effective, these lookup tables are discrete and rigid. They burn thousands of parameters per block, ignore the naturally smooth statistics of real-world images, and lack a clean mathematical rule for resolution changes. If you train at $224\times224$ and test at $384\times384$, you have to stretch the table via ad-hoc bilinear interpolation, smoothing away learned structure.

Meanwhile, hybrid models that mix cheap Fourier-based token mixing with expensive self-attention face two awkward design seams: architects must manually hard-code which layers use spectral mixing versus attention, and they still bolt spatial lookup tables onto frequency-domain mixers, straddling two incompatible mathematical worlds.

Methods

The authors unify token mixing and positional encoding inside a Dual-Domain Residual (DDR) block, introducing two main innovations alongside standard modern transformer components (RMSNorm, QK-Norm, and SwiGLU FFNs):

Figure 1: DDR block. Three residual branches: a spectral filter (left, blue) at O(N log N) cost, a self-attention head with SCQB position bias (center, orange) gated by a per-layer sigmoid σ(αℓ), and a SwiGLU FFN (right, purple). The spectral branch is ungated; the attention branch carries the gate. The SCQB module (red inset) learns h×14×8 complex Fourier coefficients, recovers a 14×14 spatial kernel through irfft2, and assembles the N×N bias by circulant displacement indexing: 896 parameters per block versus 2,916 for Swin RelPos (num_heads=4). The block is repeated L times (L=12 or 19).
  1. Spectral-Conditioned QK Bias (SCQB): Instead of a spatial table, relative positional bias is parameterized directly in the 2D frequency domain. Each attention head learns a compact set of complex Fourier coefficients ($14\times8$ per head for a $14\times14$ patch grid). During the forward pass, an inverse 2D Fast Fourier Transform (irfft2) recovers a smooth spatial kernel, which is indexed circularly (treating the grid like a discrete torus) to build the $N\times N$ attention bias matrix. To scale up to finer grids at test time, you simply zero-pad the Fourier coefficients; to scale down, you truncate them.
  2. Learned Continuous Gating: Rather than forcing a layer to be either spectral or attention, every DDR block runs an ungated 2D FFT spectral mixer (for cheap $\mathcal{O}(N \log N)$ global context), followed by a gated self-attention branch (carrying SCQB), and finally an FFN. A single learned scalar gate $\sigma(\alpha_\ell) \in (0, 1)$ per layer scales the attention branch, letting gradient descent decide where attention is actually worth its weight.

Datasets

All main models and controlled ablations are trained from scratch and evaluated on ImageNet-1K (1.28M training images, 50K validation images across 1,000 classes), alongside multi-resolution zero-shot evaluations ranging from $128^2$ to $448^2$. The authors also use ImageNet-100 for a targeted experiment comparing learned gating against frozen, hand-coded schedules. No new benchmark datasets are introduced.

Key Insights and Ideas

  • Frequency is a natural substrate for vision geometry: Parameterizing positional bias in Fourier space gives you translation equivariance and bandlimited spatial smoothness for free. Plus, because the spectral mixer and SCQB live in the same domain, a single closed-form rule transfers both when image resolution or patch size changes.
  • Nature finds the schedule on its own: Prior hybrids like SpectFormer manually hard-code spectral layers at the front of the network and attention at the back. Left to learn continuous gates from scratch, DDR spontaneously converges to this exact pattern—keeping gates lower in layers 0–2 ($\approx 0.58\text{–}0.80$) so spectral mixing dominates early, and saturating gates ($\ge 0.93$) from layer 3 onward for late-stage content-adaptive attention.
  • Parameter-free RoPE is brittle under big upscaling: While axial 2D-RoPE matches SCQB at the native $224^2$ training resolution without using any bias parameters, its native extension degrades sharply on larger grids—losing 7.3 to 11.6 percentage points (pp) more accuracy than learned biases at $384^2$ and $448^2$.

Key Results

  • Controlled Bias Ablations (Tiny Scale, 10.7M params): Inside the exact same backbone and training recipe, SCQB achieves 78.88% top-1 accuracy—beating a no-bias baseline by +2.74 pp and a Swin-style spatial table by +1.98 pp, while using $3.25\times$ fewer bias parameters (896 vs. 2,916 reals per block).
  • Capacity Dependence: Repeating the controlled test at Small scale (23.1M params), SCQB (81.2%) and Swin RelPos (81.3%) effectively tie, showing that SCQB's accuracy edge over spatial tables narrows as model capacity grows, though the $3.25\times$ parameter savings and exact transfer remain.
  • Branch Contributions & Scaling: Removing the spectral branch drops Tiny accuracy by 2.22 pp; removing the attention+SCQB branch drops it by 5.35 pp. Across scales on ImageNet-1K, DDR reaches 78.9% (Tiny, 10.7M), 82.3% (Small-Deep, 36.1M), and 82.5% (Base-Deep, 63.1M).
  • Inference Overhead: Because SCQB depends only on learned weights, the $N\times N$ bias matrix can be precomputed once at model load. Using a fused SDPA kernel, adding SCQB costs just 1.9–2.0% in end-to-end throughput at $224^2$.

Limitations and Future Work

The authors are admirably candid about the trade-offs:

  • Wall-clock FFT bottleneck: While SCQB itself is cheap, the 2D FFT spectral branch cuts wall-clock throughput by roughly $3\times$ compared to a plain ViT of similar size, and stock FlashAttention-2 cannot natively fuse arbitrary additive biases like SCQB.
  • Exact transfer $\neq$ guaranteed accuracy win: While zero-padding is structurally exact, at moderate upscaling ($288^2\text{–}320^2$) it actually trails simple bilinear smoothing of the kernel by 1.0–1.7 pp, and unconstrained tables hold up better when downscaling to $128^2$.
  • Fading absolute position: Because both mixing branches are translation-equivariant, absolute position (injected only once at the input) washes out across depth (a linear probe's $R^2$ drops from $0.74$ to $0.04$).

Future directions include re-injecting absolute position at every layer, making the scalar gates input-dependent rather than static at inference, writing custom fused GPU kernels for SCQB, and testing the resolution-transfer rules on dense prediction tasks like detection and segmentation.

Summary updated

BibTeX
@inproceedings{alshamsi2026dual,
  author = {Abdulaziz Alshamsi and Abdulla Alghfeli and Chenghua Lin and Hujun Yin},
  title = {{A Dual-Domain Vision Transformer with Spectral Positional Bias}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=c4AamFDDmb},
}
Figure