ChatPaper.aiChatPaper

De Vloek van Diepte in Grote Taalmodellen

The Curse of Depth in Large Language Models

February 9, 2025
Auteurs: Wenfang Sun, Xinyuan Song, Pengxiang Li, Lu Yin, Yefeng Zheng, Shiwei Liu
cs.AI

Samenvatting

In dit paper introduceren we de Vloek van Diepte, een concept dat de recente observatie in moderne Grote Taalmodellen (LLMs) benadrukt, verklaart en aanpakt, waar bijna de helft van de lagen minder effectief is dan verwacht. We bevestigen eerst het wijdverspreide bestaan van dit fenomeen over de meest populaire families van LLMs zoals Llama, Mistral, DeepSeek en Qwen. Onze analyse identificeert theoretisch en empirisch dat de onderliggende reden voor de ineffectiviteit van diepe lagen in LLMs het veelvuldige gebruik van Pre-Layer Normalization (Pre-LN) is. Terwijl Pre-LN het trainen van Transformer LLMs stabiliseert, groeit de outputvariatie exponentieel met de modeldiepte, wat ongewenst leidt tot de afgeleide van de diepe Transformer blokken als een identiteitsmatrix, en daardoor nauwelijks bijdraagt aan de training. Om dit trainingsstruikelblok op te lossen, stellen we LayerNorm Scaling voor, dat de variatie van de output van de laagnormalisatie omgekeerd schaalt met de vierkantswortel van de diepte. Deze eenvoudige aanpassing vermindert de outputvariatie-explosie van diepere Transformerlagen, waardoor hun bijdrage verbetert. Onze experimentele resultaten, variërend van modelgroottes van 130M tot 1B, tonen aan dat LayerNorm Scaling de prestaties van LLM-vooraftraining aanzienlijk verbetert in vergelijking met Pre-LN. Bovendien draagt deze verbetering naadloos over naar begeleid fijnafstemmen. Al deze voordelen kunnen worden toegeschreven aan het feit dat LayerNorm Scaling diepere lagen in staat stelt om effectiever bij te dragen tijdens de training.
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

PDF395February 11, 2025