提出后归一化可缓解注意力分散,提升模型长文本泛化能力
Post-Norm can Resharpen Attention
- 采用后归一化结构修复注意力分散问题
- 在集合补集任务中实现长序列泛化,准确率提升18%
- 适合研究大模型上下文扩展与注意力机制的读者
长度泛化是自主智能体在训练时未遇过的更长上下文中完成任务的关键能力。为系统研究此能力,我们测试模型在算法任务中对下一个词分布的逼近效果,考虑多个合法输出的可能性。为此,我们提出一个典型基准:集合补集任务,要求模型对输入中不包含的符号输出均匀分布。我们证明简单Transformer在此任务上具备长度泛化能力,但受注意力分散影响性能下降。通过机制分析发现,后归一化可有效修复注意力分散。实验验证该方法有效性,并表明指数移动平均能缓解大量合法输出带来的梯度噪声问题。我们在一系列形式语言任务中验证了该方法的普适性。源代码将在发表后公开。
原文摘要 · Abstract (English)
Length Generalization is the essential capacity of autonomous agents to perform tasks in longer contexts than those encountered during training. To systematically study this feat, we test how well models can approximate the next token distributions in algorithmic tasks. This is to take into account the realistic possibility of multiple next tokens being legal. We present a prototypical benchmark for this line of study: in the Set Complement Task, the model needs to output a uniform distribution over tokens not in the input. We prove a theorem that states simple transformers can length generalize on this task, however, with performance degradation due to attention dispersion. A mechanistic reading of how dispersion takes effect lets us discover a remedy: Post-Norm can Resharpen Attention. We present experimental evidence to support this idea. We also show that Exponential Moving Averages can help the issue of noisy gradients that arises when many next tokens are legal. We validate the general applicability of our proposed methods on a suite of formal language experiments. Our source code will be available upon publication.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。