arXiv:2505.20065cs.LGcs.AI2025-05被引 40

提出轻量级安全对齐方法SafeDPO,无需奖励模型也能有效提升LLM安全性。

SafeDPO: A Simple Approach to Direct Preference Optimization with Enhanced Safety

  • 基于理论推导出可直接优化的安全对齐目标,仅需一个额外超参数。
  • 在PKU-SafeRLHF-30K上显著提升安全性,同时保持良好帮助性。
  • 适合追求简单高效安全对齐的开发者,尤其适用于大模型部署。

随着大语言模型在真实场景中的广泛应用,如何平衡有用性与安全性成为核心挑战。现有方法多依赖辅助网络或多阶段流程,增加复杂性。本文重新审视原始安全对齐目标,在温和假设下证明其存在闭式最优策略,并推导出可直接优化的等价目标。基于此,提出SafeDPO:一种轻量级方法,仅需一个额外超参数,无需奖励模型、成本模型或在线采样,仅依赖偏好数据与安全指标即可实现安全对齐。实验表明,SafeDPO在PKU-SafeRLHF-30K基准上显著提升安全性,同时保持与现有方法相当的帮助性。消融研究验证了超参数的灵活性及对理论最优解的保持,且在13B参数规模模型上表现稳定。结果表明,理论驱动的简单目标可提供轻量而有效的安全对齐方案。

原文摘要 · Abstract (English)

As Large Language Models (LLMs) are increasingly deployed in real-world applications, balancing helpfulness and safety has become a central challenge. A natural approach is to incorporate safety constraints into Reinforcement Learning from Human Feedback (RLHF), where recent studies have shown promising progress. However, these methods often rely on auxiliary networks or multi-stage pipelines, thereby increasing complexity. In this work, we revisit the original safety alignment objective and show that, under mild assumptions, it admits a closed-form optimal policy. We further derive a provably equivalent and tractable objective, enabling direct optimization. Building on this insight, we propose SafeDPO, a lightweight method that preserves the optimal solution of the underlying safety-constrained objective while requiring only one additional hyperparameter and minimal modifications to existing preference-based training methods. SafeDPO eliminates the need for reward models, cost models, and online sampling, relying only on preference data and safety indicators. Despite its simplicity, SafeDPO achieves competitive safety-helpfulness trade-offs compared to existing safety alignment methods. Experiments on the PKU-SafeRLHF-30K benchmark demonstrate that SafeDPO substantially improves safety while maintaining competitive helpfulness. Ablation studies further show that the additional hyperparameter provides a flexible mechanism to enhance safety while preserving the theoretical optimum, and confirm that SafeDPO scales reliably to LLMs with up to 13B parameters. Overall, our results highlight that a simple, theory-driven objective can provide a lightweight yet effective solution for safety alignment in practice.

安全对齐大模型轻量化偏好学习

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