Self-attention selects information freely across the sequence, but across depth, Transformers merely add each layer's output to the residual stream, so later layers cannot selectively reuse earlier-layer representations. Recent cross-layer methods improve this flow but operate on hidden states outside attention, adding state beyond the key-value cache at inference--a cost that becomes increasingly salient as modern LLMs compress the cache with grouped-query and multi-head latent attention. We introduce Depth-Attention, which performs this selection inside the attention module itself: before a layer attends over the sequence, its query attends over the keys of earlier layers at the same token position and mixes their values into the value that self-attention then reads. Because Depth-Attention reuses the standard attention queries, keys, and value-cache slots, storing depth-mixed values in place of the original values, it adds no parameters and introduces no persistent inference state beyond the standard key-value cache--the same cache size as a vanilla decoder and less than hidden-state-based cross-layer methods. On Qwen3-style decoders at 1.5B and 3B parameters, Depth-Attention attains the lowest perplexity and the highest average downstream accuracy, improving over the vanilla Transformer by up to 2.3 accuracy points and surpassing strong cross-layer baselines in perplexity and average accuracy, while adding under 0.01% extra arithmetic FLOPs and no additional persistent inference state. The gains hold from 360M to 3B parameters and extend to looped Transformers.


翻译:自注意力机制使得信息可以在序列各位置间自由选择,但在深度维度上,Transformer仅将每层输出添加到残差流中,导致后续层无法选择性重用先前层的表示。近期跨层方法虽改善了信息流动,但其操作对象为注意力外的隐藏状态,从而在推理时向键值缓存之外引入了额外状态——随着现代大语言模型采用分组查询和多头潜注意力压缩缓存,这一开销日益显著。我们提出深度注意力(Depth-Attention),在注意力模块内部实现选择性交互:当某层对序列执行注意力计算前,其查询(query)会与同位置更早层的键(key)进行匹配,并将这些层的值(value)混合至自注意力即将读取的值中。由于深度注意力复用标准注意力的查询、键以及值缓存槽位,并通过原位存储深度混合值取代原始值,因此既不增加参数,也不会在标准键值缓存之外引入持久化推理状态——其缓存大小与原生解码器相同,且小于基于隐藏状态的跨层方法。在基于Qwen3架构的1.5B和3B参数解码器上,深度注意力实现了最低困惑度与最高平均下游任务准确率,相比原始Transformer提升高达2.3个准确率百分点,同时在困惑度与平均准确率上超越强跨层基线方法。其带来的额外计算量不足0.01%算术FLOPs,且不增加持久化推理状态。该优势在360M至3B参数范围内保持稳定,并可扩展至循环Transformer架构。

0
下载
关闭预览

相关内容

【NeurIPS 2021】流形上的注意力机制:规范等变的Transformer
最新《注意力机制与深度学习结合》综述论文
专知会员服务
76+阅读 · 2021年6月17日
专知会员服务
48+阅读 · 2020年10月20日
Transformer模型-深度学习自然语言处理,17页ppt
专知会员服务
108+阅读 · 2020年8月30日
深度学习的下一步:Transformer和注意力机制
云头条
56+阅读 · 2019年9月14日
跨越注意力:Cross-Attention
我爱读PAMI
172+阅读 · 2018年6月2日
深度学习中的注意力机制
人工智能头条
16+阅读 · 2017年11月2日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
13+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
6+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
7+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
4+阅读 · 6月17日
相关VIP内容
【NeurIPS 2021】流形上的注意力机制:规范等变的Transformer
最新《注意力机制与深度学习结合》综述论文
专知会员服务
76+阅读 · 2021年6月17日
专知会员服务
48+阅读 · 2020年10月20日
Transformer模型-深度学习自然语言处理,17页ppt
专知会员服务
108+阅读 · 2020年8月30日
相关基金
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
13+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员