Attention Is All You Need But You Don't Need All Of It For Inference of Large Language Models

Georgy Tyukin, Gbetondji J-S Dovonon, Jean Kaddour, Pasquale Minervini
7/22/2024
cs.LGcs.CL

No confident code implementation found for this paper. 3 possible matches can be shown below.

Abstract

The inference demand for LLMs has skyrocketed in recent months, and serving models with low latencies remains challenging due to the quadratic input length complexity of the attention layers. In this work, we investigate the effect of dropping MLP and attention layers at inference time on the performance of Llama-v2 models. We find that dropping dreeper attention layers only marginally decreases performance but leads to the best speedups alongside dropping entire layers. For example, removing 33\% of attention layers in a 13B Llama2 model results in a 1.8\% drop in average performance over the OpenLLM benchmark. We also observe that skipping layers except the latter layers reduces performances for more layers skipped, except for skipping the attention layers.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 3 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{tyukin2024attention,
  title  = {Attention Is All You Need But You Don't Need All Of It For Inference of Large Language Models},
  author = {Georgy Tyukin and Gbetondji J-S Dovonon and Jean Kaddour and Pasquale Minervini},
  year   = {2024},
  eprint = {2407.15516},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.15516v1}
}

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/2407.15516.svg)](https://codeofpaper.com/paper/2407.15516)

Discussion