In this paper, we introduce the Curse of Depth, a concept that highlights, explains, and addresses the recent observation in modern Large Language Models (LLMs) where nearly half of the layers are less effective than expected. We first confirm the wide existence of this phenomenon across the most popular families of LLMs such as Llama, Mistral, DeepSeek, and Qwen. Our analysis, theoretically and empirically, identifies that the underlying reason for the ineffectiveness of deep layers in LLMs is the widespread usage of Pre-Layer Normalization (Pre-LN). While Pre-LN stabilizes the training of Transformer LLMs, its output variance exponentially grows with the model depth, which undesirably causes the derivative of the deep Transformer blocks to be an identity matrix, and therefore barely contributes to the training. To resolve this training pitfall, we propose LayerNorm Scaling (LNS), which scales the variance of output of the layer normalization inversely by the square root of its depth. This simple modification mitigates the output variance explosion of deeper Transformer layers, improving their contribution. Across a wide range of model sizes (130M to 7B), our experiments show that LNS consistently outperforms previous normalization and scaling techniques in enhancing LLM pre-training performance. Moreover, this improvement seamlessly carries over to supervised fine-tuning. All these gains can be attributed to the fact that LayerNorm Scaling enables deeper layers to contribute more effectively during training. Our code is available at \href{https://github.com/lmsdss/LayerNorm-Scaling}{LayerNorm-Scaling}.


翻译:本文提出“深度诅咒”这一概念,用以阐释并解决现代大语言模型(LLMs)中近半数层表现不及预期的现象。我们首先在Llama、Mistral、DeepSeek、Qwen等主流大语言模型系列中广泛验证了该现象的存在。通过理论与实证分析,我们发现导致大语言模型深层失效的根本原因在于广泛采用的预层归一化(Pre-LN)机制。虽然Pre-LN能稳定Transformer大语言模型的训练过程,但其输出方差会随模型深度呈指数级增长,这导致深层Transformer块的导数趋近单位矩阵,从而对训练几乎不产生贡献。为克服这一训练缺陷,我们提出层归一化缩放(LNS)方法,通过深度平方根的倒数对层归一化输出方差进行缩放。这一简单改进有效抑制了深层Transformer层的输出方差爆炸问题,提升了其贡献度。在130M至7B参数规模的广泛实验中,LNS在增强大语言模型预训练性能方面持续优于现有归一化与缩放技术。此外,该改进能无缝迁移至监督微调阶段。所有这些提升均可归因于层归一化缩放使深层在训练过程中发挥了更有效的作用。代码已开源:\href{https://github.com/lmsdss/LayerNorm-Scaling}{LayerNorm-Scaling}。

0
下载
关闭预览

相关内容

跨越黑盒:大语言模型的理论与机制
专知会员服务
37+阅读 · 1月7日
大语言模型幻觉:系统综述
专知会员服务
40+阅读 · 2025年10月10日
赋能大型语言模型多领域资源挑战
专知会员服务
10+阅读 · 2025年6月10日
DeepSeek与其他大型语言模型的比较
专知会员服务
85+阅读 · 2025年2月9日
大语言模型简明指南
专知会员服务
143+阅读 · 2023年7月29日
「PPT」深度学习中的不确定性估计
专知
27+阅读 · 2019年7月20日
深度强化学习简介
专知
30+阅读 · 2018年12月3日
深度上下文词向量
微信AI
27+阅读 · 2018年9月13日
什么是深度学习的卷积?
论智
18+阅读 · 2018年8月14日
深度学习在CTR预估中的应用 | CTR深度模型大盘点
PaperWeekly
15+阅读 · 2018年4月11日
展望:模型驱动的深度学习
人工智能学家
12+阅读 · 2018年1月23日
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
Arxiv
0+阅读 · 1月6日
VIP会员
最新内容
探秘Palantir:驱动美情报的科技巨头
专知会员服务
2+阅读 · 今天3:14
《美国海军军事海运司令部 2026年手册》
专知会员服务
2+阅读 · 今天3:05
《人工智能使能系统可靠性框架》
专知会员服务
4+阅读 · 今天2:28
2026“人工智能+”行业发展蓝皮书(附下载)
专知会员服务
13+阅读 · 4月26日
《强化学习数学基础》
专知会员服务
9+阅读 · 4月26日
“Maven计划”的发展演变之“Maven智能系统”应用
相关资讯
「PPT」深度学习中的不确定性估计
专知
27+阅读 · 2019年7月20日
深度强化学习简介
专知
30+阅读 · 2018年12月3日
深度上下文词向量
微信AI
27+阅读 · 2018年9月13日
什么是深度学习的卷积?
论智
18+阅读 · 2018年8月14日
深度学习在CTR预估中的应用 | CTR深度模型大盘点
PaperWeekly
15+阅读 · 2018年4月11日
展望:模型驱动的深度学习
人工智能学家
12+阅读 · 2018年1月23日
相关基金
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员