{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/reward-shaping-to-mitigate-reward-hacking-in","title":"Reward Shaping to Mitigate Reward Hacking in RLHF","arxiv_id":"2502.18770","date":"2025-02-26","proceeding":null,"authors":["Jiayi Fu","Xuandong Zhao","Chengyuan Yao","Heng Wang","Qi Han","Yanghua Xiao"],"abstract":"Reinforcement Learning from Human Feedback (RLHF) is essential for aligning large language models (LLMs) with human values. However, RLHF is susceptible to reward hacking, where the agent exploits flaws in the reward function rather than learning the intended behavior, thus degrading alignment. While reward shaping helps stabilize RLHF and partially mitigate reward hacking, a systematic investigation into shaping techniques and their underlying principles remains lacking. To bridge this gap, we present a comprehensive study of the prevalent reward shaping methods. Our analysis suggests three key design principles: (1) RL reward is ideally bounded, (2) RL benefits from rapid initial growth followed by gradual convergence, and (3) RL reward is best formulated as a function of centered reward. Guided by these insights, we propose Preference As Reward (PAR), a novel approach that leverages the latent preferences embedded within the reward model itself as the signal for reinforcement learning. We evaluated PAR on two base models, Gemma2-2B and Llama3-8B, using two datasets, Ultrafeedback-Binarized and HH-RLHF. Experimental results demonstrate PAR's superior performance over other reward shaping methods. On the AlpacaEval 2.0 benchmark, PAR achieves a win rate at least 5 percentage points higher than competing approaches. Furthermore, PAR exhibits remarkable data efficiency, requiring only a single reference reward for optimal performance, and maintains robustness against reward hacking even after two full epochs of training. Code is available at https://github.com/PorUna-byte/PAR.","url_abs":"https://arxiv.org/abs/2502.18770v1","url_pdf":"https://arxiv.org/pdf/2502.18770v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"reward-shaping-to-mitigate-reward-hacking-in","repo_url":"https://github.com/poruna-byte/par","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[{"method_slug":"base","method_name":"BASE"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2502.18770","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2502.18770"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/poruna-byte/par","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":1,"unverified":9},"by_repo_kind":{"official":{"samples":10,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"a145434950c05a50","entry":"load_json","repo":"poruna-byte/par","repo_kind":"official","path":"src/combine_plot.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/combine_plot.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a145434950c05a50"}},{"code_sha256_prefix":"cc5a76ecc3a1d460","entry":"canonical_split_path","repo":"poruna-byte/par","repo_kind":"official","path":"src/dataloaders/dataset.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/dataloaders/dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cc5a76ecc3a1d460"}},{"code_sha256_prefix":"82cd7f761c5ff6a6","entry":"cleanup_reward_run_dir","repo":"poruna-byte/par","repo_kind":"official","path":"src/merge/merge_rm_checkpoints.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/merge/merge_rm_checkpoints.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"82cd7f761c5ff6a6"}},{"code_sha256_prefix":"095074fe98fc96d0","entry":"dataset_dir_name","repo":"poruna-byte/par","repo_kind":"official","path":"src/dataloaders/dataset.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/dataloaders/dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"095074fe98fc96d0"}},{"code_sha256_prefix":"719518e1f8da623f","entry":"dataset_split_path","repo":"poruna-byte/par","repo_kind":"official","path":"src/dataloaders/dataset.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/dataloaders/dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"719518e1f8da623f"}},{"code_sha256_prefix":"0642c76d45b5c6b0","entry":"estimate_cost","repo":"poruna-byte/par","repo_kind":"official","path":"src/llm_rating/pricing.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/llm_rating/pricing.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0642c76d45b5c6b0"}},{"code_sha256_prefix":"8c056d7ca84dcc86","entry":"finalize_args","repo":"poruna-byte/par","repo_kind":"official","path":"src/configs/config.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/configs/config.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8c056d7ca84dcc86"}},{"code_sha256_prefix":"19e0f4d65d713471","entry":"identify_method","repo":"poruna-byte/par","repo_kind":"official","path":"src/combine_plot.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/combine_plot.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"19e0f4d65d713471"}},{"code_sha256_prefix":"3bef92bd5333c7f2","entry":"split_prefix","repo":"poruna-byte/par","repo_kind":"official","path":"src/combine_plot.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/combine_plot.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3bef92bd5333c7f2"}},{"code_sha256_prefix":"bf9be4a1557720d7","entry":"str2bool","repo":"poruna-byte/par","repo_kind":"official","path":"src/configs/config.py","file_url":"https://github.com/poruna-byte/par/blob/HEAD/src/configs/config.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bf9be4a1557720d7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}