Spectral-Window Hybrid (SWH)
Vladimer Khasia
TL;DR
The paper tackles the quadratic scaling of global self-attention in Transformers for long-context sequence modeling. It introduces Spectral-Window Hybrid (SWH), a parallel architecture that runs a global spectral convolution and a local chunked sliding-window attention, then fuses their outputs to maintain short-context accuracy while enabling long-context scalability. The global branch uses a learnable damped harmonic oscillator kernel implemented via FFT to achieve $O(T \log T)$ time, while the local branch employs RoPE and chunked attention with a 2W receptive field. Experiments on synthetic tasks and the FineWeb-Edu corpus show that SWH matches Transformer perplexity on short contexts, provides superior length generalization, and scales linearly in latency and memory for long sequences, highlighting its practical value for long-context language modeling; code is available at the provided GitHub link.
Abstract
Scaling sequence modeling to extreme contexts requires balancing computational efficiency with representational expressivity. While Transformers provide precise retrieval via the attention mechanism, their quadratic $\mathcal{O}(T^2)$ complexity limits their application to long-horizon tasks. In this work, we propose the \textbf{Spectral-Window Hybrid (SWH)}, an architecture that decouples sequence modeling into two \textit{parallel} streams: a global branch utilizing the Convolution Theorem to model long-range decay dynamics in $\mathcal{O}(T \log T)$ time, and a local branch employing sliding-window attention for token interactions within a bounded context. By aggregating these representations, SWH avoids the computational bottleneck of global attention while retaining local precision. We demonstrate that SWH matches the perplexity of standard Transformers on short contexts while enabling efficient linear scaling to extended sequences. The code is available at https://github.com/VladimerKhasia/SWH
