Fast Transformer Decoding: One Write-Head is All You Need
Noam Shazeer

TL;DR
This paper introduces multi-query attention, a variant of multi-head attention in Transformers, which shares keys and values across heads to significantly speed up incremental decoding with minimal quality loss.
Contribution
The paper proposes multi-query attention, reducing memory bandwidth during decoding and enabling faster inference without substantial accuracy compromise.
Findings
Decoding speed is significantly improved.
Minor quality degradation observed.
Memory bandwidth requirements are greatly reduced.
Abstract
Multi-head attention layers, as used in the Transformer neural sequence model, are a powerful alternative to RNNs for moving information across and between sequences. While training these layers is generally fast and simple, due to parallelizability across the length of the sequence, incremental inference (where such paralleization is impossible) is often slow, due to the memory-bandwidth cost of repeatedly loading the large "keys" and "values" tensors. We propose a variant called multi-query attention, where the keys and values are shared across all of the different attention "heads", greatly reducing the size of these tensors and hence the memory bandwidth requirements of incremental decoding. We verify experimentally that the resulting models can indeed be much faster to decode, and incur only minor quality degradation from the baseline.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
- 🤗bigcode/starcodermodel· 10k dl· ♡ 293210k dl♡ 2932
- 🤗tiiuae/falcon-40bmodel· 22k dl· ♡ 243322k dl♡ 2433
- 🤗bigcode/santacodermodel· 7.0k dl· ♡ 3357.0k dl♡ 335
- 🤗olivierdehaene/optimized-santacodermodel· 19 dl· ♡ 819 dl♡ 8
- 🤗mrm8488/santacoder-finetuned-the-stack-bash-shellmodel· 19 dl· ♡ 519 dl♡ 5
- 🤗muhtasham/santacoder-finetuned-the-stack-assemblymodel· 11 dl· ♡ 111 dl♡ 1
- 🤗mrm8488/santacoder-finetuned-the-stack-swiftmodel· 8 dl· ♡ 18 dl♡ 1
- 🤗muhtasham/santacoder-finetuned-the-stack-cobolmodel· 18 dl· ♡ 518 dl♡ 5
- 🤗mrm8488/santacoder-finetuned-the-stack-clojuremodel· 16 dl· ♡ 116 dl♡ 1
- 🤗tiiuae/falcon-7bmodel· 153k dl· ♡ 1099153k dl♡ 1099
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling · Natural Language Processing Techniques · Advanced Neural Network Applications
MethodsMulti-Query Attention · Linear Layer · Absolute Position Encodings · Position-Wise Feed-Forward Layer · Residual Connection · Byte Pair Encoding · Dense Connections · Label Smoothing · Softmax · Dropout
