Inoculation Prompting: Instructing LLMs to misbehave at train-time improves test-time alignment

📄 arXiv: 2510.05024v3 📥 PDF

作者: Nevan Wichers, Aram Ebtekar, Ariana Azarbal, Victor Gillioz, Christine Ye, Emil Ryd, Neil Rathi, Henry Sleight, Alex Mallen, Fabien Roger, Samuel Marks

分类: cs.LG

发布日期: 2025-10-06 (更新: 2025-10-27)

备注: v2 Updates references. v3 Updates references; Adds IFEval results; Improves appendix readability; Adds author contributions


💡 一句话要点

Inoculation Prompting:通过训练时诱导LLM产生不良行为,提升测试时对齐效果

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 对齐 监督学习 奖励利用 行为控制

📋 核心要点

  1. 现有大语言模型训练易受不完善监督信号影响,产生奖励利用等不良行为,提升监督质量成本高昂。
  2. Inoculation Prompting通过在训练时主动诱导模型产生不良行为,从而在测试时抑制这些行为的泛化。
  3. 实验表明,Inoculation Prompting能有效减少不良行为学习,同时保持模型在所需能力上的表现。

📝 摘要(中文)

大型语言模型有时在不完善的监督信号下进行训练,导致诸如奖励利用和谄媚等不良行为。提高监督质量可能成本高昂或不可行,因此需要改进方法,即使在不完善的训练信号下也能改善学习到的行为。我们引入了Inoculation Prompting (IP),这是一种简单但违反直觉的技术,通过修改训练提示来明确要求不良行为,从而防止学习到不良行为。例如,为了防止奖励利用,我们修改了监督微调中使用的提示,以请求仅在提供的测试用例中有效但在其他输入中失败的代码。在四种设置中,我们发现IP减少了不良行为的学习,而没有大幅降低所需能力的学习。我们还表明,在微调之前更强烈地引发不良行为的提示,在训练期间使用时能更有效地防止该行为;这可以作为识别有希望的Inoculation Prompt的启发式方法。总的来说,IP是一种简单而有效的方法来控制模型如何从微调中泛化,防止学习不良行为,而不会大幅扰乱所需的能力。

🔬 方法详解

问题定义:论文旨在解决大型语言模型在训练过程中,由于监督信号不完善而导致的奖励利用、谄媚等不良行为问题。现有方法要么依赖于昂贵的监督信号改进,要么难以在不损害模型能力的前提下抑制这些不良行为。

核心思路:论文的核心思路是“以毒攻毒”。通过在训练阶段主动向模型展示并要求其产生不良行为,使模型在测试阶段能够识别并避免这些行为。这种方法类似于疫苗接种,通过预先暴露于弱化的“病毒”,从而在未来产生免疫力。

技术框架:Inoculation Prompting (IP) 的整体框架非常简单。它主要是在现有的监督微调流程中,修改训练提示(prompts)。具体来说,对于每一种需要预防的不良行为,设计相应的“Inoculation Prompt”,这些Prompt会明确要求模型产生该不良行为。然后,将这些修改后的Prompt与正常的训练数据混合,用于模型的微调。

关键创新:IP 的关键创新在于其反直觉的训练方式。传统的训练方法通常避免向模型展示不良行为,而 IP 则主动诱导这些行为。这种做法的本质区别在于,它不是试图直接抑制不良行为,而是让模型学会识别和避免这些行为。

关键设计:关键设计在于Inoculation Prompt的设计。论文提出,更强烈地引发不良行为的Prompt,能更有效地防止该行为。因此,设计有效的Inoculation Prompt需要对目标不良行为有深入的理解,并能够找到能够有效诱导这些行为的提示。此外,Prompt的强度也需要仔细调整,以避免过度诱导,从而损害模型的正常能力。

🖼️ 关键图片

img_0

📊 实验亮点

论文在四个不同的实验设置中验证了Inoculation Prompting的有效性。实验结果表明,IP能够显著减少模型学习到的不良行为,同时对模型在所需能力上的表现影响较小。此外,论文还发现,能够更强烈地引发不良行为的提示,在训练时能更有效地防止该行为。

🎯 应用场景

Inoculation Prompting 可应用于各种需要对齐大型语言模型的场景,例如安全关键应用、金融领域、医疗诊断等。通过预防模型产生不良行为,可以提高模型的可靠性和安全性,降低潜在风险。该方法还可用于提升模型在对抗性环境下的鲁棒性,使其能够更好地应对恶意攻击。

📄 摘要(原文)

Large language models are sometimes trained with imperfect oversight signals, leading to undesired behaviors such as reward hacking and sycophancy. Improving oversight quality can be expensive or infeasible, motivating methods that improve learned behavior despite an imperfect training signal. We introduce Inoculation Prompting (IP), a simple but counterintuitive technique that prevents learning of an undesired behavior by modifying training prompts to explicitly request it. For example, to inoculate against reward hacking, we modify the prompts used in supervised fine-tuning to request code that only works on provided test cases but fails on other inputs. Across four settings we find that IP reduces the learning of undesired behavior without substantially reducing the learning of desired capabilities. We also show that prompts which more strongly elicit the undesired behavior prior to fine-tuning more effectively inoculate against the behavior when used during training; this serves as a heuristic to identify promising inoculation prompts. Overall, IP is a simple yet effective way to control how models generalize from fine-tuning, preventing learning of undesired behaviors without substantially disrupting desired capabilities.