Inferring Reward Machines and Transition Machines from Partially Observable Markov Decision Processes

Yuly Wu, Jiamou Liu, Libo ZhangarXiv 2025 · OpenReview

TL;DR

This paper tackles the challenge of learning in partially observable environments by introducing "Transition Machines" (TMs) to complement existing "Reward Machines" (RMs). They propose a unified framework (DBMM) and an efficient algorithm (DB-RPNI) to infer both, achieving significant speedups over prior methods and enabling agents to learn optimal policies in complex scenarios.

What Problem Does This Paper Address?

Reinforcement learning (RL) agents often operate in environments where they don't have full information about the current state – these are called Partially Observable Markov Decision Processes (POMDPs). The core difficulty here is that the "Markov property" breaks down: the same observation might require different actions depending on the agent's past experiences. To combat this, researchers have used "Reward Machines" (RMs) to act as external memory, helping agents remember relevant history to make better decisions.

However, existing RM approaches have two main drawbacks:

  1. Limited Scope: They primarily focus on remembering history related to rewards, but not necessarily history that affects transitions (i.e., what state the environment will move to next). This can lead to awkward problem formulations.
  2. Computational Cost: Inferring these RMs from observed data is computationally very expensive, making them impractical for many real-world applications.

This paper aims to address both these limitations by introducing a new type of memory structure and a more efficient inference method.

Methods

The paper's core contribution lies in two main areas:

  • Introducing Transition Machines (TMs): TMs are proposed as a counterpart to RMs. While RMs capture non-Markovian reward dependencies, TMs are designed to capture non-Markovian transition dependencies. This means they help remember history that influences where the agent will go next, not just what reward it will get.
  • Unified Framework and Efficient Inference:
    • Dual Behavior Mealy Machine (DBMM): The authors propose a unified automaton framework called DBMM that can represent both TMs and RMs. This allows for a single, consistent way to model these memory structures.
  • DB-RPNI Algorithm: They adapt the classic RPNI (Regular Positive Regular Inference) algorithm for inferring deterministic finite automata. Their DB-RPNI algorithm is specifically designed to infer DBMMs from trace data. It includes novel preprocessing steps (like redundant input removal) and a state-merging process that avoids the computationally expensive reductions used by previous methods.

By inferring both a TM and an RM (represented as DBMMs), the agent's state is augmented to include the current observation, the TM state, and the RM state. This augmented state is designed to be Markovian, allowing standard RL algorithms to be applied effectively.

Datasets

The paper uses datasets generated from simulated grid-world environments for evaluation.

  • Baseline Comparison: Datasets were generated from 3x3, 4x4, and 5x5 grid environments using a random agent. These environments were designed with specific task structures (e.g., reaching certain locations to trigger events) to test the inference of automata.
  • Ablation Study: A large-scale, randomly generated 25x25 grid environment was used. This environment features a ground-truth TM and RM that control position passability and rewards, respectively. Datasets were generated with two conditions: "Low Data" (1,000 traces) and "High Data" (10,000 traces) to analyze the impact of data availability and the contribution of different components of their method.

Key Insights and Ideas

  • Decoupling Non-Markovianity: The key insight is that POMDPs exhibit two distinct types of non-Markovian behavior: transition dependencies and reward dependencies. Separating these into TMs and RMs, respectively, simplifies the problem and leads to more natural formulations.
  • TMs as Memory for Transitions: TMs provide a crucial missing piece for many POMDP problems by explicitly modeling how past events influence future state transitions, not just rewards.
  • Unified Representation is Powerful: The DBMM framework elegantly unifies TMs and RMs, allowing for a single, efficient inference algorithm to handle both. This is a significant step towards a more general approach to memory augmentation in RL.
  • Passive Learning Efficiency: The DB-RPNI algorithm's ability to infer automata directly from traces, without costly intermediate reductions, is a major breakthrough for practical applications of passive automata learning in RL.
  • Observation Supplement is Crucial: Augmenting observations with TM states before RM inference significantly reduces the complexity of the inferred RMs, making them more compact and easier to learn from. This highlights how transition dynamics can unnecessarily complicate reward machine inference.

Key Results

  • Massive Speedups: The DB-RPNI algorithm achieves speedups of up to three orders of magnitude compared to state-of-the-art (SOTA) baselines (HMM-based and ILP-based methods) for inferring automata. For example, in a 4x4 environment, their method takes 3.9 seconds, while a baseline takes over 6,000 seconds.
  • Compact Automata: The proposed method infers smaller and more interpretable automata, especially when using the observation supplement technique.
  • Scalability: The approach demonstrates strong scalability, successfully inferring automata in a complex 25x25 grid environment where baselines failed on smaller grids.
  • Effective Policy Learning: An agent augmented with the inferred TM and RM successfully learned an optimal policy in the 25x25 environment, demonstrating the practical utility of their approach for downstream RL tasks.

Limitations and Future Work

  • Deterministic POMDPs: The current work focuses on deterministic POMDPs. The authors acknowledge that extending this to stochastic environments (where transitions and observations are probabilistic) is a crucial next step. This would likely involve using probabilistic automata.
  • Data Quality: The algorithm's performance relies on sufficiently informative trace data. Inferring from incomplete or noisy data remains a challenge.
  • Future Research: Future work includes extending to stochastic environments, developing methods for inferring from incomplete data, and exploring applications in more complex, real-world scenarios.

Summary updated

BibTeX
@misc{wu2025inferring,
  author = {Yuly Wu and Jiamou Liu and Libo Zhang},
  title = {{Inferring Reward Machines and Transition Machines from Partially Observable Markov Decision Processes}},
  year = {2025},
  eprint = {2508.01947},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.01947},
}
Figure