SpecAttn:推测稀疏注意力
SpecAttn: Speculating Sparse Attention
AI总结:
本文提出SpecAttn,一种免训练的稀疏注意力方法,利用推测解码中草稿模型已计算的注意力权重指导目标模型的动态键值缓存剪枝,在保持输出质量的同时显著降低计算瓶颈。
摘要:
大型语言模型(LLMs)在推理过程中,由于自注意力机制的二次复杂度,尤其是在上下文长度增加时,面临显著的计算瓶颈。我们引入了SpecAttn,这是一种新颖的免训练方法,可与现有的推测解码技术无缝集成,以在预训练transformers中实现高效的稀疏注意力。我们的核心见解是利用推测解码期间草稿模型已计算的注意力权重,来识别目标模型的重要token,从而消除冗余计算并保持输出质量。SpecAttn采用三项核心技术:草稿模型与目标模型之间基于KL散度的层对齐、一种GPU优化的无需排序算法(用于从草稿注意力模式中选择top-p token),以及由这些预测指导的动态键值缓存剪枝。通过利用标准推测解码流程中已完成的计算工作,SpecAttn在PG-19数据集上实现了超过75%的键值缓存访问减少,且困惑度仅增加15.29%,显著优于现有的稀疏注意力方法。我们的方法表明,可以增强推测执行以提供近似验证,而不会导致显著的性能下降。
英文摘要:
Large Language Models (LLMs) face significant computational bottlenecks during inference due to the quadratic complexity of self-attention mechanisms, particularly as context lengths increase. We introduce SpecAttn, a novel training-free approach that seamlessly integrates with existing speculative decoding techniques to enable efficient sparse attention in pre-trained transformers. Our key insight is to exploit the attention weights already computed by the draft model during speculative decoding to identify important tokens for the target model, eliminating redundant computation while maintaining output quality. SpecAttn employs three core techniques: KL divergence-based layer alignment between draft and target models, a GPU-optimized sorting-free algorithm for top-p token selection from draft attention patterns, and dynamic key-value cache pruning guided by these predictions. By leveraging the computational work already performed in standard speculative decoding pipelines, SpecAttn achieves over 75% reduction in key-value cache accesses with a mere 15.29% increase in perplexity on the PG-19 dataset, significantly outperforming existing sparse attention methods. Our approach demonstrates that speculative execution can be enhanced to provide approximate verification without significant performance degradation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。