Dynamic layer selection in decoder-only transformers
Authors:
- Theodore GlavasTGTheodore Glavas
- Joud ChataouiJCJoud Chataoui
- Florence RegolFRFlorence Regol
- Antonios ValkanasAVAntonios Valkanas
- Boris N. OreshkinBOBoris N. Oreshkin
- Mark CoatesMCMark Coates
Preprint
Abstract
The vast size of Large Language Models (LLMs) has prompted a search to optimize inference. One effective approach is dynamic inference, which adapts the architecture to the sample-at-hand to reduce the overall computational cost. We empirically examine two common dynamic inference methods for natural language generation (NLG): layer skipping and early exiting. We find that a pre-trained decoder-only model is significantly more robust to layer removal via layer skipping, as opposed to early exit. We demonstrate the difficulty of using hidden state information to adapt computation on a per-token basis for layer skipping. Finally, we show that dynamic computation allocation on a per-sequence basis holds promise for significant efficiency gains by constructing an oracle controller. Remarkably, we find that there exists an allocation which achieves equal performance to the full model using only 23.3% of its layers on average.Keywords
All Related Versions
This publication has 3 references indexed in Scilit:
- Unlocking Efficiency in Large Language Model Inference: A Comprehensive Survey of Speculative Decoding2024
- A Comprehensive Survey on Model Quantization for Deep Neural Networks in Image ClassificationACM Transactions on Intelligent Systems and Technology, 2023
- Knapsack Problems: Algorithms and Computer ImplementationsJournal of the Operational Research Society, 1991