One-Shot Safety Alignment for Large Language Models via Optimal Dualization

Xinmeng Huang, Shuo Li, Edgar Dobriban, Osbert Bastani, Hamed Hassani +1 more
5/29/2024
cs.AIcs.CLcs.LG

No official code found. Best implementation: shuoli90/CAN (8 stars, Apache-2.0, last commit 2025-01-14).

Abstract

The growing safety concerns surrounding large language models raise an urgent need to align them with diverse human preferences to simultaneously enhance their helpfulness and safety. A promising approach is to enforce safety constraints through Reinforcement Learning from Human Feedback (RLHF). For such constrained RLHF, typical Lagrangian-based primal-dual policy optimization methods are computationally expensive and often unstable. This paper presents a perspective of dualization that reduces constrained alignment to an equivalent unconstrained alignment problem. We do so by pre-optimizing a smooth and convex dual function that has a closed form. This shortcut eliminates the need for cumbersome primal-dual policy iterations, greatly reducing the computational burden and improving training stability. Our strategy leads to two practical algorithms in model-based and preference-based settings (MoCAN and PeCAN, respectively). A broad range of experiments demonstrate the effectiveness and merits of our algorithms.

View on arXivView PDF

Code Implementations(1)

shuoli90/CANCommunity100%
Apache-2.0
80Shell, PythonOct 31, 20241 years agoApache-2.0

Similar Papers

Cite this paper

@article{huang2024oneshot,
  title  = {One-Shot Safety Alignment for Large Language Models via Optimal Dualization},
  author = {Xinmeng Huang and Shuo Li and Edgar Dobriban and Osbert Bastani and Hamed Hassani and Dongsheng Ding},
  year   = {2024},
  eprint = {2405.19544},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2405.19544},
  url    = {http://arxiv.org/abs/2405.19544v3},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.19544.svg)](https://codeofpaper.com/paper/2405.19544)

Discussion