学习何时不进行全局关注
Learning When Not to Attend Globally
AI总结:
AHA通过动态切换全关注与局部滑动窗口关注,实现高效推理,减少93%的完全关注操作。
摘要:
在阅读书籍时,人类主要关注当前页面,只有在必要时才会翻回去回顾之前的上下文。同样,我们证明大型语言模型(LLMs)可以学习动态决定何时关注全局上下文。我们提出了All-or-Here Attention(AHA),它使用每个注意力头的一个二进制路由器,动态地在完全关注和局部滑动窗口关注之间切换。我们的结果表明,当窗口大小为256个标记时,可以将原始完全关注操作的93%替换为滑动窗口关注而不损失性能。此外,通过在各种窗口大小上评估AHA,我们发现上下文依赖性存在长尾分布,随着局部窗口的扩大,对完全关注的必要性迅速下降。通过将局部处理与全局访问解耦,AHA揭示了完全关注大多是冗余的,高效推理只需要按需访问全局上下文。
英文摘要:
When reading books, humans focus primarily on the current page, flipping back to recap prior context only when necessary. Similarly, we demonstrate that Large Language Models (LLMs) can learn to dynamically determine when to attend to global context. We propose All-or-Here Attention (AHA), which utilizes a binary router per attention head to dynamically toggle between full attention and local sliding window attention for each token. Our results indicate that with a window size of 256 tokens, up to 93\% of the original full attention operations can be replaced by sliding window attention without performance loss. Furthermore, by evaluating AHA across various window sizes, we identify a long-tail distribution in context dependency, where the necessity for full attention decays rapidly as the local window expands. By decoupling local processing from global access, AHA reveals that full attention is largely redundant, and that efficient inference requires only on-demand access to the global context.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。