arXiv:2610.13674stat.MLOct 2026

Manuscript Offprint

arXiv:2610.13674

Not All Dimensions Are Equal: Outlier-Aware Attention Linearization with Grouped Quadratic Kernels

Weiqi Sun, Qianyue Wu, Wenjia Wang, Tianyang Hu

Weiqi Sun ∗1^{*1}, Qianyue Wu ∗2^{*2}, Wenjia Wang †3^{\dagger3} and Tianyang Hu ‡1^{\ddagger1}

1^{1}The Chinese University of Hong Kong, Shenzhen, 2^{2}Beijing Normal University, Zhuhai, 3^{3}National University of Singapore

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 GitHub.

1. Introduction

Softmax attention is central to modern Transformers, but computing all pairwise token interactions incurs quadratic computation as context length grows (Vaswani et al., 2017). Linear attention offers an alternative: separable query and key features permit recurrent evaluation with linear sequence-length complexity for a fixed feature dimension (Katharopoulos et al., 2020). Approximating softmax attention in pretrained Transformers with linear attention therefore offers a promising route to improving inference efficiency while reusing pretrained representations. Realizing this potential, however, requires approximations that closely preserve the original attention behavior, particularly when only limited adaptation is available to compensate for approximation errors.

Existing methods approximate the softmax kernel using feature maps that separate query and key computations, or low-order polynomials that admit efficient evaluation (Choromanski et al., 2021; Nguyen et al., 2026; Chen et al., 2024b; Nauen et al., 2024). To better preserve pretrained attention, these approximations can also be learned or adapted to match the original model's attention behavior (Chowdhury et al., 2022; Zhang et al., 2025; Lan et al., 2025). Despite these advances,

∗^{*}These authors contributed equally to this work.

†^{\dagger}Corresponding author: wenjiawang@nus.edu.sg

∗^{*}Corresponding author: hutianyang@cuhk.edu.cn approximation errors are still to be desired under the limited-adaptation setting. To better understand the remaining approximation error, we examine how it relates to the contributions of individual query-key dimensions.

Our analysis reveals that a small subset of query-key dimensions contributes disproportionately to attention logits (Section 3). Diagnostic experiments further show that approximating these dimensions alone can induce substantial attention-output error. This suggests that the approximation should have sufficient flexibility to accommodate differences in dimension-wise contributions. The representative approaches discussed above generally formulate their approximations through vector-level feature mappings or functions of the aggregated query-key score. Their parameterization, however, is not explicitly organized around the unequal contributions of individual query-key dimensions. Our findings motivate making these contributions explicit and using their statistics to guide the approximation, so that outlier dimensions can be treated differently from the remaining dimensions.

Therefore, we propose Outlier-Aware Attention Linearization (OAL), which explicitly adapts the approximation to dimension-wise heterogeneity in pretrained attention. We use a quadratic kernel as a tractable starting point for introducing dimension-specific parameters while retaining separable evaluation. To enable dimension-wise treatment, we introduce a Hadamard-product formulation that makes individual query-key contributions explicit. This formulation generalizes the globally shared coefficients in a quadratic approximation to dimension-specific linear coefficients and coefficients for cross-dimensional quadratic interactions. It thereby allows different dimensions to be approximated differently while preserving the separable structure required for linear-time evaluation.

A fully dimension-specific parameterization, however, introduces many coefficients. The empirical distribution of dimension-wise contributions suggests that much of this flexibility can be shared. This observation motivates grouping dimensions with similar contributions and sharing coefficients within groups and across corresponding group pairs. The resulting parameterization accommodates outlier dimensions while keeping the number of learned coefficients small. With the groups fixed, we calibrate the resulting positive quadratic kernel against pretrained softmax attention outputs using frozen queries, keys, and values.

On frozen Qwen2.5-0.5B attention states, OAL achieves the lowest error among the evaluated methods, reducing attention-output relative MSE by approximately 8.9% compared with DiJiang (Chen et al., 2024b). Under a common middle-layer attention replacement protocol with matched LoRA adaptation (Hu et al., 2022), OAL outperforms the evaluated converted methods on WikiText-103 perplexity and all three downstream tasks on both Qwen2.5-0.5B and Llama-3.2-1B (Llama Team, 2024). Relative to the learned global quadratic, it lowers Qwen2.5-0.5B perplexity from 31.71 to 27.50, although a gap to the LoRA-adapted softmax reference remains on both backbones. OAL also requires only O(N)O(N) attention computation for a sequence of length N and fixed head dimensions, without explicitly constructing the N×NN \times N attention matrix.

Our contributions are threefold:

• We characterize dimension-wise heterogeneity in pretrained query-key interactions and its association with attention approximation error, motivating contribution-aware kernel design.

• We develop a dimension-aware quadratic formulation with separable evaluation, and introduce contribution-based grouping to retain this flexibility with a compact parameterization.

• We demonstrate improved frozen-attention fidelity and adapted model quality under a matched conversion protocol, and examine the role of group-aware flexibility through a diagnostic budget study.

References (75)