arXiv:2502.13603cs.CLcs.AI2025-02被引 4

用少量数据低成本提升大模型抗越狱攻击能力

Efficient Safety Retrofitting Against Jailbreaking for LLMs

  • 基于DPO方法,仅用2000样本即可对齐安全偏好
  • 模型攻击成功率降低10%-30%,且在未见攻击风格上仍有效
  • 适用于主流大模型,适合关注安全对齐的研究者与开发者

直接偏好优化(DPO)是一种高效对齐技术,通过偏好数据引导大模型生成更优输出,无需显式奖励模型。本文研究DPO在对抗越狱攻击中的安全性,同时控制数据与训练成本。提出Egida数据集,涵盖27个安全主题和18种攻击方式,包含合成与人工标注。用于增强Llama-3.1-8B/70B-Instruct、Qwen-2.5-7B/72B-Instruct等先进模型的安全性。评估显示,经对齐后模型攻击成功率下降10%-30%,仅需2,000样本,计算成本低(8B模型约3美元,72B模型约20美元)。模型在未见主题与攻击风格下仍具泛化能力,最成功攻击成功率降至约5%。模型规模与架构显著影响其可安全对齐性,凸显预训练选择的重要性。作者还独立验证了人类偏好与Llama-Guard-3-8B的一致性,发布Egida-HSafe数据集。研究证明,利用DPO可低成本实现大模型安全增强,同时揭示其局限性。所有数据与模型均已开源。

原文摘要 · Abstract (English)

Direct Preference Optimization (DPO) is an efficient alignment technique that steers LLMs towards preferable outputs by training on preference data, bypassing the need for explicit reward models. Its simplicity enables easy adaptation to various domains and safety requirements. This paper examines DPO's effectiveness in model safety against jailbreaking attacks while minimizing data requirements and training costs. We introduce Egida, a dataset expanded from multiple sources, which includes 27 different safety topics and 18 different attack styles, complemented with synthetic and human labels. This data is used to boost the safety of state-of-the-art LLMs (Llama-3.1-8B/70B-Instruct, Qwen-2.5-7B/72B-Instruct) across topics and attack styles. In addition to safety evaluations, we assess their post-alignment performance degradation in general purpose tasks, and their tendency to over refusal. Following the proposed methodology, trained models reduce their Attack Success Rate by 10%-30%, using small training efforts (2,000 samples) with low computational cost (3\$ for 8B models, 20\$ for 72B models). Safety aligned models generalize to unseen topics and attack styles, with the most successful attack style reaching a success rate around 5%. Size and family are found to strongly influence model malleability towards safety, pointing at the importance of pre-training choices. To validate our findings, a large independent assessment of human preference agreement with Llama-Guard-3-8B is conducted by the authors and the associated dataset Egida-HSafe is released. Overall, this study illustrates how affordable and accessible it is to enhance LLM safety using DPO while outlining its current limitations. All datasets and models are released to enable reproducibility and further research.

安全对齐越狱防御DPO小样本

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