LongCat 提出 LRSA:1024K 长上下文下键选择加速 4.70 倍
LongCat Recall Sparse Attention: Co-Designing Key Organization and Retrieval for Long-Context Inference
LongCat 团队把 DeepSeek 那套稀疏注意力里最耗时的检索环节单独优化了,1024K 上下文下键选择快了 4.70 倍。方案已经接进 SGLang,做长上下文推理部署的同学可以直接参考这篇的工程实现细节。
美团 LongCat 团队发布 LongCat Recall Sparse Attention(LRSA),针对检索式稀疏注意力(以 DeepSeek Sparse Attention 为代表)在长序列下检索开销过大的问题。在 1024K token 上下文中,LRSA 将键选择环节相比 DSA 加速 4.70 倍,选择与注意力合计相比全注意力加速 35.60 倍。
技术上,LRSA 将序列切分为可独立索引的时间桶(time bucket),新键到来时无需重组已有历史;桶内把索引键组织成容量均衡的方向性分组(directional groups),每页打包固定数量的完整分组并保留每组的中心向量作为细粒度代表。页选定后,再对页内成员与 sink、滑动窗口、可见未索引候选统一打分,选出最终 Top-K 逻辑位置。工程上通过重排页内成员、按分组大小融合构建阶段、在 chunked prefill 期间跨查询共享重叠固定候选的存储来降低内核启动与数据传输开销。
该方案已集成进 SGLang,推理时可异步构建新桶索引并与后续计算重叠,前缀命中后还能复用原 KV 池中兼容的桶索引与成员页。对需要处理超长上下文、以 DSA 类稀疏注意力为基础部署推理服务的团队,这套键组织与检索协同设计提供了可直接落地的效率改进路径。
LongCat Recall Sparse Attention: Co-Designing Key Organization and Retrieval for Long-Context Inference
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$\times$ over DSA and combined selection and attention by 35.60$\times$ over full attention.
This report is categorized under AITOP's "Papers" desk, focusing on China's AI industry and domestic foundation model ecosystem. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include LongCat, DeepSeek, SGLang, sparse attention.
Primary source verification: published directly by arXiv: DeepSeek with first-party authority.