Not All Dimensions Are Equal: Outlier-Aware Attention Linearization with Grouped Quadratic Kernels
Weiqi Sun, Qianyue Wu, Wenjia Wang, Tianyang Hu
Abstract
Linearizing softmax attention offers a route to efficient Transformer inference, but preserving pretrained attention remains challenging. We identify an important source of approximation error overlooked by standard linearization methods: a small number of outlier dimensions contribute disproportionately to query-key dot products and account for a large fraction of the approximation error. Motivated by this heterogeneity, we propose Outlier-Aware Attention Linearization (OAL), a dimension-aware method for constructing quadratic attention approximations. Starting from a second-order Taylor approximation, we introduce a Hadamard-product formulation that makes individual query-key contributions explicit. This formulation relaxes globally shared coefficients to support dimension-specific linear terms and cross-dimensional quadratic interactions while preserving separable evaluation. To retain this flexibility with fewer parameters, OAL groups dimensions with similar contribution scales to share coefficients, while allowing distinct treatment of the few outliers. The resulting positive quadratic kernel is calibrated against pretrained attention outputs and admits linear-time evaluation with respect to sequence length for fixed head dimensions. On Qwen2.5-0.5B, OAL reduces frozen-attention output relative MSE by approximately 8.9% compared with DiJiang. Replacing middle-layer attention modules and jointly fine-tuning the kernel coefficients with LoRA further lowers WikiText-103 perplexity from 31.71 to 27.50 compared with a learned global quadratic, while improving accuracy on PIQA, HellaSwag, and ARC-E. These results demonstrate the value of outlier-aware dimension grouping for both attention approximation and pretrained-model conversion. The code is available at https://github.com/wuqianyue09/OAL
Create a lesson
Related papers
Hitting-Time Bounds for Asynchronous Q-Learning
Yang Peng
Finite-Sample Guarantees for Fully Discrete Conditional Diffusion Models
Qiuyun Zhu
Constrained Probabilistic Numerics: Gaussian Process Solvers for Linear PDEs under Linear Inequality Constraints
Boyuan Deng, Kshitiz Upadhyay, Michael Shields
From Pixels to Privacy-Sensitive Features: An Information-Theoretic Framework for Reconstruction Bounds
Henry Bourne, Robert F. Allison
How Well Do Prior-Data Fitted Networks Amortize Bayesian Inference?
Manuel Hülskamp, Julius Kobialka, Emanuel Sommer et al.
Scalable Sparse Autoregressive Variational Inference for Non-Gaussian Spatial Fields
Paul F. V. Wiemann, Matthias Katzfuss