Layer Normalization (LayerNorm) is one of the fundamental components in transformers that stabilizes training and improves optimization. In recent times, Pre-LayerNorm transformers have become the preferred choice over Post-LayerNorm transformers due to their stable gradient flow. However, the impact of LayerNorm on learning and memorization across these architectures remains unclear. In this work, we investigate how LayerNorm influences memorization and learning for Pre- and Post-LayerNorm transformers. We identify that LayerNorm serves as a key factor for stable learning in Pre-LayerNorm transformers, while in Post-LayerNorm transformers, it impacts memorization. Our analysis reveals that eliminating LayerNorm parameters in Pre-LayerNorm models exacerbates memorization and destabilizes learning, while in Post-LayerNorm models, it effectively mitigates memorization by restoring genuine labels. We further precisely identify that early layers LayerNorm are the most critical over middle/later layers and their influence varies across Pre and Post LayerNorm models. We have validated it through 13 models across 6 Vision and Language datasets. These insights shed new light on the role of LayerNorm in shaping memorization and learning in transformers.


翻译:层归一化(LayerNorm)是Transformer架构中的核心组件之一,用于稳定训练过程并优化模型性能。近年来,由于梯度流动更为稳定,采用前置层归一化(Pre-LayerNorm)的Transformer逐渐取代后置层归一化(Post-LayerNorm)成为主流选择。然而,层归一化在不同架构中对模型学习与记忆机制的具体影响尚不明确。本研究系统探究了层归一化在Pre-LayerNorm与Post-LayerNorm Transformer中对记忆与学习行为的作用机制。我们发现,在Pre-LayerNorm架构中,层归一化是实现稳定学习的关键因素;而在Post-LayerNorm架构中,它主要影响模型的记忆能力。分析表明:移除Pre-LayerNorm模型的层归一化参数会加剧记忆效应并破坏学习稳定性,而在Post-LayerNorm模型中移除该参数则能通过恢复真实标签分布有效抑制记忆效应。进一步精确分析揭示,早期层的层归一化比中/后期层更为关键,且其影响模式在两种架构中存在显著差异。我们在6个视觉与语言数据集上通过13个模型验证了上述结论。这些发现为理解层归一化如何塑造Transformer的记忆与学习机制提供了新的视角。

0
下载
关闭预览

相关内容

【ICML2022】Sharp-MAML:锐度感知的模型无关元学习
专知会员服务
17+阅读 · 2022年6月10日
IEEE TPAMI | 基于标注偏差估计的实例相关PU学习
专知会员服务
12+阅读 · 2021年10月23日
【ICML2020】图神经网络谱聚类
专知
10+阅读 · 2020年7月7日
【NeurIPS2019】图变换网络:Graph Transformer Network
NAACL 2019 | 一种考虑缓和KL消失的简单VAE训练方法
PaperWeekly
20+阅读 · 2019年4月24日
国家自然科学基金
2+阅读 · 2016年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关VIP内容
【ICML2022】Sharp-MAML:锐度感知的模型无关元学习
专知会员服务
17+阅读 · 2022年6月10日
IEEE TPAMI | 基于标注偏差估计的实例相关PU学习
专知会员服务
12+阅读 · 2021年10月23日
相关资讯
【ICML2020】图神经网络谱聚类
专知
10+阅读 · 2020年7月7日
【NeurIPS2019】图变换网络:Graph Transformer Network
NAACL 2019 | 一种考虑缓和KL消失的简单VAE训练方法
PaperWeekly
20+阅读 · 2019年4月24日
相关基金
国家自然科学基金
2+阅读 · 2016年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员