Table of Contents
Fetching ...

Constrained Language Model Policy Optimization via Risk-aware Stepwise Alignment

Lijun Zhang, Lin Li, Wei Wei, Yajie Qi, Huizhong Song, Jun Wang, Yaodong Yang, Jiye Liang

TL;DR

This work addresses the challenge of balancing usefulness and safety in large language model alignment by introducing Risk-aware Stepwise Alignment (RSA), a token-level constrained policy optimization framework that incorporates nested risk measures into a risk-sensitive CMDP. It develops a two-step, monotonic policy-improvement scheme that maps risk-aware state-action values to reward- and cost-aware policies, with theoretical guarantees under mild assumptions. A practical RSA(P) variant avoids unstable dual updates by mixing a reward-focused policy with a safety-adjusted counterpart, improving stability and deployment practicality. Empirically, RSA achieves superior helpfulness while maintaining strong safety and suppressing tail risks across text generation and multi-turn conversations, outperforming Safe RLHF, SACPO, DPO, and Ra-DPO. Overall, RSA provides a principled, scalable approach to safer LLM deployment with explicit tail-risk control and robustness across diverse risk scenarios.

Abstract

When fine-tuning pre-trained Language Models (LMs) to exhibit desired behaviors, maintaining control over risk is critical for ensuring both safety and trustworthiness. Most existing safety alignment methods, such as Safe RLHF and SACPO, typically operate under a risk-neutral paradigm that is insufficient to address the risks arising from deviations from the reference policy and offers limited robustness against rare but potentially catastrophic harmful behaviors. To address this limitation, we propose Risk-aware Stepwise Alignment (RSA), a novel alignment method that explicitly incorporates risk awareness into the policy optimization process by leveraging a class of nested risk measures. Specifically, RSA formulates safety alignment as a token-level risk-aware constrained policy optimization problem and solves it through a stepwise alignment procedure that yields token-level policy updates derived from the nested risk measures. This design offers two key benefits: (1) it mitigates risks induced by excessive model shift away from a reference policy, and (2) it explicitly suppresses low-probability yet high-impact harmful behaviors. Moreover, we provide theoretical analysis on policy optimality under mild assumptions. Experimental results demonstrate that our method achieves high levels of helpfulness while ensuring strong safety and significantly suppresses tail risks, namely low-probability yet high-impact unsafe responses.

Constrained Language Model Policy Optimization via Risk-aware Stepwise Alignment

TL;DR

This work addresses the challenge of balancing usefulness and safety in large language model alignment by introducing Risk-aware Stepwise Alignment (RSA), a token-level constrained policy optimization framework that incorporates nested risk measures into a risk-sensitive CMDP. It develops a two-step, monotonic policy-improvement scheme that maps risk-aware state-action values to reward- and cost-aware policies, with theoretical guarantees under mild assumptions. A practical RSA(P) variant avoids unstable dual updates by mixing a reward-focused policy with a safety-adjusted counterpart, improving stability and deployment practicality. Empirically, RSA achieves superior helpfulness while maintaining strong safety and suppressing tail risks across text generation and multi-turn conversations, outperforming Safe RLHF, SACPO, DPO, and Ra-DPO. Overall, RSA provides a principled, scalable approach to safer LLM deployment with explicit tail-risk control and robustness across diverse risk scenarios.

Abstract

When fine-tuning pre-trained Language Models (LMs) to exhibit desired behaviors, maintaining control over risk is critical for ensuring both safety and trustworthiness. Most existing safety alignment methods, such as Safe RLHF and SACPO, typically operate under a risk-neutral paradigm that is insufficient to address the risks arising from deviations from the reference policy and offers limited robustness against rare but potentially catastrophic harmful behaviors. To address this limitation, we propose Risk-aware Stepwise Alignment (RSA), a novel alignment method that explicitly incorporates risk awareness into the policy optimization process by leveraging a class of nested risk measures. Specifically, RSA formulates safety alignment as a token-level risk-aware constrained policy optimization problem and solves it through a stepwise alignment procedure that yields token-level policy updates derived from the nested risk measures. This design offers two key benefits: (1) it mitigates risks induced by excessive model shift away from a reference policy, and (2) it explicitly suppresses low-probability yet high-impact harmful behaviors. Moreover, we provide theoretical analysis on policy optimality under mild assumptions. Experimental results demonstrate that our method achieves high levels of helpfulness while ensuring strong safety and significantly suppresses tail risks, namely low-probability yet high-impact unsafe responses.
Paper Structure (37 sections, 6 theorems, 44 equations, 9 figures, 2 tables, 2 algorithms)

This paper contains 37 sections, 6 theorems, 44 equations, 9 figures, 2 tables, 2 algorithms.

Key Result

Proposition 4.1

Given two policies $\pi$ and $\bar{\pi}$, if for any state $s_t = \left[x, y^{<t}\right],$$\mathbb{E}_{z \sim \bar{\pi}_{t}}\left[\tilde{A}_\pi\left(s_t, z\right)\right] \geq 0$, then we can conclude $\mathbb{E}_{x \sim \mathcal{D}}\left[\tilde{V}_{\bar{\pi}}(s_1)\right] \geq \mathbb{E}_{x \sim \mat

Figures (9)

  • Figure 1: Win rate against the SFT model (i.e., Alpaca-7B-reproduced). H and S are abbreviations for helpfulness and safety (i.e., harmlessness), respectively. Higher values on the horizontal axis indicate better helpfulness, and higher values on the vertical axis indicate better harmlessness. In (a), the numbers indicate $\frac{1}{\beta^{\prime}}$. In (b), the numbers represent $q$.
  • Figure 2: The average generation length of models trained with different algorithms, sampled under helpfulness and harmlessness prompts.
  • Figure 3: Visualizing decision boundaries. Each subplot shows t-SNE embeddings of model outputs for distinguishing helpful and unsafe prompts. The SVM decision boundary (dashed line) separates helpful content (blue) from harmful content (pink). In addition, different types of unsafe prompts are represented by distinct colors.
  • Figure 4: A comparative evaluation in terms of safety across different types of red-teaming prompts. Each boxplot shows the distribution of harmlessness scores (higher is better).
  • Figure 5: Average harmlessness score under different types of red-teaming prompts (higher is better).
  • ...and 4 more figures

Theorems & Definitions (11)

  • Proposition 4.1
  • Theorem 4.2
  • Proposition 4.3
  • proof
  • Lemma 4.5: Strong duality and boundness of $\lambda^{\ast}$
  • Theorem 4.6: Relation between $\pi^{\ast}_{r^{\ast}_{t}}$ and $\pi^{\ast}_{t}$
  • proof
  • Theorem 4.7
  • proof
  • proof
  • ...and 1 more