Dynamic layer selection in decoder-only transformers

Theodore Glavas, Joud Chataoui, Florence Regol, Wassim Jabbour, Antonios Valkanas +2 more
10/26/2024
cs.CLcs.LG

No official code found. Best implementation: networkslab/enlsp_neurips24 (1 star, last commit 2024-10-25).

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.

View on arXivView PDF

Code Implementations(1)

Autoregressive Decoding with Adaptive Layer Skipping

11PythonSep 15, 20241 years ago

Similar Papers

Cite this paper

@article{glavas2024dynamic,
  title  = {Dynamic layer selection in decoder-only transformers},
  author = {Theodore Glavas and Joud Chataoui and Florence Regol and Wassim Jabbour and Antonios Valkanas and Boris N. Oreshkin and Mark Coates},
  year   = {2024},
  eprint = {2410.20022},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.20022v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.20022.svg)](https://codeofpaper.com/paper/2410.20022)

Discussion