arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.08152cs.CL
收藏

带哨兵令牌的自回归Transformer上下文压缩

Context Compression for Auto-regressive Transformers with Sentinel Tokens

Shanghai Jiao Tong University(上海交通大学);University of Texas at Arlington(德克萨斯大学阿灵顿分校)

Siyu Ren, Qi Jia, Kenny Q. Zhu

AI总结:

针对Transformer注意力二次复杂度和长输入KV缓存问题,提出即插即用的上下文压缩方法,通过哨兵令牌增量压缩中间激活,降低内存与计算开销,并在流畅性、n-gram匹配和语义相似性上优于稀疏注意力基线。

摘要:

注意力模块的二次复杂度使其在基于Transformer的大语言模型生成过程中逐渐成为计算的主要部分。此外,处理长输入时产生的过多键值缓存也带来了内存占用和推理延迟方面的严重问题。在这项工作中,我们提出了一种即插即用的方法,能够增量地将指定令牌跨度内的中间激活压缩为紧凑形式,从而在处理后续上下文时减少内存和计算成本。在域内语言建模和零样本开放式文档生成上的实验表明,我们的方法在流畅性、n-gram匹配和语义相似性方面优于稀疏注意力基线。最后,我们全面分析了上下文压缩在提升系统吞吐量方面的益处。代码可在https://github.com/DRSY/KV_Compression获取。

英文摘要:

The quadratic complexity of the attention module makes it gradually become the bulk of compute in Transformer-based LLMs during generation. Moreover, the excessive key-value cache that arises when dealing with long inputs also brings severe issues on memory footprint and inference latency. In this work, we propose a plug-and-play approach that is able to incrementally compress the intermediate activation of a specified span of tokens into compact ones, thereby reducing both memory and computational cost when processing subsequent context. Experiments on both in-domain language modeling and zero-shot open-ended document generation demonstrate the advantage of our approach over sparse attention baselines in terms of fluency, n-gram matching, and semantic similarity. At last, we comprehensively profile the benefit of context compression on improving the system throughout. Code is available at https://github.com/DRSY/KV_Compression.

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

↑