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.


翻译:长度泛化是指语言模型在处理比预训练时所见更长的输入时保持性能的能力。本研究提出了一种简单而有效的位置编码策略——随机浮点数采样,该策略能够很好地泛化到预训练或微调阶段未见过的长度。具体而言,RFS不使用预定义的离散集合中的位置索引,而是采用随机采样的连续值,通过在训练过程中让模型接触多样化的索引,从而避免在未见长度上出现分布外问题。由于为词元分配索引是广泛使用的位置编码方法中常见且基础的操作,RFS的优势可以轻松融入诸如绝对正弦编码、RoPE和ALiBi等编码方案。实验证实了该方法的有效性,结果表明RFS在长度泛化任务以及零样本常识推理基准测试中均取得了更优的性能。

0
下载
关闭预览

相关内容

【CMU博士论文】深度学习中泛化的量化、理解与改进
专知会员服务
21+阅读 · 2025年10月11日
深度学习中泛化的量化、理解与改进
专知会员服务
17+阅读 · 2025年9月13日
【CMU博士论文】长度可外推的Transformer,149页pdf
专知会员服务
27+阅读 · 2024年6月30日
【博士论文】基于信息论的泛化理论方法,274页pdf
专知会员服务
54+阅读 · 2024年6月3日
【博士论文】信息论视角下的泛化理论方法,274页pdf
专知会员服务
51+阅读 · 2024年4月28日
Transformer的无限之路:位置编码视角下的长度外推综述
专知会员服务
44+阅读 · 2024年1月17日
最新综述:速览Transformer长文本建模研究进展
专知会员服务
46+阅读 · 2023年3月15日
【ICML2021】具有线性复杂度的Transformer的相对位置编码
专知会员服务
25+阅读 · 2021年5月20日
迁移学习在深度学习中的应用
专知
24+阅读 · 2017年12月24日
国家自然科学基金
43+阅读 · 2015年12月31日
国家自然科学基金
23+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
最新内容
2025年大语言模型进展报告
专知会员服务
9+阅读 · 4月25日
多智能体协作机制
专知会员服务
8+阅读 · 4月25日
非对称优势:美海军开发低成本反无人机技术
专知会员服务
9+阅读 · 4月25日
《美战争部小企业创新研究(SBIR)计划》
专知会员服务
8+阅读 · 4月25日
《军事模拟:将军事条令与目标融入AI智能体》
专知会员服务
12+阅读 · 4月25日
【NTU博士论文】3D人体动作生成
专知会员服务
9+阅读 · 4月24日
以色列军事技术对美国军力发展的持续性赋能
专知会员服务
9+阅读 · 4月24日
《深度强化学习在兵棋推演中的应用》40页报告
专知会员服务
16+阅读 · 4月24日
《多域作战面临复杂现实》
专知会员服务
13+阅读 · 4月24日
《印度的多域作战:条令与能力发展》报告
专知会员服务
6+阅读 · 4月24日
相关基金
国家自然科学基金
43+阅读 · 2015年12月31日
国家自然科学基金
23+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员