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.


翻译:在阅读书籍时,人类主要关注当前页面,仅在必要时才翻回前文回顾先前语境。类似地,我们证明大型语言模型(LLMs)能够学会动态决定何时需要关注全局上下文。我们提出全有或此处注意力机制(All-or-Here Attention, AHA),该机制在每个注意力头中使用二元路由器,为每个标记动态切换完整注意力与局部滑动窗口注意力。实验结果表明,在窗口大小为256个标记时,高达93%的原始完整注意力操作可被滑动窗口注意力替代而保持性能不变。此外,通过在不同窗口尺寸下评估AHA,我们发现上下文依赖性呈现长尾分布:随着局部窗口扩大,对完整注意力的需求迅速衰减。通过将局部处理与全局访问解耦,AHA表明完整注意力在很大程度上是冗余的,高效的推理仅需按需访问全局上下文即可实现。

0
下载
关闭预览

相关内容

专知会员服务
31+阅读 · 2020年12月14日
专知会员服务
29+阅读 · 2020年10月2日
图机器学习 2.2-2.4 Properties of Networks, Random Graph
图与推荐
10+阅读 · 2020年3月28日
【NeurIPS2019】图变换网络:Graph Transformer Network
注意力机制可解释吗?这篇ACL 2019论文说……
机器之心
11+阅读 · 2019年6月16日
读论文Discriminative Deep Metric Learning for Face and KV
统计学习与视觉计算组
12+阅读 · 2018年4月6日
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关资讯
图机器学习 2.2-2.4 Properties of Networks, Random Graph
图与推荐
10+阅读 · 2020年3月28日
【NeurIPS2019】图变换网络:Graph Transformer Network
注意力机制可解释吗?这篇ACL 2019论文说……
机器之心
11+阅读 · 2019年6月16日
读论文Discriminative Deep Metric Learning for Face and KV
统计学习与视觉计算组
12+阅读 · 2018年4月6日
相关基金
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员