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

具有键值存储器的线性化Transformer

Linearizing Transformer with Key-Value Memory

Meta AI;The Chinese University of Hong Kong(香港中文大学)

Yizhe Zhang, Deng Cai

摘要:

已经开发了具有线性时间复杂度的高效Transformer变体,以减轻普通Transformer的二次计算开销。其中有低秩投影方法,如Linformer和基于内核的Transformers。尽管它们具有独特的优点,但在许多序列生成任务上,它们通常遭受与vanilla Transformer相比的性能下降,并且在生成时间较短时通常无法获得计算增益。我们提出了MemSizer,一种缩小性能差距的方法,同时提高效率,即使是短世代。它将源序列投影到像Linformer这样的低维表示中,同时享受类似于基于内核的Transformers的高效递归式增量计算。这在推理时产生线性计算时间和恒定的内存复杂度。MemSizer还采用了轻量级的多头机制,使计算与单头模型一样轻。我们证明,MemSizer提供了一个改进的平衡效率和准确性的香草Transformer和其他有效的Transformer变种在三个典型的序列生成任务,包括机器翻译,抽象的文本摘要,语言建模。

英文摘要:

Efficient transformer variants with linear time complexity have been developed to mitigate the quadratic computational overhead of the vanilla transformer. Among them are low-rank projection methods such as Linformer and kernel-based Transformers. Despite their unique merits, they usually suffer from a performance drop comparing with the vanilla transformer on many sequence generation tasks, and often fail to obtain computation gain when the generation is short. We propose MemSizer, an approach towards closing the performance gap while improving the efficiency even with short generation. It projects the source sequences into lower dimension representations like Linformer, while enjoying efficient recurrent-style incremental computation similar to kernel-based transformers. This yields linear computation time and constant memory complexity at inference time. MemSizer also employs a lightweight multi-head mechanism which renders the computation as light as a single-head model. We demonstrate that MemSizer provides an improved balance between efficiency and accuracy over the vanilla transformer and other efficient transformer variants in three typical sequence generation tasks, including machine translation, abstractive text summarization, and language modeling.

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

↑