Retentive Network:大型语言模型中 Transformer 的继任者

Retentive Network: A Successor to Transformer for Large Language Models

韦福如 Furu Wei · Microsoft Research Asia · 2023-07-17 · arXiv:2307.08621 ↗ · 被引 696

打开互动全文版(逐段中英对照 + 图/公式 + 论文问答)→

摘要 · Abstract

在这项工作中,我们提出 Retentive Network(RetNet)作为大型语言模型的基础架构,同时实现了训练并行性、低成本推理和良好性能。我们从理论上推导了循环和注意力之间的联系。然后,我们提出了用于序列建模的保留机制,该机制支持三种计算范式,即并行、循环和分块循环。具体来说,并行表示允许训练并行性。循环表示实现了低成本的 O(1)推理,在不牺牲性能的情况下提高了解码吞吐量、延迟和 GPU 内存。分块循环表示以线性复杂度实现高效的长序列建模,其中每个块并行编码,同时循环汇总块。语言建模的实验结果表明,RetNet 实现了良好的扩展结果、并行训练、低成本部署和高效推理。这些有趣的特性使 RetNet 成为大型语言模型中 Transformer 的有力继任者。代码将在 https://aka.ms/retnet 提供。

In this work, we propose Retentive Network (RetNet) as a foundation architecture for large language models, simultaneously achieving training parallelism, low-cost inference, and good performance. We theoretically derive the connection between recurrence and attention. Then we propose the retention mechanism for sequence modeling, which supports three computation paradigms, i.e., parallel, recurrent, and chunkwise recurrent. Specifically, the parallel representation allows for training parallelism. The recurrent representation enables low-cost $O(1)$ inference, which improves decoding throughput, latency, and GPU memory without sacrificing performance. The chunkwise recurrent representation facilitates efficient long-sequence modeling with linear complexity, where each chunk is encoded parallelly while recurrently summarizing the chunks. Experimental results on language modeling show that RetNet achieves favorable scaling results, parallel training, low-cost deployment, and efficient inference. The intriguing properties make RetNet a strong successor to Transformer for large language models. Code will be available at https://aka.ms/retnet.

核心贡献 · Key contributions

局限 · Limitations

论文章节 · Sections(共 16)

阅读逐段中英对照全文 →