A Dual-Domain Vision Transformer with Spectral Positional Bias
Abdulaziz Al Shamsi ⋅ Abdulla Alghfeli ⋅ Chenghua Lin ⋅ Hujun Yin
Abstract
Positional encoding in Vision Transformers presents a recurring trade-off: spatial relative-position tables (Swin) carry thousands of parameters per block and require ad-hoc interpolation to transfer across resolutions, while no-bias designs leave the attention logits geometry-agnostic. We propose a relative positional bias parameterized directly in the spatial frequency domain. This parameterization yields three benefits over the standard spatial-table position encoding: (i) it expresses the same translation-equivariant bias with $3.25\times$ fewer parameters than Swin's spatial table at the same head count; (ii) it admits a closed-form, structurally exact transfer to a different patch grid (zero-padding to a finer grid, anti-aliased truncation to a coarser one), in contrast to interpolation of spatial tables, which replaces the learned kernel with a smoothed approximation; and (iii) it shares its parameterization with a frequency-domain spectral mixer, so that one transfer rule moves the positional bias and the token mixer together. We demonstrate the bias inside our Dual-Domain Residual (DDR) framework, in which a spectral mixer and a gated attention head act as parallel residuals within each block. In recipe-controlled comparisons at Tiny scale, the frequency-domain bias (SCQB) outperforms a Swin-style spatial table, with $3.25\times$ fewer bias parameters, by $+1.98$ pp, and a no-bias baseline by $+2.74$ pp; removing the entire attention branch (which carries the bias) drops accuracy by $5.35$ pp, while removing the spectral branch drops it by $2.22$ pp. At Small scale SCQB ties the spatial table and both exceed no bias, and a parameter-free 2D-RoPE arm ties SCQB at Tiny but loses 7.3 to 11.6 pp more at $384^2$ and $448^2$. Across Tiny, Small and Base, DDR's ImageNet-1K accuracy is consistent with published spectral hybrids (78.9% at 10.7M, 82.5% at 63.1M), though recipe differences prevent a strict comparison. The learned per-layer gates concentrate spectral processing in early blocks and attention in late blocks, qualitatively matching the schedules that are hand-coded in the previous hybrid models.
Successful Page Load