FFTSparse: Relative-Position Correlation Guided Sparse Attention for Long-Context Language Models
Zemin Chao ⋅ Cen Jianhe ⋅ Qianhui Xu ⋅ Guangzhi Ge ⋅ Zhixin Qi ⋅ Hongzhi Wang
Abstract
The quadratic cost of attention limits the efficiency of long-context language model prefilling. We observe that attention logits in the evaluated models often exhibit diagonal stripes: query--key pairs separated by particular relative distances have consistently high correlation. We introduce FFTSparse, a training-free hybrid block-sparse attention framework that exploits this structure. FFTSparse formulates dominant-lag extraction as cross-correlation and computes it using the Fast Fourier Transform in $O(DN\log N)$ time per head, where $N$ is the number of blocks and $D$ is the head dimension. A sampled head classifier routes diagonal-dominant heads to lag-based masks and diffuse heads to block-affinity masks, with structural priors preserving local and boundary interactions. The complete mask-construction pipeline also includes quadratic block-level mask writes and affinity scoring. Evaluations on Llama-3.1-8B-Instruct and Qwen2.5-7B-Instruct demonstrate a competitive accuracy--efficiency trade-off on LongBench. Direct measurements across all 32 layers of Llama-3.1-8B-Instruct yield up to an $8.37\times$ attention-module speedup at 128K tokens with a correlation threshold of $0.90$. These results support frequency-domain lag extraction as an efficient way to select structured long-range interactions.
Successful Page Load