Skip to main content
QUICK REVIEW

[论文解读] Safety-Tuned LLaMAs: Lessons From Improving the Safety of Large Language Models that Follow Instructions

Federico Bianchi, Mirac Süzgün|arXiv (Cornell University)|Sep 14, 2023
Natural Language Processing Techniques被引用 11
一句话总结

论文显示,在指令微调过程中加入少量以安全为焦点的示范显著提升开源 LLaMA/Falcon 模型的安全性,对标准基准影响很小,而过多的安全数据可能导致安全性过度抬高和拒绝无害提示。

ABSTRACT

Training large language models to follow instructions makes them perform better on a wide range of tasks and generally become more helpful. However, a perfectly helpful model will follow even the most malicious instructions and readily generate harmful content. In this paper, we raise concerns over the safety of models that only emphasize helpfulness, not harmlessness, in their instruction-tuning. We show that several popular instruction-tuned models are highly unsafe. Moreover, we show that adding just 3% safety examples (a few hundred demonstrations) when fine-tuning a model like LLaMA can substantially improve its safety. Our safety-tuning does not make models significantly less capable or helpful as measured by standard benchmarks. However, we do find exaggerated safety behaviours, where too much safety-tuning makes models refuse perfectly safe prompts if they superficially resemble unsafe ones. As a whole, our results illustrate trade-offs in training LLMs to be helpful and training them to be safe.

研究动机与目标

  • 展示以安全为焦点的指令微调如何降低开源遵循指令的大型语言模型中的有害响应。
  • 研究安全数据的数量和类型如何影响模型的安全性和通用能力。
  • 确定潜在权衡,包括安全性被夸大与提示框架效应。
  • 提供数据集与评估流程,便于对大型语言模型进行可重复的安全评估。

提出的方法

  • 通过使用 GPT-3.5-turbo 将红队提问转换为安全的指令-应答对,构建一个安全聚焦的指令数据集。
  • 在基础的 Alpaca 清洗指令集中加入不同比例的安全数据(100、300、500、1000、1500、2000 条指令)。
  • 使用 LoRA 对 LLaMA 7B、LLaMA 13B 和 Falcon 7B 进行四轮微调,按验证损失选择检查点。
  • 设计覆盖恶意、具争议性、物理安全与夸大安全场景的安全评估数据集。
  • 通过有害性奖励模型、内容审核 API 和人工标注来评估安全性,并加上通用能力基准(AlpacaEval、LM Harness)。
  • 通过对比在“安全问题”与“安全指令”与“混合格式”上的训练,分析提示格式效应。

实验结果

研究问题

  • RQ1当遇到恶意提示时,开源指令微调的大型语言模型有多不安全?
  • RQ2在指令微调中增加安全示范是否在不伤害通用能力的前提下降低有害输出?
  • RQ3过多的安全数据(安全性夸大)对模型行为有哪些风险?
  • RQ4安全训练格式(指令、问题、混合)如何影响安全性和可用性?

主要发现

  • 在指令微调中加入的安全数据在奖励模型与内容审核指标下显著减少有害响应。
  • 在基础约 20k 的前提下,添加 500–1000 条安全指令可显著降低有害性且不降低标准基准。
  • 过多的安全数据(例如 2000 条安全指令)增加了安全性被夸大化的可能性,即模型甚至会拒绝安全的提示。
  • 训练中提示的表述方式(指令 vs. 提问 vs. 混合)显著影响安全结果,其中指令格式通常能产生更安全的回答。
  • 安全微调的模型在标准基准(AlpacaEval、LM Harness)上的总体表现,与非安全微调的基线相比保持相当。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。