Exploit Reward Shifting in Value-Based Deep-RL: Optimistic Curiosity-Based Exploration and Conservative Exploitation via Linear Reward Shaping

Hao Sun, Lei Han, Rui Yang, Xiaoteng Ma, Jian Guo, Bolei Zhou

The Hidden Power of a Simple Constant

In Reinforcement Learning (RL), "reward shaping" usually involves carefully designing auxiliary rewards to help an agent learn faster. However, this is notoriously difficult: poorly designed rewards can lead to "reward hacking," where the agent finds a loophole to get high scores without solving the actual task.

This paper focuses on the most basic transformation possible: linear reward shifting ($r' = r + b$). While it has been known since 1999 that adding a constant to every reward doesn't change the optimal policy, the RL community has largely ignored how this shift interacts with the "black box" of Deep Learning. Specifically, how does a simple constant shift affect the learning dynamics of neural networks in value-based agents like DQN or TD3?

The Equivalence Insight: Shift = Initialization

The core contribution of this work is the Equivalence Insight: Shifting the reward by a constant $b$ is mathematically equivalent to initializing the Q-function at a different starting point. Specifically, a reward shift of $b$ corresponds to an initialization shift of $b / (1 - \gamma)$.

Even if the "finish line" (the optimal policy) remains the same, changing the reward shift moves the "starting line" for the neural network. This simple mechanism allows us to directly manipulate the agent's intrinsic optimism or pessimism:

  • Positive Shift = Pessimism: If you add $+10$ to every reward, the network starts out thinking everything is worse than it actually is relative to the new shifted optimal values. This creates a natural lower bound, making the agent "conservative."
  • Negative Shift = Optimism: If you subtract $10$ from every reward, the network starts out thinking actions are better than they actually are. This creates an optimistic upper bound, driving the agent to explore actions to see if they live up to the hype—the essence of curiosity.
Theoretical intuition: A negative reward shift creates an optimistic upper bound (b), while a positive shift creates a pessimistic lower bound (c).

Three Practical Applications

Because this method is "plug-and-play," it doesn't require changing the underlying RL algorithm. It merely requires a post-hoc adjustment of the rewards in the replay buffer. The authors propose three distinct applications based on this insight:

  1. Conservative Exploitation (Offline RL): In offline RL, agents often overestimate the value of actions not seen in the static dataset. By applying a positive reward shift, the agent's Q-values are initialized "below" the shifted optimal values. This pessimism prevents the agent from choosing risky, out-of-distribution actions.
  2. Random Reward Shift (Online RL): For online continuous control, the authors train an ensemble of Q-networks, each with a different reward shift constant. This allows the agent to dynamically trade off between being "curious" (negative shift) and "cautious" (positive shift), significantly improving sample efficiency.
  3. Compatible Curiosity (Hard Exploration): The authors adapt the popular Random Network Distillation (RND) algorithm for value-based RL. They argue that vanilla RND's positive intrinsic rewards actually cause pessimism in value-based agents. By applying a negative shift to the intrinsic reward, they align it with the agent's need for optimistic exploration.

Key Results

The authors validated their approach across several standard RL benchmarks, proving that the sign of the reward shift is critical for value-based learning:

  • Offline RL: Adding a positive shift to baseline algorithms like BCQ and CQL consistently improved performance on D4RL MuJoCo datasets and prevented the "performance drop" often seen as training progresses.
  • Online RL: The Random Reward Shift (RRS) method outperformed vanilla TD3 and even more complex ensemble methods (like Bootstrapped TD3) in standard MuJoCo environments.
  • Exploration: In difficult discrete control tasks (like MiniGrid navigation), the "Compatible Curiosity" method significantly outperformed standard DQN and vanilla RND.
Exploration performance in a 20x20 Grid World. Reward shifting dramatically accelerates learning compared to standard epsilon-greedy and count-based methods.

Limitations and Future Work

While the paper shows that constants like $\pm 0.5$ work well across many tasks, there is currently no theoretical formula to determine the optimal shift constant $b$ for a specific environment. Furthermore, the interaction between reward shifting and the optimization of "black-box" neural networks remains complex.

Future work could involve more rigorous theoretical analysis of these optimization dynamics, or the development of a "meta-learner" trained to automatically adjust the reward shift constant during training to perfectly balance exploration and exploitation on the fly.

Summary updated

BibTeX
@inproceedings{sun2022exploit,
  author = {Hao Sun and Lei Han and Rui Yang and Xiaoteng Ma and Jian Guo and Bolei Zhou},
  title = {{Exploit Reward Shifting in Value-Based Deep-RL: Optimistic Curiosity-Based Exploration and Conservative Exploitation via Linear Reward Shaping}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=iCxRsZcVVAH},
}
Figure