arXiv:2411.02688cs.CLcs.LG2024-11NeurIPS被引 10

微调导致大模型丢失上下文理解能力,新方法可有效保留。

On the Loss of Context-awareness in General Instruction Fine-tuning

  • 通过分析注意力分配变化,发现微调引发角色偏见
  • 在4个任务上验证,模型上下文感知力显著提升
  • 适合关注指令遵循与上下文理解平衡的研究者

预训练大语言模型需通过指令微调(SFT)获得指令遵循能力,但此过程可能损害预训练阶段习得的原有能力。本文研究指令微调后上下文感知力的损失问题,即模型从用户提供的上下文中提取并理解信息以作出响应的能力。研究发现,尤其在开源模型中,当输入提示应用聊天模板时,上下文感知力下降,其根源在于对话式指令微调过程中形成的对不同角色的偏好。通过可视化注意力分配变化及手动调控注意力头,证实该偏差源于训练样本与模型内部知识对齐,导致模型更依赖自身知识而非用户上下文生成正确回答。基于此,提出一种度量指标,用于识别通用指令微调数据集中具有上下文依赖性的样本,并采用带上下文依赖性指示器的条件指令微调,使模型在完成SFT后仍能保持上下文感知能力。在三个不同规模的预训练模型和四个上下文依赖性下游任务上的实验表明,该方法有效缓解了上下文感知力的损失,且未影响通用指令遵循能力。

原文摘要 · Abstract (English)

Pre-trained Large Language Models (LLMs) require post-training methods such as supervised fine-tuning (SFT) on instruction-response pairs to enable instruction following. However, this process can potentially harm existing capabilities learned during pre-training. In this paper, we investigate the loss of context awareness after SFT, where context awareness is defined as the ability to extract and understand information from user-provided context and respond accordingly. We identify and demonstrate that the loss of context awareness, particularly in open-source models, occurs in instruction fine-tuned LLMs when the chat template is applied to input prompts. We identify that the performance decline is associated with a bias toward different roles learned during conversational instruction fine-tuning. We demonstrate this correlation by visualizing changes in attention allocation after the chat template is applied and manually steering the attention heads. The bias can be learned from training examples that align with the model's internal knowledge and rely less on the user-provided context to generate correct responses. Based on these observations, we propose a metric to identify context-dependent examples from general instruction fine-tuning datasets. We then apply conditional instruction fine-tuning with a context-dependency indicator, enabling the model to preserve context awareness after SFT. Empirical experiments on four context-dependent downstream tasks and three pre-trained LLMs of different sizes show that our method effectively mitigates the loss of context awareness without compromising general instruction-following capabilities.

指令微调上下文感知注意力机制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。