Offline Reinforcement Learning with On-Policy Q-Function Regularization

Laixi Shi, Robert Dadashi, Yuejie Chi, Pablo Samuel Castro, Matthieu Geist

TL;DR

Offline Reinforcement Learning (RL) often fails because agents try to execute actions they haven't seen in their training data, leading to "extrapolation errors." This paper proposes a clever shift: instead of trying to mimic the unknown behavior policy directly, we should regularize the agent using the Q-function of the behavior policy. By using a simple SARSA-style estimate, the authors develop two algorithms (Qsarsa-AC and AC2) that significantly outperform existing state-of-the-art methods on standard benchmarks.

What Problem Does This Paper Address?

The fundamental challenge in offline RL is distribution shift. Imagine training a self-driving car on a dataset of human drivers. If the car decides to take a turn slightly differently than a human would, it enters a "state-action" pair it has never seen before. When the agent tries to estimate the value (Q-value) of that unseen action, it often overestimates it wildly—this is the extrapolation error.

To fix this, most researchers use "behavior regularization," forcing the agent to stay close to the "behavior policy" ($\pi_b$) that generated the data. However, $\pi_b$ is usually unknown and hard to estimate, especially if the data comes from many different sources (multimodal distributions). If your estimate of the behavior policy is wrong, your regularization will be wrong, and the agent will fail.

Methods

The authors propose regularizing towards the Q-function of the behavior policy ($Q^{\pi_b}$) rather than the policy itself. They argue that $Q^{\pi_b}$ is easier to estimate reliably using a standard SARSA-style objective.

They introduce two main algorithms built on top of the popular TD3-BC framework:

  1. Qsarsa-AC (Actor-Critic):
    • The Critic: Adds two new regularization terms. One pushes the learned Q-function toward the SARSA estimate for data inside the dataset (InD-sarsa). The other pushes it toward the SARSA estimate for out-of-distribution actions (OOD-sarsa), acting as a safety rail against overestimation.
  2. The Actor: Instead of using a single global weight for Behavior Cloning (BC), it uses point-wise weights. Actions that have a higher advantage relative to the behavior policy get more weight, effectively telling the agent: "Imitate the behavior policy, but focus more on its best moments."
  3. Qsarsa-AC2:
    • A variant that adjusts the global regularization strength based on the estimated optimal Q-value of the specific task. This helps the algorithm adapt to different environments where reward scales might vary wildly.

Datasets

The researchers evaluated their methods on the D4RL (Datasets for Deep Data-Driven Reinforcement Learning) benchmark. Specifically, they tested on 15 MuJoCo tasks (HalfCheetah, Hopper, and Walker2d) across five different dataset quality levels:

  • Random: Data from a completely random policy.
  • Medium-Replay: The entire replay buffer of an agent trained to medium performance.
  • Medium: Data from a partially trained "medium" policy.
  • Medium-Expert: A mix of medium and expert demonstrations.
  • Expert: Data from a fully optimized expert policy.

Key Insights and Ideas

  • SARSA is a Stable Anchor: The paper demonstrates that a SARSA-style estimate ($Q_{sarsa}$) is surprisingly accurate for in-sample data and, crucially, doesn't suffer from the massive overestimation that plagues standard offline RL critics.
  • Direct vs. Indirect Regularization: Regularizing the Q-function is more "direct." Since the goal of imitation is usually to prevent errors during the bootstrapping step of value estimation, it makes more sense to regularize the value function itself rather than the policy.
  • The Actor Matters Most: Through ablation studies, the authors found that while the regularized critic helps, the point-wise weighted actor (the way $Q_{sarsa}$ is used to guide imitation) is the primary driver of the performance boost.
  • Simplicity Wins: By building on TD3-BC—a "minimalist" offline RL algorithm—the authors show that you don't need complex generative models (like CVAEs) to handle distribution shift if you have a good value-based anchor.

Key Results

The Qsarsa-based methods showed a clear advantage over strong baselines like CQL, TD3-BC, and OnestepRL:

  • Overall Performance: Across all 15 tasks, Qsarsa-AC2 achieved a total normalized score of 1021.8, compared to 936.2 for TD3-BC and 841.5 for CQL.
  • Robustness: The method was particularly effective on "Random" and "Medium" datasets. For example, on random-HalfCheetah, Qsarsa-AC scored 30.2, while the baseline TD3-BC only managed 6.0.
  • Efficiency: The training is split into two phases: first, learn the SARSA estimate (1M steps), then train the main agent (3M steps). Despite the extra phase, the simplicity of the architecture keeps it computationally competitive.

Limitations and Future Work

  • Two-Phase Training: The requirement to train a SARSA model before the main RL agent adds a step to the pipeline, though the authors note $Q_{sarsa}$ is very easy to train.
  • Hyperparameter Sensitivity: The method introduces several new hyperparameters ($\lambda, \tau_1, \tau_2, \tau_3$) for weighting the various regularization terms, which may require tuning for new, non-MuJoCo domains.
  • Future Directions: The authors suggest that this "Q-regularization" approach could be integrated into other frameworks, such as Soft Actor-Critic (SAC) or even sequential modeling approaches like Decision Transformers, to further improve offline stability.

Summary updated

BibTeX
@inproceedings{shi2023offline,
  author = {Laixi Shi and Robert Dadashi and Yuejie Chi and Pablo Samuel Castro and Matthieu Geist},
  title = {{Offline Reinforcement Learning with On-Policy Q-Function Regularization}},
  booktitle = {ECML/PKDD},
  year = {2023},
  doi = {10.1007/978-3-031-43421-1\_27},
}
Figure