Skip to main content
QUICK REVIEW

[论文解读] Safe RLHF: Safe Reinforcement Learning from Human Feedback

Josef Dai, Xuehai Pan|arXiv (Cornell University)|Oct 19, 2023
Software Engineering ResearchComputer Science被引用 20
一句话总结

Safe RLHF 将有用性和无害性在人工反馈中解耦,并在微调期间使用带拉格朗日约束的 RLHF 框架来平衡它们,从而提升安全性和性能。

ABSTRACT

With the development of large language models (LLMs), striking a balance between the performance and safety of AI systems has never been more critical. However, the inherent tension between the objectives of helpfulness and harmlessness presents a significant challenge during LLM training. To address this issue, we propose Safe Reinforcement Learning from Human Feedback (Safe RLHF), a novel algorithm for human value alignment. Safe RLHF explicitly decouples human preferences regarding helpfulness and harmlessness, effectively avoiding the crowdworkers' confusion about the tension and allowing us to train separate reward and cost models. We formalize the safety concern of LLMs as an optimization task of maximizing the reward function while satisfying specified cost constraints. Leveraging the Lagrangian method to solve this constrained problem, Safe RLHF dynamically adjusts the balance between the two objectives during fine-tuning. Through a three-round fine-tuning using Safe RLHF, we demonstrate a superior ability to mitigate harmful responses while enhancing model performance compared to existing value-aligned algorithms. Experimentally, we fine-tuned the Alpaca-7B using Safe RLHF and aligned it with collected human preferences, significantly improving its helpfulness and harmlessness according to human evaluations.

研究动机与目标

  • 解耦人类对有用性和无害性的偏好,以避免众包人员的混淆。
  • 在 RLHF 框架内将安全性形式化为一个受约束的优化问题。
  • 分别为有用性和无害性训练独立的奖励模型和成本模型。
  • 在策略优化过程中使用拉格朗日乘子动态平衡这两个目标。
  • 通过三轮微调迭代,在 Alpaca-7B 上展示改进的安全性和性能。

提出的方法

  • 引入一种两阶段标注方案,产出有用性和无害性两个数据集。
  • 在有用性数据上训练奖励模型,在无害性数据上训练成本模型,使用基于 Bradley–Terry 的损失。
  • 将 Safe RLHF 表述为带 J_R(theta)、J_C(theta) 和移动的 d-offset 的约束优化。
  • 应用拉格朗日方法求解 min_theta max_lambda>=0 [-J_R(theta) + lambda*J_C(theta)],自适应更新 lambda。
  • 使用三轮迭代:红队测试、数据收集、模型训练和在 Alpaca-7B 上的 Safe RL 微调。
  • 提供统一的、基于模型的评估器(奖励模型和成本模型),以快速评估未来模型。

实验结果

研究问题

  • RQ1Safe RLHF 是否能同时提升 LLM 的有用性和无害性?
  • RQ2在 RLHF 过程中显式解耦无害性和有用性会带来哪些好处?
  • RQ3动态的拉格朗日平衡与静态奖赏塑形在管理安全性与有用性之间的权衡方面有多大差异?
  • RQ4具备分类能力的成本模型相较于仅使用安全分类信号,是否更有助于安全调整?

主要发现

  • 与基线 RLHF 相比,三轮 Safe RLHF 显著提高了有用性并降低了有害反应。
  • 解耦标注提高了评估者之间的一致性并更好地与研究人员对齐,提升 PPO 训练效果。
  • 动态拉格朗日平衡在管理有用性与无害性之间的权衡方面优于静态奖赏塑形。
  • 具有安全标注的成本模型在提升无害性方面优于仅使用安全分类信号。
  • Beaver-v3(经过三轮后的 Beaver)在评测提示上的有害反应大幅下降(从 53.08% 降至 2.45%)。
  • GPT-4 与人工评估在各轮次中都显示出有用性与无害性方面的 Elo 分数持续提升。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。