首页 > AI前沿 > LongCat Recall Sparse Attention: Co-Designing Key Organization and Retrieval for Long-Context Inference

LongCat Recall Sparse Attention: Co-Designing Key Organization and Retrieval for Long-Context Inference

arXiv自然语言 2026-11-20 15:35 6 阅读 查看原文
用户需要我作为专业的新闻排版工程师,将给定的纯文本新闻正文排版成语义化的HTML片段。 规则如下: 1. 只输出HTML片段本身,不要Markdown围栏、不要解释。 2. 每个自然段落用`

`包裹,长文用`

`/`

`划分小节。 3. 列表内容用`
  • `,引用用`
    `,代码用`
    `,重要句子可用``。
    4. 保留原文所有信息,不得增删改内容。
    5. 不要输出``/``/``等文档级标签。
    
    分析正文内容:
    正文是一个关于"LongCat Recall Sparse Attention (LRSA)"的技术新闻/摘要。
    内容分为几个逻辑部分:
    1. 背景与问题:Retrieval-based sparse attention (DSA) 的瓶颈。
    2. 提出的方法:LRSA 的核心机制(时间桶、方向组、页、中心)。
    3. 优化与执行:高效检索的实现细节(重排序页、融合构造阶段、共享存储)。
    4. 系统集成与性能:集成到SGLang,性能提升数据。
    
    虽然原文没有明确的小标题,但为了符合"长文用

    /

    划分小节"的规则,我可以合理地添加小标题来划分结构,或者如果不算长文,直接用`

    `包裹并适当使用``。不过规则提到“长文用

    /

    划分小节”,这段文本大概400多词,可以算作较长的段落,添加小标题能让结构更清晰,且不违反“保留原文所有信息,不得增删改内容”(小标题属于排版结构,不属于修改正文内容,但为了严格遵守“不得增删改内容”,最好不添加原文没有的词汇作为标题,或者使用非常泛化的标题?等等,规则说“不得增删改内容”,如果我加了小标题,算不算增加了内容? “保留原文所有信息,不得增删改内容”通常指正文文本不能改动。添加HTML标签是允许的。如果添加小标题文本,可能会被认为“增改内容”。为了安全起见,我可以不添加额外的标题文本,直接用`

    `包裹所有段落,或者将第一句作为引言,后面用`

    `。 再仔细看规则2:“长文用

    /

    划分小节”。如果原文没有小标题,我可以通过提取段落首句或者不添加纯文本标题,只使用标签?不行,`

    `里面必须有文本。如果添加文本就违反了“不得增删改内容”。 折中方案:不添加额外的标题文本,直接将每个自然段用`

    `包裹,对重要句子用``。或者,把原文按逻辑拆分成几个`

    `,如果必须用`

    /

    `,可以将原文中的一些关键短语作为标题?不,原文是连贯的段落。 其实,原文可以分成几个自然段。 段落1:Retrieval-based sparse attention... limiting the efficiency gains from sparse attention. 段落2:To address this problem... select the final Top-$K$ logical positions. 段落3:To execute this retrieval process efficiently... repeated candidate transfers. 段落4:Moreover, we integrate LRSA into SGLang... 35.60$\times$ over full attention. 这样直接用`

    `包裹这四个段落即可。因为原文没有明显的小节标题,强行加标题会违反“不得增删改内容”。规则说“长文用

    /

    划分小节”,这里如果不算是“长文”或者没有现成的小节,就不需要强行加。或者我可以把第一句作为`

    `?不,改变原文结构可能违反规则。最稳妥的方式是:直接分成几个`

    `,并使用``加粗重要句子。 让我们把原文分成几个自然段,保持原样。 原文: 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. 排版:

    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.

    检查规则: 1. 只输出HTML片段本身,不要Markdown围栏、不要解释。 -> 满足。 2. 每个自然段落用

    包裹,长文用

    /

    划分小节。 -> 原文没有小标题,直接按自然段用`

    `包裹。如果非要体现“划分小节”,可以把没有空行的自然段视为同一段落,但原文明显是四段。这里直接用四个`

    `。 3. 列表内容用`

    • `,引用用`
      `,代码用`
      `,重要句子可用``。 -> 使用了``。
      4. 保留原文所有信息,不得增删改内容。 -> 满足,文本完全一致。
      5. 不要输出``/``/``等文档级标签。 -> 满足。
      
      再审视一下是否需要加`

      `或`

      `。原文是一段完整的摘要,强行加标题会违背“不得增删改内容”。所以只用`

      `