Since the introduction of the Transformer architecture for large language models, the softmax-based attention layer has faced increasing scrutinity due to its quadratic-time computational complexity. Attempts have been made to replace it with less complex methods, at the cost of reduced performance in most cases. We introduce Hierarchical Shift Mixing (HSM), a general framework for token mixing that distributes pairwise token interactions across Transformer layers rather than computing them densely within each layer. HSM enables linear-time complexity while remaining agnostic to the specific mixing function. We show that even simple HSM variants achieve performance close to softmax attention, and that hybrid architectures combining HSM with softmax attention can outperform a GPT-style Transformer baseline while reducing computational cost during both training and inference.


翻译:自Transformer架构被引入大型语言模型以来,基于softmax的注意力层因其二次时间复杂度而日益受到审视。已有研究尝试用复杂度更低的方法替代该机制,但在多数情况下会以性能下降为代价。本文提出层次化位移混合(HSM),一种通用的令牌混合框架,将成对令牌交互分布在Transformer各层中计算,而非在单层内进行密集计算。HSM在保持对具体混合函数无关性的同时,实现了线性时间复杂度。研究表明,即使简单的HSM变体也能达到接近softmax注意力的性能,而将HSM与softmax注意力结合的混合架构,在降低训练和推理计算成本的同时,其性能可超越GPT风格的Transformer基线模型。

0
下载
关闭预览

相关内容

【ICML2024】通过动态可组合多头注意力改进Transformers
专知会员服务
21+阅读 · 2024年5月17日
【CVPR2023】BiFormer:基于双层路由注意力的视觉Transformer
专知会员服务
35+阅读 · 2023年3月20日
144页ppt!《Transformers》全面讲解,附视频
专知会员服务
117+阅读 · 2023年1月1日
【Google】高效Transformer综述,Efficient Transformers: A Survey
专知会员服务
66+阅读 · 2022年3月17日
【NeurIPS 2021】流形上的注意力机制:规范等变的Transformer
深度学习的下一步:Transformer和注意力机制
云头条
56+阅读 · 2019年9月14日
跨越注意力:Cross-Attention
我爱读PAMI
172+阅读 · 2018年6月2日
深度学习中的注意力机制
人工智能头条
16+阅读 · 2017年11月2日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 2月16日
VIP会员
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员