Skip to content

Recall Before You Rank: Similarity-Guided Top-K Reuse for Efficient Long-Context Attention

Jul 2026 · arXiv.org · Vol abs/2607.27692 · 0 citations · 22 references
Computer Science

TL;DR

ReTopK is a training-free method that accelerates dynamic Top-$K$ attention by reusing historical retrieval decisions and retains the complete KV cache and reuses only selected indices, rather than historical scores, attention weights, or outputs.

Abstract

Top-$K$ 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-$K$ 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-$K$ 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-$K$ 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-$K$ 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 $K=512$, ReTopK incurs only a 0.50\% perplexity increase over Exact Top-$K$ while accelerating attention computation by $3.07\times$.

View source

Similar papers

Preprint Sep 2026

Top-K Is Not a Budget for Hybrid Retrieval

Modern hybrid retrieval for RAG typically fuses the Top-$L$ results from dense and sparse retrievers, but a fixed truncation depth may not transfer across changing queries and corpora. Exact fusion removes the dependence on a fixed depth, yet completing a specified Top-$K$ still incurs variable access costs. We present...

Chunran Zhang · 0 citations
Review Sep 2026

Sample-Guided Exact Top-K Selection for Long-Context Sparse Attention

HPC-Ops Top-K is presented, a sample-guided exact selector for ragged sparse-attention score rows that outperforms the fastest verified external exact baseline and outperforms the fastest verified external exact baseline on indexer scores from Hy4-Preview.

Si-Ran Liu, Ya-Long Xue, Theo Tang et al. · 0 citations
Preprint Sep 2026

BoundaryMORPH: Budgeted Reranking via Active Set Selection for Diffuse Retrieval

Open-ended queries in modern Retrieval-Augmented Generation (RAG) are increasingly"diffuse,"requiring a large set of documents to be assembled into a finite LLM context window. To ensure retrieval quality, systems use fast dual-encoders and more expensive cross-encoders (CEs) to score candidates. However, the CE budget...

Eylon Caplan, Shamik Roy, S. Dasgupta et al. · 0 citations
#machine learning Preprint Sep 2026

Block Sparse Attention with Log-Linear Complexity

PISA is proposed, a block-sparse attention mechanism that employs a pyramid Top-$K selection strategy, and develops hardware-aware Triton kernels for both training and inference, fusing hierarchical routing and LogSumExp scoring without materializing the query-key score matrix.

Bo-Hao Tang, Zhen Qin, Yu-Qi Pan et al. · 0 citations
Preprint Aug 2026

Exact Adaptive Hybrid Retrieval Without Fixed Top-L Cutoffs

This work proposes Exact Adaptive Hybrid Retrieval (EAHR), which fixes the ordered Top-$K$ defined by complete-list weighted RRF as the retrieval target and treats channel depth as request-specific execution state and reproduced the complete-list ordered Top-20 in all 150 query-snapshot combinations.

Chunran Zhang · 2 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.