2025-02-11 · 专家 · 自然语言处理 · 机器学习

The Curse of Depth in Large Language Models

本文提出了“深度诅咒”的概念,揭示了现代大型语言模型中深层层效率低下的现象,并提出了层归一化缩放(LayerNorm Scaling)方法来解决这一问题。

更新于 2025-02-11。作者:Wenfang Sun、Xinyuan Song、Pengxiang Li、Lu Yin、Yefeng Zheng、Shiwei Liu。

中文摘要

在这篇论文中,我们介绍了深度诅咒这一概念,它突出了、解释了并解决了现代大型语言模型(LLMs)中近期观察到的一种现象,即近一半的层的效果不如预期。我们首先确认了这一现象在Llama、Mistral、DeepSeek和Qwen等最受欢迎的LLM家族中广泛存在。我们的分析从理论和实证两方面确定了LLMs中深层层无效的根本原因是广泛使用预层归一化(Pre-LN)。虽然Pre-LN稳定了Transformer LLM的训练,但其输出方差随着模型深度的增加而指数级增长,这导致深层Transformer块的导数成为单位矩阵,从而几乎对训练贡献甚微。为了解决这一训练陷阱,我们提出了层归一化缩放(LayerNorm Scaling),它通过层的深度的平方根的倒数来缩放层归一化输出的方差。这种简单的修改减轻了深层Transformer层的输出方差爆炸,提高了它们的贡献。我们的实验结果涵盖了从1.3亿到10亿的模型大小,表明层归一化缩放与Pre-LN相比显著提高了LLM预训练性能。此外,这种改进无缝地延续到监督微调。所有这些收益都可以归因于层归一化缩放使得深层层在训练期间能够更有效地做出贡献。

英文摘要

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, 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. Our experimental results, spanning model sizes from 130M to 1B, demonstrate that LayerNorm Scaling significantly enhances LLM pre-training performance compared to Pre-LN. 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.

解读

一句话总结

本文提出了“深度诅咒”的概念,揭示了现代大型语言模型中深层层效率低下的现象,并提出了层归一化缩放(LayerNorm Scaling)方法来解决这一问题。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt