通过识别模型安全能力缺口,精准挑选高价值安全样本提升微调安全性
DataRx: Missingness-Aware Sampling for Safer Large Language Model Task-Specific Fine-Tuning

- 基于隐藏层表示差异,识别模型缺失的安全信号
- 仅用1%额外数据,攻击成功率从59.23%降至13.70%
- 适合关注模型安全微调的研究者与实践者
任务特定微调可提升大语言模型在下游任务的表现,但研究发现其会削弱对齐模型的安全防护。当前主流方法是引入安全数据,但随机混合效果有限,且缺乏有效筛选机制。本文提出DataRx,一种基于缺失感知的采样方法,核心思想是选择能填补模型安全能力空白的样本。该方法利用高维隐藏表示,而非离散词元,量化目标模型原响应与安全参考响应之间的安全信号差距。实验表明,在仅增加1%来自BeaverTails的安全样本条件下,DataRx将Llama3-8B-Instruct在七个下游任务上的平均攻击成功率从59.23%降至13.70%。此外,DataRx可与现有安全数据合成方法结合,进一步增强防御能力。我们希望该工作能推动以数据为中心的安全防御研究。
原文摘要 · Abstract (English)
Task-specific fine-tuning can improve the performance of large language models (LLMs) on downstream tasks. However, our study reveals that task-specific fine-tuning can also weaken the safety guardrails of aligned LLMs. A widely adopted strategy for preserving safety during fine-tuning is to incorporate safety data. Although previous studies have shown that randomly mixing safety data can alleviate safety degradation, the underlying principle determining why some safety examples are more effective than others still remains unclear. In this paper, we propose DataRx, a missingness-aware sampling method for selecting safety-critical examples. DataRx is based on the hypothesis that a safety sample is more effective when the selected examples provide safety signals that fill the missing parts of LLMs' safety capabilities. DataRx's key insight is leveraging high-dimensional hidden representations rather than discrete tokens to quantify the safety signal gap between the target model's native response and the safety reference response. The results show that, with only 1% additional safety samples from BeaverTails, DataRx reduces the average attack success rate of Llama3-8B-Instruct across seven downstream tasks from 59.23% under random sampling to 13.70%. In addition, DataRx can be combined with the existing safety data synthesis method to further enhance safety defenses during fine-tuning. We hope that DataRx will inspire more data-centric defense research.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。