Skip to main content
QUICK REVIEW

[Paper Review] Safe RLHF: Safe Reinforcement Learning from Human Feedback

Josef Dai, Xuehai Pan|arXiv (Cornell University)|Oct 19, 2023
Software Engineering ResearchComputer Science20 citations
TL;DR

Safe RLHF decouples helpfulness and harmlessness in human feedback and uses a Lagrangian-constrained RLHF framework to balance them during fine-tuning, improving safety and performance.

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.

Motivation & Objective

  • Decouple human preferences for helpfulness and harmlessness to avoid crowdworker confusion.
  • Formalize safety as a constrained optimization problem within RLHF.
  • Train separate reward and cost models for helpfulness and harmlessness, respectively.
  • Dynamically balance the two objectives during policy optimization using a Lagrangian multiplier.
  • Demonstrate improved safety and performance on Alpaca-7B through three fine-tuning iterations.

Proposed method

  • Introduce a two-stage annotation scheme yielding separate datasets for helpfulness and harmlessness.
  • Train a Reward Model on helpfulness data and a Cost Model on harmlessness data using Bradley-Terry-based losses.
  • Formulate Safe RLHF as a constrained optimization with J_R(theta) and J_C(theta) and a moving d-offset.
  • Apply the Lagrangian method to solve min_theta max_lambda>=0 [-J_R(theta) + lambda*J_C(theta)], updating lambda adaptively.
  • Use three iterative cycles of red-teaming, data collection, model training, and Safe RL fine-tuning on Alpaca-7B.
  • Provide unified, model-based evaluators (Reward and Cost Models) to rapidly assess future models.

Experimental results

Research questions

  • RQ1Can Safe RLHF simultaneously improve both helpfulness and harmlessness of an LLM?
  • RQ2What benefits arise from explicitly decoupling harmlessness and helpfulness during RLHF?
  • RQ3How effectively does a dynamic, Lagrangian balance compare to static reward shaping in managing trade-offs between safety and usefulness?
  • RQ4Does the Cost Model with classification capability contribute to better safety adjustments than alternative signals?

Key findings

  • Three iterations of Safe RLHF substantially increase helpfulness and reduce harmful responses compared to baseline RLHF.
  • Decoupled annotations yield higher inter-rater agreement and better alignment with researchers, enhancing PPO training outcomes.
  • Dynamic Lagrangian balancing outperforms static reward shaping in managing the trade-off between helpfulness and harmlessness.
  • Cost Model with safety labeling outperforms a safety classifier-only signal in improving harmlessness.
  • Beaver-v3 (Beaver after three iterations) shows a large reduction in harmful responses (from 53.08% to 2.45%) on evaluation prompts.
  • GPT-4 and human evaluations show consistent Elo-score improvements in both helpfulness and harmlessness across iterations.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.