대형 언어 모델에서의 깊이의 저주
The Curse of Depth in Large Language Models
February 9, 2025
저자: Wenfang Sun, Xinyuan Song, Pengxiang Li, Lu Yin, Yefeng Zheng, Shiwei Liu
cs.AI
초록
본 논문에서는 최근 현대 대형 언어 모델(LLMs)에서 거의 절반에 해당하는 레이어가 예상보다 효과적이지 않다는 최근 관측을 강조, 설명 및 다루는 '깊이의 저주(Curse of Depth)' 개념을 소개합니다. 우리는 먼저 Llama, Mistral, DeepSeek, Qwen과 같은 가장 인기 있는 LLM 패밀리 전반에 걸쳐 이 현상이 널리 존재함을 확인합니다. 이론적 및 경험적 분석을 통해, LLMs의 깊은 레이어의 비효율성의 근본적인 이유는 Pre-Layer Normalization(Pre-LN)의 널리 사용되는 것에서 비롯된다는 것을 확인합니다. Pre-LN은 Transformer LLMs의 훈련을 안정화시키지만, 모델의 깊이에 따라 출력 분산이 기하급수적으로 증가하여 깊은 Transformer 블록의 도함수가 항등 행렬이 되어 훈련에 거의 기여하지 않게 됩니다. 이 훈련 상의 함정을 해결하기 위해, 우리는 LayerNorm Scaling을 제안합니다. 이는 레이어 정규화의 출력 분산을 깊이의 제곱근으로 역으로 조절하는 것입니다. 이 간단한 수정은 더 깊은 Transformer 레이어의 출력 분산 폭발을 완화시키고, 그들의 기여를 향상시킵니다. 130M에서 1B까지의 모델 크기를 포함하는 실험 결과는, LayerNorm Scaling이 Pre-LN에 비해 LLM 사전 훈련 성능을 크게 향상시킨다는 것을 보여줍니다. 게다가, 이 개선은 감독된 세밀 조정에도 원활하게 이어집니다. 이 모든 이득은 LayerNorm Scaling이 깊은 레이어가 훈련 중에 더 효과적으로 기여할 수 있도록 한다는 사실로 설명할 수 있습니다.
English
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.Summary
AI-Generated Summary