Expediting Reinforcement Learning by Incorporating Knowledge About Temporal Causality in the Environment

Jan Corazza, Hadi Partovi Aria, Daniel Neider, Zhe Xu

Standard Reinforcement Learning (RL) algorithms often struggle in environments with sparse rewards, where an agent must perform a specific sequence of actions before receiving any feedback. In such scenarios, agents typically spend a significant amount of time exploring "fruitless" trajectories. This paper, presented at the 2024 Conference on Causal Learning and Reasoning (CLeaR), introduces a formal method to inject high-level causal knowledge into RL agents, allowing them to prune impossible or unproductive paths and converge on optimal policies much faster.

The Challenge of Sparse Rewards and Temporal Causality

In complex tasks, such as navigating a maze to find a key and then a door, traditional RL agents lack the inherent understanding of temporal causality that humans possess. For instance, a human knows that entering a one-way door might permanently block access to a required objective. While Probabilistic Reward Machines (PRMs) help track task progress through finite-state machines, they are often difficult to design and do not naturally incorporate these temporal causal constraints.

A sample gridworld environment used to evaluate the causal RL agent, featuring various objectives and obstacles.

The authors address this by allowing developers to specify causal "rules" using Linear Temporal Logic (LTL). These rules define what can or cannot happen over time, effectively narrowing the search space for the agent.

Methodology: From Logic to Action

The proposed framework follows a multi-step pipeline to integrate causal logic into the reward structure:

  1. Temporal Logic-based Causal Diagrams (TL-CDs): Causal relationships are expressed formally using LTL.
  2. Causal DFA Construction: These diagrams are converted into a Deterministic Finite Automaton (DFA), a computational model that accepts or rejects sequences based on the defined rules.
  3. The Product PRM: The core innovation involves creating a mathematical "product" of the original task's PRM and the Causal DFA. This combined machine tracks both task progress and causal violations simultaneously.
  4. Pessimistic Pruning: The algorithm identifies "rejecting sinks"—states from which no future reward is possible due to a causal violation. These states are marked as terminal with a value of zero, preventing the agent from wasting time exploring them.
  5. Modified Q-Learning: The standard Q-Learning for Reward Machines (QRM) is adapted to utilize this pruned structure.
A Deterministic Finite Automaton (DFA) representing the logical transitions and reward structure used by the agent.

Experimental Evaluation and Key Insights

The researchers evaluated their method across several gridworld environments, including the "Coffee vs. Soda" task and a "Small Office World." These environments required agents to navigate one-way paths and interact with specific objects in order.

The results demonstrated several key advantages:

  • Accelerated Convergence: The "Causal" agent consistently reached optimal rewards significantly faster than standard QRM agents. In the "Small Office World," the improvement was particularly stark, with the causal agent accumulating rewards almost immediately while the baseline struggled for thousands of steps.
  • Theoretical Safety: The authors proved that their pruning method does not alter the optimal policy; it merely speeds up the discovery process.
  • Robustness to Redundancy: Interestingly, the method remains efficient even when provided with "useless" or redundant causal information. While the state space may grow, the agent's performance does not degrade, as it naturally ignores irrelevant constraints.

Conclusion and Future Work

By formalizing causality as an exploration filter, this research provides a powerful tool for making RL more efficient in real-world-like scenarios. While the current approach requires manual specification of causal rules, future work aims to automate the learning of these diagrams from environment traces. Additionally, the "look-ahead" information provided by the product machine offers promising avenues for reward shaping to further guide agent behavior.

Summary updated

BibTeX
@inproceedings{corazza2024expediting,
  author = {Jan Corazza and Hadi Partovi Aria and Daniel Neider and Zhe Xu},
  title = {{Expediting Reinforcement Learning by Incorporating Knowledge About Temporal Causality in the Environment}},
  booktitle = {CLeaR},
  year = {2024},
}
Figure