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

基于随机浮点采样的位置编码增强变换器的长度泛化能力

Position Encoding with Random Float Sampling Enhances Length Generalization of Transformers

Daiwa Securities(大和证券);The University of Tokyo(东京大学)

Atsushi Shimizu, Shohei Taniguchi, Yutaka Matsuo

AI总结:

本研究提出随机浮点采样方法,通过增强位置编码的泛化能力,提升变换器在长序列处理和常识推理任务中的表现。

摘要:

长度泛化是语言模型在预训练过程中未见过的输入长度上保持性能的能力。在本工作中,我们引入了一种简单而强大的位置编码(PE)策略,即随机浮点采样(RFS),该策略在预训练或微调过程中未见过的长度上泛化效果良好。具体而言,而不是从预定义的离散集合中选择位置索引,RFS使用随机采样的连续值,从而通过在训练过程中使模型接触多样化的索引来避免未见过的长度上的分布外(OOD)问题。由于将索引分配给令牌是广泛使用的PE中常见的基本过程,RFS的优势可以轻松地融入,例如绝对正弦编码、RoPE和ALiBi中。实验通过显示RFS在长度泛化任务以及零样本常识推理基准上的优越性能来证实其有效性。

英文摘要:

Length generalization is the ability of language models to maintain performance on inputs longer than those seen during pretraining. In this work, we introduce a simple yet powerful position encoding (PE) strategy, Random Float Sampling (RFS), that generalizes well to lengths unseen during pretraining or fine-tuning. In particular, instead of selecting position indices from a predefined discrete set, RFS uses randomly sampled continuous values, thereby avoiding out-of-distribution (OOD) issues on unseen lengths by exposing the model to diverse indices during training. Since assigning indices to tokens is a common and fundamental procedure in widely used PEs, the advantage of RFS can easily be incorporated into, for instance, the absolute sinusoidal encoding, RoPE, and ALiBi. Experiments corroborate its effectiveness by showing that RFS results in superior performance in length generalization tasks as well as zero-shot commonsense reasoning benchmarks.

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

↑