HackerPapers

arXiv:1911.02150cs.NE

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

Noam Shazeer

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.

arXiv comments
Journal reference
DOI
Subjects
cs.NENeural and Evolutionary Computing cs.CLComputation and Language cs.LGMachine Learning

On Hacker News

Linked by 2 identifiable commenters in 2 comments across 1 thread, from Jul 2023 to Jul 2023. Found in 1 HN submission from May 2023 to May 2023. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments1 thread

  1. GPT-4 details leaked? 2 comments
    • >Autoregressive decoder inference is a severe bottleneck for Transformer models due to the memory bandwidth overhead from loading decoder weights and all attention keys and values at every decoding step (Shazeer, 2019; Pope et al., 2022; de Jong et al., 2022). The memory…

      RC_ITRView on HNParent context

    • This is the original paper: https://arxiv.org/abs/1911.02150 . The idea is that with a transformer you have many heads, say 64 for LLaMa, and for each head you have 1 "query" vector one "key" vector and one "value" vector per token. Most of the cost of inferencing models is…

      why_only_15View on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.