LongCat Recall Sparse Attention: Co-Designing Key Organization and Retrieval for Long-Context Inference
Hao Zhang, Bin Xiao, Kefeng Zhang
Abstract
Retrieval-based sparse attention, exemplified by DeepSeek Sparse Attention (DSA), reduces attention computation by selecting a small subset of key-value entries. However, selecting these entries can still require searching the entire visible history. For long sequences, retrieval becomes a major bottleneck, limiting the efficiency gains from sparse attention. To address this problem, we propose LongCat Recall Sparse Attention (LRSA), which combines fine-grained representatives with paged retrieval in an incrementally maintained index. LRSA partitions the sequence into time buckets that can be indexed independently as new keys arrive, without regrouping existing history. Within each bucket, it organizes indexing keys into capacity-balanced directional groups and packs a fixed number of complete groups into each page, retaining a separate center for every group. These centers provide fine-grained representatives for page selection, after which refinement scores members of the selected pages together with sink, sliding-window, and visible unindexed candidates to select the final Top-K logical positions. To execute this retrieval process efficiently, we store members in reordered pages, fuse construction stages according to group size, and share storage for overlapping fixed candidates across queries during chunked prefill. These choices support regular member access while reducing kernel launches during construction and repeated candidate transfers. Moreover, we integrate LRSA into SGLang to maintain the index during inference, overlapping asynchronous index construction for new buckets with subsequent computation and reusing compatible bucket indices and member pages after a prefix match in the original key-value pool. With a 1024K-token context, LRSA accelerates key selection by 4.70× over DSA and combined selection and attention by 35.60× over full attention.
Create a lesson
Related papers
LoopCache: Accelerating Long-Context Self-Speculative Decoding for Looped Transformers
Shared title terminology · Zizhuo Fu, Haochen Huang, Shengxuan Qiu et al.
Auditing Post-Training Unlearning in Diffusion Language Models using Sparse Autoencoders
Shared title terminology · Yunha Seo, Changhoon Kim
Breaking the Long Horizon: Short-Horizon Process Supervision for Long-Form Generation in LLMs
Shared title terminology · Heyang Xu, HanWen Hao, Qianren Mao et al.
Explicit Style Extraction for Personalized Long-Form Text Generation
Shared title terminology · Jenitha Reddy Patel, Sameeksha Kini, Amulya Rayasam et al.
Your Judge Inherits Your Prompt: In-Context Label Bias in an LLM-as-Judge Is Directional, Not Symmetric
Shared title terminology · Abdullah Ahmad, Ahmed J. O. Ahmed, Luca Citi
How Long Will My Language Model Run? A Benchmark for Pre-Execution Runtime Prediction
Shared title terminology · Ashish Molakalapalli, Kangda Wei, Haonan Duan et al.