LongCat 稀疏注意力:通过流感知的层级跨层索引驯服闪电

LongCat Sparse Attention: Taming the Lightning via Streaming-aware Hierarchical Cross-Layer Indexing

美团 LongCat 团队 Meituan LongCat Team · · 2026-08-03 · arXiv:2608.01662 ↗

打开互动全文版(逐段中英对照 + 图/公式 + 论文问答)→

摘要 · Abstract

DeepSeek 稀疏注意力(DSA)通过其闪电索引器实现了高效的长上下文建模。然而,实际部署仍受限于索引器昂贵的 O(L^2)评分开销以及其输出导致的硬件低效、不连续的内存访问模式。为解决这些系统级瓶颈,我们引入了 LongCat 稀疏注意力(LSA),一种硬件-算法协同设计的框架,包含三个互补且正交的策略:(1)流感知索引,选择性地将分散的 KV 条目转换为硬件对齐的连续布局,以实现合并的 HBM 访问;(2)跨层索引,通过重用单层结果在连续层间摊销索引开销,并辅以跨层蒸馏;(3)层级索引,采用从粗到细的评分方案逐步缩小每个查询的候选集,从而大幅减少索引计算。从 69B-A3B 到 560B-A27B 模型的广泛扩展实验表明,LSA 在通用和长上下文基准上均持续达到与全注意力相当的性能。此外,LSA 支持长达一百万 token 的原生训练,并支撑了 LongCat-2.0(1.6T-A48B)的开发。为促进进一步研究,我们还引入并开源了 LongCat-Flash-Lite-Sparse(69B-A3B),它将 LSA 集成到 LongCat-Flash-Lite 中,并整合了更新的长上下文训练语料库。

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.

核心贡献 · Key contributions

局限 · Limitations

论文章节 · Sections(共 28)

阅读逐段中英对照全文 →