arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.13795cs.LGcs.AI
收藏

Mix-LN:结合Pre-LN与Post-LN释放深层网络的力量

Mix-LN: Unleashing the Power of Deeper Layers by Combining Pre-LN and Post-LN

Dalian University of Technology(大连理工大学);University of Surrey(Surrey大学);University of Oxford(牛津大学)

Pengxiang Li, Lu Yin, Shiwei Liu

AI总结:

针对LLM深层训练不足问题,提出Mix-LN归一化技术,在浅层用Post-LN、深层用Pre-LN,使梯度更均匀,提升预训练及下游微调性能,不增加模型规模。

摘要:

大型语言模型(LLMs)已取得显著成功,但近期研究发现其较深层往往贡献甚微,甚至可以在不影响整体性能的情况下被剪枝。虽然有人将此视为模型压缩的机遇,我们则将其识别为一种源于广泛使用的Pre-Layer Normalization(Pre-LN)的训练缺陷。我们证明,在GPT和LLaMA等模型中普遍采用的Pre-LN会导致深层梯度范数减小,从而降低其有效性。相比之下,Post-Layer Normalization(Post-LN)在深层保留了较大的梯度范数,但在浅层却面临梯度消失问题。为解决这一问题,我们引入了Mix-LN,一种在同一模型中结合Pre-LN和Post-LN优势的新型归一化技术。Mix-LN在浅层应用Post-LN,在深层应用Pre-LN,确保各层梯度更加均匀。这使得网络的所有部分——无论是浅层还是深层——都能有效参与训练。通过从70M到7B多种模型规模的广泛实验,我们证明Mix-LN始终优于Pre-LN和Post-LN,促进整个网络梯度范数更加均衡、健康,并提升LLM预训练的整体质量。此外,我们证明使用Mix-LN预训练的模型在监督微调(SFT)和基于人类反馈的强化学习(RLHF)中比使用Pre-LN或Post-LN的模型学习得更好,凸显了高质量深层的关键重要性。通过有效解决当前LLM中深层效率低下的问题,Mix-LN在不增加模型规模的情况下释放了其潜力,增强了模型能力。我们的代码可在https://github.com/pixeli99/MixLN获取。

英文摘要:

Large Language Models (LLMs) have achieved remarkable success, yet recent findings reveal that their deeper layers often contribute minimally and can be pruned without affecting overall performance. While some view this as an opportunity for model compression, we identify it as a training shortfall rooted in the widespread use of Pre-Layer Normalization (Pre-LN). We demonstrate that Pre-LN, commonly employed in models like GPT and LLaMA, leads to diminished gradient norms in its deeper layers, reducing their effectiveness. In contrast, Post-Layer Normalization (Post-LN) preserves larger gradient norms in deeper layers but suffers from vanishing gradients in earlier layers. To address this, we introduce Mix-LN, a novel normalization technique that combines the strengths of Pre-LN and Post-LN within the same model. Mix-LN applies Post-LN to the earlier layers and Pre-LN to the deeper layers, ensuring more uniform gradients across layers. This allows all parts of the network--both shallow and deep layers--to contribute effectively to training. Extensive experiments with various model sizes from 70M to 7B demonstrate that Mix-LN consistently outperforms both Pre-LN and Post-LN, promoting more balanced, healthier gradient norms throughout the network, and enhancing the overall quality of LLM pre-training. Furthermore, we demonstrate that models pre-trained with Mix-LN learn better compared to those using Pre-LN or Post-LN during supervised fine-tuning (SFT) and reinforcement learning from human feedback (RLHF), highlighting the critical importance of high-quality deep layers. By effectively addressing the inefficiencies of deep layers in current LLMs, Mix-LN unlocks their potential, enhancing model capacity without increasing model size. Our code is available at https://github.com/pixeli99/MixLN.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑