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

长序列建模中的注意力张量化:从序列学习到张量学习

Long Sequence Modeling with Attention Tensorization: From Sequence to Tensor Learning

Yale University(耶鲁大学)

Aosong Feng, Rex Ying, Leandros Tassiulas

AI总结:

本文提出注意力张量化方法,通过将长序列转化为张量并在各维度上应用注意力,扩展注意力感受野,提高长序列建模效率,实验表明该方法可高效适配预训练大模型并实现显著加速。

摘要:

随着处理扩展文本数据的需求不断增长,处理长距离依赖并保持计算效率的能力比以往任何时候都更为关键。使用基于注意力的模型进行长序列建模的一个关键问题是,全注意力的有限范围建模能力与输入序列中的长距离标记依赖之间的不匹配。在这项工作中,我们提出通过将长输入序列张量化为紧凑的张量表示,然后在每个变换维度上进行注意力操作,来扩大注意力的感受野。由此产生的张量化注意力可以作为高效的Transformer骨干,以扩展输入上下文长度,同时提高内存和时间效率。我们表明,所提出的注意力张量化将标记依赖编码为多跳注意力过程,并且等价于全注意力的Kronecker分解。大量实验表明,张量化注意力可用于适配预训练的大语言模型,并提高效率。值得注意的是,使用张量化的Llama-8B在32,768上下文长度下进行训练,在推理过程中可以稳定地外推到128k长度,与使用FlashAttention-2的全注意力相比,实现了11倍的速度提升。

英文摘要:

As the demand for processing extended textual data grows, the ability to handle long-range dependencies and maintain computational efficiency is more critical than ever. One of the key issues for long-sequence modeling using attention-based model is the mismatch between the limited-range modeling power of full attention and the long-range token dependency in the input sequence. In this work, we propose to scale up the attention receptive field by tensorizing long input sequences into compact tensor representations followed by attention on each transformed dimension. The resulting Tensorized Attention can be adopted as efficient transformer backbones to extend input context length with improved memory and time efficiency. We show that the proposed attention tensorization encodes token dependencies as a multi-hop attention process, and is equivalent to Kronecker decomposition of full attention. Extensive experiments show that tensorized attention can be used to adapt pretrained LLMs with improved efficiency. Notably, Llama-8B with tensorization is trained under 32,768 context length and can steadily extrapolate to 128k length during inference with $11\times$ speedup, compared to full attention with FlashAttention-2.

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

↑