arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.42112cs.CLcs.AI
收藏

具有分层树结构索引器的次二次注意力机制

Subquadratic Attention with a Hierarchical Tree-Structured Indexer

Zyphra Research(齐普拉研究机构)

Leon Lufkin, Cutter Dawes, Alexander Speicher, Kamesh Krishnamurthy, Tomás Figliolia, Beren Millidge

AI总结:

本文提出Zyphra分层注意力(ZHA),一种基于分层树结构索引器的次二次稀疏注意力方法,可廉价应用于现有预训练LLM,在长上下文任务上性能优异,有望将有效上下文窗口扩展至数亿或数十亿token。

摘要:

注意力机制的二次缩放是限制大型语言模型(LLM)长上下文能力的核心瓶颈。多种方法试图规避这一问题,但要么无法匹配注意力的表达能力(例如固定大小状态的滑动窗口或线性注意力变体),要么仅实现常数因子的加速(例如索引器自身呈二次缩放的稀疏注意力方法)。本文中,我们提出一种基于分层树结构索引器的渐近次二次稀疏注意力方法,将其命名为Zyphra分层注意力(ZHA)。ZHA在KV缓存上构建递归压缩键摘要的树,后续查询自顶向下遍历该树以检索稀疏键子集。关键在于,通过迭代增加树的深度,包括路由和最终注意力在内的总开销随序列长度呈亚线性增长,使注意力整体呈次二次(但超线性)缩放。我们证明,ZHA可通过仅在数十亿token上进行的短KL蒸馏训练阶段,廉价应用于现有预训练模型,且在长上下文检索及具有挑战性的推理、数学和智能体编码评估任务上保持性能。此外,我们表明该方法对树几何结构具有高度鲁棒性,包括深度达6层的极深树。最后,我们开发了详细的性能模型,证明我们的方法呈次二次缩放,在超过100万上下文时显著优于竞争方法,最终有潜力将有效上下文窗口扩展至数亿或数十亿token。

英文摘要:

The quadratic scaling of attention is a fundamental bottleneck limiting the long-context capabilities of large language models (LLMs). A variety of approaches have attempted to circumvent this, but they either fail to match attention's expressiveness (e.g., sliding-window or linear attention variants with fixed-size state) or only achieve constant-factor speedups (e.g., sparse attention methods whose indexers themselves scale quadratically). In this paper, we derive an asymptotically subquadratic sparse attention method based on a hierarchical, tree-structured indexer, which we call Zyphra Hierarchical Attention (ZHA). ZHA constructs a tree of recursively compressed key summaries over the KV cache, which future queries traverse from the top down to retrieve a sparse subset of keys. Crucially, by iteratively growing the tree's depth, the total cost including routing and final attention grows sublinearly in sequence length, resulting in overall subquadratic (but superlinear) scaling for attention. We demonstrate that ZHA can be cheaply applied to existing pretrained models with only a short KL distillation training stage of a billion tokens, and maintains performance on long-context retrieval and challenging reasoning, mathematical, and agentic coding evaluation tasks. Moreover, we show that our method is highly robust to tree geometry including very deep trees of up to 6 levels. Finally, we develop a detailed performance model and show that our approach scales subquadratically, dramatically outperforms competing methods beyond 1 million tokens of context, and ultimately has the potential to extend effective context windows to the hundreds of millions or billions of tokens.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑