Joint learning of reward machines and policies in environments with partially known semantics

Christos K. Verginis, Cevahir Köprülü, Sandeep Chinchali, Ufuk Topcu

Introduction

Reinforcement learning (RL) has seen remarkable success in various domains, yet it often struggles with "long-horizon" tasks—complex missions requiring multiple steps in a specific sequence, such as "retrieve coffee, then deliver it to the office, while avoiding obstacles." Reward Machines (RMs) have emerged as a powerful symbolic tool to address this. They function as high-level state machines that guide an agent through sub-tasks by providing intermediate rewards.

However, a significant hurdle remains: most RM-based methods assume perfect perception. They rely on the agent knowing with absolute certainty when a specific environmental property (e.g., "I am in the kitchen") is true. In real-world applications, sensors are inherently noisy and uncertain. This paper introduces a novel approach to jointly learn both the task logic (the RM) and the optimal policy in environments where the semantics of the world are only partially known.

The Challenge: Noisy Sensors and Broken Logic

When an agent's perception is flawed, the symbolic logic it learns becomes unreliable. If a robot incorrectly identifies its location due to sensor noise, it might receive a reward that contradicts its current understanding of the task. This leads to "broken" Reward Machines that fail to generalize.

An example of a Reward Machine (RM). Transitions between high-level states ($v_0$ to $v_3$) are triggered by logical propositions (like 'c' for coffee or 'o' for office) and result in specific reward signals.

To bridge this gap, the authors propose the Joint Perception and Learning (JPL) algorithm. JPL is designed to handle "partially known semantics," where the agent has a noisy observation model but must eventually infer the ground-truth properties of the environment to succeed.

The JPL Architecture

The JPL algorithm operates through three tightly coupled loops that allow the agent to refine its understanding of the world while simultaneously learning how to act within it.

The JPL framework: Sensor measurements drive Bayesian belief updates, which inform Reward-machine inference. The resulting RM estimate is then used by the Q-learning component to select actions.
  1. Perception (Bayesian Belief Updates): Instead of making binary "true/false" judgments about environmental properties, the agent maintains a probabilistic belief. Each interaction with the environment provides a sensor reading that updates this belief via Bayesian filtering.
  2. Reward Machine Inference: The agent maintains a hypothesis RM. It records "traces"—sequences of perceived properties and associated rewards. When a trace contradicts the current RM, a SAT solver is employed to find the simplest new RM that fits all observed data.
  3. Policy Learning (Q-Learning): The agent performs Q-learning on an augmented state space that combines its physical location with the current state of its inferred Reward Machine.

A critical component of JPL is the use of Jensen-Shannon Divergence (JSD) to monitor belief stability. If the agent's understanding of the environment's layout changes significantly, it triggers a reset of the RM inference process, ensuring the task logic is built on a stable foundation of "facts."

Experimental Evaluation

The researchers tested JPL across three diverse environments:

  • Office World: A benchmark grid where an agent must navigate to specific locations (coffee, mail, office) in order while avoiding traps.
  • Craft World: A complex, Minecraft-inspired environment requiring multi-stage resource collection and tool usage (e.g., "build stairs" using wood and iron).
  • HouseExpo: A large-scale dataset of real-world indoor floor plans. Here, the agent used a Bayesian Neural Network as a noisy sensor to identify room types.

Key Insights and Results

The experiments yielded several important findings:

  • Robustness to Noise: JPL successfully learned tasks even when sensors were highly unreliable. A key theoretical insight is the 0.5 Threshold: as long as the probability of the correct label eventually exceeds 0.5, the algorithm is guaranteed to converge to the ground-truth RM.
  • Efficiency: In the HouseExpo tests, the agent's belief about room labels converged much faster (approx. 500 steps) than the optimal policy (thousands of steps). This indicates that "learning the map" is a manageable precursor to mastering complex maneuvers.
  • Superiority over Baselines: JPL consistently outperformed standard RL methods like Deep Q-Networks (DQN), which struggled to handle the long-horizon nature of the tasks without the structured guidance of an RM.

Conclusion and Future Directions

JPL represents a significant step toward deploying symbolic RL in uncertain, real-world environments. By decoupling perception from policy and using formal methods (SAT solvers) to infer task structure, it provides a robust framework for complex mission execution.

Future work aims to address the computational complexity of SAT-based RM inference, which currently limits the size of the machines that can be learned. Additionally, extending the framework to "dynamic semantics"—where environmental properties change over time—remains an open and exciting challenge.

Summary updated

BibTeX
@article{verginis2022joint,
  author = {Christos K. Verginis and Cevahir Köprülü and Sandeep Chinchali and Ufuk Topcu},
  title = {{Joint learning of reward machines and policies in environments with partially known semantics}},
  journal = {Artificial Intelligence},
  year = {2022},
}
Figure