Manuscript Offprint

arXiv:2610.10871

Sparse Attention Is Matrix Approximation, Not Choosing from a Bag of Values

Fang Wan, Xufeng Liu, Fan Li, Yi Liu

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

ABSTRACT

Large Language Models (LLMs) achieve strong performance across many domains, but their efficiency is limited by the quadratic cost of attention with respect to prompt length. Sparse attention reduces this cost by retaining only a small fraction of query-key interactions to approximate the full attention matrix. However, existing methods are trapped in a mathematically wrong view: they simply keep large scalar entries or high-mass regions of the attention matrix. This treats the attention matrix as a bag of values, ignoring that it is used as a structured matrix whose entries jointly determine the attention output through multiplication with value vectors. We argue that this is the core conceptual issue: sparse attention should be formulated as matrix approximation, not as blindly choosing the largest values from a bag of entries. Based on this view, we propose Matrix Approximation Sparse Attention (MASA). MASA replaces raw attention-mass ranking with a closed-form score that measures how much each sparse unit reduces matrix-product approximation error. As a theory-grounded plug-in correction, MASA can be added to existing sparse attention frameworks without changing their sparse kernels or budgets. Extensive experiments across multiple sparse attention methods, benchmarks, and LLM backbones show consistent accuracy gains, supporting both MASA and the matrix-approximation view of sparse attention.

1 INTRODUCTION

Large Language Models (LLMs) have achieved strong performance across a wide range of applications, from natural language processing (Radford et al., 2018) to mathematical reasoning (Ahn et al., 2024), multimodal tasks (Team et al., 2023), and scientific discovery (Zhang et al., 2025b). However, efficiency remains a central challenge for LLMs (Bai et al., 2024a). As tasks become more complex and prompts become more structured, the input length continues to grow rapidly (Liu et al., 2025). Since attention computation has quadratic complexity with respect to the prompt length (Vaswani et al., 2017), attention becomes a major bottleneck for efficient long-context inference.

Sparse attention is a natural way to reduce this cost while keeping the main modeling benefit of attention. Prior work has observed that attention matrices often contain sparse and structured patterns (Jiang et al., 2024a), suggesting that only a small fraction of query-key interactions is needed to approximate full attention. Based on this observation, many methods select a sparse subset of the attention matrix under a compute budget. Early approaches use fixed or predefined patterns: Sliding Window Attention (Jiang et al., 2023a) restricts each query to a local context window, while MInference (Jiang et al., 2024a) approximates attention using vertical lines, slash lines, and blocks. Other methods make the selection input-aware: SeerAttention (Gao et al., 2025) learns to predict block-sparse attention patterns, and Quest (Tang et al., 2024) retrieves query-aware key pages. More recent methods further adapt the sparse budget, such as FlexPrefill (Lai et al., 2025), which decides when to stop selecting additional sparse units, and Tactic (Zhu et al., 2025), which adjusts the budget through clustering and distribution fitting. Despite these different designs, the final selection rule remains ultimately magnitude-driven: sparse attention methods keep large scalar entries or high-mass regions of the attention matrix.

This selection principle has a mathematical mismatch. As illustrated in Fig. 1, a candidate with much larger mass can preserve the matrix product substantially worse under the same sparse budget. Magnitude-based selection treats the attention matrix as a bag of scalar values, whereas Transformers use it as a structured matrix acting on value vectors through matrix multiplication (Vaswani et al., 2017). Therefore, the right question is not which entries of the attention matrix are largest, but which

∗^{*}Correspondence to yi.liu.4@stonybrook.edu selected entries best preserve the matrix product that produces the attention output. In other words, sparse attention should be formulated as matrix approximation, not as blindly choosing the largest values from a bag of entries.

Based on this view, we propose Matrix Approximation Sparse Attention (MASA), a theory-grounded plug-in correction for sparse attention. MASA keeps the sparse units, kernels, and budgets of existing sparse attention methods, but replaces their raw attention-mass ranking with a closed-form score derived from matrix-product approximation error. This changes the selection target from preserving large entries of the attention matrix to preserving the matrix action that determines the attention output. As a result, MASA can be added to diverse sparse attention frameworks without changing their implementation interface.

In this work, our contributions are summarized as follows:

• Theory. We identify a long-standing selection mismatch in sparse attention: existing magnitude-based rules approximate the attention matrix entrywise, while the Transformer uses attention through matrix multiplication. We provide a matrix-approximation view that gives the correct selection objective.

• Method. We propose MASA, a theory-grounded plug-in scoring method that ranks sparse units by their closed-form reduction in matrix-product approximation error. MASA can be integrated into existing sparse attention baselines while keeping their sparse kernels and budgets unchanged.

• Experiments. We evaluate MASA across multiple sparse attention methods, benchmarks, and LLM backbones. Under matched settings with the original baselines, MASA gives consistent accuracy gains, supporting both the proposed method and the matrix-approximation view of sparse attention.

Largest entries can be the wrong sparse units

Same one-column budget: entry magnitude vs. matrix-product preservation.

(a) A valid counterexample

keep 1 column in A (50% sparsity)

A=[u1u20.990.010.980.02]×[x100.1x2100200]=[12.124.1]\mathrm{A}=\begin{bmatrix}{{{u_{1}}}}&{{{u_{2}}}} \\{{{0.99}}}&{{{0.01}}} \\{{{0.98}}}&{{{0.02}}}\end{bmatrix}\times\begin{bmatrix}{{{x_{1}}}} \\{{{0}}}&{{{0.1}}} \\{{{x_{2}}}} \\{{{100}}}&{{{200}}}\end{bmatrix}=\begin{bmatrix}{{{1}}}&{{{2.1}}} \\{{{2}}}&{{{4.1}}}\end{bmatrix}

mass( u1u_{1}) = 1.97

mass( u2u_{2}) = 0.03

u1u_{1} has 66×66 \times more mass, yet contributes almost nothing to AX.

(b) Conventional mass-based ranking

Pick the column

with the largest

entries

1.97 > 0.03 → keep u1u_{1}

selected matrix product ≈0\approx 0

0 0.099

0 0.098

relative error

98%

(c) MASA: matrix approximation

Pick the column

that best

preserves AX

u2u_{2} nearly reproduces AX→AX \rightarrow keep u2u_{2}

selected matrix product ≈AX\approx AX

1 2

2 4

relative error

3%

Magnitude ranks A. MASA ranks what preserves AX.

Figure 1: A minimal two-column counterexample. Under the same one-column budget, conventional mass-based ranking selects u1u_{1}, whose mass is 66×66 \times larger but incurs 98% relative matrix-product error. MASA selects u2u_{2} and reduces the error to 3%. Here, X is an illustrative probe matrix.

References (48)