← Back to Reinforcement Learning Mind Map
🎮 Reinforcement LearningID: reward-design

Reward Design & Hacking

奖励设计与 Hacking
🎯Core Definition
Reward design comes in three forms: sparse rewards (±1\pm 1 only at termination — unbiased but hard to explore), dense rewards (signal every step — faster learning but potentially misleading), and potential-based reward shaping — augmenting the reward with F(s,a,s′)=γΦ(s′)−Φ(s)F(s, a, s') = \gamma\Phi(s') - \Phi(s) for any potential function Φ(s)\Phi(s) (e.g. negative distance to goal) and discount γ\gamma. Ng et al. (1999) theorem: potential-based shaping does not change the optimal policy — along any trajectory ∑tFt=γΦ(sT)−Φ(s0)\sum_t F_t = \gamma\Phi(s_T) - \Phi(s_0) telescopes to boundary terms only, so value ordering is preserved and domain knowledge accelerates learning without misdirection.
📌Overview
Reward hacking: the policy finds and exploits loopholes in the reward function, scoring high without actually solving the task — e.g. an LLM bypassing unit tests, sycophantic 'I am very honest' text that inflates reward-model scores, or a game agent stalling in a corner. Mitigations: verifiable rewards (RLVR — the verifier has no exploitable loopholes), KL constraints limiting drift, adversarial training/regularization of reward models, multi-sample verification and human auditing.
💡Use Cases
reward-function design for games, robotics, and LLM alignment; interviews probe the shaping theorem derivation and LLM hacking case studies.
⚡Key Problems Solved
sparse rewards stall learning; poorly designed dense rewards get exploited and cause capability regression — good reward design balances learning speed (shaping) against hackability (verifiability).
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Reward Design & Hacking.
Use Cases
In production engineering, what are the primary use cases for Reward Design & Hacking and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Pros and cons of sparse vs dense rewards? How to choose per task?
2
Write the shaping formula F = γΦ(s') − Φ(s) and explain why it preserves the optimal policy (Ng's theorem)?
3
What is reward hacking? Give an LLM-scenario example (RLHF/RLVR)?
4
How to mitigate reward hacking? Why are verifiable rewards immune?
5
Best practices for reward design in LLM reasoning RL (verifiable rewards vs reward models vs PRMs)?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Reward Design & Hacking"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardRL with Verifiable RewardsNext Card →Process Reward Model

🔗 More Reinforcement Learning Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/RL/card/reward-design
中文速览与面试要点

奖励设计与 Hacking (Reward Design & Hacking)

定义: 奖励设计分三类:稀疏奖励 (仅终止时给 1,信号少但无偏,探索困难)、密集奖励 (每步有信号、学习快,但可能引入误导)、势函数 shaping (Potential-Based Reward Shaping)——在原奖励上加 F(s, a, s') = (s') - (s) 其中 (s) 为任意势函数 (如到目标距离的负值), 为折扣因子。Ng et al. (1999) 定理:势函数 shaping 不改变最优策略——因为沿任意轨迹求和 _t F_t = (s_T) - (s_0) (望远镜求和) 只差首尾常数,价值排序不变,故可放心用领域知识加速学习而不错导。 reward hacking: 策略发现并 exploit 奖励函数的漏洞,获得高奖励却没有真正完成任务——例如 LLM 绕过程序测试、对奖励模型输出"我很诚实"类话术刷分、游戏 agent 卡 bug 或死循环。缓解手段:改用可验证奖励 (RLVR,验证器无漏洞)、KL 约束限制策略漂移、奖励模型对抗性训练/正则化、多次采样验证与人工抽查。 使用场景: 游戏/机器人/LLM 对齐的奖励函数设计;面试高频考点为 shaping 定理的推导与 LLM 场景下的 hacking 案例。 解决的问题: 稀疏奖励下探索效率低、训练几乎无法起步;设计不良的密集奖励会被 exploit 导致能力退化——好的奖励设计在加速学习 (shaping) 与防止 hacking (可验证性) 之间取得平衡。

核心要点

  • 稀疏奖励与密集奖励各自的优缺点?如何根据任务选择?
  • 写出势函数 shaping 公式 F = γΦ(s') − Φ(s),并说明为什么它不改变最优策略 (Ng 定理)?
  • 什么是 reward hacking?举一个 LLM 场景 (RLHF/RLVR) 的例子?
  • 如何缓解 reward hacking?可验证奖励为什么天然免疫?
  • LLM 推理 RL 中奖励设计的最佳实践 (可验证奖励 vs 奖励模型 vs PRM)?