arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1911.02150cs.NEcs.CLcs.LG
收藏

快速Transformer解码:只需一个Write-Head

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

Google(谷歌)

Noam Shazeer

摘要:

在Transformer神经序列模型中使用的多头注意力层是RNN的一个强大的替代方案,用于在序列之间移动信息。虽然训练这些层通常是快速和简单的,由于跨序列长度的并行化,增量推理(这种并行化是不可能的)通常是缓慢的,由于重复加载大的“键”和“值”张量的内存带宽成本。我们提出了一种称为多查询注意力的变体,其中键和值在所有不同的注意力“头”之间共享,大大减少了这些张量的大小,从而减少了增量解码的内存带宽要求。我们通过实验验证,由此产生的模型确实可以更快地解码,并且只会导致基线的轻微质量下降。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑