arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2506.17286cs.CLcs.AI
收藏

GTA:分组头潜在注意力(Grouped-head latenT Attention)

GTA: Grouped-head latenT Attention

Institution of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);School of Artificial Intelligence, University of Chinese Academy of Sciences(中国科学院大学人工智能学院);AI Lab, The Yangtze River Delta(长江三角洲人工智能实验室);The Hong Kong University of Science and Technology (Guangzhou)(香港科学与技术大学(广州));University College London(伦敦大学学院);The Hong Kong University of Science and Technology(香港科学与技术大学);UCL Centre for Artificial Intelligence(伦敦大学学院人工智能中心)

Luoyang Sun, Cheng Deng, Jiwen Jiang, Xinjian Wu, Haifeng Zhang, Lei Chen, Lionel Ni, Jun Wang

AI总结:

本文提出GTA注意力机制,通过共享注意力图和潜在value压缩降低KV cache与计算开销,在保持性能的同时将推理速度提升至2倍。

摘要:

注意力机制支撑了大型语言模型(LLM)的成功,但其巨大的计算和内存开销给效率与性能优化带来挑战。一个关键瓶颈在于,KV cache和注意力计算会随文本长度迅速增长,使其难以部署在计算和内存资源有限的硬件上。我们观察到,注意力机制存在显著冗余:KV cache可以被大幅压缩,而且不同注意力头之间的注意力图表现出高度相似性,这表明大量计算和存储并非必要。基于这些洞察,我们提出Grouped-Head LatenT Attention(GTA,分组头潜在注意力),这是一种新型注意力机制,可在保持性能的同时降低内存使用和计算复杂度。GTA包含两个组件:(1)共享注意力图机制,在多个注意力头之间复用注意力分数,从而减小key cache大小;(2)带有学习型投影的非线性value解码器,将value cache压缩到潜在空间中,进一步降低内存需求。与Grouped-Query Attention相比,GTA最多可将注意力计算FLOPs减少62.5%,并将KV cache最多缩小70%,同时避免Multi-Head Latent Attention带来的额外开销,从而提升LLM部署效率。因此,GTA模型实现了2倍的端到端推理速度提升,其中prefill受益于计算成本降低,decoding受益于更小的缓存占用。

英文摘要:

Attention mechanisms underpin the success of large language models (LLMs), yet their substantial computational and memory overhead poses challenges for optimizing efficiency and performance. A critical bottleneck arises as KV cache and attention computations scale rapidly with text length, challenging deployment on hardware with limited computational and memory resources. We observe that attention mechanisms exhibit substantial redundancy, since the KV cache can be significantly compressed and attention maps across heads display high similarity, revealing that much of the computation and storage is unnecessary. Leveraging these insights, we propose \textbf{G}rouped-Head Laten\textbf{T} \textbf{A}ttention (GTA), a novel attention mechanism that reduces memory usage and computational complexity while maintaining performance. GTA comprises two components: (1) a shared attention map mechanism that reuses attention scores across multiple heads, decreasing the key cache size; and (2) a nonlinear value decoder with learned projections that compresses the value cache into a latent space, further cutting memory needs. GTA cuts attention computation FLOPs by up to \emph{62.5\%} versus Grouped-Query Attention and shrink the KV cache by up to \emph{70\%}, all while avoiding the extra overhead of Multi-Head Latent Attention to improve LLM deployment efficiency. Consequently, GTA models achieve a \emph{2x} increase in end-to-end inference speed, with prefill benefiting from reduced computational cost and decoding benefiting from the smaller cache footprint.

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

↑