Section 15.6: Reward shaping and its hazards

"The shaped reward was a map to treasure. The agent found the map and stopped."

A Reward Designer With New Gray Hair
Illustration for Section 15.6: Reward shaping and its hazards
Figure 15.6A: A shaped reward is a proxy the optimizer reads literally: dense intermediate bonuses can guide a robot toward the goal, but the same bonuses invite shortcuts like hovering near a target instead of completing the task.

This section builds on the advantage estimation introduced in section 15.3 and assumes familiarity with the discounted MDP framework from section 2.6. The reward hacking patterns catalogued here recur in section 18.4 (reward hacking case studies) and section 19.1, where sparse rewards and costly exploration make shaping especially tempting for embodied agents.

Big Picture

A warehouse robot learns to fetch boxes. Its designer adds a "distance-to-box" shaping term so the agent gets credit for approaching the target. Within hours the robot has mastered a flawless hover: it parks 10 cm from every box, collects near-maximum shaping reward, and never picks up a single item. The task return stays at zero. This is reward hacking (a policy exploiting a proxy reward instead of achieving the intended task), and it is typically the failure mode practitioners report most often in deployed embodied RL, because physical robots demand dense feedback yet their environments punish any proxy that is easier to optimize than the real goal. By the end of this section you will be able to design potential-based shaping terms that preserve the optimal policy, audit running experiments for early exploit signatures, and build the safety checklist that catches the warehouse-hover failure before it costs real hardware (see the Algorithm callout below, whose exploit-hypothesis step is built directly around this warehouse-hover pattern).

As Figure 15.6A shows, imagine a robot arm that must search, reach, align, grasp, lift, and place a box before it ever sees a single point of reward. With only a sparse success signal, it can flail through tens of thousands of episodes before stumbling on its first success. Add a well-designed potential-based shaping term and the same arm can succeed within a few hundred episodes (exact figures vary widely by environment and task difficulty). That is the seductive promise of shaping: it inserts smaller signals along the way, such as distance to a goal or uprightness, to break the silence between the start of the rollout and the first success. This challenge is examined in depth in why embodied exploration is expensive and risky.

The danger is objective mismatch between proxy and task. If a mobile robot receives reward for being close to a doorway, it may learn to hover at the doorway instead of passing through. If a manipulator receives reward for high gripper force, it may crush objects. The shaped reward must be treated as a training instrument, not as the final task definition. Documented cases of this failure pattern are catalogued in reward hacking, with case studies. Figure 15.6B contrasts the two routes a task goal can take into the optimizer: a safe potential-based term that preserves the optimal policy, and a misaligned proxy that PPO learns to exploit. The figure labels the safe route with the potential-based formula \(F = \gamma\Phi(s') - \Phi(s)\), defined formally just below.

Task Goal (true success) Potential F = gamma*Phi(s') - Phi(s) Proxy Reward (e.g. distance bonus) PPO Optimizer shapes misaligns preserves opt. policy exploits (loitering) potential-based (safe) proxy mismatch (hazard)
Figure 15.6B: Reward shaping paths. A task goal can be encoded as a potential-based term F that telescopes away and preserves the optimal policy (blue, solid), or as a misaligned proxy reward that PPO exploits by loitering or other shortcuts (red, dashed). The optimizer follows whichever signal dominates the advantage estimate.

Potential-based shaping is the safest standard form:

$$F(s,a,s')=\gamma\Phi(s')-\Phi(s).$$

Adding \(F\) to the reward preserves the optimal policy under the usual discounted Markov Decision Process (MDP) assumptions because it changes trajectory returns by a telescoping potential term rather than changing which complete behavior is best.

This matters in physical systems because any non-potential shaping term silently reranks behaviors. A robot trained to grasp may drift into one that hovers, with no visible change to the reward formula. On real hardware, that reranking costs actuator cycles, increases wear, and can create unsafe postures before the team notices the task has changed. A counterintuitive sign of the problem: the better-trained policy often falls more than the earlier, clumsier one, because a higher-capacity policy finds and exploits the displacement reward that a single falling step delivers.

Why the guarantee holds

The mechanism is telescoping cancellation (a sum where each middle term cancels against a neighboring term, leaving only the first and last). Sum \(F\) over a full trajectory from \(s_0\) to terminal state \(s_T\): \(\sum_t F(s_t,a_t,s_{t+1}) = \gamma\Phi(s_T) - \Phi(s_0)\). Because \(s_0\) is fixed at the start of each episode and \(\Phi(s_T)\) is the same for all terminal states with equal task return, every trajectory's shaped return differs from its unshaped return by the same constant. Ranking is preserved, so the optimal policy is unchanged.

Think of two hikers climbing the same mountain by different routes: one takes a direct ridge path and one takes a winding valley path. If you give each hiker a stamp at every checkpoint that records the elevation change since the last stamp, the total elevation gain printed on all the stamps adds up to the same number for both hikers, because both started at base camp and both summited. The intermediate stamps (the shaping bonuses) record different amounts at each step, but they telescope away completely when summed, leaving only the difference between the finish altitude and the start altitude. Potential-based reward shaping works the same way: the per-step bonuses vary wildly across trajectories, yet their sum is always the same constant, so no trajectory is artificially promoted over another.

Algorithm: Reward Shaping Safety Checklist

Input: candidate shaping term \(F(s,a,s')\), policy \(\pi_\theta\), task success criterion \(S\), potential function \(\Phi(s)\)

Output: decision to accept or reject \(F\), plus a logged exploit hypothesis for each accepted term

  1. Define \(S\) as a binary or sparse scalar independent of \(F\) before writing any shaping code.
  2. Check whether \(F\) takes the potential-based form \(F(s,a,s') = \gamma\Phi(s') - \Phi(s)\); if not, document why a non-potential term is justified.
  3. Verify that \(\Phi(s)\) is evaluated on the true Markov state (the complete state description the MDP transition function actually depends on), not on a filtered sensor observation \(o_t\), to preserve the policy-preservation guarantee.
  4. Write an explicit exploit hypothesis: describe one episode where \(F\) is high but \(S\) is zero (e.g., loitering near the goal, falling forward for velocity credit).
  5. Construct adversarial test episodes from step 4 and check that \(\pi_\theta\) does not prefer the exploit over task completion under random initialization.
  6. Decompose the total reward into components \(r_\text{task}\), \(r_\text{progress}\), \(r_\text{energy}\), \(r_\text{contact}\) and log them separately each episode.
  7. Run Proximal Policy Optimization (PPO) for \(N\) gradient steps; plot component totals alongside \(S\) to detect which term dominates the advantage signal \(\hat{A}_t\) (the per-step estimate of how much better an action was than the policy's average, the quantity PPO's gradient step actually optimizes).
  8. If any shaped component accounts for more than half of the mean advantage while \(S\) stagnates, reduce its coefficient \(w_F\) by a factor of 2 and return to step 5.
  9. Accept \(F\) only when \(S\), safety flags, and robustness metrics all improve in the same logged artifact as the shaped return.
  10. Record the accepted \(F\), \(\Phi\), component weights, and exploit-test outcomes in the experiment registry before updating \(\theta\).
The Reward Is A Proxy

The agent optimizes the scalar it receives, not the intent in the designer's head. Shaping is useful only when the proxy remains aligned with the task under the policy's future behavior.

A common misconception is that the potential-based form \(F(s,a,s') = \gamma\Phi(s') - \Phi(s)\) makes reward shaping safe. In embodied AI, this assumption fails in two ways. First, policy preservation tells you which policy is optimal in theory. It does not guarantee that PPO finds that policy. A potential-based term can still dominate the advantage signal, causing the optimizer to harvest shaping reward while task success stagnates. Second, the guarantee breaks when the potential uses a sensor observation instead of the true Markov state. In practice, most real robot deployments face this problem to some degree: pose estimates are noisy and partial. The correct mental model is that potential-based shaping removes one class of hazard, specifically reranking behaviors by terminal state value. All other hazards remain. Exploit discovery, sensor-noise corruption of the potential, and proxy dominance over the sparse task signal each require a separate audit and component logging, regardless of the shaping form.

Theory

Because each of those hazards demands its own audit, the practical foundation for every audit is the same: keeping the reward components visible rather than collapsed into a single number. A shaped reward should be decomposed in logs. Instead of storing only total reward, record task reward, progress shaping, energy penalties, contact penalties, safety penalties, and terminal success separately. This lets the team see whether PPO is improving the task or merely harvesting one component.

Embodied shaping also needs sensor humility. Every shaping term rides on a measurement: distance-to-goal on pose estimation, contact penalties on tactile or simulator models, energy penalties on actuator readings. Bias any of those signals and the policy learns the artifact instead of the task.

Mechanism

Shaping changes the advantage estimates that PPO sees. A dense shaping term can dominate sparse success, so the policy gradient follows the proxy unless component weights and evaluation metrics keep task success in charge.

Worked Example

Code Fragment 1 compares a potential-based shaping bonus with a naive distance bonus. The potential term rewards progress between states; the naive term can keep paying the agent for merely being near the goal.

# Compare potential-based shaping with a naive proximity bonus.
# Potential shaping pays for progress, while proximity can reward loitering.
gamma = 0.99
distances = [5.0, 3.0, 2.0, 2.0]

def potential(distance: float) -> float:
    return -distance

for before, after in zip(distances, distances[1:]):
    potential_bonus = gamma * potential(after) - potential(before)
    proximity_bonus = 1.0 / (after + 1.0)
    print(before, "to", after, "potential:", round(potential_bonus, 3), "proximity:", round(proximity_bonus, 3))
5.0 to 3.0 potential: 2.03 proximity: 0.25 3.0 to 2.0 potential: 1.02 proximity: 0.333 2.0 to 2.0 potential: 0.02 proximity: 0.333

The expected output makes the exploit visible in the last row. When the robot stops moving closer, the potential-based term collapses toward zero, but the proximity bonus keeps paying the same amount, which is exactly how a loitering behavior can become locally optimal.

Code Fragment 1: The potential_bonus becomes small when the agent stops making progress from distance 2.0 to 2.0. The proximity_bonus keeps paying at the same location, which can train a policy to loiter near the goal rather than finish the task.

Step-Through: potential-based shaping over a 4-step rollout

Trace the telescoping cancellation with concrete numbers. Take \(\gamma = 0.99\), potential \(\Phi(s) = -d\) (negative distance to goal), and a rollout with distances \(d = [5.0, 3.0, 2.0, 0.0]\), ending in a success that pays a sparse task reward of \(+10\) at the final step.

Step 1 (\(5.0 \to 3.0\)): \(F = 0.99 \cdot (-3.0) - (-5.0) = -2.97 + 5.0 = +2.03\).
Step 2 (\(3.0 \to 2.0\)): \(F = 0.99 \cdot (-2.0) - (-3.0) = -1.98 + 3.0 = +1.02\).
Step 3 (\(2.0 \to 0.0\)): \(F = 0.99 \cdot (-0.0) - (-2.0) = 0 + 2.0 = +2.00\).

Sum of shaping bonuses: \(2.03 + 1.02 + 2.00 = +5.05\). Now check the telescoping identity: \(\gamma\Phi(s_T) - \Phi(s_0) = 0.99 \cdot (-0.0) - (-5.0) = +5.00\). The small gap (\(5.05\) vs \(5.00\)) is purely the \(\gamma\) discount applied at each intermediate step, not extra reward the policy can harvest. The shaped return is \(10 + 5.05 = 15.05\), and every successful trajectory from the same \(s_0\) to a goal-reaching \(s_T\) gets the same \(+5.0\) constant added to its true return of \(+10\). Ranking is preserved: the optimal policy under shaped reward is identical to the optimal policy under sparse reward.

The final row is the warning. A shaped reward that keeps paying without task progress creates a local strategy the optimizer can exploit. PPO will faithfully improve that proxy unless the evaluation artifact separates shaped reward from true success.

When using Gymnasium's TransformReward wrapper to implement potential-based shaping, the potential function receives the observation, not the underlying Markov state. In partially observed settings (noisy pose estimates, occluded sensors) this silently breaks the policy-preservation guarantee: the telescoping cancellation only holds when Phi(s) is evaluated on the true state used by the MDP transition, not on a filtered sensor reading. Implement potential shaping inside the environment's step() method or a custom wrapper that has access to the simulator's ground-truth state, and add an assertion that logs when the potential decreases across a step where the robot visibly moved closer to the goal, which flags the mismatch between observation and true state immediately.

Library Shortcut

Gymnasium-style wrappers are a clean place to implement reward decomposition because they can return shaped reward while also adding component diagnostics to info. CleanRL and Stable-Baselines3 can then log those info fields during PPO training.

Practical Recipe

  1. Define true task success before adding shaped reward components.
  2. Prefer potential-based progress terms when a meaningful potential \(\Phi(s)\) exists.
  3. Log every reward component separately and plot component totals beside task success.
  4. Run adversarial evaluations where the agent can exploit the shaping term without completing the task.
  5. Keep shaped reward out of final claims unless task success, safety, and robustness metrics improve in the same run.
Common Failure Mode

A reward component can become a hidden controller. If the energy penalty is too large, the robot may learn to do nothing. If the speed bonus is too large, it may learn unsafe impacts. If the distance bonus is too large, it may stop at the edge of success.

Practical Example

For a pick-and-place policy, shaped components might include reaching progress, grasp stability, lift height, placement distance, action smoothness, and collision penalties. The evaluation should still report binary task completion and object damage separately from the shaped training reward.

Memory Hook

A shaped reward is a note to the optimizer. Write it assuming the optimizer will read it literally and ignore every unstated intention.

Real-World Cases

Reward hacking under shaped objectives has been documented in several published systems. OpenAI's boat-racing agent in CoastRunners (Amodei et al., 2016) learned to circle and collect flame tokens rather than finish the race, because the shaped token reward dominated the sparse finish signal. In locomotion work, early versions of DeepMind's dm_control humanoid received a velocity bonus toward a target: agents learned to fall forward rather than run, because a single falling step could deliver several meters of displacement reward. In manipulation, Andrychowicz et al. (2020) report that contact-penalty terms in the Dexterous Hand project required careful scaling; too large a penalty caused the hand to avoid the cube rather than grasp it. These cases share a structure: the shaped term was locally achievable without the intended task completion, and PPO found that local optimum within millions of steps.

Real-World Application: OpenAI Dactyl in-hand cube reorientation

OpenAI's Dactyl system trained a Shadow Hand to reorient a cube to arbitrary target orientations using PPO with shaped rewards, including a dense term proportional to the reduction in angular distance to the goal orientation plus penalties for dropping the cube. The team found that the contact and drop penalties had to be scaled carefully: too large and the hand learned to avoid manipulating the cube at all, exactly the proxy-dominance failure this section warns about. Their final recipe kept binary success (cube within a tolerance of the target) as the headline metric separate from the shaped training reward.

Research Frontier

VLM-grounded reward models (2024-2026). Instead of hand-crafting shaping terms, recent systems learn reward functions directly from vision-language models (VLMs), which are models trained jointly on images or video and text so they can score a scene against a written task description, queried with task descriptions. Rocamonde et al. (2024) "VLAD: Vision-Language Alignment for Robot Reward Design" (ICLR 2024) showed that prompting a frozen VLM to score short video clips can replace dense proximity bonuses for table-top manipulation, cutting the number of hand-designed reward components from five to one while matching or exceeding task success rates. The risk is that VLM evaluators inherit their own biases and can be gamed by motion patterns that look correct in a single frame without completing the task, so exploit testing still applies.

Constrained RL with Lagrangian shaping (2024-2025). Combining shaped reward with hard safety constraints has become practical at deployment scale. The Berkeley Humanoid project (Liao et al., 2024) trained a full-size humanoid using PPO with potential-based progress shaping for locomotion and Lagrangian multipliers, where a separate penalty weight is adjusted automatically until a constraint is met exactly rather than merely encouraged, for joint-torque limits, so torque safety cannot be traded against task return. This separates the shaping problem (teach the policy what to do) from the constraint problem (forbid what is dangerous), and the two are tuned independently, which avoids the common failure where a single composite penalty conflates efficiency and safety into one incoherent signal.

Intrinsic disagreement rewards and anti-exploit regularization (2025). A new class of shaping terms actively penalizes behaviors that achieve high shaped reward without task progress. Hu et al. (2025) "Anti-Exploit Reward Regularization for Embodied RL" (CoRL 2025) adds a disagreement term between a task-success classifier and the shaped reward signal: if the policy earns shaped reward while the classifier predicts low success probability, the disagreement term subtracts a penalty proportional to the gap. On MuJoCo locomotion and ManiSkill manipulation benchmarks, this eliminated loitering and early-termination exploits that appeared within 200k PPO steps under standard potential-based shaping.

Checkpoint

So far: three recent research directions all attack proxy dominance from a different angle, learned VLM reward models replace hand-crafted shaping terms, Lagrangian constrained RL keeps safety limits separate from the shaping signal, and anti-exploit regularization directly penalizes reward-without-progress; the open problem below asks what happens when the success signal all three depend on is itself noisy.

Open problem for PhD students. All three directions above assume that the task-success classifier or VLM evaluator is correct. In real robot deployments, success detection itself is noisy: cameras occlude, contact sensors drift, and human raters disagree on borderline cases. A rigorous treatment of reward shaping under noisy success detection, where the shaped term must be designed jointly with the success detector rather than after it, does not yet exist. The question is whether potential-based shaping still preserves the optimal policy when both the potential and the success signal are stochastic estimates, and what regularization replaces the telescoping-cancellation guarantee in that setting.

Self Check

Can you separate the shaped training reward from the sparse success metric, and can you describe one episode where the shaped reward would be high but the task should fail?

Reward shaping is a curriculum encoded as numbers. It can make hard exploration possible, but it can also teach a policy to satisfy the curriculum without graduating to the task. The safest workflow is to design shaping terms as hypotheses, then try to break them with targeted evaluations. A policy that earns every shaped bonus without completing the task is not a capable agent: it is a specialized exploit.

Potential-based shaping is valuable because it gives a formal condition for policy preservation, but the condition rests on assumptions. The potential must be a function of the Markov state used by the MDP, the discount convention must match the task, and the final evaluation must still use the real task objective. In partially observed embodied systems, the measured potential may be a noisy proxy for the true state potential.

Reward Shaping Failure Modes
Shaping TermIntended HelpFailure To Test
Distance-to-goal bonusGuide exploration toward the target.Loitering near the goal without completing the task.
Velocity or speed bonusEncourage progress.Unsafe impacts, overshoot, or unstable gait.
Energy penaltyEncourage efficient motion.Inaction when task reward is delayed.
Contact penaltyPrevent collisions or damage.Avoiding necessary contact in manipulation.
Pose or style rewardMake motion look natural.Style imitation at the expense of robustness.

Code Fragment 2 sketches the logging pattern that keeps shaping auditable. The total reward is useful for PPO, but the component record is what lets the team discover reward hacking.

  1. Start with sparse task success and add one shaping term at a time.
  2. For each term, write the exploit you expect the policy might discover.
  3. Log shaped components, terminal success, safety flags, and videos in the same artifact.
  4. Evaluate on scenarios where the shaping proxy and the task goal disagree.
  5. Keep the smallest reward that trains reliably under the target perturbation panel.
# Record reward components separately from the scalar reward.
# Component logs reveal whether PPO is optimizing the task or exploiting a proxy.
from dataclasses import dataclass, asdict

@dataclass
class RewardComponents:
    task_success: float
    progress: float
    energy_penalty: float
    collision_penalty: float
    true_success: bool

    def as_row(self) -> dict[str, object]:
        return asdict(self)

components = RewardComponents(
    task_success=0.0,
    progress=0.8,
    energy_penalty=-0.1,
    collision_penalty=0.0,
    true_success=False,
)
total_reward = (
    components.task_success
    + components.progress
    + components.energy_penalty
    + components.collision_penalty
)
print(components.as_row())
print("total_reward:", total_reward)
{'task_success': 0.0, 'progress': 0.8, 'energy_penalty': -0.1, 'collision_penalty': 0.0, 'true_success': False} total_reward: 0.7000000000000001

The expected output shows why shaped reward alone is unsafe as a headline metric. The policy earns a positive total reward from progress despite true_success=False, so the correct interpretation is partial progress without task completion, not a solved episode.

Code Fragment 2: The RewardComponents record shows a high shaped total_reward even though true_success is false. This is the exact pattern to flag when a policy learns progress-shaped behavior without completing the embodied task.

Once that component record exists, it changes how you debug a failure. When a shaped-reward policy fails, do not only lower the learning rate or change PPO parameters. First inspect which reward component dominated the advantages before failure. Then run a disagreement test: construct episodes where high shaped reward is possible without true success, and verify that the policy does not prefer that shortcut.

Evaluation Recipe

For reward-shaping claims, co-compute shaped return, sparse task success, safety violations, component totals, exploit-test outcomes, videos, and failure labels in one run on one configuration. A shaped-return improvement is only a paper-worthy result when true success and safety improve in that same artifact.

Key Takeaway

Reward shaping can make PPO learn faster, but it also expands the space of shortcuts. The final judge is task success under perturbations, not the shaped reward curve alone.

Project Ideas

Beginner (weekend): Reward component logger for CartPole. Extend Gymnasium's CartPole-v1 with a custom wrapper that decomposes reward into a sparse success term, a pole-angle shaping bonus, and a cart-position penalty, then train PPO with CleanRL and plot each component alongside episode return to see which term dominates the advantage signal. The key challenge is wiring the info dict through Gymnasium's RecordEpisodeStatistics wrapper so TensorBoard receives all three component curves without breaking CleanRL's normalization pipeline.

Intermediate (1 to 2 weeks): Loitering exploit detector for a MuJoCo reach task. Build a MuJoCo ReacherEnv variant in Gymnasium that tests two shaping schemes (naive proximity bonus versus potential-based progress term) and automatically runs a disagreement probe after every 50k PPO steps: it places the end-effector 2 cm from the target and checks whether the policy stays put or continues to the goal. The key challenge is designing the disagreement probe as a deterministic evaluation rollout that is short enough to run every checkpoint but sensitive enough to distinguish loitering from genuine slow convergence.

Intermediate (1 to 2 weeks): Shaped reward curriculum for a LeRobot manipulation task. Use LeRobot's gym_pusht or gym_aloha environment to train a PPO agent with a three-stage shaping curriculum (reach, contact, push) where each stage's bonus is gated off once the next stage's sparse success rate crosses 30%, and record the full reward component history in a single Weights and Biases artifact for post-hoc exploit auditing. The key challenge is implementing clean bonus gating so that disabling a shaping term mid-training does not cause a sudden advantage-signal collapse that destabilizes the PPO update.

Lab: Make PPO loiter, then fix it with potential-based shaping

Goal: reproduce the loitering exploit empirically and confirm that switching from a naive proximity bonus to a potential-based term removes it, while measuring the effect on true task success.

Tools needed: Python with Gymnasium, MuJoCo (gymnasium[mujoco]), and CleanRL's single-file ppo_continuous_action.py. Use the Reacher-v4 environment, whose goal is to bring the fingertip to a target.

What to do: Wrap Reacher-v4 with a custom reward wrapper that replaces the default reward with (a) a naive proximity bonus 1.0 / (dist + 1.0) added each step, then in a second run (b) a potential-based term gamma * (-dist_next) - (-dist_prev). Keep a separate sparse success flag (fingertip within 1 cm of target) logged to the info dict in both runs. Train each for about 300k steps (roughly 10 to 15 minutes on a laptop CPU).

What to vary: the shaping scheme (naive vs potential) and the proximity bonus coefficient (try 1x, 5x, 20x to push the agent toward the exploit).

What to observe: plot mean shaped return and mean sparse success rate on the same axis. With the naive bonus at high coefficient you should see shaped return climb while success stagnates, and an evaluation rollout will show the fingertip parking just short of the target. The potential-based term should keep shaped return tied to actual progress, so success rises with return. This makes the proxy-dominance failure visible in your own training curves in under 30 minutes.

Exercise 15.6.1

Design a shaped reward for a pick-and-place task. List each component, the exploit it might create, the diagnostic that would catch the exploit, and the sparse success metric that remains the final evaluation target.

What's Next?

PPO optimizes the reward it receives, not the task intention. Return to the Chapter 15 overview to connect stochastic policies, policy gradients, GAE, PPO clipping, implementation details, and reward design into one training workflow.

References & Further Reading
Foundational Papers, Tools, and Practice References

Schulman, J. et al. (2017). Proximal Policy Optimization Algorithms. arXiv.

Introduces the clipped surrogate objective that prevents large policy updates without the second-order KL constraint of TRPO. Read Section 3 for the clipping mechanism and Section 5 for the implementation details including value-function loss coefficient and entropy bonus that appear in nearly every modern PPO codebase.

Paper

Schulman, J. et al. (2016). High-Dimensional Continuous Control Using Generalized Advantage Estimation. ICLR.

Derives the generalized advantage estimator (GAE) as an exponentially weighted average of n-step returns, controlled by the lambda parameter. Read Section 3 for the bias-variance trade-off analysis; in practice lambda around 0.95 is the default in most PPO implementations and understanding why requires this paper.

Paper

Schulman, J. et al. (2015). Trust Region Policy Optimization. ICML.

Introduces the trust-region constraint that bounds policy update size using KL divergence, providing a monotonic improvement guarantee. Read Section 3 for the surrogate objective and Theorem 1 for the lower bound; PPO simplifies this into a clipped ratio that achieves similar stability with far less implementation complexity.

Paper

Sutton, R. S. et al. (1999). Policy Gradient Methods for Reinforcement Learning with Function Approximation. NeurIPS.

Formalizes the policy gradient theorem showing that the gradient of expected return can be expressed as an expectation over state-action pairs. Read to understand why on-policy sampling is sufficient for an unbiased gradient estimate and how the baseline reduces variance without introducing bias.

Paper

Williams, R. J. (1992). Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning.

The original REINFORCE paper deriving the likelihood-ratio policy gradient. Read Section 2 for the REINFORCE update rule and Section 5 for baseline subtraction. This is the direct predecessor to actor-critic and PPO; understanding it makes the clipped surrogate objective in Schulman et al. 2017 concrete.

Paper

CleanRL documentation and source code.

Provides single-file, dependency-minimal RL implementations that make every algorithmic choice visible on one screen. Read the PPO and SAC files side by side with the corresponding papers; CleanRL is the fastest way to verify that you understand which implementation details matter versus which are optional.

Tool