Abstract
Reinforcement Learning (RL) often suffers from sample inefficiency in environments with sparse rewards and complex temporal dependencies. This paper proposes a framework to integrate high-level causal knowledge, expressed via Temporal Logic, into Probabilistic Reward Machines (PRMs). By identifying and pruning trajectories that violate the environment's causal structure, the agent's search space is significantly reduced, leading to faster convergence without sacrificing policy optimality.
Introduction
Reinforcement Learning algorithms often struggle with "sparse rewards." Imagine an agent in a maze that only receives a reward after performing a specific sequence of actions—such as picking up key A, then key B, before opening door C. Without guidance, the agent spends a massive amount of time wandering into dead ends or attempting sequences that are physically or logically impossible.
While Reward Machines (RMs) help by decomposing tasks into finite-state sub-goals, they are often difficult to design manually and do not inherently "understand" the causal constraints of the world (e.g., "If you go through this one-way door, you can never reach the soda machine again"). This paper, presented at CausalLR 2024, addresses this gap by automatically injecting high-level causal insights into the agent's reward structure to prevent exploration of impossible paths.
Methodology: Causalizing the Reward Function
The authors introduce a multi-step pipeline to integrate causal knowledge into the RL process:
- Temporal Logic-based Causal Diagrams (TL-CDs): Causal relationships are expressed using Linear Temporal Logic (LTL). For example, a diagram might encode: "If the agent picks up a soda, the office becomes unreachable before hitting a flower pot."
- Causal DFA: These diagrams are converted into a Deterministic Finite Automaton (DFA), a mathematical graph that tracks whether causal rules are being followed or violated.
- The Product PRM: The core innovation is the creation of a "product" between the original task's Reward Machine and the Causal DFA. This augmented reward machine "knows" both the goal and the causal constraints.
- Pessimistic Pruning: The algorithm performs value iteration on two versions of this machine—one "optimistic" and one "pessimistic." If a state has zero value in both (meaning it leads to no reward and has no future potential), it is marked as a terminal state. This effectively "prunes" the search space, instructing the agent to avoid exploring known dead ends.
Experimental Evaluation
The method was evaluated on several custom-designed Gridworld benchmarks simulating complex task dependencies:
- Coffee vs. Soda Task: A 5x5 grid where the agent must navigate one-way doors and avoid "sink" states (flower pots).
- Two-Doors and Four-Doors Tasks: Scaled environments where the agent must open doors in specific orders, but certain doors act as traps.
- Small Office World: A 17x9 spatial layout with keys, one-way doors, and specific exit requirements.
Key Insights and Results
The empirical results demonstrate a dramatic improvement in learning efficiency. In the "Coffee vs. Soda" and "Office World" tasks, the causal-aware agent reached the maximum reward in roughly half the steps compared to standard Q-learning for Reward Machines (QRM).
- Causality as a Filter: Instead of just predicting the next state, causality defines the boundaries of the searchable world. By identifying "rejecting sink states" in the causal DFA, the agent learns what not to do before it even tries.
- Robustness to Redundancy: Adding useless or redundant causal information does not hurt performance. The pruning mechanism ensures the agent doesn't get bogged down by the extra complexity of a larger state space.
- Preserving Optimality: The authors provide a theoretical proof (Theorem 1) showing that their transformations do not change the optimal policy.
Conclusion and Future Work
By incorporating temporal causal knowledge, RL agents can significantly expedite their learning process. While current TL-CDs require manual specification by human experts, future work aims to learn these causal diagrams directly from environment interactions. Additionally, the "look-ahead" information in the product PRM could be leveraged for reward shaping to provide even more granular guidance to the agent.
Summary updated