Reward Shaping to Mitigate Reward Hacking in RLHF

Jiayi Fu, Xuandong Zhao, Chengyuan Yao, Heng Wang, Qi Han +2 more
2/26/2025
98 citations
cs.LGcs.AIcs.CL
rlrlhf-rlvr-dpo

Official code: PorUna-byte/PAR (0 stars, Python, MIT, last commit 2026-09-08).

Abstract

Reinforcement learning from human feedback (RLHF) is widely used to align large language models (LLMs) with human preferences. However, RLHF remains vulnerable to \emph{reward hacking}, whereby a policy exploits imperfections in the reward function instead of learning the intended behavior, thereby undermining alignment.

Show full abstract

Although reward shaping can stabilize RLHF training and partially mitigate reward hacking, shaping methods and their underlying design principles have not been systematically investigated. To address this gap, we conduct a comprehensive study of prevalent reward-shaping techniques. Our analysis identifies two key design principles: (1) the reinforcement-learning reward should be bounded, and (2) it should grow rapidly at first and then gradually saturate. Motivated by these principles, we propose Preference as Reward (PAR), a novel method that uses the latent preferences encoded in the reward model as the reinforcement-learning signal. We further show that PAR possesses two variance-reduction properties that stabilize RLHF training and substantially widen the practical window for early stopping. Our evaluation consists of two parts. First, we compare PAR with several other reward-shaping strategies using Proximal Policy Optimization (PPO) as the reinforcement-learning algorithm and Gemma2-2B as the base model. Second, we compare PAR with the vanilla baseline (i.e., unshaped reward) across four base models and four reinforcement-learning algorithms. In the first set of experiments, PAR consistently outperforms other reward-shaping methods and also reflects high data efficiency and robustness. The second set of experiments shows that PAR is particularly effective for actor-critic RL algorithms when value estimates become unstable and demonstrates its effectiveness across different base models. The code is available at https://github.com/PorUna-byte/PAR.

View on arXivView PDF

Code Implementations(1)

PorUna-byte/PAROfficial100%
MIT
00Python, ShellSep 8, 20262 months agoMIT

Similar Papers

Cite this paper

@article{fu2025reward,
  title  = {Reward Shaping to Mitigate Reward Hacking in RLHF},
  author = {Jiayi Fu and Xuandong Zhao and Chengyuan Yao and Heng Wang and Qi Han and Yanghua Xiao and Yuxia Wang},
  year   = {2025},
  eprint = {2502.18770},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.18770v8}
}

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/2502.18770.svg)](https://codeofpaper.com/paper/2502.18770)

Discussion