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

分层全局注意力(HGA)

Hierarchical Global Attention (HGA)

BMW Group(宝马集团)

Woernle Frank, Fedosov Vladimir, Grinenko Artemiy

AI总结:

提出分层全局注意力(HGA),作为预训练长上下文Transformer中密集因果注意力的即插即用替代方案,通过分层路由实现高效长上下文处理,在单GPU上支持64K token上下文,近似误差极小。

摘要:

分层全局注意力(HGA)是预训练长上下文Transformer中密集因果注意力的即插即用替代方案。HGA保留原始检查点参数:预训练的$W_Q$、$W_K$、$W_V$和$W_O$投影保持不变,不引入校准参数,也不需要重新训练。在单个RTX 5090(32GB)上应用于Qwen3-30B-A3B-Instruct-2507-FP8时,修补后的模型在64K token上下文中可直接运行,而在此硬件上token级K/V存储不可行。与之前的稀疏注意力方法不同,HGA执行分层两级路由。它首先使用紧凑的RoPE感知摘要检索相关块,然后通过仅路由最相关的组来细化选择,最后执行精确的token级注意力。这种分层检索显著减少了获取的token数量,同时保持对检索token集的精确注意力,使得RAM和NVMe支持的存储变得实用。完整的历史token K/V驻留在主机RAM或NVMe存储中,而只有小的路由工作集在注意力期间传输到GPU内存。因此,GPU内存消耗主要取决于模型权重和路由工作集,而不是总上下文长度。在所有测试的上下文长度(4K-64K token)中,路由注意力与密集注意力的差异保持在约$0.01$--$0.02$ nats内,而使用的稀疏度仅为约3%。这些结果表明,分层路由引入的近似很小,剩余的质量差距可能主要由长上下文位置编码主导,而不是路由算法本身。

英文摘要:

Hierarchical Global Attention (HGA) is a drop-in replacement for dense causal attention in pretrained long-context transformers. HGA preserves the original checkpoint parameters: the pretrained $W_Q$, $W_K$, $W_V$, and $W_O$ projections remain unchanged, no calibration parameters are introduced, and no retraining is required. Applied to Qwen3-30B-A3B-Instruct-2507-FP8 on a single RTX~5090 (32GB), the patched model runs out of the box at a 64K-token context, where token-level K/V storage is not feasible on this hardware. Unlike previous sparse-attention methods, HGA performs hierarchical two-level routing. It first retrieves relevant chunks using compact RoPE-aware summaries and then refines the selection by routing only the most relevant groups before performing exact token-level attention. This hierarchical retrieval significantly reduces the number of fetched tokens while preserving exact attention over the retrieved token set, making RAM- and NVMe-backed storage practical. The full historical token K/V resides in host RAM or NVMe storage, while only a small routed working set is transferred to GPU memory during attention. Consequently, GPU memory consumption depends primarily on model weights and the routed working set rather than on the total context length. Across all tested context lengths (4K - 64K tokens), routed attention remains within approximately $0.01$--$0.02$ nats of dense attention while the sparsity used is just about 3%. These results suggest that the approximation introduced by hierarchical routing is small, and that the remaining quality gap is likely dominated by long-context positional encoding rather than by the routing algorithm itself.

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

↑