ChatPaper.aiChatPaper

事前学習済みLLMにおける適応的レイヤースキッピング

Adaptive Layer-skipping in Pre-trained LLMs

March 31, 2025
著者: Xuan Luo, Weizhi Wang, Xifeng Yan
cs.AI

要旨

大規模言語モデル(LLM)におけるトークン生成を加速するため、様々なレイヤースキップ手法が提案されてきた。しかし、これらの手法は根本的な問いを見落としてきた。すなわち、異なるトークンの生成において、計算要求がどのように変化するのか、という点である。本研究では、FlexiDepthという手法を導入し、テキスト生成に使用するTransformerレイヤーの数を動的に調整する。プラグインルーターとアダプターを組み込むことで、FlexiDepthはLLMの元のパラメータを変更することなく、適応的なレイヤースキップを可能にする。Llama-3-8BモデルにFlexiDepthを導入した結果、32レイヤーのうち8レイヤーをスキップしながら、ベンチマーク性能を100%維持することができた。FlexiDepthを用いた実験結果は、LLMにおける計算要求がトークンの種類に応じて大きく変化することを示している。具体的には、反復的なトークンや固定フレーズの生成には少ないレイヤー数で済む一方、計算を伴うトークンや不確実性の高いトークンの生成にはより多くのレイヤーを必要とする。興味深いことに、この適応的な割り当てパターンは人間の直感と一致している。この分野の研究を推進するため、FlexiDepthとそのレイヤー割り当てパターンを記録したデータセットをオープンソースとして公開し、今後の探求に役立てる。
English
Various layer-skipping methods have been proposed to accelerate token generation in large language models (LLMs). However, they have overlooked a fundamental question: How do computational demands vary across the generation of different tokens? In this work, we introduce FlexiDepth, a method that dynamically adjusts the number of Transformer layers used in text generation. By incorporating a plug-in router and adapter, FlexiDepth enables adaptive layer-skipping in LLMs without modifying their original parameters. Introducing FlexiDepth to Llama-3-8B model achieves layer skipping of 8 layers out of 32, and meanwhile maintains the full 100\% benchmark performance. Experimental results with FlexiDepth demonstrate that computational demands in LLMs significantly vary based on token type. Specifically, generating repetitive tokens or fixed phrases requires fewer layers, whereas producing tokens involving computation or high uncertainty requires more layers. Interestingly, this adaptive allocation pattern aligns with human intuition. To advance research in this area, we open sourced FlexiDepth and a dataset documenting FlexiDepth's layer allocation patterns for future exploration.

Summary

AI-Generated Summary

PDF62April 3, 2025