用隐状态改进Transformer注意力,解决深层模型的性能退化问题。
On the Role of Hidden States of Modern Hopfield Network in Transformer

- 引入现代霍普菲尔德网络的隐状态,构建新型注意力机制MHA。
- MHA能继承输入层注意力分数,缓解深层Transformer的秩坍缩与令牌均匀性问题。
- 无需增加参数即可提升ViT和GPT的准确率,适合关注模型优化的研究者。
基于霍普菲尔德网络的关联记忆模型与基于键值机制的自注意力在深度学习记忆机制研究中备受关注。已有研究指出,在绝热近似下,现代霍普菲尔德网络(MHN)的状态更新规则与Transformer中的自注意力层一致。本文突破该近似,通过引入源自MHN的隐状态到自注意力中,建立了更广义的对应关系。新提出的现代霍普菲尔德注意力(MHA)机制使注意力分数可从Transformer输入层传递至输出层,显著改善注意力权重的性质。理论与实证均表明,MHA隐状态有效缓解深层Transformer中存在的秩坍缩与令牌均匀性等严重问题。同时,我们验证了MHA可在不增加训练参数的前提下,系统性提升Vision Transformer与GPT的准确性。结果表明,霍普菲尔德网络为改进Transformer架构提供了新视角。
原文摘要 · Abstract (English)
Associative memory models based on Hopfield networks and self-attention based on key-value mechanisms have been popular approaches in the study of memory mechanisms in deep learning. It has been pointed out that the state update rule of the modern Hopfield network (MHN) in the adiabatic approximation is in agreement with the self-attention layer of Transformer. In this paper, we go beyond this approximation and investigate the relationship between MHN and self-attention. Our results show that the correspondence between Hopfield networks and Transformers can be established in a more generalized form by adding a new variable, the hidden state derived from the MHN, to self-attention. This new attention mechanism, modern Hopfield attention (MHA), allows the inheritance of attention scores from the input layer of the Transformer to the output layer, which greatly improves the nature of attention weights. In particular, we show both theoretically and empirically that MHA hidden states significantly improve serious problem of deep Transformers known as rank collapse and token uniformity. We also confirm that MHA can systematically improve accuracy without adding training parameters to the Vision Transformer or GPT. Our results provide a new case in which Hopfield networks can be a useful perspective for improving the Transformer architecture.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。