Recall Before You Rank: Similarity-Guided Top- Reuse for Efficient Long-Context Attention
Wenshuai Yao, Wenyong Zhou, Hanyong Shao, Yizhe Chen, Zhiyuan Ning, Yuannuo Feng, Ru Huang, Kechao Tang
Abstract
Top- sparse attention reduces the cost of Softmax and value aggregation by attending to only a small subset of key--value (KV) entries. However, identifying this subset still requires scoring the current query against the full KV cache and performing global Top- selection, leaving selector cost linear in context length and limiting the practical efficiency of sparse attention for long-context decoding. In this paper, we introduce ReTopK, a training-free method that accelerates dynamic Top- attention by reusing historical retrieval decisions. ReTopK builds on the observation that similar queries often attend to overlapping supports and that partially overlapping supports can still preserve most of the Exact Top- attention mass. For each attention head, it maintains a bounded cache of historical query--support pairs, retrieves the most similar cached queries for each new query, unions their stored supports with a recent window, and reranks only the resulting compact candidate set using exact current-query scores. A similarity-based fallback invokes full-history Exact Top- when reuse is unreliable, while periodic exact refreshes limit cache drift. ReTopK retains the complete KV cache and reuses only selected indices, rather than historical scores, attention weights, or outputs. Across 16K--128K contexts, ReTopK achieves the lowest PG19 perplexity and the highest NIAH and LongBench scores among the evaluated approximate methods. At 128K with , ReTopK incurs only a 0.50\% perplexity increase over Exact Top- while accelerating attention computation by .
Create a lesson
Metadata
- Categories
- cs.CL, cs.LG
- Comments
- 9 pages, 9 figures, and 5 tables
Related papers
DFly2: Turbocharging Long-Context Speculative Decoding by Sharing the Target's Sparsity
Shared title terminologycs.CLHong Liu, Rui Cen, Junhan Shi et al.
S^4R: Selective Sampling, Subspaces, and Sparse Reconstruction for Compressed Long-Context KV Caching
Shared title terminologycs.CLJialong Han, You Wu, Kewei Tu
SeDeM: Selective Decompression of Hidden-State Memories for Long-Context Question Answering
Shared title terminologycs.CLMaryam Haghifam, Jason Cong, Yizhou Sun
DenseOn with the LateOn: Fully Open Dense and Late-Interaction Models for Multilingual, Long-Context, and Code Search
Shared title terminologycs.CLRaphaël Sourty, Antoine Chaffin, Paulo Roberto Moura Junior et al.
Copy Less, Ground More: Overcoming Repetitive Copying in Long-Context Reasoning via Evidence-Aware Reinforcement Learning
Shared title terminologycs.CLLizhe Fang, Weizhou Shen, Tianyi Tang et al.
Mergeable Model-Side Aggregation States for Long-Context Language Models
Shared title terminologycs.CLDachuan Song, Junyu Yin, Zechen Hu et al.