arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2108.12409cs.CL
收藏

训练短,测试长:线性偏置的注意力启用输入长度外推

Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation

Paul G. Allen School of Computer Science & Engineering, University of Washington(华盛顿大学保罗·G·艾伦计算机科学与工程学院);Facebook AI Research(脸书人工智能研究院);Allen Institute for AI(艾伦人工智能研究所)

Ofir Press, Noah A. Smith, Mike Lewis

摘要:

自Vaswani等人(2017)引入Transformer模型以来,一个基本问题尚未得到回答:对于比训练期间看到的更长的序列,模型如何在推理时间实现外推?我们首先表明,外推可以通过简单地改变位置表示方法,虽然我们发现,目前的方法不允许有效的外推。因此,我们引入了一种更简单,更有效的位置方法,注意力与线性偏差(ALiBi)。ALiBi不会在词嵌入中添加位置嵌入;相反,它会对查询键的注意力分数施加与距离成比例的惩罚。我们证明了这种方法在长度为1024的输入序列上训练了一个13亿参数的模型,该模型外推到长度为2048的输入序列,实现了与在长度为2048的输入上训练的正弦位置嵌入模型相同的困惑,但训练速度快了11%,使用的内存少了11%。ALiBi对近因的归纳偏见也使其在WikiText-103基准测试中优于多个强位置方法。

英文摘要:

Since the introduction of the transformer model by Vaswani et al. (2017), a fundamental question has yet to be answered: how does a model achieve extrapolation at inference time for sequences that are longer than it saw during training? We first show that extrapolation can be enabled by simply changing the position representation method, though we find that current methods do not allow for efficient extrapolation. We therefore introduce a simpler and more efficient position method, Attention with Linear Biases (ALiBi). ALiBi does not add positional embeddings to word embeddings; instead, it biases query-key attention scores with a penalty that is proportional to their distance. We show that this method trains a 1.3 billion parameter model on input sequences of length 1024 that extrapolates to input sequences of length 2048, achieving the same perplexity as a sinusoidal position embedding model trained on inputs of length 2048 but training 11% faster and using 11% less memory. ALiBi's inductive bias towards recency also leads it to outperform multiple strong position methods on the WikiText-103 benchmark.

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

↑