arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2305.04749cs.CLcs.CV
收藏

Toeplitz神经网络用于序列建模

Toeplitz Neural Network for Sequence Modeling

Shanghai AI Laboratory(上海人工智能实验室);SenseTime Research(商汤科技研究院);Australian National University(澳大利亚国立大学);Northwestern Polytechnical University(西北工业大学);The University of Hong Kong(香港大学)

Zhen Qin, Xiaodong Han, Weixuan Sun, Bowen He, Dong Li, Dongxu Li, Yuchao Dai, Lingpeng Kong, Yiran Zhong

AI总结:

本文提出Toeplitz神经网络,利用相对位置编码的Toeplitz矩阵和对数线性复杂度,实现高效长序列建模,在多项任务上性能优于Transformer。

摘要:

序列建模在自然语言处理和计算机视觉中具有重要应用。近年来,基于Transformer的模型在各种序列建模任务上表现出强大的性能,这些模型依赖注意力机制来捕获成对的标记关系,并通过位置嵌入来注入位置信息。尽管性能良好,但Transformer模型在扩展到长输入序列时效率低下,主要原因是注意力机制的二次方空间-时间复杂度。为了克服这一低效问题,我们提出使用相对位置编码的Toeplitz矩阵对序列进行建模,并利用Toeplitz矩阵-向量乘积技巧将序列建模的空间-时间复杂度降低到对数线性。我们提出了一种轻量子网络,称为相对位置编码器,以固定参数预算生成相对位置系数,使所提出的Toeplitz神经网络能够处理不同长度的序列。此外,尽管模型在512个标记的序列上训练,但在推理时可以将输入序列长度外推到14K个标记,并保持一致的性能。在自回归和双向语言建模、图像建模以及具有挑战性的Long-Range Arena基准上的大量实验表明,我们的方法在大多数下游任务上取得了优于竞争对手的性能,同时速度显著更快。代码可在https://github.com/OpenNLPLab/Tnn获取。

英文摘要:

Sequence modeling has important applications in natural language processing and computer vision. Recently, the transformer-based models have shown strong performance on various sequence modeling tasks, which rely on attention to capture pairwise token relations, and position embedding to inject positional information. While showing good performance, the transformer models are inefficient to scale to long input sequences, mainly due to the quadratic space-time complexity of attention. To overcome this inefficiency, we propose to model sequences with a relative position encoded Toeplitz matrix and use a Toeplitz matrix-vector production trick to reduce the space-time complexity of the sequence modeling to log linear. A lightweight sub-network called relative position encoder is proposed to generate relative position coefficients with a fixed budget of parameters, enabling the proposed Toeplitz neural network to deal with varying sequence lengths. In addition, despite being trained on 512-token sequences, our model can extrapolate input sequence length up to 14K tokens in inference with consistent performance. Extensive experiments on autoregressive and bidirectional language modeling, image modeling, and the challenging Long-Range Arena benchmark show that our method achieves better performance than its competitors in most downstream tasks while being significantly faster. The code is available at https://github.com/OpenNLPLab/Tnn.

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

↑