DataRx: Missingness-Aware Sampling for Safer Large Language Model Task-Specific Fine-Tuning

📄 arXiv: 2608.04322v1 📥 PDF

作者: Junbo Zhang, Qianli Zhou, Xinyang Deng, Wen Jiang

分类: cs.CL

发布日期: 2026-08-05


💡 一句话要点

提出DataRx以解决大语言模型任务特定微调中的安全性问题

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

关键词: 大语言模型 任务特定微调 安全性 数据采样 对抗性攻击 机器学习

📋 核心要点

  1. 现有的任务特定微调方法可能导致大语言模型的安全性下降,尤其是在安全数据的使用上存在不足。
  2. 本文提出的DataRx方法通过关注缺失性,选择能够有效填补LLMs安全能力缺口的安全示例,从而增强微调过程中的安全性。
  3. 实验结果显示,DataRx在仅增加1%安全样本的情况下,显著降低了模型的攻击成功率,展示了其有效性和潜力。

📝 摘要(中文)

任务特定微调可以提升大语言模型(LLMs)在下游任务中的表现。然而,我们的研究发现,任务特定微调也可能削弱已对齐LLMs的安全防护。虽然以往研究表明随机混合安全数据可以缓解安全性下降,但为何某些安全示例比其他示例更有效的原理仍不清楚。本文提出DataRx,一种关注缺失性的采样方法,用于选择安全关键示例。DataRx基于假设:当所选示例提供的安全信号填补了LLMs安全能力的缺失部分时,安全样本更有效。实验结果表明,仅需1%的额外安全样本,DataRx便能将Llama3-8B-Instruct在七个下游任务中的平均攻击成功率从59.23%降低至13.70%。

🔬 方法详解

问题定义:本文旨在解决任务特定微调过程中大语言模型的安全性下降问题。现有方法在安全数据的混合使用上存在随机性,未能有效识别和利用最具安全性的示例。

核心思路:DataRx的核心思路是通过缺失性意识采样,选择那些能够填补模型安全能力缺口的安全示例。该方法基于高维隐藏表示而非离散标记,量化目标模型原生响应与安全参考响应之间的安全信号差距。

技术框架:DataRx的整体架构包括数据采样模块、信号量化模块和微调模块。首先,通过分析模型的安全能力缺失,选择合适的安全示例;然后,利用高维表示量化安全信号;最后,将选定的安全样本用于微调过程。

关键创新:DataRx的主要创新在于其缺失性意识采样策略,通过量化安全信号差距来选择安全示例,这与传统的随机混合方法本质上有所区别。

关键设计:在设计上,DataRx使用高维隐藏表示来捕捉安全信号,采用特定的损失函数来优化安全性,并在微调过程中结合已有的安全数据合成方法,以进一步增强安全防御。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,DataRx在仅增加1%安全样本的情况下,成功将Llama3-8B-Instruct在七个下游任务中的平均攻击成功率从59.23%降低至13.70%。这一显著的性能提升展示了DataRx在安全防护方面的有效性,值得在未来的研究中进一步探索。

🎯 应用场景

该研究的潜在应用领域包括大语言模型的安全性增强、自然语言处理任务的安全防护以及对抗性攻击的防御策略。通过优化微调过程中的安全数据选择,DataRx能够为实际应用提供更安全的模型,降低潜在风险,具有重要的实际价值和未来影响。

📄 摘要(原文)

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.