Abstract
Reinforcement Learning (RL) typically treats reward functions as black boxes, leading to significant sample inefficiency in complex environments. While Reward Machines (RMs) have been proposed to decompose tasks into logical sub-goals, they are inherently discrete and cannot account for continuous physical processes that may be critical to task success. This paper presents Physics-Informed Reward Machines (pRMs), a novel framework that embeds continuous physical dynamics, modeled via Ordinary Differential Equations (ODEs), into symbolic reward structures. By utilizing these embedded physics for counterfactual experience generation and potential-based reward shaping, pRMs enable agents to learn more efficiently and safely. Experimental results across various stochastic physical environments demonstrate that pRMs achieve up to a 4x speedup in convergence compared to state-of-the-art baselines.
Introduction
Reinforcement Learning (RL) is notoriously sample-inefficient, often requiring millions of interactions to learn even simple control tasks. A major bottleneck is the treatment of the reward mechanism as a "black box." While previous research introduced Reward Machines (RMs) to expose the logical structure of a task (e.g., "pick up coffee, then mail, then go to the office"), standard RMs struggle with tasks where success depends on continuous physical processes—such as ensuring a cup of coffee stays warm during delivery. This paper addresses the gap between high-level logical task specification and the low-level physical constraints that govern real-world success.
The Physics-Informed Reward Machine (pRM) Framework
The authors introduce Physics-Informed Reward Machines (pRMs) as a hybrid symbolic-continuous architecture. Unlike traditional RMs, which are finite-state machines, a pRM state includes a continuous component governed by Ordinary Differential Equations (ODEs). This allows the reward structure to track physical variables (like temperature, fluid levels, or fuel) that evolve independently of the agent's discrete actions.
In this framework, transitions are triggered by events, but the internal state (and resulting reward) evolves according to physical laws. This "physics-awareness" allows the reward machine to provide a more nuanced signal to the agent, reflecting not just whether a goal was reached, but whether it was reached while satisfying necessary physical constraints.
Experimental Setup: The Office Gridworld
To evaluate the framework, the authors utilize several benchmarks, most notably the Office Gridworld. In this environment, an agent must navigate to specific locations to deliver coffee and mail. The "physics" component involves the coffee's temperature, which cools over time based on the room's ambient temperature and the presence of heaters.
Beyond the gridworld, the framework was tested on high-dimensional continuous systems, including a Two-Tank fluid system, a Five-Room temperature control model, and a Five-Road traffic network. These environments test the pRM's ability to handle both discrete logic and complex, stochastic physical dynamics.
Key Mechanisms for Efficiency
Two primary mechanisms drive the performance gains of pRMs:
- Counterfactual Experience Generation (pRME): Since the physics within the pRM is known, the agent can "imagine" what would have happened in different states of the reward machine without performing additional environment steps. This creates high-quality, physically grounded synthetic data to speed up learning.
- Potential-Based Reward Shaping (RS): The pRM structure provides intermediate rewards that guide the agent toward the goal. This mitigates the "sparse reward" problem, where an agent might otherwise only receive a signal at the very end of a long, multi-stage task.
Results and Discussion
The integration of physics into the reward structure yielded massive improvements in sample efficiency. In the Office World benchmark, pRM-enhanced RL reached maximum rewards in under 5,000 training steps, whereas previous state-of-the-art methods required approximately 20,000 steps. Furthermore, heatmaps of the learned policies show that pRM-guided agents successfully avoid "unsafe" regions (e.g., areas where the coffee would cool too quickly) much earlier in the training process than baseline agents.
While the framework introduces some computational overhead due to the complexity of generating counterfactual experiences, the trade-off is a significant reduction in the number of environment interactions required. Future work aims to extend this to handle noisy sensor data and learn pRM structures directly from demonstrations.
Conclusion
Physics-Informed Reward Machines represent a significant step toward integrating domain knowledge into RL. By making the reward structure "aware" of the physical laws governing the environment, pRMs provide a path toward more efficient, safe, and explainable autonomous systems.
Summary updated