Potential-Based Reward Shaping for Intrinsic Motivation

Grant C. Forbes, Nitish Gupta, Leonardo Villalobos-Arias, Colin M. Potts, Arnav Jhala, David L. Roberts

Abstract

Reinforcement learning (RL) agents often struggle in environments with sparse rewards, where meaningful feedback is rare. While Intrinsic Motivation (IM) provides a mechanism for exploration by rewarding curiosity, it frequently alters the environment's underlying Markov Decision Process (MDP), potentially leading to "reward hacking" or convergence to suboptimal policies. This paper introduces Potential-Based Intrinsic Motivation (PBIM), a framework that leverages the theory of Potential-Based Reward Shaping (PBRS) to incorporate exploration rewards while theoretically guaranteeing convergence to the original optimal policy. By extending PBRS to arbitrary variables and utilizing a specific potential function wrapper, PBIM ensures that intrinsic rewards act as temporary hints rather than permanent distractions.

Introduction

In Reinforcement Learning, the "sparse reward" problem remains a significant hurdle. When an agent only receives a signal upon completing a complex task—such as navigating a large maze—it may wander aimlessly for millions of steps without ever encountering a positive reinforcement. To mitigate this, researchers often employ Intrinsic Motivation (IM), which provides supplementary rewards for visiting novel states or experiencing unpredictable transitions.

However, IM is a double-edged sword. By modifying the reward signal, it can change the fundamental goal of the agent. A classic failure mode is the "noisy TV" problem, where an agent becomes obsessed with a source of random, task-irrelevant information because it consistently generates high curiosity rewards. Traditional methods to prevent this, such as Potential-Based Reward Shaping (PBRS), were historically too restrictive, as they were limited to simple state-based functions and could not accommodate modern IM techniques that depend on complex neural network outputs or the agent's entire history.

Methodology

The authors bridge the gap between flexible exploration and rigorous safety through three primary contributions:

1. Theoretical Extension of PBRS

The researchers prove that the classic PBRS formula—$F = \gamma \Phi_{t+1} - \Phi_t$—preserves the optimal policy even when the potential function ($\Phi$) depends on arbitrary variables, such as the full trajectory of states and actions. This holds true provided a specific boundary condition is met at the conclusion of an episode, ensuring the added rewards do not create "cycles" of infinite reward.

2. The PBIM Wrapper

PBIM functions by treating any existing IM reward as a component of a potential function. By setting the potential function to the negative of the expected future intrinsic rewards, the authors create a mathematical "wrapper." This ensures that the total intrinsic reward added over the course of an episode sums to zero (or a constant). Consequently, while the agent feels the "pull" of curiosity in the short term, it cannot "hack" the system for infinite gain because every reward received must eventually be "paid back" by a corrective term at the end of the episode.

3. Normalization for Stability

To prevent the agent from being confused by large corrective terms early in training—which might lead it to believe the end of an episode is inherently "bad"—the authors introduce a normalized version of PBIM. This version subtracts the running mean of intrinsic rewards, smoothing the learning signal and improving empirical stability.

Experimental Setup

The framework was evaluated on two classic RL benchmarks designed to test sparse rewards and exploration:

  • MiniGrid DoorKey (8x8): A partially observable environment where an agent must locate a key, unlock a door, and reach a goal. This tests the agent's ability to handle complex dependencies.
  • Cliff Walking: Specifically, a "Long Cliff Walking" variant (4x50 grid) was used to simulate extreme sparsity. The agent must navigate a narrow path where falling off the cliff resets the episode, testing whether the agent can break out of local exploration loops.

Key Results and Insights

Safety from Hacking

In the MiniGrid environment, standard IM methods often caused the agent to converge to "procrastinating" policies when the curiosity reward was set too high. PBIM successfully mitigated this risk, consistently guiding the agent toward the true optimal policy regardless of the intrinsic reward magnitude.

Speed and Convergence

PBIM frequently outperformed baseline IM methods in both speed and stability. In the Long Cliff Walking task, standard methods like Random Network Distillation (RND) often became trapped in exploration loops along the cliffside. PBIM was the only method that successfully transitioned from exploration to goal-oriented behavior, demonstrating that its theoretical guarantees translate into practical performance gains.

The Importance of Normalization

Empirical results highlighted that normalization is essential for practical implementation. Without it, the large terminal corrections required by the PBRS theory can overwhelm the agent's learning process in the early stages of training, leading to high variance.

Limitations and Future Work

While PBIM represents a significant step forward, it has limitations. The current proof assumes that the intrinsic reward at any given time does not depend on future actions, which currently precludes its use with "Empowerment-based" IM methods. Additionally, there is a risk that a highly efficient agent might learn the "futility" of the intrinsic reward (the fact that it sums to zero) before it has finished exploring the environment. Future research will focus on scaling PBIM to high-dimensional 3D environments and extending the theory to cover a broader range of empowerment-based exploration metrics.

Conclusion

PBIM provides a robust structural fix for the pitfalls of Intrinsic Motivation. By ensuring that exploration rewards act as "hints" rather than new objectives, it allows researchers to use powerful curiosity-driven methods without sacrificing the guarantee that the agent will ultimately solve the task at hand.

Summary updated

BibTeX
@inproceedings{forbes2024potential,
  author = {Grant C. Forbes and Nitish Gupta and Leonardo Villalobos-Arias and Colin M. Potts and Arnav Jhala and David L. Roberts},
  title = {{Potential-Based Reward Shaping for Intrinsic Motivation}},
  booktitle = {AAMAS},
  year = {2024},
}
Figure