Automatic Reward Shaping from Confounded Offline Data

Mingxuan Li, Junzhe Zhang, Elias Bareinboim · DOI

TL;DR

This paper tackles the challenge of designing effective reward shaping functions for reinforcement learning agents when using offline data that might be contaminated by unobserved confounders. They propose a novel method to derive robust potential functions from such data, which can then be used to improve online learning efficiency and achieve better regret bounds.

What Problem Does This Paper Address?

Reinforcement learning (RL) agents often struggle with sample efficiency, meaning they need a lot of experience to learn effectively. Reward shaping is a technique that can accelerate learning by providing additional reward signals to guide the agent. However, designing good shaping functions is difficult and often relies on domain expertise. A more promising approach is to learn these shaping functions from existing offline data.

The core problem this paper addresses is that offline data is often collected passively, and the underlying data-generating process might be influenced by unobserved factors (confounders). These confounders can create spurious correlations, violating the "no unobserved confounding" (NUC) assumption crucial for standard off-policy learning. If standard methods are used to learn shaping functions from such confounded data, the resulting functions can be biased, leading to suboptimal policies and hindering learning. This paper aims to develop a method for learning effective reward shaping functions even in the presence of these unobserved confounders.

Methods

The authors propose a method to automatically design reward shaping functions from confounded offline data using a causal perspective. Their approach involves:

  • Causal State Value Upper Bounds: They leverage the concept of Confounded Markov Decision Processes (CMDPs) to model environments with unobserved confounders. Instead of directly estimating the optimal state value (which is difficult with confounders), they derive upper bounds on these values. This is done by modifying the Bellman Optimal Equation to account for the uncertainty introduced by confounders, leading to a "Causal Bellman Optimal Equation."
  • Potential-Based Reward Shaping (PBRS): These derived upper bounds on state values are then used as "state potentials" in the Potential-Based Reward Shaping (PBRS) framework. PBRS ensures that the optimal policy remains unchanged, but the learning process is accelerated.
  • Model-Free UCB Algorithm: They introduce a modified version of the Q-UCB (Upper Confidence Bound) algorithm, a model-free RL learner. This modified algorithm, "Q-UCB Shaping," leverages the derived potential functions from offline data. Key modifications include zero initialization of Q-values, using potential-function-dependent UCB bonuses, value clipping, and incorporating the shaped reward during updates.
  • Regret Analysis: The paper provides a theoretical analysis of their Q-UCB Shaping algorithm, deriving a novel gap-dependent regret bound. This bound demonstrates that using their proposed conservatively optimistic potential functions leads to improved learning efficiency compared to learners without shaping or those using biased shaping functions.

Datasets

The paper uses simulated environments for evaluation. Specifically, they mention:

  • Windy Grid Worlds: A suite of environments including "Windy Empty World," "Windy LavaCross (easy)," "Windy LavaCross (hard)," and "Windy LavaCross (maze)." These environments are designed to mimic CMDPs where wind direction acts as an unobserved confounder.
  • Customized Windy MiniGrid Environments: These are used for experiments and are based on existing MiniGrid environments but with added wind dynamics.

The paper also discusses collecting offline datasets from different "behavioral policies" (e.g., conservative, adventurous, random) within these environments to simulate the confounded data scenario.

Key Insights and Ideas

  • Confounding Bias is a Major Hurdle for Reward Shaping: The paper clearly demonstrates how unobserved confounders can lead to severely biased estimates of state values when using standard off-policy methods, making naive reward shaping detrimental.
  • Optimistic Upper Bounds as a Solution: Instead of trying to perfectly identify the true state values (which is impossible with confounders), the authors propose using optimistic upper bounds. This "conservative optimism" provides a robust signal for shaping that guides the agent without being misled by spurious correlations.
  • Causal Perspective is Key: Framing the problem within CMDPs and using causal inference principles allows for a principled way to derive these robust bounds.
  • Theoretical Guarantees for Online Learning: The paper provides a strong theoretical contribution by deriving a gap-dependent regret bound for their Q-UCB Shaping algorithm, showing improved sample efficiency and convergence guarantees.

Key Results

  • Improved Learning Efficiency: Simulations show that their proposed Q-UCB Shaping algorithm, using the derived causal upper bounds, significantly improves learning efficiency and converges to the optimal policy faster than baselines (including vanilla Q-UCB and shaping with biased values).
  • Better Regret Bounds: The paper derives a novel gap-dependent regret bound for their algorithm, which is theoretically better than existing bounds for similar settings.
  • Empirical Validation: Experiments in windy grid worlds demonstrate that their method successfully learns to navigate complex environments and find optimal policies, even when faced with unobserved wind confounders. For instance, in the "LavaCross maze," their method helps the agent converge to the correct policy, avoiding lava traps that other methods might fall into due to biased shaping.

Limitations and Future Work

  • Finite Horizon Assumption: The theoretical analysis and algorithms are primarily developed for finite-horizon CMDPs. Extending this to infinite-horizon settings would be a valuable next step.
  • Tabular MDP Assumption: The regret analysis is for tabular MDPs. Adapting these methods to function approximation settings (deep RL) would broaden their applicability.
  • Specific Environment Dynamics: While the windy grid worlds are illustrative, testing the approach on more complex, real-world robotics or control tasks would be beneficial.
  • Exploration Strategy: The paper focuses on UCB-style exploration. Investigating how other exploration strategies interact with their proposed shaping method could be fruitful.

Summary updated

BibTeX
@inproceedings{li2025automatic,
  author = {Mingxuan Li and Junzhe Zhang and Elias Bareinboim},
  title = {{Automatic Reward Shaping from Confounded Offline Data}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=Hu7hUjEMiW},
}
Figure