提出LongCat稀疏注意力,高效处理百万级长文本
LongCat Sparse Attention: Taming the Lightning via Streaming-aware Hierarchical Cross-Layer Indexing

- 通过流式感知分层索引,减少计算与内存开销
- 支持最大100万词元上下文,训练性能媲美全注意力
- 适合超长文本建模与大模型高效部署场景
DeepSeek稀疏注意力(DSA)通过闪电索引器实现了长上下文建模的高效性。然而,实际部署仍受限于索引器高达$O(L^2)$的评分开销,以及其输出引发的硬件低效、不连续的内存访问模式。为解决这些系统级瓶颈,本文提出LongCat稀疏注意力(LSA),一种软硬件协同设计框架,包含三项互补且正交的策略:(1) 流式感知索引,将分散的键值条目转换为硬件对齐的连续布局,实现合并的高带宽内存访问;(2) 跨层索引,通过跨层蒸馏复用单层生成的索引结果,摊薄索引开销;(3) 分层索引,采用粗到精的评分机制,逐步缩小每查询候选集,显著降低索引计算量。大规模扩展实验覆盖69B-A3B至560B-A27B模型,结果表明LSA在通用和长上下文基准上均保持与全注意力相当的性能。此外,LSA原生支持长达百万词元的训练,并支撑了LongCat-2.0(1.6T-A48B)的开发。为促进后续研究,我们还推出并开源LongCat-Flash-Lite-Sparse(69B-A3B),将LSA集成至LongCat-Flash-Lite,并引入更新的长上下文训练语料库。
原文摘要 · Abstract (English)
DeepSeek Sparse Attention (DSA) enables efficient long-context modeling through its Lightning Indexer. However, practical deployment remains constrained by the indexer's expensive $O(L^2)$ scoring overhead and the hardware-inefficient, discontinuous memory-access patterns induced by its outputs. To address these system-level bottlenecks, we introduce LongCat Sparse Attention (LSA), a hardware-algorithm co-designed framework comprising three complementary and orthogonal strategies: (1) Streaming-Aware Indexing, which selectively converts scattered KV entries into hardware-aligned contiguous layouts to enable coalesced HBM access; (2) Cross-Layer Indexing, which amortizes indexing overhead by reusing the results produced by a single layer across consecutive layers, supported by cross-layer distillation; and (3) Hierarchical Indexing, which adopts a coarse-to-fine scoring scheme to progressively narrow the candidate set for each query, thereby substantially reducing indexing computation. Extensive scaling experiments, ranging from 69B-A3B to 560B-A27B models, demonstrate that LSA consistently achieves performance on par with full attention across both general-purpose and long-context benchmarks. Moreover, LSA supports native training with context lengths of up to one million tokens and underpins the development of LongCat-2.0 (1.6T-A48B). To facilitate further research, we also introduce and open-source LongCat-Flash-Lite-Sparse (69B-A3B), which integrates LSA into LongCat-Flash-Lite and incorporates an updated long-context training corpus.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。