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

超越单任务:面向大语言模型的鲁棒多任务长度泛化

Beyond Single-Task: Robust Multi-Task Length Generalization for LLMs

Institute for Artificial Intelligence, Peking University(北京大学人工智能研究院);Xiaohongshu Inc.(小红书公司)

Yi Hu, Shijia Kang, Haotong Yang, Haotian Xu, Muhan Zhang

AI总结:

针对现有LLM长度泛化方法多局限于单任务、易损害通用性能的问题,本文提出Meta-RFFT框架,构建含86类任务的数据集,实现跨任务鲁棒长度泛化,32B模型在30位加法任务上准确率达95%,超越671B级SOTA模型。

摘要:

长度泛化,即解决比训练期间所遇问题更长的问题的能力,仍是大语言模型(LLMs)面临的一项关键挑战。已有研究通过修改位置编码(PEs)和数据格式来提升加法、排序等特定符号任务上的长度泛化能力,但这些方法从根本上受限于特殊任务,往往会降低通用语言性能。此外,这类方法通常在针对单任务从头训练的小型Transformer上进行评估,应用于具备通用能力的实用LLM的后训练阶段时,可能导致性能下降。Hu等人(2024)提出了规则遵循微调(Rule-Following Fine-Tuning, RFFT),用于在LLM的后训练阶段提升长度泛化能力。尽管RFFT与实用模型兼容且性能优异,但它同样是针对单任务提出的,需要为每个单独任务使用大量示例重新训练。本文研究多任务场景下的长度泛化问题,并提出元规则遵循微调(Meta Rule-Following Fine-Tuning, Meta-RFFT),这是首个实现鲁棒跨任务长度泛化的框架。作为第一项贡献,我们构建了一个大型长度泛化数据集,包含86项任务,涵盖代码执行、数字处理、符号推理与逻辑推理任务,超出了常见的加法或乘法任务范畴。其次,我们证明Meta-RFFT可实现跨任务长度泛化。在大量任务和实例上训练后,模型仅需极少微调或单样本提示,就能在未见过的任务上获得显著的长度泛化能力。例如,在1至5位加法上微调后,我们的32B模型在30位加法上达到95%的准确率,显著优于当前最优推理模型(DeepSeek-R1-671B:72%),尽管该任务在RF预训练期间从未出现过。

英文摘要:

Length generalization, the ability to solve problems longer than those seen during training, remains a critical challenge for large language models (LLMs). Previous work modifies positional encodings (PEs) and data formats to improve length generalization on specific symbolic tasks such as addition and sorting. However, these approaches are fundamentally limited to special tasks, often degrading general language performance. Furthermore, they are typically evaluated on small transformers trained from scratch on single tasks and can cause performance drop when applied during post-training stage of practical LLMs with general capabilities. Hu et al., (2024) proposed Rule-Following Fine-Tuning (RFFT) to improve length generalization in the post-training stage of LLMs. Despite its compatibility with practical models and strong performance, RFFT is proposed for single tasks too, requiring re-training for each individual task with extensive examples. In this paper, we study length generalization in multi-task settings and propose Meta Rule-Following Fine-Tuning (Meta-RFFT), the first framework enabling robust cross-task length generalization. As our first contribution, we construct a large length generalization dataset containing 86 tasks spanning code execution, number processing, symbolic and logical reasoning tasks, beyond the common addition or multiplication tasks. Secondly, we show that cross-task length generalization is possible with Meta-RFFT. After training on a large number of tasks and instances, the models achieve remarkable length generalization ability on unseen tasks with minimal fine-tuning or one-shot prompting. For example, after fine-tuning on 1 to 5 digit addition, our 32B model achieves 95% accuracy on 30 digit addition, significantly outperforming the state-of-the-art reasoning models (DeepSeek-R1-671B: 72%), despite never seeing this task during RF-pretraining.

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

↑