调整指令微调中提示与响应的损失权重,提升模型泛化能力
On the Effect of Instruction Tuning Loss on Generalization
- 在损失函数中为提示和响应分别加权,改进传统仅对响应计算损失的方式
- 适度提高响应权重、降低提示权重能显著提升多任务表现和鲁棒性
- 适用于追求更强泛化能力的模型开发者及后续对齐训练研究者
指令微调已成为使预训练语言模型更好遵循用户指令的关键后训练范式。然而,针对损失函数的优化关注甚少。一个基本但常被忽视的问题是:传统的自回归目标(仅对响应词元计算损失,忽略提示词元)是否真正最优?本文系统研究了在指令微调损失中差异化加权提示与响应词元的影响,提出加权指令微调(WIT)作为更优替代方案。在五种不同家族与规模的语言模型、三个不同大小的微调数据集、五个多样化评估基准上进行广泛实验,结果表明标准指令微调损失常导致次优性能,且对输入提示变化的鲁棒性有限。发现提示词元低至中等权重、响应词元中等至高权重时,在各类设置下均表现最佳,并可作为后续偏好对齐训练的更优起点。这些发现强调需重新审视指令微调损失,为构建更鲁棒、更具泛化性的模型提供可操作洞见。代码已开源:https://github.com/kowndinya-renduchintala/WIT。
原文摘要 · Abstract (English)
Instruction Tuning has emerged as a pivotal post-training paradigm that enables pre-trained language models to better follow user instructions. Despite its significance, little attention has been given to optimizing the loss function used. A fundamental, yet often overlooked, question is whether the conventional auto-regressive objective - where loss is computed only on response tokens, excluding prompt tokens - is truly optimal for instruction tuning. In this work, we systematically investigate the impact of differentially weighting prompt and response tokens in instruction tuning loss, and propose Weighted Instruction Tuning (WIT) as a better alternative to conventional instruction tuning. Through extensive experiments on five language models of different families and scale, three finetuning datasets of different sizes, and five diverse evaluation benchmarks, we show that the standard instruction tuning loss often yields suboptimal performance and limited robustness to input prompt variations. We find that a low-to-moderate weight for prompt tokens coupled with a moderate-to-high weight for response tokens yields the best-performing models across settings and also serve as better starting points for the subsequent preference alignment training. These findings highlight the need to reconsider instruction tuning loss and offer actionable insights for developing more robust and generalizable models. Our code is open-sourced at https://github.com/kowndinya-renduchintala/WIT.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。