Highly Efficient Self-Adaptive Reward Shaping for Reinforcement Learning

Haozhe Ma, Zhengding Luo, Thanh Vinh Vo, Kuankuan Sima, Tze-Yun Leong

TL;DR

The authors propose SASR (Self-Adaptive Success Rate-based reward shaping), a novel method that uses historical success rates to provide auxiliary rewards in sparse-reward environments. By modeling these rewards with Beta distributions and using computationally efficient density estimation, SASR naturally transitions from exploration to exploitation, significantly outperforming existing baselines in both learning speed and stability.

The Challenge of Sparse Rewards

In many real-world Reinforcement Learning (RL) tasks, rewards are "sparse"—the agent might only receive a positive signal after completing a long, complex sequence of actions, and zero otherwise. Without intermediate feedback, agents often wander aimlessly, struggling to discover the goal.

Existing solutions like Reward Shaping (RS) attempt to add "bonus" rewards to guide the agent. However, these often fall into two traps:

  1. Intrinsic Motivation: Rewarding novelty (visiting new states). While good for exploration, these methods can get distracted by "noisy TVs"—random but ultimately useless parts of the environment.
  2. Inherent Value: Rewarding states that seem "good" based on heuristics. These often require heavy human engineering or struggle with early-stage exploration because their guidance is too rigid.

The core challenge is creating an autonomous system that provides meaningful guidance while balancing the need to explore new areas versus exploiting known successful paths.

The SASR Mechanism

To address these issues, the paper introduces the SASR mechanism. It works by calculating a "success rate" for every state the agent visits: the ratio of how often that state appeared in a successful trajectory versus its total occurrences.

Key technical components include:

  • Probabilistic Reward Modeling: Instead of using a fixed success rate, SASR samples rewards from a Beta distribution. Early in training, when data is scarce, the distribution is wide (high uncertainty), leading to stochastic rewards that encourage exploration. As more data is gathered, the distribution narrows, providing stable, reliable signals for exploitation.
  • Efficient Density Estimation: To handle continuous and high-dimensional state spaces where exact state counts are impossible, the authors use Kernel Density Estimation (KDE). To keep this computationally light, they integrate Random Fourier Features (RFF), which approximates complex kernel calculations using simple linear operations. This avoids the need for training additional auxiliary neural networks.
  • Retention Rate ($\phi$): A hyperparameter that sub-samples which states are stored in the success/failure buffers. This prevents the system from becoming overconfident too quickly and keeps memory usage low.
Schematic diagram of the SASR mechanism showing how success and failure densities evolve into Beta distributions for reward sampling across early and late learning stages.

Evaluated Environments

The authors evaluated SASR against ten baselines across a wide variety of challenging, sparse-reward environments:

  • MuJoCo: High-dimensional physics simulations (AntStand, AntFar, HumanStand, HumanKeep).
  • Robotics: Tasks involving a robotic arm (RobotReach, RobotSlide, RobotPush, RobotPickPlace).
  • Atari Games: Classic benchmarks known for sparse rewards (Pitfall, Frogger, Montezuma’s Revenge, Solaris, Freeway).
  • Physical Simulation: The classic MountainCar problem.
Example of a sparse-reward robotics environment used to evaluate the SASR method.

Key Insights and Results

  • The "Self-Adaptive" Bridge: The most elegant idea is using the variance of the Beta distribution as a natural bridge between exploration and exploitation. In the beginning, the "noisy" rewards act as a perturbation that pushes the agent to try different things. Later, the rewards align perfectly with the task objective.
  • Success vs. Novelty: Unlike novelty-seeking methods, SASR prioritizes states that actually lead to success. This prevents the agent from getting stuck in "interesting" but useless parts of the state space.
  • Efficiency via RFF: By using RFF to approximate KDE, the authors achieve a reward-shaping mechanism that is mathematically grounded but runs with remarkably low computational overhead compared to methods that require training separate "reward-agent" networks.

SASR consistently outperformed both standard RL algorithms (SAC, PPO) and advanced reward-shaping baselines (RND, ReLara, ExploRS). It demonstrated superior sample efficiency in tasks like AntFar and HumanKeep, reaching high performance levels much faster. Furthermore, SASR showed much lower variance across different random seeds, indicating higher convergence stability, and covered a wider range of the state space more quickly in exploration-heavy tasks like MountainCar.

Limitations and Future Work

  • Dense Reward Settings: The authors acknowledge that in environments where rewards are already frequent (dense), the additional shaped rewards from SASR might be unnecessary or even redundant.
  • State Relationships: Currently, SASR treats every state in a trajectory as equally important for the success/failure count. It doesn't account for the fact that some states in a successful run might be more critical than others.
  • Buffer Management: The method is sensitive to the "retention rate." Future work could involve developing an adaptive mechanism to manage these buffers more intelligently.

Summary updated

BibTeX
@inproceedings{ma2025highly,
  author = {Haozhe Ma and Zhengding Luo and Thanh Vinh Vo and Kuankuan Sima and Tze-Yun Leong},
  title = {{Highly Efficient Self-Adaptive Reward Shaping for Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=QOfWubPhdS},
}
Figure