arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.17698cs.LGcs.AI
收藏

MEP:多核学习增强相对位置编码长度外推

MEP: Multiple Kernel Learning Enhancing Relative Positional Encoding Length Extrapolation

Weiguo Gao

AI总结:

针对Transformer长度外推问题,提出MEP相对位置编码方法,通过加权平均结合多种核函数生成注意力偏置惩罚,无参数和参数化变体均实现SOTA性能。

摘要:

当预测序列长度超过训练时所见长度时,Transformer的推理准确度会下降。现有的相对位置编码方法(如基于ALiBi技术的方法)仅通过实现单一核函数来解决长度外推挑战,该函数根据距离为每个softmax后的注意力分数引入恒定偏置。这些方法未研究或采用多核函数应对外推挑战。借鉴ALiBi方法,本研究提出一种新颖的相对位置编码方法MEP,采用加权平均结合不同核函数(如指数核和高斯核)生成偏置并应用于softmax后的注意力分数。该框架首先利用多种核函数构建多个核函数,每个核函数遵循一致的平均权重系数,利用不同核的协同优势构建创新偏置函数。随后为每个核函数设定特定斜率,以不同速率施加惩罚,增强模型外推能力。最后将此偏置作为惩罚无缝融入softmax后的分数。我们提出两种版本:无需新可学习参数的无参数变体,在不影响训练效率下增强长度外推能力;以及能集成前沿技术的参数化变体。跨多数据集的实证评估表明,两种变体均达到SOTA性能,超越传统无参数和参数化方法。

英文摘要:

When the predicted sequence length exceeds the length seen during training, the transformer's inference accuracy diminishes. Existing relative position encoding methods, such as those based on the ALiBi technique, address the length extrapolation challenge exclusively through the implementation of a single kernel function, which introduces a constant bias to every post-softmax attention scores according to their distance. These approaches do not investigate or employ multiple kernel functions to address the extrapolation challenge. Drawing on the ALiBi approach, this study proposes a novel relative positional encoding method, called MEP, which employs a weighted average to combine distinct kernel functions(such as the exponential kernel and the Gaussian kernel) to generate a bias that is applied to post-softmax attention scores. Initially, the framework utilizes various kernel functions to construct multiple kernel functions. Each kernel function adheres to a consistent mean weight coefficient, harnessing the synergistic advantages of different kernels to formulate an innovative bias function. Subsequently, specific slopes are tailored for each kernel function, applying penalties at varying rates, to enhance the model's extrapolation capabilities. Finally, this bias is seamlessly incorporated as a penalty to the post-softmax scores. We present two distinct versions of our method: a parameter-free variant that requires no new learnable parameters, which enhances length extrapolation capabilities without compromising training efficiency, and a parameterized variant capable of integrating state-of-the-art techniques. Empirical evaluations across diverse datasets have demonstrated that both variants of our method achieve state-of-the-art performance, outperforming traditional parameter-free and parameterized approaches.

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

↑