Analyzing and Bridging the Gap between Maximizing Total Reward and Discounted Reward in Deep Reinforcement Learning

Shuyu Yin, Fei Wen, Peilin Liu, Tao LuoarXiv 2024

Abstract

The optimal objective is a fundamental aspect of reinforcement learning (RL), as it determines how policies are evaluated and optimized. While total return maximization is the ideal objective in RL, discounted return maximization is the practical objective due to its stability. This can lead to a misalignment of objectives. To better understand the problem, we theoretically analyze the performance gap between the policy maximizes the total return and the policy maximizes the discounted return. Our analysis reveals that increasing the discount factor can be ineffective at eliminating this gap when environment contains cyclic states, a frequent scenario. To address this issue, we propose two alternative approaches to align the objectives. The first approach achieves alignment by modifying the terminal state value, treating it as a tunable hyper-parameter with its suitable range defined through theoretical analysis. The second approach focuses on calibrating the reward data in trajectories, enabling alignment in practical Deep RL applications using off-policy algorithms. This method enhances robustness to the discount factor and improve performance when the trajectory length is large. Our proposed methods demonstrate that adjusting reward data can achieve alignment, providing an insight that can be leveraged to design new optimization objectives to fundamentally enhance the performance of RL algorithms.

Introduction

In Reinforcement Learning (RL), the ultimate goal is typically to maximize the total return—the simple sum of rewards over an episode. However, most modern algorithms (e.g., DQN, SAC, TD3) optimize for discounted return, where future rewards are decayed by a factor $\gamma < 1$. This discounting is a mathematical necessity for stability and convergence, but it introduces a fundamental "objective misalignment." A policy that appears optimal under a discounted lens may perform poorly when evaluated on total return.

The Challenge of Objective Misalignment

The researchers identify that this misalignment is most severe in environments containing cyclic states, where an agent can loop back to previous states. In these cases, the "regularization" effect of the discount factor can prevent the agent from discovering high-quality, long-term strategies.

A cyclic MDP where maximizing discounted return can lead to suboptimal total return.

Theoretical analysis reveals a "third term" in the suboptimality bound: a gap between discounted and total return policies that exists even if the Bellman loss is zero. This gap depends on $\gamma$ and trajectory length, meaning that simply pushing $\gamma$ closer to 1 is often ineffective and can lead to training instability.

Proposed Solutions

The paper proposes two methods to bridge this gap without sacrificing the stability of discounting:

  1. Terminal State Value Modification ($V_T$): Traditionally, terminal state values are set to zero. The authors prove that treating $V_T$ as a tunable hyperparameter can align the objectives. For example, in environments with positive rewards, a negative $V_T$ acts as a deterrent against early termination, encouraging the agent to accumulate more total reward.
  2. Trajectory Reward Calibration: For complex Deep RL tasks, the authors introduce a calibration framework. This method analyzes historical trajectories to estimate "suitable" discounted returns that are strictly monotonic with total returns. It then adjusts the actual reward data within a trajectory so that its discounted sum matches this suitable value, effectively forcing the discounted objective to behave like the total objective.

Experimental Results

The proposed methods were validated on standard benchmarks like LunarLander and Hopper. A key result is the restoration of monotonicity between the proxy objective and the true goal.

Alignment of discounted and total returns after applying the proposed reward calibration method in LunarLander and Hopper environments.

The calibration method significantly improved performance in high-dimensional tasks like Humanoid, primarily by enabling agents to achieve much longer trajectory lengths. Furthermore, the method makes algorithms more robust to the choice of discount factor; for instance, in the Hopper environment, an agent with $\gamma=0.97$ using calibration could match or exceed the performance of a standard agent using $\gamma=0.99$.

Conclusion

This work demonstrates that the misalignment between discounted and total returns is a structural issue in RL, particularly in cyclic environments. By adjusting terminal values or calibrating reward data, practitioners can ensure that optimizing for a stable proxy objective actually leads to the desired real-world behavior. These insights pave the way for designing new optimization objectives that fundamentally enhance RL performance.

Summary updated

BibTeX
@misc{yin2024analyzing,
  author = {Shuyu Yin and Fei Wen and Peilin Liu and Tao Luo},
  title = {{Analyzing and Bridging the Gap between Maximizing Total Reward and Discounted Reward in Deep Reinforcement Learning}},
  year = {2024},
  eprint = {2407.13279},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.13279},
}
Figure