QASparse: Query-Adaptive Sparse Attention with Tailored Budgets and Tokens
Zhiyuan Chen, Zihao Yang, Quanjiang Li, Haijiang Li, Jiancheng Pan, Qichao Zhao, Zihan Dong, Qiushi Shi, Jinshi Liu
Abstract
Long-sequence inference in large language models is constrained by the high cost of prefilling, where dense attention scales quadratically with context length. Exploiting similarity across attention heads offers a way to reduce redundant computation. Prior approaches in this direction have relied on localized query observations to determine head-level computation reuse or budget allocation. However, inter-head similarity does not imply uniform query requirements, leaving adaptation to varying budget needs and selection preferences across query regions a key challenge. We introduce QASparse, a Query-Adaptive Sparse attention mechanism with hardware-efficient execution. QASparse preserves the efficiency of shared cross-head importance estimation while adapting computational budgets and token selections to query requirements, and it executes these dynamic sparse decisions through dedicated kernels. Its query adaptivity stems from two complementary innovations: Local Budget Regression models local variations in computational demand along query positions to estimate budgets for different query regions and attention heads; Boundary Voting lets queries within each head vote over candidates near the selection cutoff using actual query/key scores, refining the retained set while preserving the initial selection size. To reduce the execution overhead of dynamic budgets, we further design length-specialized selection kernels that efficiently support query-adaptive sparse patterns across context lengths. Together, these designs efficiently combine shared estimation with local decisions while adapting both how much attention is computed and which interactions are retained. Experimental results demonstrate improved benchmark scores and faster prefill attention computation compared with existing sparse attention baselines.
Create a lesson
Related papers
RefineKV: Query-Adaptive KV Cache Compression via Attention-Error Bounds
Shared title terminology · Kewei Lian, Jiayi Zhai, Anji Liu
DisSparse: Pipelined Top-p Sparse Attention for Long-Context LLM Serving
Shared title terminology · Nurlan Nazaraliyev, Elaheh Sadredini, Nael Abu-Ghazaleh
Learning Acceptable Lotteries via Queries: Minimizing Aggregated Violation Distances
Shared title terminology · Nicholas Teh, Paul W. Goldberg
Adaptation or Poisoning? Security Risks of Conversational Test-Time Learning in Large Language Models
Shared title terminology · Honghao Feng, Shanhan Qu, Kai Tong et al.
Hybrid state-space and attention neural operators for nonlinear structural dynamics under environmental loading
Shared title terminology · Anastasios Stamou, Rui Teixeira, Maria Nogal et al.
On Adaptive Step Sizes for Eligibility Traces in Deep Reinforcement Learning
Shared title terminology · Esraa Elelimy, Martha White