Manuscript Offprint

arXiv:2610.34971

SVD-Attention: Efficiently Analyzing Attention Blocks in Transformers

Debopam Sanyal, Hongjie Chen, Riya Elizabeth Kuriyan, Arth Tak, Divya Kothandaraman, Akshay Mehra, Joshua Kimball, Alexey Tumanov

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Pretrained transformers spend a large share of their inference compute inside self-attention, yet the per-head query-key interaction is structurally low-rank by construction. We ask a diagnostic question: across layers and architectures, which heads actually use the full rank budget on real data, and which do not? We propose SVD-Attention, a post-hoc method that decomposes the per-head interaction matrix MhM_h and scores every singular mode by both its spectral magnitude and its activation variance across tokens on a small calibration set. The score keeps the modes the head can amplify and that real data actually activates, and discards the rest; the resulting factorization is exact for the retained modes and needs no finetuning. Across seven pretrained models and five task types, the diagnostic finds a task-dependent pattern: redundancy sits in the early to middle layers for sentiment and image classification and for generation, and in the late layers for dense prediction and extractive question answering. It is also predictive: truncating the layers it flags costs at most 1.75 F1, while truncating the same number of layers elsewhere in the same model costs up to 50 F1. SVD-Attention is an analysis tool rather than a compression method: acting on it reduces inference FLOPs by 0.8-1.5% on its own and by 8-11% when composed with weight pruning, with 0-4% change in task quality.

1 Introduction

Multi-head self-attention is the central building block of modern transformers, and a long line of work has sought to reduce its cost by changing the attention pattern (Beltagy et al., 2020; Liu et al., 2021), approximating the softmax kernel (Wang et al., 2020a; Choromanski et al., 2020; Meng et al., 2025; Fan et al., 2025), or removing redundancy from pretrained projection weights after training (Yuan et al., 2023; Wang et al., 2025; Sanyal et al., 2026). We follow this third direction. Existing post-hoc methods decompose Wq,hW_{q,h} and Wk,hW_{k,h} independently, which leaves their product, the object the softmax actually consumes, unconstrained. We instead decompose the per-head interaction matrix Mh=Wq,hWk,h⊤M_h = W_{q,h} W_{k,h}^\top directly. MhM_h has rank at most dhd_h, so the head has algebraic room for many directions but uses far fewer in practice: a singular direction only affects the head's output if real input tokens vary along it, and otherwise contributes a constant offset that softmax absorbs. We outline our method in Fig. 1.

We therefore score each mode of MhM_h by the product of its singular value and the geometric mean of its query- and key-side activation variances on a small calibration set. Keeping the smallest set of modes that captures a (1−ϵ)(1-\epsilon) fraction of that importance gives an exact rank- rhr_h factorization with no finetuning. We use this diagnostic to ask three questions. First, does adding data to the score change which modes look important compared to ranking by singular value alone (RQ1)? Second, where in a pretrained transformer does the diagnostic find the most redundancy, and does the pattern depend on the task (RQ2)? Third, is the diagnostic predictive: when we remove the modes it flags, does performance hold up where the score is low and drop where it is high (RQ3)?

We run the diagnostic on seven pretrained transformers spanning language understanding (DistilBERT), extractive question answering (RoBERTa-base, MiniLM), generation (Llama-2-7B), vision classification (ViT, Swin), and dense prediction (DPT-Large). Redundancy sits in the early to middle layers for sentiment and image classification and for generation, and in the late layers for dense prediction and extractive question answering. Acting on the diagnostic reduces inference FLOPs by 0.8-1.5% on its own; composing it with weight pruning (Sun et al., 2024) raises the reduction to 8-11%, with task quality within 0-4% of baseline and no gradient updates. In the flagged layers more than half of the average head’s rank budget can be discarded for 0.16 F1 (RoBERTa-base on SQuAD 2.0), and the same diagnostic predicts where truncation instead fails.